From e174961ca1a0b28f7abf0be47973ad57cb74e5f0 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 27 Oct 2008 15:59:26 -0700 Subject: net: convert print_mac to %pM This converts pretty much everything to print_mac. There were a few things that had conflicts which I have just dropped for now, no harm done. I've built an allyesconfig with this and looked at the files that weren't built very carefully, but it's a huge patch. Signed-off-by: Johannes Berg Signed-off-by: David S. Miller --- drivers/net/e100.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3d69fae781cf..bb4b6e285245 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2616,7 +2616,6 @@ static int __devinit e100_probe(struct pci_dev *pdev, struct net_device *netdev; struct nic *nic; int err; - DECLARE_MAC_BUF(mac); if(!(netdev = alloc_etherdev(sizeof(struct nic)))) { if(((1 << debug) - 1) & NETIF_MSG_PROBE) @@ -2746,9 +2745,9 @@ static int __devinit e100_probe(struct pci_dev *pdev, goto err_out_free; } - DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %s\n", + DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), - pdev->irq, print_mac(mac, netdev->dev_addr)); + pdev->irq, netdev->dev_addr); return 0; -- cgit v1.2.3 From bc79fc8409b3dccbde072e8113cc1fb3fd876fc5 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Wed, 29 Oct 2008 14:22:18 -0700 Subject: e100: adapt to the reworked PCI PM Adapt the e100 driver to the reworked PCI PM * Use the observation that it is sufficient to call pci_enable_wake() once, unless it fails Signed-off-by: Rafael J. Wysocki Tested-by: Jeff Kirsher Acked-by: Jeff Kirsher Cc: Jesse Barnes Cc: Jeff Garzik Cc: Frans Pop Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/e100.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index bb4b6e285245..084127fe0813 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2322,7 +2322,8 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct nic *nic = netdev_priv(netdev); - if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) + if ((wol->wolopts && wol->wolopts != WAKE_MAGIC) || + !device_can_wakeup(&nic->pdev->dev)) return -EOPNOTSUPP; if(wol->wolopts) @@ -2330,6 +2331,8 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) else nic->flags &= ~wol_magic; + device_set_wakeup_enable(&nic->pdev->dev, wol->wolopts); + e100_exec_cb(nic, NULL, e100_configure); return 0; @@ -2733,8 +2736,10 @@ static int __devinit e100_probe(struct pci_dev *pdev, /* Wol magic packet can be enabled from eeprom */ if((nic->mac >= mac_82558_D101_A4) && - (nic->eeprom[eeprom_id] & eeprom_id_wol)) + (nic->eeprom[eeprom_id] & eeprom_id_wol)) { nic->flags |= wol_magic; + device_set_wakeup_enable(&pdev->dev, true); + } /* ack any pending wake events, disable PME */ pci_pme_active(pdev, false); @@ -2793,11 +2798,10 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) pci_save_state(pdev); if ((nic->flags & wol_magic) | e100_asf(nic)) { - pci_enable_wake(pdev, PCI_D3hot, 1); - pci_enable_wake(pdev, PCI_D3cold, 1); + if (pci_enable_wake(pdev, PCI_D3cold, true)) + pci_enable_wake(pdev, PCI_D3hot, true); } else { - pci_enable_wake(pdev, PCI_D3hot, 0); - pci_enable_wake(pdev, PCI_D3cold, 0); + pci_enable_wake(pdev, PCI_D3hot, false); } pci_disable_device(pdev); -- cgit v1.2.3 From babcda74e9d96bb58fd9c6c5112dbdbff169e695 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 3 Nov 2008 21:11:17 -0800 Subject: drivers/net: Kill now superfluous ->last_rx stores. The generic packet receive code takes care of setting netdev->last_rx when necessary, for the sake of the bonding ARP monitor. Drivers need not do it any more. Some cases had to be skipped over because the drivers were making use of the ->last_rx value themselves. Signed-off-by: David S. Miller --- drivers/net/e100.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 084127fe0813..62cdefa2a4f0 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -1880,7 +1880,6 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, } else { dev->stats.rx_packets++; dev->stats.rx_bytes += actual_size; - nic->netdev->last_rx = jiffies; netif_receive_skb(skb); if(work_done) (*work_done)++; -- cgit v1.2.3 From acc784263b0c46f3052fb4f155fdfe39b7001c98 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 19 Nov 2008 22:21:53 -0800 Subject: e100: convert to net_device_ops Convert to new network device ops interface. Compile tested only. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- drivers/net/e100.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index c9c707980865..5894716de19f 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2612,6 +2612,20 @@ static int e100_close(struct net_device *netdev) return 0; } +static const struct net_device_ops e100_netdev_ops = { + .ndo_open = e100_open, + .ndo_stop = e100_close, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_multicast_list = e100_set_multicast_list, + .ndo_set_mac_address = e100_set_mac_address, + .ndo_change_mtu = e100_change_mtu, + .ndo_do_ioctl = e100_do_ioctl, + .ndo_tx_timeout = e100_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = e100_netpoll, +#endif +}; + static int __devinit e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -2625,19 +2639,10 @@ static int __devinit e100_probe(struct pci_dev *pdev, return -ENOMEM; } - netdev->open = e100_open; - netdev->stop = e100_close; + netdev->netdev_ops = &e100_netdev_ops; netdev->hard_start_xmit = e100_xmit_frame; - netdev->set_multicast_list = e100_set_multicast_list; - netdev->set_mac_address = e100_set_mac_address; - netdev->change_mtu = e100_change_mtu; - netdev->do_ioctl = e100_do_ioctl; SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); - netdev->tx_timeout = e100_tx_timeout; netdev->watchdog_timeo = E100_WATCHDOG_PERIOD; -#ifdef CONFIG_NET_POLL_CONTROLLER - netdev->poll_controller = e100_netpoll; -#endif strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); nic = netdev_priv(netdev); @@ -2845,7 +2850,7 @@ static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel struct nic *nic = netdev_priv(netdev); /* Similar to calling e100_down(), but avoids adapter I/O. */ - netdev->stop(netdev); + e100_close(netdev); /* Detach; put netif into a state similar to hotplug unplug. */ napi_enable(&nic->napi); -- cgit v1.2.3 From 008298231abbeb91bc7be9e8b078607b816d1a4a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 20 Nov 2008 20:14:53 -0800 Subject: netdev: add more functions to netdevice ops This patch moves neigh_setup and hard_start_xmit into the network device ops structure. For bisection, fix all the previously converted drivers as well. Bonding driver took the biggest hit on this. Added a prefetch of the hard_start_xmit in the fast path to try and reduce any impact this would have. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- drivers/net/e100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 5894716de19f..2001a63794f5 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2615,6 +2615,7 @@ static int e100_close(struct net_device *netdev) static const struct net_device_ops e100_netdev_ops = { .ndo_open = e100_open, .ndo_stop = e100_close, + .ndo_start_xmit = e100_xmit_frame, .ndo_validate_addr = eth_validate_addr, .ndo_set_multicast_list = e100_set_multicast_list, .ndo_set_mac_address = e100_set_mac_address, @@ -2640,7 +2641,6 @@ static int __devinit e100_probe(struct pci_dev *pdev, } netdev->netdev_ops = &e100_netdev_ops; - netdev->hard_start_xmit = e100_xmit_frame; SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); netdev->watchdog_timeo = E100_WATCHDOG_PERIOD; strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); -- cgit v1.2.3 From f4113030e73db80bc5368a8303458008975402dd Mon Sep 17 00:00:00 2001 From: Jeff Kirsher Date: Thu, 27 Nov 2008 00:23:37 -0800 Subject: e100: cleanup link up/down messages The system log messages created on a link status change need to follow a specific format to work with tools some customers use. This also makes the messages consistant with other Intel driver link messages. Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/e100.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 2001a63794f5..dce7ff28c3ff 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -1580,11 +1580,13 @@ static void e100_watchdog(unsigned long data) mii_ethtool_gset(&nic->mii, &cmd); if(mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { - DPRINTK(LINK, INFO, "link up, %sMbps, %s-duplex\n", - cmd.speed == SPEED_100 ? "100" : "10", - cmd.duplex == DUPLEX_FULL ? "full" : "half"); + printk(KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n", + nic->netdev->name, + cmd.speed == SPEED_100 ? "100" : "10", + cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); } else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { - DPRINTK(LINK, INFO, "link down\n"); + printk(KERN_INFO "e100: %s NIC Link is Down\n", + nic->netdev->name); } mii_check_link(&nic->mii); -- cgit v1.2.3 From 908a7a16b852ffd618a9127be8d62432182d81b4 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Mon, 22 Dec 2008 20:43:12 -0800 Subject: net: Remove unused netdev arg from some NAPI interfaces. When the napi api was changed to separate its 1:1 binding to the net_device struct, the netif_rx_[prep|schedule|complete] api failed to remove the now vestigual net_device structure parameter. This patch cleans up that api by properly removing it.. Signed-off-by: Neil Horman Signed-off-by: David S. Miller --- drivers/net/e100.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/net/e100.c') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index dce7ff28c3ff..9f38b16ccbbd 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2049,9 +2049,9 @@ static irqreturn_t e100_intr(int irq, void *dev_id) if(stat_ack & stat_ack_rnr) nic->ru_running = RU_SUSPENDED; - if(likely(netif_rx_schedule_prep(netdev, &nic->napi))) { + if(likely(netif_rx_schedule_prep(&nic->napi))) { e100_disable_irq(nic); - __netif_rx_schedule(netdev, &nic->napi); + __netif_rx_schedule(&nic->napi); } return IRQ_HANDLED; @@ -2060,7 +2060,6 @@ static irqreturn_t e100_intr(int irq, void *dev_id) static int e100_poll(struct napi_struct *napi, int budget) { struct nic *nic = container_of(napi, struct nic, napi); - struct net_device *netdev = nic->netdev; unsigned int work_done = 0; e100_rx_clean(nic, &work_done, budget); @@ -2068,7 +2067,7 @@ static int e100_poll(struct napi_struct *napi, int budget) /* If budget not fully consumed, exit the polling mode */ if (work_done < budget) { - netif_rx_complete(netdev, napi); + netif_rx_complete(napi); e100_enable_irq(nic); } -- cgit v1.2.3