[PATCH] e1000: disable polling before registering netdevice
To assure the symmetry of poll enable/disable in up/down, we should initialize the netdevice to be poll_disabled at load time. Doing this after register_netdevice leaves us open to another race, so lets move all the netif_* calls above register_netdevice so the stack starts out how we expect it to be. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: Herbert Xu <[EMAIL PROTECTED]> Cc: Doug Chapman <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 9ec35b7..cf8af92 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -1142,13 +1142,16 @@ e1000_probe(struct pci_dev *pdev, !e1000_check_mng_mode(&adapter->hw)) e1000_get_hw_control(adapter); - strcpy(netdev->name, "eth%d"); - if ((err = register_netdev(netdev))) - goto err_register; - /* tell the stack to leave us alone until e1000_open() is called */ netif_carrier_off(netdev); netif_stop_queue(netdev); +#ifdef CONFIG_E1000_NAPI + netif_poll_disable(netdev); +#endif + + strcpy(netdev->name, "eth%d"); + if ((err = register_netdev(netdev))) + goto err_register; DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] [RFC] NET: Implement a standard ndev_printk family
A lot of netdevices implement their own variant of printk and use use variations of dev_printk, printk or others that use msg_enable, which has been an eyesore with countless variations across drivers. This patch implements a standard ndev_printk and derivatives such as ndev_err, ndev_info, ndev_warn that allows drivers to transparently use both the msg_enable and a generic netdevice message layout. It moves the msg_enable over to the net_device struct and allows drivers to obsolete ethtool handling code of the msg_enable value. The current code has each driver contain a copy of msg_enable and handle the setting/changing through ethtool that way. Since the netdev name is stored in the net_device struct, those two are not coherently available in a uniform way across all drivers (a single macro or function would not work since all drivers name their net_device members differently). This makes netdevice driver writes reinvent the wheel over and over again. It thus makes sense to move msg_enable to the net_device. This gives us the opportunity to (1) initialize it by default with a globally sane value, (2) remove msg_enable handling code w/r ethtool for drivers that know and use the msg_enable member of the net_device struct. (3) Ethtool code can just modify the net_device msg_enable for drivers that do not have custom msg_enable get/set handlers so converted drivers lose some code for that as well. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/netdevice.h | 24 net/core/dev.c| 10 ++ net/core/ethtool.c| 14 +++--- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a70f55..5551b63 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -540,6 +540,8 @@ struct net_device struct device dev; /* space for optional statistics and wireless sysfs groups */ struct attribute_group *sysfs_groups[3]; + + int msg_enable; }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -838,6 +840,28 @@ enum { NETIF_MSG_WOL = 0x4000, }; +#define ndev_printk(kern_level, netif_level, netdev, format, arg...) \ + do { if ((netdev)->msg_enable & NETIF_MSG_##netif_level) { \ + printk(kern_level "%s: " format, \ + (netdev)->name, ## arg); } } while (0) + +#ifdef DEBUG +#define ndev_dbg(level, netdev, format, arg...) \ + ndev_printk(KERN_DEBUG, level, netdev, format, ## arg) +#else +#define ndev_dbg(level, netdev, format, arg...) \ + do { (void)(netdev); } while (0) +#endif + +#define ndev_err(level, netdev, format, arg...) \ + ndev_printk(KERN_ERR, level, netdev, format, ## arg) +#define ndev_info(level, netdev, format, arg...) \ + ndev_printk(KERN_INFO, level, netdev, format, ## arg) +#define ndev_warn(level, netdev, format, arg...) \ + ndev_printk(KERN_WARNING, level, netdev, format, ## arg) +#define ndev_notice(level, netdev, format, arg...) \ + ndev_printk(KERN_NOTICE, level, netdev, format, ## arg) + #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV) #define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE) #define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK) diff --git a/net/core/dev.c b/net/core/dev.c index 5a7f20f..e854c09 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3376,6 +3376,16 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name, dev->priv = netdev_priv(dev); dev->get_stats = internal_stats; + dev->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK; +#ifdef DEBUG + /* put these to good use: */ + dev->msg_enable |= NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | + NETIF_MSG_IFUP | NETIF_MSG_RX_ERR | + NETIF_MSG_TX_ERR | NETIF_MSG_TX_QUEUED | + NETIF_MSG_INTR | NETIF_MSG_TX_DONE | + NETIF_MSG_RX_STATUS | NETIF_MSG_PKTDATA | + NETIF_MSG_HW | NETIF_MSG_WOL; +#endif setup(dev); strcpy(dev->name, name); return dev; diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 8d5e5a0..ff8d52f 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -234,9 +234,9 @@ static int ethtool_get_msglevel(struct net_device *dev, char __user *useraddr) struct ethtool_value edata = { ETHTOOL_GMSGLVL }; if (!dev->ethtool_ops->get_msglevel) - return -EOPNOTSUPP; - - edata.data = dev->ethtool_ops->get_msglevel(dev); + edata.data = dev->msg_enable; + else + edata.data = dev->ethtool_ops->get_msglevel(dev); if (copy_to_user(useraddr, &edata, sizeof(edata))) retur
[PATCH 2/2] [RFC] NET: Convert several drivers to ndev_printk
With the generic ndev_printk macros, we can now convert network drivers to use this generic printk family for netdevices. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c| 121 +++-- drivers/net/e1000/e1000.h | 15 - drivers/net/e1000/e1000_ethtool.c | 39 drivers/net/e1000/e1000_main.c| 101 +++ drivers/net/e1000/e1000_param.c | 67 ++-- drivers/net/ixgb/ixgb.h | 14 drivers/net/ixgb/ixgb_ethtool.c | 15 - drivers/net/ixgb/ixgb_main.c | 46 ++ 8 files changed, 166 insertions(+), 252 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 6ca0a08..56e7504 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -172,19 +172,12 @@ MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); -static int debug = 3; static int eeprom_bad_csum_allow = 0; static int use_io = 0; -module_param(debug, int, 0); module_param(eeprom_bad_csum_allow, int, 0); module_param(use_io, int, 0); -MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums"); MODULE_PARM_DESC(use_io, "Force use of i/o access mode"); -#define DPRINTK(nlevel, klevel, fmt, args...) \ - (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \ - printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \ - __FUNCTION__ , ## args)) #define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \ @@ -644,12 +637,12 @@ static int e100_self_test(struct nic *nic) /* Check results of self-test */ if(nic->mem->selftest.result != 0) { - DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", + ndev_err(HW, nic->netdev, "Self-test failed: result=0x%08X\n", nic->mem->selftest.result); return -ETIMEDOUT; } if(nic->mem->selftest.signature == 0) { - DPRINTK(HW, ERR, "Self-test failed: timed out\n"); + ndev_err(HW, nic->netdev, "Self-test failed: timed out\n"); return -ETIMEDOUT; } @@ -753,7 +746,7 @@ static int e100_eeprom_load(struct nic *nic) * the sum of words should be 0xBABA */ checksum = le16_to_cpu(0xBABA - checksum); if(checksum != nic->eeprom[nic->eeprom_wc - 1]) { - DPRINTK(PROBE, ERR, "EEPROM corrupted\n"); + ndev_err(PROBE, nic->netdev, "EEPROM corrupted\n"); if (!eeprom_bad_csum_allow) return -EAGAIN; } @@ -908,7 +901,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) break; } spin_unlock_irqrestore(&nic->mdio_lock, flags); - DPRINTK(HW, DEBUG, + ndev_dbg(HW, nic->netdev, "%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n", dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out); return (u16)data_out; @@ -960,8 +953,8 @@ static void e100_get_defaults(struct nic *nic) static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) { struct config *config = &cb->u.config; - u8 *c = (u8 *)config; - + u8 *c; + cb->command = cpu_to_le16(cb_config); memset(config, 0, sizeof(struct config)); @@ -1021,12 +1014,16 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config->standard_stat_counter = 0x0; } - DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); - DPRINTK(HW, DEBUG, "[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); - DPRINTK(HW, DEBUG, "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); + c = (u8 *)config; + ndev_dbg(HW, nic->netdev, +"[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", +c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); + ndev_dbg(HW, nic->netdev, +"[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", +c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); + ndev_dbg(HW, nic->netdev, +"[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", +c[16], c[17], c[18], c[19], c[
[PATCH 1/2] [RFC] NET: Implement a standard ndev_printk family
A lot of netdevices implement their own variant of printk and use use variations of dev_printk, printk or others that use msg_enable, which has been an eyesore with countless variations across drivers. This patch implements a standard ndev_printk and derivatives such as ndev_err, ndev_info, ndev_warn that allows drivers to transparently use both the msg_enable and a generic netdevice message layout. It moves the msg_enable over to the net_device struct and allows drivers to obsolete ethtool handling code of the msg_enable value. The current code has each driver contain a copy of msg_enable and handle the setting/changing through ethtool that way. Since the netdev name is stored in the net_device struct, those two are not coherently available in a uniform way across all drivers (a single macro or function would not work since all drivers name their net_device members differently). This makes netdevice driver writes reinvent the wheel over and over again. It thus makes sense to move msg_enable to the net_device. This gives us the opportunity to (1) initialize it by default with a globally sane value, (2) remove msg_enable handling code w/r ethtool for drivers that know and use the msg_enable member of the net_device struct. (3) Ethtool code can just modify the net_device msg_enable for drivers that do not have custom msg_enable get/set handlers so converted drivers lose some code for that as well. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/netdevice.h | 38 ++ net/core/dev.c|5 + net/core/ethtool.c| 14 +++--- 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a70f55..d185f41 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -540,6 +540,8 @@ struct net_device struct device dev; /* space for optional statistics and wireless sysfs groups */ struct attribute_group *sysfs_groups[3]; + + int msg_enable; }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -838,6 +840,42 @@ enum { NETIF_MSG_WOL = 0x4000, }; +#define ndev_err(netdev, level, format, arg...) \ + do { if ((netdev)->msg_enable & NETIF_MSG_##level) { \ + printk(KERN_ERR "%s: %s: " format, (netdev)->name, \ + (netdev)->dev.parent->bus_id, ## arg); } } while (0) + +#define ndev_warn(netdev, level, format, arg...) \ + do { if ((netdev)->msg_enable & NETIF_MSG_##level) { \ + printk(KERN_WARNING "%s: %s: " format, (netdev)->name, \ + (netdev)->dev.parent->bus_id, ## arg); } } while (0) + +#define ndev_notice(netdev, level, format, arg...) \ + do { if ((netdev)->msg_enable & NETIF_MSG_##level) { \ + printk(KERN_NOTICE "%s: %s: " format, (netdev)->name, \ + (netdev)->dev.parent->bus_id, ## arg); } } while (0) + +#define ndev_info(netdev, level, format, arg...) \ + do { if ((netdev)->msg_enable & NETIF_MSG_##level) { \ + printk(KERN_INFO "%s: %s: " format, (netdev)->name, \ + (netdev)->dev.parent->bus_id, ## arg); } } while (0) + +#ifdef DEBUG +#define ndev_debug(netdev, level, format, arg...) \ + do { if ((netdev)->msg_enable & NETIF_MSG_##level) { \ + printk(KERN_DEBUG "%s: %s: " format, (netdev)->name, \ + (netdev)->dev.parent->bus_id, ## arg); } } while (0) +#else +/* Force type-checking on ndev_dbg() when DEBUG is not set */ +static inline int __attribute__ ((format (printf, 3, 4))) +__ndev_dbg(struct net_device * netdev, u32 level, const char *format, ...) +{ + return 0; +} +#define ndev_dbg(netdev, level, fmt, args...) \ + __ndev_dbg(netdev, NETIF_MSG_##level, fmt, ##args) +#endif + #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV) #define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE) #define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK) diff --git a/net/core/dev.c b/net/core/dev.c index 2609062..316f250 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3378,6 +3378,11 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name, dev->priv = netdev_priv(dev); dev->get_stats = internal_stats; + dev->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK; +#ifdef DEBUG + /* put these to good use: */ + dev->msg_enable |= NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR; +#endif setup(dev); strcpy(dev->name, name); return dev; diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 8d5e5a0..ff8d52f 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -234,9 +234,9 @@ static int
[PATCH 2/2] [RFC] NET: Convert several drivers to ndev_printk
With the generic ndev_printk macros, we can now convert network drivers to use this generic printk family for netdevices. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c| 135 - drivers/net/e1000/e1000.h | 15 drivers/net/e1000/e1000_ethtool.c | 39 +++ drivers/net/e1000/e1000_main.c| 110 +++--- drivers/net/e1000/e1000_param.c | 67 +- drivers/net/ixgb/ixgb.h | 14 drivers/net/ixgb/ixgb_ethtool.c | 15 drivers/net/ixgb/ixgb_main.c | 50 ++ 8 files changed, 184 insertions(+), 261 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 6169663..8c09c9e 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -172,19 +172,12 @@ MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); -static int debug = 3; static int eeprom_bad_csum_allow = 0; static int use_io = 0; -module_param(debug, int, 0); module_param(eeprom_bad_csum_allow, int, 0); module_param(use_io, int, 0); -MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums"); MODULE_PARM_DESC(use_io, "Force use of i/o access mode"); -#define DPRINTK(nlevel, klevel, fmt, args...) \ - (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \ - printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \ - __FUNCTION__ , ## args)) #define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \ @@ -645,12 +638,12 @@ static int e100_self_test(struct nic *nic) /* Check results of self-test */ if(nic->mem->selftest.result != 0) { - DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", + ndev_err(nic->netdev, HW, "Self-test failed: result=0x%08X\n", nic->mem->selftest.result); return -ETIMEDOUT; } if(nic->mem->selftest.signature == 0) { - DPRINTK(HW, ERR, "Self-test failed: timed out\n"); + ndev_err(nic->netdev, HW, "Self-test failed: timed out\n"); return -ETIMEDOUT; } @@ -754,7 +747,7 @@ static int e100_eeprom_load(struct nic *nic) * the sum of words should be 0xBABA */ checksum = le16_to_cpu(0xBABA - checksum); if(checksum != nic->eeprom[nic->eeprom_wc - 1]) { - DPRINTK(PROBE, ERR, "EEPROM corrupted\n"); + ndev_err(nic->netdev, PROBE, "EEPROM corrupted\n"); if (!eeprom_bad_csum_allow) return -EAGAIN; } @@ -896,8 +889,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) udelay(20); } if (unlikely(!i)) { - printk("e100.mdio_ctrl(%s) won't go Ready\n", - nic->netdev->name ); + dev_err(&nic->pdev->dev, "mdio_ctrl won't go Ready\n"); spin_unlock_irqrestore(&nic->mdio_lock, flags); return 0; /* No way to indicate timeout error */ } @@ -909,7 +901,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) break; } spin_unlock_irqrestore(&nic->mdio_lock, flags); - DPRINTK(HW, DEBUG, + ndev_dbg(nic->netdev, HW, "%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n", dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out); return (u16)data_out; @@ -962,8 +954,8 @@ static void e100_get_defaults(struct nic *nic) static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) { struct config *config = &cb->u.config; - u8 *c = (u8 *)config; - + u8 *c; + cb->command = cpu_to_le16(cb_config); memset(config, 0, sizeof(struct config)); @@ -1023,12 +1015,16 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config->standard_stat_counter = 0x0; } - DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); - DPRINTK(HW, DEBUG, "[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); - DPRINTK(HW, DEBUG, "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); + c = (u8 *)config; + ndev
[PATCH] [RFC -v3] NET: Implement a standard ndev_printk family
A lot of netdevices implement their own variant of printk and use use variations of dev_printk, printk or others that use msg_enable, which has been an eyesore with countless variations across drivers. This patch implements a standard ndev_printk and derivatives such as ndev_err, ndev_info, ndev_warn that allows drivers to transparently use both the msg_enable and a generic netdevice message layout. It moves the msg_enable over to the net_device struct and allows drivers to obsolete ethtool handling code of the msg_enable value. The current code has each driver contain a copy of msg_enable and handle the setting/changing through ethtool that way. Since the netdev name is stored in the net_device struct, those two are not coherently available in a uniform way across all drivers (a single macro or function would not work since all drivers name their net_device members differently). This makes netdevice driver writes reinvent the wheel over and over again. It thus makes sense to move msg_enable to the net_device. This gives us the opportunity to (1) initialize it by default with a globally sane value, (2) remove msg_enable handling code w/r ethtool for drivers that know and use the msg_enable member of the net_device struct. (3) Ethtool code can just modify the net_device msg_enable for drivers that do not have custom msg_enable get/set handlers so converted drivers lose some code for that as well. (4) non-modified drivers remain functional without additional changes needed. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/netdevice.h | 54 + net/core/dev.c|5 net/core/ethtool.c| 14 ++-- 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a70f55..a5a5fc8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -540,6 +540,8 @@ struct net_device struct device dev; /* space for optional statistics and wireless sysfs groups */ struct attribute_group *sysfs_groups[3]; + + unsigned intmsg_enable; }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -838,6 +840,58 @@ enum { NETIF_MSG_WOL = 0x4000, }; +#define ndev_err(netdev, level, format, arg...) \ + do { \ + struct net_device *__nd = (netdev); \ + if ((__nd)->msg_enable & NETIF_MSG_##level) \ + printk(KERN_ERR "%s: %s: " format, (__nd)->name, \ + (__nd)->dev.parent->bus_id, ## arg); \ + } while (0) + +#define ndev_warn(netdev, level, format, arg...) \ + do { \ + struct net_device *__nd = (netdev); \ + if ((__nd)->msg_enable & NETIF_MSG_##level) \ + printk(KERN_WARNING "%s: %s: " format, (__nd)->name, \ + (__nd)->dev.parent->bus_id, ## arg); \ + } while (0) + +#define ndev_info(netdev, level, format, arg...) \ + do { \ + struct net_device *__nd = (netdev); \ + if ((__nd)->msg_enable & NETIF_MSG_##level) \ + printk(KERN_INFO "%s: %s: " format, (__nd)->name, \ + (__nd)->dev.parent->bus_id, ## arg); \ + } while (0) + +#define ndev_notice(netdev, level, format, arg...) \ + do { \ + struct net_device *__nd = (netdev); \ + if ((__nd)->msg_enable & NETIF_MSG_##level) \ + printk(KERN_NOTICE "%s: %s: " format, (__nd)->name, \ + (__nd)->dev.parent->bus_id, ## arg); \ + } while (0) + +#ifdef DEBUG +#define ndev_dbg(netdev, level, format, arg...) \ + do { \ + struct net_device *__nd = (netdev); \ + if ((__nd)->msg_enable & NETIF_MSG_##level) \ + printk(KERN_DEBUG "%s: %s: " format, (__nd)->name, \ + (__nd)->dev.parent->bus_id, ## arg); \ + } while (0) + +#else +/* Force type-checking on ndev_dbg() when DEBUG is not set */ +static inline int __attribute__ ((format (printf, 3, 4))) +__ndev_dbg(struct net_device * netdev, u32 level, const char *format, ...) +{ + return 0; +} +#define ndev_dbg(netdev, level, fmt, args...) \ + __ndev_dbg(netdev, NETIF_MSG_##level, fmt, ##args) +#endif + #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV) #define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE) #define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK) diff --git a/net/core/dev.c b/net/core/dev.c index 2609062..316f250 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3378,6 +3378,11 @@ struct net_device *alloc_netdev(int sizeof_priv, const c
[PATCH] e100: Fix Tyan motherboard e100 not receiving IPMI commands
From: David Graham <[EMAIL PROTECTED]> The 82550 & 51 parts have an extended configuration block that includes a bit "GMRC", required to enable the expected TCO behavior, in config byte offset 22d. The config block sent by the failing driver does include the extension area, but this bit is not initialised, and the downlaod only specifies 0x16 bytes to be sent to the NIC (thaht's bytes 00..21d). By initializing the GMRC bit, and extending the download size for D102+ MACs, the problem is resolved. Signed-off-by: David Graham <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 763810c..74ea637 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -159,7 +159,7 @@ #define DRV_NAME "e100" #define DRV_EXT"-NAPI" -#define DRV_VERSION"3.5.17-k4"DRV_EXT +#define DRV_VERSION"3.5.23-k4"DRV_EXT #define DRV_DESCRIPTION"Intel(R) PRO/100 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" #define PFXDRV_NAME ": " @@ -1024,10 +1024,16 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config->mwi_enable = 0x1; /* 1=enable, 0=disable */ config->standard_tcb = 0x0; /* 1=standard, 0=extended */ config->rx_long_ok = 0x1; /* 1=VLANs ok, 0=standard */ - if(nic->mac >= mac_82559_D101M) + if (nic->mac >= mac_82559_D101M) { config->tno_intr = 0x1; /* TCO stats enable */ - else + /* Enable TCO in extended config */ + if (nic->mac >= mac_82551_10) { + config->byte_count = 0x20; /* extended bytes */ + config->rx_d102_mode = 0x1; /* GMRC for TCO */ + } + } else { config->standard_stat_counter = 0x0; + } } DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.18-rc2][e1000][swsusp] - Regression - Suspend to disk and resume breaks e1000
Shawn Starr wrote: Hardware IBM ThinkPad T42 E1000 card info: 02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03) Subsystem: IBM PRO/1000 MT Mobile Connection Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 9 Memory at c022 (32-bit, non-prefetchable) [size=128K] Memory at c020 (32-bit, non-prefetchable) [size=64K] I/O ports at 8000 [size=64] [virtual] Expansion ROM at ec00 [disabled] [size=64K] Capabilities: [dc] Power Management version 2 Steps to reproduce: 1) Suspend to disk normally 2) Resume from disk, the e1000 will show garbage for network statistics. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:83 errors:4294967254 dropped:4294967289 overruns:0 frame:4294967268 TX packets:76 errors:4294967282 dropped:0 overruns:0 carrier:4294967275 collisions:4294967289 txqueuelen:100 RX bytes:50728 (49.5 KiB) TX bytes:10138 (9.9 KiB) Base address:0x8000 Memory:c022-c024 Did something change in the driver that forgot to save the registers / not register back upon resumption from disk? I can't tell from the code how the driver knows its been brought down to S3 or S4 states. A workaround is to then suspend to memory and resume, the e1000 will work again. This is repeatable each time. Not sure if anyone else noticed this. [adding netdev to the cc] unfortunately I didn't. e1000 has a special e1000_pci_save_state/e1000_pci_restore_state set of routines that save and restore the configuration space. the fact that it works for suspend to memory to me suggests that there is nothing wrong with that. I'm surprised that the t42 comes with a PCI/PCI-X e1000, which changes the need for this special routine, and the routine does the exact same thing as pci_save_state in your case. These special routines are made to handle PCI-E cards properly. Also there are no config_pm changes related to this in 2.6.18-rc2. Most of this code has been in the kernel for a few major releases afaik. This code worked fine before, so I don't rule out any suspend-related issues. You should certainly compare with 2.6.18-rc1 and make sure it was a regression, perhaps even bisect the e1000-related changes if you have the time, which is about 22 patches or so. I'll see if I can find out some more once I get back to work. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: e1000: "fix" it on thinkpad x60 / eeprom checksum read fails
Pavel Machek wrote: Hi! e1000 in thinkpad x60 fails without this dirty hack. What to do with it? Signed-off-by: Pavel Machek <[EMAIL PROTECTED]> NAK, certainly this should never be merged in any tree... this is a known issue that we're tracking here: http://sourceforge.net/tracker/index.php?func=detail&aid=1474679&group_id=42302&atid=447449 Summary of the issue: Lenovo has used certain BIOS versions where ASPD/DSPD was turned on which turns the PHY off when no cable is inserted to save power. The e1000 driver already turns off this feature but can't do this until the driver is loaded. It seems that turning this feature on causes the MAC to give read errors. Lenovo seems to have the feature turned off in their latest BIOS versions, we encourage all people to upgrade their BIOS with the latest version from Lenovo (available from their website). It seems that for at least 2 people, this has fixed the problem. Inserting a cable obviously might also work :) Hehe. We did reproduce the problem initially with the old BIOS (1.01-1.03) on a T60 system, but unfortunately the bug disappeared into nothingness. Bypassing the checksum leaves the NIC in an uncertain state and is not recommended. Okay, perhaps this should be inserted as a comment into the driver, and printk should be fixed to point at this explanation? Can't we enable the driver with the bad checksum, then read the _real_ data? no. We're working on a solution where we make sure that the PHY is physically turned on properly before we read the EEPROM, which would be the proper fix. It's completely not acceptable to run when the EEPROM checksum fails - you might even be running with the wrong MAC address, or worse. Lets fix this the right way instead. Auke PS: adding netdev to the CC... - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: e1000: "fix" it on thinkpad x60 / eeprom checksum read fails
Theodore Tso wrote: On Fri, Jul 21, 2006 at 06:41:05AM -0700, Andrew Morton wrote: It's completely not acceptable to run when the EEPROM checksum fails - you might even be running with the wrong MAC address, or worse. Lets fix this the right way instead. A printk which helps the user to understand all this saga would be very nice. - And if someone who understands all of these details could put a note in the thinkwiki (say, here: http://www.thinkwiki.org/wiki/Ethernet_Controllers#Intel_Gigabit_.2810.2F100.2F1000.29) it would be greatly appreciated. why don't I do that :) Andrew: I'm contemplating that printk... Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Runtime power management for network interfaces
Alan Stern wrote: During a Power Management session at the Ottawa Linux Symposium, it was generally agreed that network interface drivers ought to automatically suspend their devices (if possible) whenever: (1) The interface is ifconfig'ed down, or (2) No link is available. Presumably (1) should be easy enough to implement. (2) might or might not be feasible, depending on how much WOL support is available. (It might not be feasible at all for wireless networking.) Still, there can be no question that it would be a Good Thing for laptops to power-down their ethernet controllers when the network cable is unplugged. Has any progress been made in this direction? If not, a natural approach would be to start with a reference implementation in one driver which could then be copied to other drivers. Intel's newer e1000's (ich7 onboard e1000 and newer versions for instance) already support this feature partially - the MAC stays on but the PHY can be powered off when no link is present. In order to enable this feature you will need to turn it on explicitly at load time: modprobe e1000 SmartPowerDownEnable=1 Allthough not the entire NIC is powered off, it still saves a significant part of the power consumed by the NIC. All bits help. The power automatically restores once a cable is plugged in. Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: add forgotten PCI ID for supported device
The Intel(R) PRO/1000 82572EI card is fully supported by 7.0.33-k2 and onward. Add the device ID so this card works with 2.6.17.y onward. This device ID was accidentally omitted. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 523c2c9..c5e7023 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c @@ -353,6 +353,7 @@ e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_82572EI_COPPER: case E1000_DEV_ID_82572EI_FIBER: case E1000_DEV_ID_82572EI_SERDES: +case E1000_DEV_ID_82572EI: hw->mac_type = e1000_82572; break; case E1000_DEV_ID_82573E: diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 150e45e..c01e5d2 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h @@ -462,6 +462,7 @@ #define E1000_DEV_ID_82571EB_SERDES #define E1000_DEV_ID_82572EI_COPPER 0x107D #define E1000_DEV_ID_82572EI_FIBER 0x107E #define E1000_DEV_ID_82572EI_SERDES 0x107F +#define E1000_DEV_ID_82572EI 0x10B9 #define E1000_DEV_ID_82573E 0x108B #define E1000_DEV_ID_82573E_IAMT 0x108C #define E1000_DEV_ID_82573L 0x109A
Re: IBM (Lenovo) T60: e1000 driver high latency
Thomas Glanzmann wrote: Hello, [ resend because .config and the used kernel version was missing ] Linux Kernel Version: Linus Vanilla Tree; .config attached. I recently aquired a Lenovo (IBM) T60 with a e1000 network card. I experience high latency with this networkcard: Pings last upto 1 second where the ping should be around 25 ms. I googled a bit and found the following: - Enable NAPI, which didn't worked for me. 64 bytes from 192.168.0.223: icmp_seq=30 ttl=64 time=1004 ms 64 bytes from 192.168.0.223: icmp_seq=31 ttl=64 time=0.444 ms 64 bytes from 192.168.0.223: icmp_seq=32 ttl=64 time=1006 ms 64 bytes from 192.168.0.223: icmp_seq=33 ttl=64 time=0.739 ms Someone reported this problem on the e1000 bug tracker at e1000.sf.net. He also reported that the behaviour goes away completely if he disables the in-kernel irq balancer: : If I disable in kernel config Irq Balancing pings are : much better but not the best :-) : : 64 bytes from 192.168.3.74: icmp_seq=29 ttl=64 time=12.7 ms : 64 bytes from 192.168.3.74: icmp_seq=30 ttl=64 time=10.0 ms : 64 bytes from 192.168.3.74: icmp_seq=31 ttl=64 time=7.3 ms : 64 bytes from 192.168.3.74: icmp_seq=32 ttl=64 time=4.5 ms that's a large difference from >> 1000ms, and I cannot suspect otherwise that the kernel irqbalance is wreaking havoc in your system, trying to swap the entire context between each core (t60 is a core duo) every second or so. I've never believed much in the kernel irq balancer, the userspace daemon written by Arjan van der Ven just does a much better job, so can you try to disable the kernel irqbalancer? > CONFIG_IRQBALANCE=y turn that off ;) Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Runtime power management for network interfaces
Randy.Dunlap wrote: On Tue, 25 Jul 2006 09:20:06 -0700 Auke Kok wrote: Alan Stern wrote: During a Power Management session at the Ottawa Linux Symposium, it was generally agreed that network interface drivers ought to automatically suspend their devices (if possible) whenever: (1) The interface is ifconfig'ed down, or (2) No link is available. Presumably (1) should be easy enough to implement. (2) might or might not be feasible, depending on how much WOL support is available. (It might not be feasible at all for wireless networking.) Still, there can be no question that it would be a Good Thing for laptops to power-down their ethernet controllers when the network cable is unplugged. Has any progress been made in this direction? If not, a natural approach would be to start with a reference implementation in one driver which could then be copied to other drivers. Intel's newer e1000's (ich7 onboard e1000 and newer versions for instance) already support this feature partially - the MAC stays on but the PHY can be powered off when no link is present. In order to enable this feature you will need to turn it on explicitly at load time: modprobe e1000 SmartPowerDownEnable=1 Please add that to Documentation/networking/e1000.txt. I'm long overdue with documentation updates ATM, I'll see if I can fix that :) Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] irqbalance: Mark in-kernel irqbalance as obsolete, set to N by default
We've recently seen a number of user bug reports against e1000 that the in-kernel irqbalance code is detrimental to network latency. The algorithm keeps swapping irq's for NICs from cpu to cpu causing extremely high network latency (>1000ms). Another NIC driver (cxgb) already has severe warnings in their documentation file against using CONFIG_IRQBALANCE, but this is a general problem for all NIC drivers and other subsystems. This is especially so with cpufreq scaling where the system is slowed down and the migrations take much longer. I suggest that the in-kernel irqbalance is phased out, by marking it OBSOLETE first and (perhaps) removing the code later. The userspace irqbalance daemon written by Arjan van de Ven does a wonderful job and should be used instead. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- Kconfig | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) --- diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index daa75ce..5a40cfe 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -690,12 +690,19 @@ config EFI kernel should continue to boot on existing non-EFI platforms. config IRQBALANCE - bool "Enable kernel irq balancing" + bool "Enable kernel irq balancing (obsolete)" depends on SMP && X86_IO_APIC - default y + default n help - The default yes will allow the kernel to do irq load balancing. - Saying no will keep the kernel from doing irq load balancing. + The kernel irq balance will migrate interrupts between cpu's + constantly, which may help reduce load in some cases. It is not + beneficial for latency however, and a user-space daemon is available + that does a much better job. + + The default no will keep the kernel from doing irq load balancing. + Say yes will allow the kernel to do irq load balancing. + + If unsure, say N. # turning this on wastes a bunch of space. # Summit needs it only when NUMA is on
Re: e1000 speed/duplex error
Jeff Kirsher wrote: On 8/1/06, a1 <[EMAIL PROTECTED]> wrote: Hi, Jeff. JK> OPTION 2: Turn auto-negotiate on the e1000 card and tell it to only JK> advertise 100 Full Duplex. This will allow negotiation between the JK> two lnk partners and the e1000 will advertise that it is only able to JK> do 100 Full duplex. Is there any way i could do this with ethtool? It only allows force spd/dplx , but not set it for advertising... Not currently. That would be a nice feature though... :) If i do as follows other side reports 1000/FD: ethtool -s eth0 speed 100 duplex full autoneg on Which is what I would expect. I have to step away for a bit, but if no one responds with how to load the driver with auto-negotiate advertising only 100 Full Duplex, I will do so when I return. Here's that part of the driver documentation: $ modprobe e1000 AutoNeg=0x08 e1000: :00:00.0: e1000_validate_option: AutoNeg advertising 100/FD 99 /* Auto-negotiation Advertisement Override 100 * 101 * Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber) 102 * 103 * The AutoNeg value is a bit mask describing which speed and duplex 104 * combinations should be advertised during auto-negotiation. 105 * The supported speed and duplex modes are listed below 106 * 107 * Bit 7 6 5 4 3 2 1 0 108 * Speed (Mbps) N/A N/A 1000 N/A100 100 10 10 109 * DuplexFull Full Half Full Half 110 * 111 * Default Value: 0x2F (copper); 0x20 (fiber) 112 */ hth, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: E1000: bug on error path in e1000_probe()
Stephane Doyon wrote: The e1000_probe() function passes references to the netdev structure before it's actually registered. In the (admittedly obscure) case where the netdev registration fails, we are left with a dangling reference. Specifically, e1000_probe() calls netif_carrier_off(netdev); before register_netdev(netdev). (It also calls pci_set_drvdata(pdev, netdev) rather early, not sure how important that is.) netif_carrier_off() does linkwatch_fire_event(dev);, which in turn does dev_hold(dev); and queues up an event with a reference to the netdev. But the net_device reference counting mechanism only works on registered netdevs. Should the register_netdev() call fail, the error path does free_netdev(netdev);, and when the event goes off, it accesses random memory through the dangling reference. I would recommend moving the register_netdev() call earlier. We agree that this may be an issue and we're looking at how this mis-ordering entered the code in the first place. I'm probably going to send a patch later today or include it in this week-worths upstream patches later this week. We were wondering however how you encountered this problem? Did you see a case where this race actually happened? it might be an interesting case to look at. Or did you do this by code review only? Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: e1000 speed/duplex error
a1 wrote: JK> I agree. Although ethtool does not have that functionality as of yet. JK> Feel free to provide a patch to the ethtool maintainer (Jeff Garzik) JK> if you would like. I will put it on my plate of things to do, but I JK> will admit that it is near the bottom of the list of items to get done JK> for me. Feel free to ping me once in awhile to remind me. Ethtool already have support for that, but e1000 driver doesn't treat all values passed from ethtool correctly. For example, if I run ethtool with the following parameters: ethtool -s eth0 speed 100 duplex full autoneg on parameters filled by ethtool looks like: ecmd->autoneg = AUTONEG_ENABLE; ecmd->advertising = ADVERTISED_100baseT_Full; but then they passed to the driver, driver fills the structure passed to the hw layer with all possible advertise values. if (ecmd->autoneg == AUTONEG_ENABLE) { hw->autoneg = 1; if (hw->media_type == e1000_media_type_fiber) hw->autoneg_advertised = ADVERTISED_1000baseT_Full | ADVERTISED_FIBRE | ADVERTISED_Autoneg; else --->hw->autoneg_advertised = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | ADVERTISED_1000baseT_Full| ADVERTISED_Autoneg | ADVERTISED_TP; ecmd->advertising = hw->autoneg_advertised; } else If you change it that way everything works like I thought --- e1000_ethtool.c.origMon Jun 26 14:13:26 2006 +++ e1000_ethtool.c Wed Aug 02 12:35:36 2006 @@ -225,13 +225,7 @@ ADVERTISED_FIBRE | ADVERTISED_Autoneg; else - hw->autoneg_advertised = ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Full| - ADVERTISED_Autoneg | - ADVERTISED_TP; + hw->autoneg_advertised = ecmd->advertising; Don't you mean this? : + hw->autoneg_advertised = ecmd->advertising | +ADVERTISED_Autoneg | +ADVERTISED_TP; and we'd also have to do this for fibre... > ecmd->advertising = hw->autoneg_advertised; } else if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) but that's not really what you want: the way ethtool works currently only allows you to pass *one* speed/duplex tuple and autonegotiate with that, or all (by omitting any speed/duplex tuple). ethtool needs some code that allows you to specify "autonegotiate 10_half or 100_full or 1000_full" (3 tuples, but not implying 100_half or 10_full). This is something mii-tool was able to do but this functionality never made it into ethtool AFAIK :) This is the most useful case for everyone, you can omit advertising gig link if you only have 100mbit switches and speed up link times that way etc. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.18-rc2][e1000][swsusp] - Regression - Suspend to disk and resume breaks e1000 - RESOLVED Bug #6867
Shawn Starr wrote: On Sunday 16 July 2006 12:33 pm, Auke Kok wrote: [adding netdev to the cc] unfortunately I didn't. e1000 has a special e1000_pci_save_state/e1000_pci_restore_state set of routines that save and restore the configuration space. the fact that it works for suspend to memory to me suggests that there is nothing wrong with that. Hi Auke, It appears 2.6.18-rc3 this does not occur anymore. I suspended to disk/ram and the interface pci registers were restored. Bugzilla #6867 I would not be surprised if all the suspend issues in 2.6.18rcX were not involved in this somehow... thanks for reporting back in. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: e1000 speed/duplex error
a1 wrote: Hi, Auke. Auke Kok wrote: AK> Here's that part of the driver documentation: AK> $ modprobe e1000 AutoNeg=0x08 AK> e1000: :00:00.0: e1000_validate_option: AutoNeg advertising 100/FD AK> 99 /* Auto-negotiation Advertisement Override AK> 100 * AK> 101 * Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber) AK> 102 * AK> 103 * The AutoNeg value is a bit mask describing which speed and duplex AK> 104 * combinations should be advertised during auto-negotiation. AK> 105 * The supported speed and duplex modes are listed below AK> 106 * AK> 107 * Bit 7 6 5 4 3 2 1 0 AK> 108 * Speed (Mbps) N/A N/A 1000 N/A100 100 10 10 AK> 109 * DuplexFull Full Half Full Half AK> 110 * AK> 111 * Default Value: 0x2F (copper); 0x20 (fiber) AK> 112 */ This is not what I'm thinking of. Say, for example, I have a bunch of e1000 adapters in my box and want to dynamically change one's spd/dplx. For that works in the way you described I need to stop all of them and load with autoneg parameter (can I pass this parameter only to single card?) and loose all connection I had on other adapters. you can pass these parameters per card as such: $ modprobe e1000 AutoNeg=0x2f,0x28,0x2f,0x2f this way card #2 will see the non-default value, the other 3 will run with the default value (0x2f). Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bug] e100: checksum mismatch on 82551ER rev10
[cc-ing netdev] [adding original thread authors back, please do not strip CC] Charlie Brady wrote: Molle Bestefich wrote: The NICs are working perfectly. How can you tell? Do you know if jumbo frames work correctly? Is the device properly checksumming? is flow control working properly? These and many, many more settings are determined by the EEPROM. Seemingly it may work correctly, but there is no guarantee whatsoever that it will work correctly at all if the checksum is bad. Again, you can lose data, or worse, you could corrupt memory in the system causing massive failure (DMA timings, etc). Unlikely? sure, but not impossible. Let's assume that these things are all true, and the NIC currently does not work perfectly, just imperfectly, but acceptably. With the recent driver change, it now does not work at all. That's surely a bug in the driver. There is no logic in that sentence at all. You're saying that the driver is broken because it doesn't fix an error in the EEPROM? We're trying extremely hard to fix real errors here (especially when we find that hardware resellers send out hardware with EEPROM problems) and you are asking for a workaround that will (likely) introduce random errors and failure into your kernel. I do not want to accept responsability for that and I also do not think any other kernel developer would like me to release such a risk into the kernel. I'd probably get whistled back instantly :) If you want to edit your own kernel then I am fine with it. If you want to recalculate the checksum yourself and put it in the EEPROM then I am also fine with that. As long as you never ask for support for that NIC. But we can't support an option that allows all users to willingly enable a piece of non-properly-working hardware. Because that is what it is: Not properly configured hardware. The bottom line is that your problem is that a specific hardware vendor is/was selling badly configured hardware, and you buy it from them, even after it's End Of Lifed for that vendor. Even though that vendor did buy the units properly configured and had all the tools needed to configure them properly. I can maybe fix your problem by seeing if we can get you an eeprom update, but I can not break everyone elses kernel for that. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [bug] e100: checksum mismatch on 82551ER rev10
Charlie Brady wrote: Let's assume that these things are all true, and the NIC currently does not work perfectly, just imperfectly, but acceptably. With the recent driver change, it now does not work at all. That's surely a bug in the driver. There is no logic in that sentence at all. You're saying that the driver is broken because it doesn't fix an error in the EEPROM? I am not asking the driver to fix errors in the EEPROM. I'm asking it to send and receive packets, as it has done in the past. maybe you are confusing e100 with eepro100. e100 has done this since it made it into 2.6.4 or so. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] irqbalance: Mark in-kernel irqbalance as obsolete, set to N by default
Andrew Morton wrote: On Mon, 31 Jul 2006 10:35:26 -0700 Auke Kok <[EMAIL PROTECTED]> wrote: We've recently seen a number of user bug reports against e1000 that the in-kernel irqbalance code is detrimental to network latency. The algorithm keeps swapping irq's for NICs from cpu to cpu causing extremely high network latency (>1000ms). What kernel versions? Some IRQ balancer fixes went in shortly after 2.6.17. user reports show 2.6.17.1 having the problem, I'm trying to get more details information, and will ask if 2.6.18rc3 or so does better for them. Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]: e1000: Janitor: Use #defined values for literals
Linas Vepstas wrote: Resending patch from 23 June 2006; there was some confusion about whether a similar patch had already been applied; seems it wasn't. Minor janitorial patch: use #defines for literal values. Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]> Acked-by: Auke Kok <[EMAIL PROTECTED]> drivers/net/e1000/e1000_main.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux-2.6.18-rc3-mm2/drivers/net/e1000/e1000_main.c === --- linux-2.6.18-rc3-mm2.orig/drivers/net/e1000/e1000_main.c2006-08-07 14:39:37.0 -0500 +++ linux-2.6.18-rc3-mm2/drivers/net/e1000/e1000_main.c 2006-08-07 15:06:31.0 -0500 @@ -4955,8 +4955,8 @@ static pci_ers_result_t e1000_io_slot_re } pci_set_master(pdev); - pci_enable_wake(pdev, 3, 0); - pci_enable_wake(pdev, 4, 0); /* 4 == D3 cold */ + pci_enable_wake(pdev, PCI_D3hot, 0); + pci_enable_wake(pdev, PCI_D3cold, 0); /* Perform card reset only on one instance of the card */ if (PCI_FUNC (pdev->devfn) != 0) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[Fwd: Fwd: [PATCH] ethtool v4: add full autoneg specify feature]
I figured that the word "ad" "ver" "tise" must throw off the spam filter, so I hope this gets through now that I've removed it from the subject. Note this is an ethtool patch, not a kernel one :) Cheers, Auke -- Forwarded message -- From: Jeff Kirsher <[EMAIL PROTECTED]> Date: Aug 7, 2006 9:53 PM Subject: [PATCH] ethtool v4: add autoneg - feature To: netdev@vger.kernel.org adds the ability to change the advertised speed and duplex for a network interfce. Previously, a network interface was only able to advertise all supported speed's and duplex's, or one individual speed and duplex. This feature allows the user to choose which supported speed's and duplex's to advertise by using the hex value. -- Signed-off-by: Jeff Kirsher <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool.c | 30 +++--- 1 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ethtool.c b/ethtool.c index 7d408be..2ad2f99 100644 --- a/ethtool.c +++ b/ethtool.c @@ -99,6 +99,7 @@ static struct option { " [ duplex half|full ]\n" " [ port tp|aui|bnc|mii|fibre ]\n" " [ autoneg on|off ]\n" + " [ advertise %%x ]\n" " [ phyad %%d ]\n" " [ xcvr internal|external ]\n" " [ wol p|u|m|b|a|g|s|d... ]\n" @@ -546,6 +547,15 @@ static void parse_cmdline(int argc, char show_usage(1); } break; + } else if (!strcmp(argp[i], "advertise")) { + gset_changed = 1; + i += 1; + if (i >= argc) + show_usage(1); + advertising_wanted = strtol(argp[i], NULL, 6); + if (advertising_wanted < 0) + show_usage(1); + break; } else if (!strcmp(argp[i], "phyad")) { gset_changed = 1; i += 1; @@ -598,25 +608,7 @@ static void parse_cmdline(int argc, char } } - if (autoneg_wanted == AUTONEG_ENABLE){ - if (speed_wanted == SPEED_10 && duplex_wanted == DUPLEX_HALF) - advertising_wanted = ADVERTISED_10baseT_Half; - else if (speed_wanted == SPEED_10 && -duplex_wanted == DUPLEX_FULL) - advertising_wanted = ADVERTISED_10baseT_Full; - else if (speed_wanted == SPEED_100 && -duplex_wanted == DUPLEX_HALF) - advertising_wanted = ADVERTISED_100baseT_Half; - else if (speed_wanted == SPEED_100 && -duplex_wanted == DUPLEX_FULL) - advertising_wanted = ADVERTISED_100baseT_Full; - else if (speed_wanted == SPEED_1000 && -duplex_wanted == DUPLEX_HALF) - advertising_wanted = ADVERTISED_1000baseT_Half; - else if (speed_wanted == SPEED_1000 && -duplex_wanted == DUPLEX_FULL) - advertising_wanted = ADVERTISED_1000baseT_Full; - else + if ((autoneg_wanted == AUTONEG_ENABLE) && (advertising_wanted < 0)) { /* auto negotiate without forcing, * all supported speed will be assigned in do_sset() */ -- Cheers, Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 4/9] e100 driver conversion
Peter Zijlstra wrote: Update the driver to make use of the netdev_alloc_skb() API and the NETIF_F_MEMALLOC feature. this should be done in two separate patches. I should take care of the netdev_alloc_skb() part too for e100 (which I've already queued internally), also since ixgb still needs it. do you have any plans to visit ixgb for this change too? Cheers, Auke Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]> Signed-off-by: Daniel Phillips <[EMAIL PROTECTED]> --- drivers/net/e100.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/net/e100.c === --- linux-2.6.orig/drivers/net/e100.c +++ linux-2.6/drivers/net/e100.c @@ -1763,7 +1763,7 @@ static inline void e100_start_receiver(s #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) { - if(!(rx->skb = dev_alloc_skb(RFD_BUF_LEN + NET_IP_ALIGN))) + if(!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN))) return -ENOMEM; /* Align, init, and map the RFD. */ @@ -2143,7 +2143,7 @@ static int e100_loopback_test(struct nic e100_start_receiver(nic, NULL); - if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { + if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { err = -ENOMEM; goto err_loopback_none; } @@ -2573,6 +2573,7 @@ static int __devinit e100_probe(struct p #ifdef CONFIG_NET_POLL_CONTROLLER netdev->poll_controller = e100_netpoll; #endif + netdev->features |= NETIF_F_MEMALLOC; strcpy(netdev->name, pci_name(pdev)); nic = netdev_priv(netdev); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 3/9] e1000 driver conversion
Peter Zijlstra wrote: Update the driver to make use of the NETIF_F_MEMALLOC feature. Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]> Signed-off-by: Daniel Phillips <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) Index: linux-2.6/drivers/net/e1000/e1000_main.c === --- linux-2.6.orig/drivers/net/e1000/e1000_main.c +++ linux-2.6/drivers/net/e1000/e1000_main.c @@ -4020,8 +4020,6 @@ e1000_alloc_rx_buffers(struct e1000_adap */ skb_reserve(skb, NET_IP_ALIGN); - skb->dev = netdev; - buffer_info->skb = skb; buffer_info->length = adapter->rx_buffer_len; map_skb: @@ -4135,8 +4136,6 @@ e1000_alloc_rx_buffers_ps(struct e1000_a */ skb_reserve(skb, NET_IP_ALIGN); - skb->dev = netdev; - buffer_info->skb = skb; buffer_info->length = adapter->rx_ps_bsize0; buffer_info->dma = pci_map_single(pdev, skb->data, - can we really delete these?? Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 3/9] e1000 driver conversion
David Miller wrote: From: Auke Kok <[EMAIL PROTECTED]> Date: Tue, 08 Aug 2006 13:50:33 -0700 can we really delete these?? netdev_alloc_skb() does it for you yeah I didn't spot that patch #2 in that series introduces that code - my bad. Thanks. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] move skb->dev assignment into netdev_alloc_skb
Brandeburg, Jesse wrote: On Sat, 12 Aug 2006, Christoph Hellwig wrote: Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]> Since the e1000 change is non-trivial I'm not going to bypass the driver author on it, sorry. What I did do was put the netdev_alloc_skb() change into my tree, and since I'm co-author of the tg3 driver I'll apply that bit too. The e1000 bit will need to go through the e1000 maintainers. Thank you, I'll take a look at this tomorrow, as I need to digest the patch in context. Did you get a chance to look at it? For your conveniance here's just the e1000 bits, without the hunks Dave has commited already: I'm okay with this change. Auke will shortly be submitting a patch set for 2.6.19 and it should include this. Great, I was already waiting for this change to drip in but hadn't checked for it. I've queued it and it will be included in this weeks' patch series git pull request. Cheers, Auke Thanks for the feedback Christoph! Jesse for reference this is the patch, but like i said auke will enqueue it in GIT and send it to Jeff for inclusion. e1000: clean up skb allocation code, patch submitted by Christoph Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]> Acked-by: Jesse Brandeburg <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 19 +++ 1 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 627f224..66c0325 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Int #else #define DRIVERNAPI "-NAPI" #endif -#define DRV_VERSION "7.1.9-k4"DRIVERNAPI +#define DRV_VERSION "7.1.9-k6"DRIVERNAPI char e1000_driver_version[] = DRV_VERSION; static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; @@ -3711,7 +3711,6 @@ e1000_clean_rx_irq(struct e1000_adapter netdev_alloc_skb(netdev, length + NET_IP_ALIGN); if (new_skb) { skb_reserve(new_skb, NET_IP_ALIGN); - new_skb->dev = netdev; memcpy(new_skb->data - NET_IP_ALIGN, skb->data - NET_IP_ALIGN, length + NET_IP_ALIGN); @@ -3978,13 +3977,13 @@ e1000_alloc_rx_buffers(struct e1000_adap buffer_info = &rx_ring->buffer_info[i]; while (cleaned_count--) { - if (!(skb = buffer_info->skb)) - skb = netdev_alloc_skb(netdev, bufsz); - else { + skb = buffer_info->skb; + if (skb) { skb_trim(skb, 0); goto map_skb; } + skb = netdev_alloc_skb(netdev, bufsz); if (unlikely(!skb)) { /* Better luck next round */ adapter->alloc_rx_buff_failed++; @@ -4009,10 +4008,10 @@ e1000_alloc_rx_buffers(struct e1000_adap dev_kfree_skb(skb); dev_kfree_skb(oldskb); break; /* while !buffer_info->skb */ - } else { - /* Use new allocation */ - dev_kfree_skb(oldskb); } + + /* Use new allocation */ + dev_kfree_skb(oldskb); } /* Make buffer alignment 2 beyond a 16 byte boundary * this will result in a 16 byte aligned IP header after @@ -4020,8 +4019,6 @@ e1000_alloc_rx_buffers(struct e1000_adap */ skb_reserve(skb, NET_IP_ALIGN); - skb->dev = netdev; - buffer_info->skb = skb; buffer_info->length = adapter->rx_buffer_len; map_skb: @@ -4135,8 +4132,6 @@ e1000_alloc_rx_buffers_ps(struct e1000_a */ skb_reserve(skb, NET_IP_ALIGN); - skb->dev = netdev; - buffer_info->skb = skb; buffer_info->length = adapter->rx_ps_bsize0; buffer_info->dma = pci_map_single(pdev, skb->data, - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 24/41] drivers/net/e1000/: possible cleanups
[EMAIL PROTECTED] wrote: From: Adrian Bunk <[EMAIL PROTECTED]> - make needlessly global functions static - #if 0 the following unused global functions: - e1000_hw.c: e1000_mc_addr_list_update() - e1000_hw.c: e1000_read_reg_io() - e1000_hw.c: e1000_enable_pciex_master() - e1000_hw.c: e1000_ife_disable_dynamic_power_down() - e1000_hw.c: e1000_ife_enable_dynamic_power_down() - e1000_hw.c: e1000_write_ich8_word() - e1000_hw.c: e1000_duplex_reversal() - e1000_main.c: e1000_io_read() Nack We have done recent work on cleaning up *_hw for both e1000 and ixgb and will submit a patch for this ourselves. This will be submitted to netdev soon for e1000 (this week I hope). This patch would not only make my queue a mess but also conflict :). Cheers, Auke Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Cc: John Ronciak <[EMAIL PROTECTED]> Cc: Jesse Brandeburg <[EMAIL PROTECTED]> Cc: Jeff Kirsher <[EMAIL PROTECTED]> Cc: Auke Kok <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_hw.c | 89 ++- drivers/net/e1000/e1000_hw.h | 32 --- drivers/net/e1000/e1000_main.c |2 3 files changed, 67 insertions(+), 56 deletions(-) diff -puN drivers/net/e1000/e1000_hw.c~drivers-net-e1000-possible-cleanups drivers/net/e1000/e1000_hw.c --- a/drivers/net/e1000/e1000_hw.c~drivers-net-e1000-possible-cleanups +++ a/drivers/net/e1000/e1000_hw.c @@ -105,6 +105,33 @@ static int32_t e1000_configure_kmrn_for_ uint16_t duplex); static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw); +static int32_t e1000_erase_ich8_4k_segment(struct e1000_hw *hw, + uint32_t segment); +static int32_t e1000_get_software_flag(struct e1000_hw *hw); +static int32_t e1000_get_software_semaphore(struct e1000_hw *hw); +static int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw); +static int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw); +static int32_t e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, + uint16_t words, uint16_t *data); +static int32_t e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, + uint8_t* data); +static int32_t e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, + uint16_t *data); +static int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, + uint16_t *data); +static void e1000_release_software_flag(struct e1000_hw *hw); +static void e1000_release_software_semaphore(struct e1000_hw *hw); +static int32_t e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, +uint32_t no_snoop); +static int32_t e1000_verify_write_ich8_byte(struct e1000_hw *hw, + uint32_t index, uint8_t byte); +static int32_t e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, + uint16_t words, uint16_t *data); +static int32_t e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, +uint8_t data); +static int32_t e1000_write_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, + uint16_t data); + /* IGP cable length table */ static const uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = @@ -3233,7 +3260,7 @@ e1000_shift_in_mdi_bits(struct e1000_hw return data; } -int32_t +static int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) { uint32_t swfw_sync = 0; @@ -3277,7 +3304,7 @@ e1000_swfw_sync_acquire(struct e1000_hw return E1000_SUCCESS; } -void +static void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask) { uint32_t swfw_sync; @@ -3575,7 +3602,7 @@ e1000_write_phy_reg_ex(struct e1000_hw * return E1000_SUCCESS; } -int32_t +static int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *data) @@ -3608,7 +3635,7 @@ e1000_read_kmrn_reg(struct e1000_hw *hw, return E1000_SUCCESS; } -int32_t +static int32_t e1000_write_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data) @@ -3839,7 +3866,7 @@ e1000_phy_powerdown_workaround(struct e1 * * hw - struct containing variables accessed by shared code **/ -int32_t +static int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw) { int32_t ret_val; @@ -4086,7 +4113,7 @@ e1000_phy_igp_get_info(struct e1000_hw * * hw - Struct containing variables accessed by shared code * phy_info - PHY information structure **
Re: e1000: ethtool -p + cable pull = system wedges hard
Jay Vosburgh wrote: Running both 2.6.17.6 plus the e1000 7.2.7 from sourceforge, or the e1000 in netdev-2.6#upstream (7.1.9-k4). Starting up "ethtool -p ethX" then unplugging the cable connected to the identified port is causing my system to completely freeze; even sysrq is unresponsive. I'm running on a 2-way x86 box, with an 82545GM. Is this by any chance a known problem? not at all. Can you include the output of `lspci -vv` and `ethtool -e ethX` ? We'll have to go try to reproduce this. It is certainly not a good thing that it hangs when you try to identify the port and unplug the cable, that should certainly work :) Cheers, Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [E1000-devel] e1000: ethtool -p + cable pull = system wedges hard
Auke Kok wrote: Jay Vosburgh wrote: Running both 2.6.17.6 plus the e1000 7.2.7 from sourceforge, or the e1000 in netdev-2.6#upstream (7.1.9-k4). Starting up "ethtool -p ethX" then unplugging the cable connected to the identified port is causing my system to completely freeze; even sysrq is unresponsive. I'm running on a 2-way x86 box, with an 82545GM. Is this by any chance a known problem? not at all. One of my brain halves (the third one ;)) poked me and told me that it *is* a known issue. Not good. Apparently as early as kernel 2.5.50 a change was introduced that causes this. I am unsure what exactly caused it and I assume it is generic (other nic's might also suffer). The issue is documented in our standalone driver documentation. Not sure what to do with this. Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ethtool: Fix coalesce settings copy+paste typo
Coalesce setting errors use the same error messages as the descriptor ring errors. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ethtool.c b/ethtool.c index 6c7a2e3..bb9dd59 100644 --- a/ethtool.c +++ b/ethtool.c @@ -1470,7 +1470,7 @@ static int do_scoalesce(int fd, struct ifreq *ifr) &changed); if (!changed) { - fprintf(stderr, "no ring parameters changed, aborting\n"); + fprintf(stderr, "no coalesce parameters changed, aborting\n"); return 80; } @@ -1478,7 +1478,7 @@ static int do_scoalesce(int fd, struct ifreq *ifr) ifr->ifr_data = (caddr_t)&ecoal; err = ioctl(fd, SIOCETHTOOL, ifr); if (err) { - perror("Cannot set device ring parameters"); + perror("Cannot set device coalesce parameters"); return 81; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6] e1000: update netstats traffic counters realtime
formerly e1000/e1000e only updated traffic counters once every 2 seconds with the register values of bytes/packets. With newer code however in the interrupt and polling code we can real-time fill in these values in the netstats struct for users to see. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index d1b88e4..e1ba705 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -3652,10 +3652,6 @@ e1000_update_stats(struct e1000_adapter *adapter) } /* Fill out the OS statistics structure */ - adapter->net_stats.rx_packets = adapter->stats.gprc; - adapter->net_stats.tx_packets = adapter->stats.gptc; - adapter->net_stats.rx_bytes = adapter->stats.gorcl; - adapter->net_stats.tx_bytes = adapter->stats.gotcl; adapter->net_stats.multicast = adapter->stats.mprc; adapter->net_stats.collisions = adapter->stats.colc; @@ -4034,6 +4030,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, } adapter->total_tx_bytes += total_tx_bytes; adapter->total_tx_packets += total_tx_packets; + adapter->net_stats.tx_bytes += total_tx_bytes; + adapter->net_stats.tx_packets += total_tx_packets; return cleaned; } @@ -4256,6 +4254,8 @@ next_desc: adapter->total_rx_packets += total_rx_packets; adapter->total_rx_bytes += total_rx_bytes; + adapter->net_stats.rx_bytes += total_rx_bytes; + adapter->net_stats.rx_packets += total_rx_packets; return cleaned; } @@ -4443,6 +4443,8 @@ next_desc: adapter->total_rx_packets += total_rx_packets; adapter->total_rx_bytes += total_rx_bytes; + adapter->net_stats.rx_bytes += total_rx_bytes; + adapter->net_stats.rx_packets += total_rx_packets; return cleaned; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] e1000: Secondary unicast address support
From: Patrick McHardy <[EMAIL PROTECTED]> Add support for configuring secondary unicast addresses. Unicast addresses take precendece over multicast addresses when filling the exact address filters to avoid going to promiscous mode. When more unicast addresses are present than filter slots, unicast filtering is disabled and all slots can be used for multicast addresses. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 47 ++-- 1 files changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index e1ba705..dc4934d 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -126,7 +126,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring); static void e1000_clean_rx_ring(struct e1000_adapter *adapter, struct e1000_rx_ring *rx_ring); -static void e1000_set_multi(struct net_device *netdev); +static void e1000_set_rx_mode(struct net_device *netdev); static void e1000_update_phy_info(unsigned long data); static void e1000_watchdog(unsigned long data); static void e1000_82547_tx_fifo_stall(unsigned long data); @@ -487,7 +487,7 @@ static void e1000_configure(struct e1000_adapter *adapter) struct net_device *netdev = adapter->netdev; int i; - e1000_set_multi(netdev); + e1000_set_rx_mode(netdev); e1000_restore_vlan(adapter); e1000_init_manageability(adapter); @@ -899,7 +899,7 @@ e1000_probe(struct pci_dev *pdev, netdev->stop = &e1000_close; netdev->hard_start_xmit = &e1000_xmit_frame; netdev->get_stats = &e1000_get_stats; - netdev->set_multicast_list = &e1000_set_multi; + netdev->set_rx_mode = &e1000_set_rx_mode; netdev->set_mac_address = &e1000_set_mac; netdev->change_mtu = &e1000_change_mtu; netdev->do_ioctl = &e1000_ioctl; @@ -2382,21 +2382,22 @@ e1000_set_mac(struct net_device *netdev, void *p) } /** - * e1000_set_multi - Multicast and Promiscuous mode set + * e1000_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set * @netdev: network interface device structure * - * The set_multi entry point is called whenever the multicast address - * list or the network interface flags are updated. This routine is - * responsible for configuring the hardware for proper multicast, + * The set_rx_mode entry point is called whenever the unicast or multicast + * address lists or the network interface flags are updated. This routine is + * responsible for configuring the hardware for proper unicast, multicast, * promiscuous mode, and all-multi behavior. **/ static void -e1000_set_multi(struct net_device *netdev) +e1000_set_rx_mode(struct net_device *netdev) { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - struct dev_mc_list *mc_ptr; + struct dev_addr_list *uc_ptr; + struct dev_addr_list *mc_ptr; uint32_t rctl; uint32_t hash_value; int i, rar_entries = E1000_RAR_ENTRIES; @@ -2419,9 +2420,16 @@ e1000_set_multi(struct net_device *netdev) rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); } else if (netdev->flags & IFF_ALLMULTI) { rctl |= E1000_RCTL_MPE; - rctl &= ~E1000_RCTL_UPE; } else { - rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); + rctl &= ~E1000_RCTL_MPE; + } + + uc_ptr = NULL; + if (netdev->uc_count > rar_entries - 1) { + rctl |= E1000_RCTL_UPE; + } else if (!(netdev->flags & IFF_PROMISC)) { + rctl &= ~E1000_RCTL_UPE; + uc_ptr = netdev->uc_list; } E1000_WRITE_REG(hw, RCTL, rctl); @@ -2431,7 +2439,10 @@ e1000_set_multi(struct net_device *netdev) if (hw->mac_type == e1000_82542_rev2_0) e1000_enter_82542_rst(adapter); - /* load the first 14 multicast address into the exact filters 1-14 + /* load the first 14 addresses into the exact filters 1-14. Unicast +* addresses take precedence to avoid disabling unicast filtering +* when possible. +* * RAR 0 is used for the station MAC adddress * if there are not 14 addresses, go ahead and clear the filters * -- with 82571 controllers only 0-13 entries are filled here @@ -2439,8 +2450,11 @@ e1000_set_multi(struct net_device *netdev) mc_ptr = netdev->mc_list; for (i = 1; i < rar_entries; i++) { - if (mc_ptr) { - e1000_rar_set(hw, mc_ptr->dmi_addr, i); + if (uc_ptr) { +
[PATCH 6/6] e1000: fix schedule while atomic when called from mii-tool
From: Jesse Brandeburg <[EMAIL PROTECTED]> mii-tool can cause the driver to call msleep during nway reset, bugzilla.kernel.org bug 8430. Fix by simply calling reinit_locked outside of the spinlock, which is safe from ethtool, so it should be safe from here. Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 13 +++-- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index dc4934d..b7c3070 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -4794,6 +4794,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) spin_unlock_irqrestore(&adapter->stats_lock, flags); return -EIO; } + spin_unlock_irqrestore(&adapter->stats_lock, flags); if (adapter->hw.media_type == e1000_media_type_copper) { switch (data->reg_num) { case PHY_CTRL: @@ -4814,12 +4815,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) DUPLEX_HALF; retval = e1000_set_spd_dplx(adapter, spddplx); - if (retval) { - spin_unlock_irqrestore( - &adapter->stats_lock, - flags); + if (retval) return retval; - } } if (netif_running(adapter->netdev)) e1000_reinit_locked(adapter); @@ -4828,11 +4825,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) break; case M88E1000_PHY_SPEC_CTRL: case M88E1000_EXT_PHY_SPEC_CTRL: - if (e1000_phy_reset(&adapter->hw)) { - spin_unlock_irqrestore( - &adapter->stats_lock, flags); + if (e1000_phy_reset(&adapter->hw)) return -EIO; - } break; } } else { @@ -4847,7 +4841,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) break; } } - spin_unlock_irqrestore(&adapter->stats_lock, flags); break; default: return -EOPNOTSUPP; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] e1000e: convert register test macros to functions
From: Joe Perches <[EMAIL PROTECTED]> Add functions for reg_pattern_test and reg_set_and check Changed macros to use these functions Compiled x86, untested Size decreased ~2K old: $ size drivers/net/e1000e/ethtool.o textdata bss dec hex filename 14461 0 0 14461387d drivers/net/e1000e/ethtool.o new: $ size drivers/net/e1000e/ethtool.o textdata bss dec hex filename 12498 0 0 1249830d2 drivers/net/e1000e/ethtool.o Signed-off-by: Joe Perches <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c | 84 +++--- 1 files changed, 53 insertions(+), 31 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6a39784..bc1115d 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -691,41 +691,63 @@ err_setup: return err; } -#define REG_PATTERN_TEST(R, M, W) REG_PATTERN_TEST_ARRAY(R, 0, M, W) -#define REG_PATTERN_TEST_ARRAY(reg, offset, mask, writeable) \ -{\ - u32 _pat; \ - u32 _value; \ - u32 _test[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x, 0x}; \ - for (_pat = 0; _pat < ARRAY_SIZE(_test); _pat++) {\ - E1000_WRITE_REG_ARRAY(hw, reg, offset,\ - (_test[_pat] & writeable)); \ - _value = E1000_READ_REG_ARRAY(hw, reg, offset); \ - if (_value != (_test[_pat] & writeable & mask)) { \ - ndev_err(netdev, "pattern test reg %04X " \ -"failed: got 0x%08X expected 0x%08X\n", \ -reg + offset, \ -value, (_test[_pat] & writeable & mask));\ - *data = reg; \ - return 1; \ - } \ - } \ +bool reg_pattern_test_array(struct e1000_adapter *adapter, u64 *data, + int reg, int offset, u32 mask, u32 write) +{ + int i; + u32 read; + static const u32 test[] = + {0x5A5A5A5A, 0xA5A5A5A5, 0x, 0x}; + for (i = 0; i < ARRAY_SIZE(test); i++) { + E1000_WRITE_REG_ARRAY(&adapter->hw, reg, offset, + (test[i] & write)); + read = E1000_READ_REG_ARRAY(&adapter->hw, reg, offset); + if (read != (test[i] & write & mask)) { + ndev_err(adapter->netdev, "pattern test reg %04X " +"failed: got 0x%08X expected 0x%08X\n", +reg + offset, +read, (test[i] & write & mask)); + *data = reg; + return true; + } + } + return false; } -#define REG_SET_AND_CHECK(R, M, W) \ -{\ - u32 _value; \ - __ew32(hw, R, W & M); \ - _value = __er32(hw, R); \ - if ((W & M) != (_value & M)) {\ - ndev_err(netdev, "set/check reg %04X test failed: " \ -"got 0x%08X expected 0x%08X\n", R, (_value & M), \ -(W & M));\ - *data = R;\ - return 1; \ - } \ +static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, + int reg, u32 mask, u32 write) +{ + u32 read; + __ew32(&adapter->hw, reg, write & mask); + read = __er32(&adapter->hw, reg); + if ((write & mask) != (read & mask)) { + ndev_err(adapter->netdev, "set/check reg %04X test failed: " +"got 0x%08X expected 0x%08X\n", reg, (read &
[PATCH 3/6] e1000: convert regtest macro's to functions
Minimal macro to function conversion in e1000_ethtool.c Adds functions reg_pattern_test and reg_set_and_check Changes REG_PATTERN_TEST and REG_SET_AND_CHECK macros to call these functions. Saves ~2.5KB Compiled x86, untested (no hardware) old: $ size drivers/net/e1000/e1000_ethtool.o textdata bss dec hex filename 16778 0 0 16778418a drivers/net/e1000/e1000_ethtool.o new: $ size drivers/net/e1000/e1000_ethtool.o textdata bss dec hex filename 14128 0 0 141283730 drivers/net/e1000/e1000_ethtool.o Signed-off-by: Joe Perches <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_ethtool.c | 84 - 1 files changed, 55 insertions(+), 29 deletions(-) diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 667f18b..ec67ea9 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -728,39 +728,65 @@ err_setup: return err; } -#define REG_PATTERN_TEST(R, M, W) \ -{ \ - uint32_t pat, val; \ - const uint32_t test[] =\ - {0x5A5A5A5A, 0xA5A5A5A5, 0x, 0x}; \ - for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \ - E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ - val = E1000_READ_REG(&adapter->hw, R); \ - if (val != (test[pat] & W & M)) { \ - DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ - "0x%08X expected 0x%08X\n",\ - E1000_##R, val, (test[pat] & W & M)); \ - *data = (adapter->hw.mac_type < e1000_82543) ? \ - E1000_82542_##R : E1000_##R; \ - return 1; \ - } \ - } \ +static bool reg_pattern_test(struct e1000_adapter *adapter, uint64_t *data, +int reg, uint32_t mask, uint32_t write) +{ + static const uint32_t test[] = + {0x5A5A5A5A, 0xA5A5A5A5, 0x, 0x}; + uint8_t __iomem *address = adapter->hw.hw_addr + reg; + uint32_t read; + int i; + + for (i = 0; i < ARRAY_SIZE(test); i++) { + writel(write & test[i], address); + read = readl(address); + if (read != (write & test[i] & mask)) { + DPRINTK(DRV, ERR, "pattern test reg %04X failed: " + "got 0x%08X expected 0x%08X\n", + reg, read, (write & test[i] & mask)); + *data = reg; + return true; + } + } + return false; } -#define REG_SET_AND_CHECK(R, M, W) \ -{ \ - uint32_t val; \ - E1000_WRITE_REG(&adapter->hw, R, W & M); \ - val = E1000_READ_REG(&adapter->hw, R); \ - if ((W & M) != (val & M)) {\ - DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ - "expected 0x%08X\n", E1000_##R, (val & M), (W & M)); \ - *data = (adapter->hw.mac_type < e1000_82543) ? \ - E1000_82542_##R : E1000_##R; \ - return 1; \ - } \ +static bool reg_set_and_check(struct e1000_adapter *adapter, uint64_t *data, + int reg, uint32_t mask, uint32_t write) +{ + uint8_t __iomem *address = adapter->hw.hw_addr + reg; + uint32_t read; + + writel(write & mask, address); + read = readl(address); + if ((read & mask) != (write & mask)) { + DPRINTK(DRV, ERR, "set/check reg %04X test failed: " + "got 0x%08X expecte
[PATCH 1/6] e1000e: update netstats traffic counters realtime
formerly e1000/e1000e only updated traffic counters once every 2 seconds with the register values of bytes/packets. With newer code however in the interrupt and polling code we can real-time fill in these values in the netstats struct for users to see. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index a271112..6c99703 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -458,6 +458,8 @@ next_desc: adapter->total_rx_packets += total_rx_packets; adapter->total_rx_bytes += total_rx_bytes; + adapter->net_stats.rx_packets += total_rx_packets; + adapter->net_stats.rx_bytes += total_rx_bytes; return cleaned; } @@ -593,6 +595,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) } adapter->total_tx_bytes += total_tx_bytes; adapter->total_tx_packets += total_tx_packets; + adapter->net_stats.tx_packets += total_tx_packets; + adapter->net_stats.tx_bytes += total_tx_bytes; return cleaned; } @@ -755,6 +759,8 @@ next_desc: adapter->total_rx_packets += total_rx_packets; adapter->total_rx_bytes += total_rx_bytes; + adapter->net_stats.rx_packets += total_rx_packets; + adapter->net_stats.rx_bytes += total_rx_bytes; return cleaned; } @@ -2537,10 +2543,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter) } /* Fill out the OS statistics structure */ - adapter->net_stats.rx_packets = adapter->stats.gprc; - adapter->net_stats.tx_packets = adapter->stats.gptc; - adapter->net_stats.rx_bytes = adapter->stats.gorcl; - adapter->net_stats.tx_bytes = adapter->stats.gotcl; adapter->net_stats.multicast = adapter->stats.mprc; adapter->net_stats.collisions = adapter->stats.colc; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ethtool: fix typo on setting speed 10000
From: Jesse Brandeburg <[EMAIL PROTECTED]> fix the typo in speed 1 setting. Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ethtool.c b/ethtool.c index 3adf843..a668b49 100644 --- a/ethtool.c +++ b/ethtool.c @@ -524,7 +524,7 @@ static void parse_cmdline(int argc, char **argp) speed_wanted = SPEED_1000; else if (!strcmp(argp[i], "2500")) speed_wanted = SPEED_2500; - else if (!strcmp(argp[1], "1")) + else if (!strcmp(argp[i], "1")) speed_wanted = SPEED_1; else show_usage(1); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Fix NAPI state bug when Rx complete
Don't exit polling when we have not yet used our budget, this causes the NAPI system to end up with a messed up poll list. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index b7c3070..724f067 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -3926,7 +3926,7 @@ e1000_clean(struct napi_struct *napi, int budget) &work_done, budget); /* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done < budget)) || + if ((!tx_cleaned && (work_done == 0)) || !netif_running(poll_dev)) { quit_polling: if (likely(adapter->itr_setting & 3)) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] e100: cleanup unneeded math
No need to convert to bytes and back - cleanup unneeded code. Adapted from fix from 'Roel Kluin <[EMAIL PROTECTED]>' Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 9189aff..27f4d4a 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2284,13 +2284,11 @@ static void e100_get_drvinfo(struct net_device *netdev, strcpy(info->bus_info, pci_name(nic->pdev)); } +#define E100_PHY_REGS 0x1C static int e100_get_regs_len(struct net_device *netdev) { struct nic *nic = netdev_priv(netdev); -#define E100_PHY_REGS 0x1C -#define E100_REGS_LEN 1 + E100_PHY_REGS + \ - sizeof(nic->mem->dump_buf) / sizeof(u32) - return E100_REGS_LEN * sizeof(u32); + return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf); } static void e100_get_regs(struct net_device *netdev, -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] e1000: fix memcpy in e1000_get_strings
From: Roel Kluin <[EMAIL PROTECTED]> drivers/net/e1000/e1000_ethtool.c:113: #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN drivers/net/e1000e/ethtool.c:106: #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN E1000_TEST_LEN*ETH_GSTRING_LEN will expand to sizeof(e1000_gstrings_test) / (ETH_GSTRING_LEN * ETH_GSTRING_LEN) A lack of parentheses around defines causes unexpected results due to operator precedences. Signed-off-by: Roel Kluin <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_ethtool.c |2 +- drivers/net/e1000e/ethtool.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 0542b10..d876787 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -1949,7 +1949,7 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) switch (stringset) { case ETH_SS_TEST: memcpy(data, *e1000_gstrings_test, - E1000_TEST_LEN*ETH_GSTRING_LEN); + sizeof(e1000_gstrings_test)); break; case ETH_SS_STATS: for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index d824914..6d9c27f 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -1760,7 +1760,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset, switch (stringset) { case ETH_SS_TEST: memcpy(data, *e1000_gstrings_test, - E1000_TEST_LEN*ETH_GSTRING_LEN); + sizeof(e1000_gstrings_test)); break; case ETH_SS_STATS: for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e100: free IRQ to remove warningwhenrebooting
Adapted from Ian Wienand <[EMAIL PROTECTED]> Explicitly free the IRQ before removing the device to remove a warning "Destroying IRQ without calling free_irq" Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: Ian Wienand <[EMAIL PROTECTED]> --- drivers/net/e100.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 27f4d4a..f630ea9 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2807,8 +2807,9 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) pci_enable_wake(pdev, PCI_D3cold, 0); } - pci_disable_device(pdev); free_irq(pdev->irq, netdev); + + pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); return 0; @@ -2850,6 +2851,8 @@ static void e100_shutdown(struct pci_dev *pdev) pci_enable_wake(pdev, PCI_D3cold, 0); } + free_irq(pdev->irq, netdev); + pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); } -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ethtool: update license field in specfile to be correctly defined
RPM uses "License" as field and not "Copyright". Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool.spec.in |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ethtool.spec.in b/ethtool.spec.in index 1705d7f..4ff736a 100644 --- a/ethtool.spec.in +++ b/ethtool.spec.in @@ -5,7 +5,7 @@ Group : Utilities Summary: A tool for setting ethernet parameters -Copyright : GPL +License: GPL URL: http://sourceforge.net/projects/gkernel/ Buildroot : %{_tmppath}/%{name}-%{version} -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: remove no longer used code for pci read/write cfg
From: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_hw.h |2 -- drivers/net/e1000/e1000_main.c | 16 2 files changed, 0 insertions(+), 18 deletions(-) diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index a2a86c5..930554b 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h @@ -421,8 +421,6 @@ void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, u void e1000_get_bus_info(struct e1000_hw *hw); void e1000_pci_set_mwi(struct e1000_hw *hw); void e1000_pci_clear_mwi(struct e1000_hw *hw); -void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); -void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); int32_t e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value); void e1000_pcix_set_mmrbc(struct e1000_hw *hw, int mmrbc); int e1000_pcix_get_mmrbc(struct e1000_hw *hw); diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 724f067..efd8c2d 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -4866,22 +4866,6 @@ e1000_pci_clear_mwi(struct e1000_hw *hw) pci_clear_mwi(adapter->pdev); } -void -e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) -{ - struct e1000_adapter *adapter = hw->back; - - pci_read_config_word(adapter->pdev, reg, value); -} - -void -e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) -{ - struct e1000_adapter *adapter = hw->back; - - pci_write_config_word(adapter->pdev, reg, *value); -} - int e1000_pcix_get_mmrbc(struct e1000_hw *hw) { -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Add device IDs of blade version of the 82571 quad port
This blade-specific board form factor is identical to the 82571EB board. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_ethtool.c |1 + drivers/net/e1000/e1000_hw.c |1 + drivers/net/e1000/e1000_hw.h |1 + drivers/net/e1000/e1000_main.c|2 ++ 4 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 4c3785c..9ecc3ad 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -1726,6 +1726,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol case E1000_DEV_ID_82571EB_QUAD_COPPER: case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: + case E1000_DEV_ID_82571PT_QUAD_COPPER: case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: /* quad port adapters only support WoL on port A */ if (!adapter->quad_port_a) { diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index ba120f7..8604adb 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c @@ -387,6 +387,7 @@ e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_82571EB_SERDES_DUAL: case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82571EB_QUAD_COPPER: + case E1000_DEV_ID_82571PT_QUAD_COPPER: case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: hw->mac_type = e1000_82571; diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index fe87146..07f0ea7 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h @@ -475,6 +475,7 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); #define E1000_DEV_ID_82571EB_FIBER 0x105F #define E1000_DEV_ID_82571EB_SERDES 0x1060 #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 +#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5 #define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 #define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC #define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 4a22595..e7c8951 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -108,6 +108,7 @@ static struct pci_device_id e1000_pci_tbl[] = { INTEL_E1000_ETHERNET_DEVICE(0x10BC), INTEL_E1000_ETHERNET_DEVICE(0x10C4), INTEL_E1000_ETHERNET_DEVICE(0x10C5), + INTEL_E1000_ETHERNET_DEVICE(0x10D5), INTEL_E1000_ETHERNET_DEVICE(0x10D9), INTEL_E1000_ETHERNET_DEVICE(0x10DA), /* required last entry */ @@ -1101,6 +1102,7 @@ e1000_probe(struct pci_dev *pdev, case E1000_DEV_ID_82571EB_QUAD_COPPER: case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: + case E1000_DEV_ID_82571PT_QUAD_COPPER: /* if quad port adapter, disable WoL on all but port A */ if (global_quad_port_a != 0) adapter->eeprom_wol = 0; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e100: timer power saving
From: Stephen Hemminger <[EMAIL PROTECTED]> Since E100 timer is 2HZ, use rounding to make timer occur on the correct boundary. Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 280313b..d7b9437 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -1604,7 +1604,8 @@ static void e100_watchdog(unsigned long data) else nic->flags &= ~ich_10h_workaround; - mod_timer(&nic->watchdog, jiffies + E100_WATCHDOG_PERIOD); + mod_timer(&nic->watchdog, + round_jiffies(jiffies + E100_WATCHDOG_PERIOD)); } static void e100_xmit_prepare(struct nic *nic, struct cb *cb, - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [-MM, FIX V3] e1000e: incorporate napi_struct changes from net-2.6.24.git
This incorporates the new napi_struct changes into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000. Disabling polling is no longer needed at init time, so remove napi_disable() call from _probe(). Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |2 ++ drivers/net/e1000e/netdev.c | 39 --- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index c57e35a..d2499bb 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -187,6 +187,8 @@ struct e1000_adapter { struct e1000_ring *tx_ring /* One per active queue */ cacheline_aligned_in_smp; + struct napi_struct napi; + unsigned long tx_queue_len; unsigned int restart_queue; u32 txd_cmd; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 372da46..f8ec537 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1662,10 +1662,10 @@ set_itr_now: * e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean(struct net_device *poll_dev, int *budget) +static int e1000_clean(struct napi_struct *napi, int budget) { - struct e1000_adapter *adapter; - int work_to_do = min(*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); + struct net_device *poll_dev = adapter->netdev; int tx_cleaned = 0, work_done = 0; /* Must NOT use netdev_priv macro here. */ @@ -1684,25 +1684,20 @@ static int e1000_clean(struct net_device *poll_dev, int *budget) spin_unlock(&adapter->tx_queue_lock); } - adapter->clean_rx(adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx(adapter, &work_done, budget); /* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done == 0)) || + if ((tx_cleaned && (work_done < budget)) || !netif_running(poll_dev)) { quit_polling: if (adapter->itr_setting & 3) e1000_set_itr(adapter); - netif_rx_complete(poll_dev); - if (test_bit(__E1000_DOWN, &adapter->state)) - atomic_dec(&adapter->irq_sem); - else - e1000_irq_enable(adapter); + netif_rx_complete(poll_dev, napi); + e1000_irq_enable(adapter); return 0; } - return 1; + return work_done; } static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) @@ -2439,7 +2434,7 @@ int e1000e_up(struct e1000_adapter *adapter) clear_bit(__E1000_DOWN, &adapter->state); - netif_poll_enable(adapter->netdev); + napi_enable(&adapter->napi); e1000_irq_enable(adapter); /* fire a link change interrupt to start the watchdog */ @@ -2472,7 +2467,7 @@ void e1000e_down(struct e1000_adapter *adapter) e1e_flush(); msleep(10); - netif_poll_disable(netdev); + napi_disable(&adapter->napi); e1000_irq_disable(adapter); del_timer_sync(&adapter->watchdog_timer); @@ -2605,7 +2600,7 @@ static int e1000_open(struct net_device *netdev) /* From here on the code is the same as e1000e_up() */
[PATCH] [-MM, FIX V4] e1000e: incorporate napi_struct changes from net-2.6.24.git
This incorporates the new napi_struct changes into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000. Disabling polling is no longer needed at init time, so remove napi_disable() call from _probe(). This also fixes an endless polling loop where the driver signalled "polling done" improperly back to the stack. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |2 ++ drivers/net/e1000e/netdev.c | 40 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index c57e35a..d2499bb 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -187,6 +187,8 @@ struct e1000_adapter { struct e1000_ring *tx_ring /* One per active queue */ cacheline_aligned_in_smp; + struct napi_struct napi; + unsigned long tx_queue_len; unsigned int restart_queue; u32 txd_cmd; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 372da46..eeb40cc 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1662,10 +1662,10 @@ set_itr_now: * e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean(struct net_device *poll_dev, int *budget) +static int e1000_clean(struct napi_struct *napi, int budget) { - struct e1000_adapter *adapter; - int work_to_do = min(*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); + struct net_device *poll_dev = adapter->netdev; int tx_cleaned = 0, work_done = 0; /* Must NOT use netdev_priv macro here. */ @@ -1684,25 +1684,19 @@ static int e1000_clean(struct net_device *poll_dev, int *budget) spin_unlock(&adapter->tx_queue_lock); } - adapter->clean_rx(adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx(adapter, &work_done, budget); /* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done == 0)) || + if ((!tx_cleaned && (work_done < budget)) || !netif_running(poll_dev)) { quit_polling: if (adapter->itr_setting & 3) e1000_set_itr(adapter); - netif_rx_complete(poll_dev); - if (test_bit(__E1000_DOWN, &adapter->state)) - atomic_dec(&adapter->irq_sem); - else - e1000_irq_enable(adapter); - return 0; + netif_rx_complete(poll_dev, napi); + e1000_irq_enable(adapter); } - return 1; + return work_done; } static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) @@ -2439,7 +2433,7 @@ int e1000e_up(struct e1000_adapter *adapter) clear_bit(__E1000_DOWN, &adapter->state); - netif_poll_enable(adapter->netdev); + napi_enable(&adapter->napi); e1000_irq_enable(adapter); /* fire a link change interrupt to start the watchdog */ @@ -2472,7 +2466,7 @@ void e1000e_down(struct e1000_adapter *adapter) e1e_flush(); msleep(10); - netif_poll_disable(netdev); + napi_disable(&adapter->napi); e1000_irq_disable(adapter); del_timer_sync(&adapter->w
[PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git
This incorporates the new napi_struct changes into ixgbe. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/ixgbe/ixgbe.h |1 + drivers/net/ixgbe/ixgbe_main.c | 62 +--- 2 files changed, 27 insertions(+), 36 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index b24803f..c160a7d 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h @@ -179,6 +179,7 @@ struct ixgbe_adapter { /* TX */ struct ixgbe_ring *tx_ring; /* One per active queue */ + struct napi_struct napi; u64 restart_queue; u64 lsc_int; u64 hw_tso_ctxt; diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 23fb1ed..a08a462 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -557,14 +557,15 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data) struct ixgbe_adapter *adapter = rxr->adapter; IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value); - netif_rx_schedule(adapter->netdev); + netif_rx_schedule(adapter->netdev, &adapter->napi); return IRQ_HANDLED; } -static int ixgbe_clean_rxonly(struct net_device *netdev, int *budget) +static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget) { - struct ixgbe_adapter *adapter = netdev_priv(netdev); - int work_to_do = min(*budget, netdev->quota); + struct ixgbe_adapter *adapter = container_of(napi, + struct ixgbe_adapter, napi); + struct net_device *netdev = adapter->netdev; int work_done = 0; struct ixgbe_ring *rxr = adapter->rx_ring; @@ -572,22 +573,18 @@ static int ixgbe_clean_rxonly(struct net_device *netdev, int *budget) if (!netif_carrier_ok(netdev)) goto quit_polling; - ixgbe_clean_rx_irq(adapter, rxr, &work_done, work_to_do); - - *budget -= work_done; - netdev->quota -= work_done; + ixgbe_clean_rx_irq(adapter, rxr, &work_done, budget); /* If no Tx and not enough Rx work done, exit the polling mode */ - if ((work_done == 0) || !netif_running(netdev)) { + if ((work_done < budget) || !netif_running(netdev)) { quit_polling: - netif_rx_complete(netdev); + netif_rx_complete(netdev, napi); if (!test_bit(__IXGBE_DOWN, &adapter->state)) IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rxr->eims_value); - return 0; } - return 1; + return work_done; } /** @@ -669,7 +666,8 @@ static int ixgbe_setup_msix(struct ixgbe_adapter *adapter) goto release_irqs; } - adapter->netdev->poll = ixgbe_clean_rxonly; + /* FIXME: implement netif_napi_remove() instead */ + adapter->napi.poll = ixgbe_clean_rxonly; adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; return 0; @@ -713,12 +711,12 @@ static irqreturn_t ixgbe_intr(int irq, void *data) if (!test_bit(__IXGBE_DOWN, &adapter->state)) mod_timer(&adapter->watchdog_timer, jiffies); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { /* Disable interrupts and register for poll. The flush of the * posted write is intentionally left out. */ atomic_inc(&adapter->irq_sem); IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0); - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } return IRQ_HANDLED; @@ -1218,7 +1216,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) ixgbe_configure_msi_and_legacy(adapter); clear_bit(__IXGBE_DOWN, &adapter->state); - netif_poll_enable(netdev); + napi_enable(&adapter->napi); ixgbe_irq_enable(adapter); /* bring the link up in the watchdog, this could race with our first @@ -1412,7 +1410,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter) ixgbe_irq_disable(adapter); - netif_poll_disable(netdev); + napi_disable(&adapter->napi); del_timer_sync(&adapter->watchdog_timer); netif_carrier_off(netdev); @@ -1464,11 +1462,12 @@ static void ixgbe_shutdown(struct pci_dev *pdev) * ixgbe_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int ixgbe_clean(struct net_device *netdev, int *budget) +static int ixgbe_clean(struct napi_struct *napi, int budget) { - struct ixgbe_adapter *adapter = netdev_priv(netdev); - int work_to_do = min(*budget, netdev->quota); - int tx_cleaned, work_done = 0; +
[PATCH] e1000e: Do not allow requeue of freed skb
From: Krishna Kumar <[EMAIL PROTECTED]> Returning BUSY will make qdisc_restart enqueue the skb which was already freed. The bad skb was correctly freed and we should return NETDEV_TX_OK. First spotted by Jeff Garzik on 08/13/07. Signed-off-by: Krishna Kumar <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 372da46..03f7472 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -3537,7 +3537,7 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) /* handle pci_map_single() error in e1000_tx_map */ dev_kfree_skb_any(skb); spin_unlock_irqrestore(&adapter->tx_queue_lock, irq_flags); - return NETDEV_TX_BUSY; + return NETDEV_TX_OK; } e1000_tx_queue(adapter, tx_flags, count); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ethtool: Add e1000e reg dump support (using e1000 decode function)
The e1000 register dump code can print out e1000e register dump information as well, so enable it for e1000e devices. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/ethtool.c b/ethtool.c index 651529e..6c7a2e3 100644 --- a/ethtool.c +++ b/ethtool.c @@ -1003,6 +1003,7 @@ static struct { { "r8169", realtek_dump_regs }, { "de2104x", de2104x_dump_regs }, { "e1000", e1000_dump_regs }, + { "e1000e", e1000_dump_regs }, { "igb", igb_dump_regs }, { "ixgb", ixgb_dump_regs }, { "ixgbe", ixgbe_dump_regs }, - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000e: fix debugging printout code
A small bug crawled in the -DDEBUG enabled code. Fix this to properly call the backreference device name. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/hw.h |2 +- drivers/net/e1000e/netdev.c |4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 848217a..aa82f1a 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h @@ -852,7 +852,7 @@ struct e1000_hw { #ifdef DEBUG #define hw_dbg(hw, format, arg...) \ - printk(KERN_DEBUG, "%s: " format, e1000_get_hw_dev_name(hw), ##arg); + printk(KERN_DEBUG, "%s: " format, e1000e_get_hw_dev_name(hw), ##arg); #else static inline int __attribute__ ((format (printf, 2, 3))) hw_dbg(struct e1000_hw *hw, const char *format, ...) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 4a21d7d..3a0bb2a 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -66,9 +66,7 @@ static const struct e1000_info *e1000_info_tbl[] = { **/ char *e1000e_get_hw_dev_name(struct e1000_hw *hw) { - struct e1000_adapter *adapter = hw->back; - struct net_device *netdev = adapter->netdev; - return netdev->name; + return hw->adapter->netdev->name; } #endif - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000e: Fix ethtool register test code
A merge/cleanup code accidentally dropped 8254x code in and removed 8257x code here. Undo this mistake and use the pci-e relevant register test similar as to what is in e1000. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 3423f33..2e8218f 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -784,10 +784,16 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) REG_SET_AND_CHECK(E1000_RCTL, before, 0x003B); REG_SET_AND_CHECK(E1000_TCTL, 0x, 0x); - REG_SET_AND_CHECK(E1000_RCTL, 0x, 0x01FF); - REG_PATTERN_TEST(E1000_RDBAL, 0xF000, 0x); - REG_PATTERN_TEST(E1000_TXCW, 0x, 0x); - REG_PATTERN_TEST(E1000_TDBAL, 0xF000, 0x); + REG_SET_AND_CHECK(E1000_RCTL, before, 0x); + REG_PATTERN_TEST(E1000_RDBAL, 0xFFF0, 0x); + if ((mac->type != e1000_ich8lan) && + (mac->type != e1000_ich9lan)) + REG_PATTERN_TEST(E1000_TXCW, 0xC000, 0x); + REG_PATTERN_TEST(E1000_TDBAL, 0xFFF0, 0x); + REG_PATTERN_TEST(E1000_TIDV, 0x, 0x); + for (i = 0; i < mac->rar_entry_count; i++) + REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), + 0x8003, 0x); for (i = 0; i < mac->mta_reg_count; i++) REG_PATTERN_TEST_ARRAY(E1000_MTA, i, 0x, 0x); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] e1000: Simple optimizations in e1000_xmit_frame
From: Krishna Kumar <[EMAIL PROTECTED]> Some simple optimizations in e1000_xmit_frame. Signed-off-by: Krishna Kumar <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 10505de..0472638 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -3261,14 +3261,13 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; unsigned int tx_flags = 0; - unsigned int len = skb->len; + unsigned int len = skb->len - skb->data_len; unsigned long flags; - unsigned int nr_frags = 0; - unsigned int mss = 0; + unsigned int nr_frags; + unsigned int mss; int count = 0; int tso; unsigned int f; - len -= skb->data_len; /* This goes back to the question of how to logically map a tx queue * to a flow. Right now, performance is impacted slightly negatively @@ -3302,7 +3301,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) * points to just header, pull a few bytes of payload from * frags into skb->data */ hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); - if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { + if (skb->data_len && hdr_len == len) { switch (adapter->hw.mac_type) { unsigned int pull_size; case e1000_82544: - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] e1000e: Simple optimizations in e1000_xmit_frame
After an e1000 patch from Krishna Kumar <[EMAIL PROTECTED]>. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 71c9fed..033e124 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -3424,14 +3424,13 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) unsigned int max_per_txd = E1000_MAX_PER_TXD; unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; unsigned int tx_flags = 0; - unsigned int len = skb->len; + unsigned int len = skb->len - skb->data_len; unsigned long irq_flags; - unsigned int nr_frags = 0; - unsigned int mss = 0; + unsigned int nr_frags; + unsigned int mss; int count = 0; int tso; unsigned int f; - len -= skb->data_len; if (test_bit(__E1000_DOWN, &adapter->state)) { dev_kfree_skb_any(skb); @@ -3459,7 +3458,7 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) * points to just header, pull a few bytes of payload from * frags into skb->data */ hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); - if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { + if (skb->data_len && (hdr_len == len)) { unsigned int pull_size; pull_size = min((unsigned int)4, skb->data_len); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000e: restore flow control settings properly
After a cable unplug the forced flow control settings were lost accidentally and the flow control settings fell back to the default EEPROM determined values. This breaks for people who want to run without fc enabled - after a cable reset the driver would refuse to run with fc disabled. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c |1 + drivers/net/e1000e/lib.c | 12 +--- drivers/net/e1000e/netdev.c |1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 2e8218f..b7a7e2a 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -301,6 +301,7 @@ static int e1000_set_pauseparam(struct net_device *netdev, hw->mac.original_fc = hw->mac.fc; if (adapter->fc_autoneg == AUTONEG_ENABLE) { + hw->mac.fc = e1000_fc_default; if (netif_running(adapter->netdev)) { e1000e_down(adapter); e1000e_up(adapter); diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 3bbfe60..0bdeca3 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c @@ -639,9 +639,15 @@ s32 e1000e_setup_link(struct e1000_hw *hw) if (e1000_check_reset_block(hw)) return 0; - ret_val = e1000_set_default_fc_generic(hw); - if (ret_val) - return ret_val; + /* +* If flow control is set to default, set flow control based on +* the EEPROM flow control settings. +*/ + if (mac->fc == e1000_fc_default) { + ret_val = e1000_set_default_fc_generic(hw); + if (ret_val) + return ret_val; + } /* We want to save off the original Flow Control configuration just * in case we get disconnected and then reconnected into a different diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 3a0bb2a..71c9fed 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -4196,6 +4196,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, /* Initialize link parameters. User can change them with ethtool */ adapter->hw.mac.autoneg = 1; + adapter->fc_autoneg = 1; adapter->hw.mac.original_fc = e1000_fc_default; adapter->hw.mac.fc = e1000_fc_default; adapter->hw.phy.autoneg_advertised = 0x2f; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Seved Torstendahl <[EMAIL PROTECTED]> suggested to
From: Jesse Brandeburg <[EMAIL PROTECTED]> let the module parameter for invalid eeprom checksum control the valid mac address test. If this bypass happens we should print a different message, or at least one that is correct, maybe something like below Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 1dd1a22..7d9984a 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2597,11 +2597,16 @@ static int __devinit e100_probe(struct pci_dev *pdev, memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN); memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN); - if(!is_valid_ether_addr(netdev->perm_addr)) { - DPRINTK(PROBE, ERR, "Invalid MAC address from " - "EEPROM, aborting.\n"); - err = -EAGAIN; - goto err_out_free; + if (!is_valid_ether_addr(netdev->perm_addr)) { + if (!eeprom_bad_csum_allow) { + DPRINTK(PROBE, ERR, "Invalid MAC address from " + "EEPROM, aborting.\n"); + err = -EAGAIN; + goto err_out_free; + } else { + DPRINTK(PROBE, ERR, "Invalid MAC address from EEPROM, " + "you MUST configure one.\n"); + } } /* Wol magic packet can be enabled from eeprom */ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] It appears that some systems still like e100 better if it uses
From: Jesse Brandeburg <[EMAIL PROTECTED]> I/O access mode. Setting the new parameter use_io=1 will cause all driver instances to use io mapping to access the register space on the e100 device. Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e100.c | 72 1 files changed, 39 insertions(+), 33 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 7d9984a..7ca207c 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -159,7 +159,7 @@ #define DRV_NAME "e100" #define DRV_EXT"-NAPI" -#define DRV_VERSION"3.5.17-k2"DRV_EXT +#define DRV_VERSION"3.5.17-k4"DRV_EXT #define DRV_DESCRIPTION"Intel(R) PRO/100 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" #define PFXDRV_NAME ": " @@ -174,10 +174,13 @@ MODULE_VERSION(DRV_VERSION); static int debug = 3; static int eeprom_bad_csum_allow = 0; +static int use_io = 0; module_param(debug, int, 0); module_param(eeprom_bad_csum_allow, int, 0); +module_param(use_io, int, 0); MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums"); +MODULE_PARM_DESC(use_io, "Force use of i/o access mode"); #define DPRINTK(nlevel, klevel, fmt, args...) \ (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \ printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \ @@ -584,7 +587,7 @@ static inline void e100_write_flush(struct nic *nic) { /* Flush previous PCI writes through intermediate bridges * by doing a benign read */ - (void)readb(&nic->csr->scb.status); + (void)ioread8(&nic->csr->scb.status); } static void e100_enable_irq(struct nic *nic) @@ -592,7 +595,7 @@ static void e100_enable_irq(struct nic *nic) unsigned long flags; spin_lock_irqsave(&nic->cmd_lock, flags); - writeb(irq_mask_none, &nic->csr->scb.cmd_hi); + iowrite8(irq_mask_none, &nic->csr->scb.cmd_hi); e100_write_flush(nic); spin_unlock_irqrestore(&nic->cmd_lock, flags); } @@ -602,7 +605,7 @@ static void e100_disable_irq(struct nic *nic) unsigned long flags; spin_lock_irqsave(&nic->cmd_lock, flags); - writeb(irq_mask_all, &nic->csr->scb.cmd_hi); + iowrite8(irq_mask_all, &nic->csr->scb.cmd_hi); e100_write_flush(nic); spin_unlock_irqrestore(&nic->cmd_lock, flags); } @@ -611,11 +614,11 @@ static void e100_hw_reset(struct nic *nic) { /* Put CU and RU into idle with a selective reset to get * device off of PCI bus */ - writel(selective_reset, &nic->csr->port); + iowrite32(selective_reset, &nic->csr->port); e100_write_flush(nic); udelay(20); /* Now fully reset device */ - writel(software_reset, &nic->csr->port); + iowrite32(software_reset, &nic->csr->port); e100_write_flush(nic); udelay(20); /* Mask off our interrupt line - it's unmasked after reset */ @@ -632,7 +635,7 @@ static int e100_self_test(struct nic *nic) nic->mem->selftest.signature = 0; nic->mem->selftest.result = 0x; - writel(selftest | dma_addr, &nic->csr->port); + iowrite32(selftest | dma_addr, &nic->csr->port); e100_write_flush(nic); /* Wait 10 msec for self-test to complete */ msleep(10); @@ -670,23 +673,23 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data) for(j = 0; j < 3; j++) { /* Chip select */ - writeb(eecs | eesk, &nic->csr->eeprom_ctrl_lo); + iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); for(i = 31; i >= 0; i--) { ctrl = (cmd_addr_data[j] & (1 << i)) ? eecs | eedi : eecs; - writeb(ctrl, &nic->csr->eeprom_ctrl_lo); + iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); - writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo); + iowrite8(ctrl | eesk, &nic->csr->eeprom_ctrl_lo); e100_write_flush(nic); udelay(4); } /* Wait 10 msec for cmd to complete */ msleep(10); /* Chip deselect */ - write
[PATCH 1/2] e1000: ROUND_UP macro cleanup in drivers/net/e1000
From: Milind Arun Choudhary <[EMAIL PROTECTED]> E1000_ROUNDUP macro cleanup, use ALIGN Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000.h |3 --- drivers/net/e1000/e1000_ethtool.c |6 +++--- drivers/net/e1000/e1000_main.c| 10 +- drivers/net/e1000/e1000_param.c |4 ++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index dd4b728..a9ea67e 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -155,9 +155,6 @@ struct e1000_adapter; /* Number of packet split data buffers (not including the header buffer) */ #define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1 -/* only works for sizes that are powers of 2 */ -#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1))) - /* wrapper around a pointer to a socket buffer, * so a DMA handle can be stored along with the buffer */ struct e1000_buffer { diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 6777887..0fbd873 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -686,12 +686,12 @@ e1000_set_ringparam(struct net_device *netdev, rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD)); - E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); + rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD); txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD)); - E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); + txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); for (i = 0; i < adapter->num_tx_queues; i++) txdr[i].count = txdr->count; @@ -1068,7 +1068,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) memset(txdr->buffer_info, 0, size); txdr->size = txdr->count * sizeof(struct e1000_tx_desc); - E1000_ROUNDUP(txdr->size, 4096); + txdr->size = ALIGN(txdr->size, 4096); if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) { ret_val = 2; goto err_nomem; diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 9267f16..b9ff21f 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -748,9 +748,9 @@ e1000_reset(struct e1000_adapter *adapter) VLAN_TAG_SIZE; min_tx_space = min_rx_space; min_tx_space *= 2; - E1000_ROUNDUP(min_tx_space, 1024); + min_tx_space = ALIGN(min_tx_space, 1024); min_tx_space >>= 10; - E1000_ROUNDUP(min_rx_space, 1024); + min_rx_space = ALIGN(min_rx_space, 1024); min_rx_space >>= 10; /* If current Tx allocation is less than the min Tx FIFO size, @@ -1560,7 +1560,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter, /* round up to nearest 4K */ txdr->size = txdr->count * sizeof(struct e1000_tx_desc); - E1000_ROUNDUP(txdr->size, 4096); + txdr->size = ALIGN(txdr->size, 4096); txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); if (!txdr->desc) { @@ -1803,7 +1803,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter, /* Round up to nearest 4K */ rxdr->size = rxdr->count * desc_len; - E1000_ROUNDUP(rxdr->size, 4096); + rxdr->size = ALIGN(rxdr->size, 4096); rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); @@ -3175,7 +3175,7 @@ e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb) uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR; - E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR); + skb_fifo_len = ALIGN(skb_fifo_len, E1000_FIFO_HDR); if (adapter->link_duplex != HALF_DUPLEX) goto no_fifo_stall_required; diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index f8862e2..f485874 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c @@ -305,7 +305,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_TxDescriptors > bd) { tx_ring->count = TxDescriptors[bd]; e1000_validate_option(&tx_ring->count, &
[PATCH 2/2] ixgb: ROUND_UP macro cleanup in drivers/net/ixgb
From: Milind Arun Choudhary <[EMAIL PROTECTED]> IXGB_ROUNDUP macro cleanup ,use ALIGN Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/ixgb/ixgb.h |3 --- drivers/net/ixgb/ixgb_ethtool.c |4 ++-- drivers/net/ixgb/ixgb_main.c|4 ++-- drivers/net/ixgb/ixgb_param.c |4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h index cf30a10..c8e9086 100644 --- a/drivers/net/ixgb/ixgb.h +++ b/drivers/net/ixgb/ixgb.h @@ -111,9 +111,6 @@ struct ixgb_adapter; /* How many Rx Buffers do we bundle into one write to the hardware ? */ #define IXGB_RX_BUFFER_WRITE 8 /* Must be power of 2 */ -/* only works for sizes that are powers of 2 */ -#define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1))) - /* wrapper around a pointer to a socket buffer, * so a DMA handle can be stored along with the buffer */ struct ixgb_buffer { diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c index d6628bd..afde848 100644 --- a/drivers/net/ixgb/ixgb_ethtool.c +++ b/drivers/net/ixgb/ixgb_ethtool.c @@ -577,11 +577,11 @@ ixgb_set_ringparam(struct net_device *netdev, rxdr->count = max(ring->rx_pending,(uint32_t)MIN_RXD); rxdr->count = min(rxdr->count,(uint32_t)MAX_RXD); - IXGB_ROUNDUP(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); + rxdr->count = ALIGN(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); txdr->count = max(ring->tx_pending,(uint32_t)MIN_TXD); txdr->count = min(txdr->count,(uint32_t)MAX_TXD); - IXGB_ROUNDUP(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); + txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); if(netif_running(adapter->netdev)) { /* Try to get new resources before deleting old */ diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index dfde80e..6d2b059 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c @@ -685,7 +685,7 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter) /* round up to nearest 4K */ txdr->size = txdr->count * sizeof(struct ixgb_tx_desc); - IXGB_ROUNDUP(txdr->size, 4096); + txdr->size = ALIGN(txdr->size, 4096); txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); if(!txdr->desc) { @@ -774,7 +774,7 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter) /* Round up to nearest 4K */ rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc); - IXGB_ROUNDUP(rxdr->size, 4096); + rxdr->size = ALIGN(rxdr->size, 4096); rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c index b27442a..ee8cc67 100644 --- a/drivers/net/ixgb/ixgb_param.c +++ b/drivers/net/ixgb/ixgb_param.c @@ -284,7 +284,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) } else { tx_ring->count = opt.def; } - IXGB_ROUNDUP(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); + tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); } { /* Receive Descriptor Count */ struct ixgb_option opt = { @@ -303,7 +303,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) } else { rx_ring->count = opt.def; } - IXGB_ROUNDUP(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); + rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); } { /* Receive Checksum Offload Enable */ struct ixgb_option opt = { - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [NET] Add constant for FCS/CRC length (frame check sequence)
From: Auke Kok <[EMAIL PROTECTED]> About a dozen drivers that have some form of crc checksumming or offloading use this constant, warranting a global define for it. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/if_ether.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 1db774c..3213f6f 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -33,6 +33,7 @@ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500/* Max. octets in payload*/ #define ETH_FRAME_LEN 1514/* Max. octets in frame sans FCS */ +#define ETH_FCS_LEN4 /* Octets in the FCS */ /* * These are the defined Ethernet Protocol ID's. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Fix msi enable leak on error, don't print error message, cleanup
pci_enable_msi failure is a normal event so we should not print any error. Going over the code I spotted a missing pci_disable_msi() leak when irq allocation fails. The whole code also needed a cleanup, so I combined the two different calls to pci_request_irq into a single call making this look a lot better. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: H. Peter Anvin <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 32 +++- 1 files changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 637ae8f..b2c5b8e 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -300,31 +300,29 @@ module_exit(e1000_exit_module); static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter->netdev; - int flags, err = 0; + void (*handler) = &e1000_intr; + int irq_flags = IRQF_SHARED; + int err; - flags = IRQF_SHARED; #ifdef CONFIG_PCI_MSI if (adapter->hw.mac_type >= e1000_82571) { - adapter->have_msi = TRUE; - if ((err = pci_enable_msi(adapter->pdev))) { - DPRINTK(PROBE, ERR, -"Unable to allocate MSI interrupt Error: %d\n", err); - adapter->have_msi = FALSE; + adapter->have_msi = !pci_enable_msi(adapter->pdev); + if (adapter->have_msi) { + handler = &e1000_intr_msi; + irq_flags = 0; } } - if (adapter->have_msi) { - flags &= ~IRQF_SHARED; - err = request_irq(adapter->pdev->irq, &e1000_intr_msi, flags, - netdev->name, netdev); - if (err) - DPRINTK(PROBE, ERR, - "Unable to allocate interrupt Error: %d\n", err); - } else #endif - if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags, - netdev->name, netdev))) + err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, + netdev); + if (err) { +#ifdef CONFIG_PCI_MSI + if (adapter->have_msi) + pci_disable_msi(adapter->pdev); +#endif DPRINTK(PROBE, ERR, "Unable to allocate interrupt Error: %d\n", err); + } return err; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Fix msi enable leak on error, don't print error message, cleanup
pci_enable_msi failure is a normal event so we should not print any error. Going over the code I spotted a missing pci_disable_msi() leak when irq allocation fails. The whole code also needed a cleanup, so I combined the two different calls to pci_request_irq into a single call making this look a lot better. All #ifdef CONFIG_PCI_MSI's have been removed. Compile tested with both CONFIG_PCI_MSI enabled and disabled. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: H. Peter Anvin <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000.h |4 +--- drivers/net/e1000/e1000_main.c | 39 ++- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index a9ea67e..16a6edf 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -333,11 +333,9 @@ struct e1000_adapter { struct e1000_tx_ring test_tx_ring; struct e1000_rx_ring test_rx_ring; - int msg_enable; -#ifdef CONFIG_PCI_MSI boolean_t have_msi; -#endif + /* to not mess up cache alignment, always add to the bottom */ boolean_t tso_force; boolean_t smart_power_down; /* phy smart power down */ diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 637ae8f..49be393 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -158,9 +158,7 @@ static struct net_device_stats * e1000_get_stats(struct net_device *netdev); static int e1000_change_mtu(struct net_device *netdev, int new_mtu); static int e1000_set_mac(struct net_device *netdev, void *p); static irqreturn_t e1000_intr(int irq, void *data); -#ifdef CONFIG_PCI_MSI static irqreturn_t e1000_intr_msi(int irq, void *data); -#endif static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring); #ifdef CONFIG_E1000_NAPI @@ -300,31 +298,26 @@ module_exit(e1000_exit_module); static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter->netdev; - int flags, err = 0; + void (*handler) = &e1000_intr; + int irq_flags = IRQF_SHARED; + int err; - flags = IRQF_SHARED; -#ifdef CONFIG_PCI_MSI if (adapter->hw.mac_type >= e1000_82571) { - adapter->have_msi = TRUE; - if ((err = pci_enable_msi(adapter->pdev))) { - DPRINTK(PROBE, ERR, -"Unable to allocate MSI interrupt Error: %d\n", err); - adapter->have_msi = FALSE; + adapter->have_msi = !pci_enable_msi(adapter->pdev); + if (adapter->have_msi) { + handler = &e1000_intr_msi; + irq_flags = 0; } } - if (adapter->have_msi) { - flags &= ~IRQF_SHARED; - err = request_irq(adapter->pdev->irq, &e1000_intr_msi, flags, - netdev->name, netdev); - if (err) - DPRINTK(PROBE, ERR, - "Unable to allocate interrupt Error: %d\n", err); - } else -#endif - if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags, - netdev->name, netdev))) + + err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, + netdev); + if (err) { + if (adapter->have_msi) + pci_disable_msi(adapter->pdev); DPRINTK(PROBE, ERR, "Unable to allocate interrupt Error: %d\n", err); + } return err; } @@ -335,10 +328,8 @@ static void e1000_free_irq(struct e1000_adapter *adapter) free_irq(adapter->pdev->irq, netdev); -#ifdef CONFIG_PCI_MSI if (adapter->have_msi) pci_disable_msi(adapter->pdev); -#endif } /** @@ -3744,7 +3735,6 @@ e1000_update_stats(struct e1000_adapter *adapter) spin_unlock_irqrestore(&adapter->stats_lock, flags); } -#ifdef CONFIG_PCI_MSI /** * e1000_intr_msi - Interrupt Handler @@ -3810,7 +3800,6 @@ e1000_intr_msi(int irq, void *data) return IRQ_HANDLED; } -#endif /** * e1000_intr - Interrupt Handler - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Work around 82571 completion timout on Pseries HW
Our 82571 (first PCI-E hardware) causes P-Series hardware to throw issues. Disabling PCI-E completion timeouts in our NIC resolves the issue. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: Wen Xiong <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 49be393..830d851 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -819,6 +819,16 @@ e1000_reset(struct e1000_adapter *adapter) E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); } +#if defined(CONFIG_PPC64) || defined(CONFIG_PPC) +#define E1000_GCR_DISABLE_TIMEOUT_MECHANISM 0x8000 + if (adapter->hw.mac.type == e1000_82571) { + /* work around pSeries hardware by disabling timeouts */ + u32 gcr = E1000_READ_REG(&adapter->hw, E1000_GCR); + gcr |= E1000_GCR_DISABLE_TIMEOUT_MECHANISM; + E1000_WRITE_REG(&adapter->hw, E1000_GCR, gcr); + } +#endif + /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak
From: Auke Kok <[EMAIL PROTECTED]> pci_enable_msi calls can fail for normal operational reasons. Driver should not print an error message in that case. Fix a leak that leaves msi enabled if pci_request_irq fails. We can remove CONFIG_PCI_MSI ifdefs alltogether Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/ixgb/ixgb.h |2 -- drivers/net/ixgb/ixgb_main.c | 36 +++- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h index c8e9086..3569d5b 100644 --- a/drivers/net/ixgb/ixgb.h +++ b/drivers/net/ixgb/ixgb.h @@ -193,8 +193,6 @@ struct ixgb_adapter { u16 msg_enable; struct ixgb_hw_stats stats; uint32_t alloc_rx_buff_failed; -#ifdef CONFIG_PCI_MSI boolean_t have_msi; -#endif }; #endif /* _IXGB_H_ */ diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 6d2b059..991c883 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c @@ -227,7 +227,7 @@ int ixgb_up(struct ixgb_adapter *adapter) { struct net_device *netdev = adapter->netdev; - int err; + int err, irq_flags = IRQF_SHARED; int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; struct ixgb_hw *hw = &adapter->hw; @@ -246,26 +246,21 @@ ixgb_up(struct ixgb_adapter *adapter) /* disable interrupts and get the hardware into a known state */ IXGB_WRITE_REG(&adapter->hw, IMC, 0x); -#ifdef CONFIG_PCI_MSI - { - boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) & - IXGB_STATUS_PCIX_MODE) ? TRUE : FALSE; - adapter->have_msi = TRUE; - - if (!pcix) - adapter->have_msi = FALSE; - else if((err = pci_enable_msi(adapter->pdev))) { - DPRINTK(PROBE, ERR, -"Unable to allocate MSI interrupt Error: %d\n", err); - adapter->have_msi = FALSE; + /* only enable MSI if bus is in PCI-X mode */ + if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) { + err = pci_enable_msi(adapter->pdev); + if (!err) { + adapter->have_msi = 1; + irq_flags = 0; + } /* proceed to try to request regular interrupt */ } - } -#endif - if((err = request_irq(adapter->pdev->irq, &ixgb_intr, - IRQF_SHARED | IRQF_SAMPLE_RANDOM, - netdev->name, netdev))) { + err = request_irq(adapter->pdev->irq, &ixgb_intr, irq_flags, + netdev->name, netdev); + if (err) { + if (adapter->have_msi) + pci_disable_msi(adapter->pdev); DPRINTK(PROBE, ERR, "Unable to allocate interrupt Error: %d\n", err); return err; @@ -307,11 +302,10 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) ixgb_irq_disable(adapter); free_irq(adapter->pdev->irq, netdev); -#ifdef CONFIG_PCI_MSI - if(adapter->have_msi == TRUE) + + if (adapter->have_msi) pci_disable_msi(adapter->pdev); -#endif if(kill_watchdog) del_timer_sync(&adapter->watchdog_timer); #ifdef CONFIG_IXGB_NAPI - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Don't enable polling in open() (was: e1000: assertion hit in e1000_clean(), kernel 2.6.21.1)
Herbert Xy wrote: "netif_poll_enable can only be called if you've previously called netif_poll_disable. Otherwise a poll might already be in action and you may get a crash like this." Removing the call to netif_poll_enable in e1000_open should fix this issue, the only other call to netif_poll_enable is in e1000_up() which is only reached after a device reset or resume. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: Herbert Xu <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 49be393..cbc7feb 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -1431,10 +1431,6 @@ e1000_open(struct net_device *netdev) /* From here on the code is the same as e1000_up() */ clear_bit(__E1000_DOWN, &adapter->flags); -#ifdef CONFIG_E1000_NAPI - netif_poll_enable(netdev); -#endif - e1000_irq_enable(adapter); /* fire a link status change interrupt to start the watchdog */ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000: Don't enable polling in open() (was: e1000: assertion hit in e1000_clean(), kernel 2.6.21.1)
Herbert Xu wrote: "netif_poll_enable can only be called if you've previously called netif_poll_disable. Otherwise a poll might already be in action and you may get a crash like this." Removing the call to netif_poll_enable in e1000_open should fix this issue, the only other call to netif_poll_enable is in e1000_up() which is only reached after a device reset or resume. Bugzilla: http://bugzilla.kernel.org/show_bug.cgi?id=8455 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=240339 Tested by Doug Chapman <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Acked-by: Herbert Xu <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_main.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 49be393..cbc7feb 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -1431,10 +1431,6 @@ e1000_open(struct net_device *netdev) /* From here on the code is the same as e1000_up() */ clear_bit(__E1000_DOWN, &adapter->flags); -#ifdef CONFIG_E1000_NAPI - netif_poll_enable(netdev); -#endif - e1000_irq_enable(adapter); /* fire a link status change interrupt to start the watchdog */ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [NET] ethtool: Add LRO support
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/ethtool.h |8 +++ include/linux/netdevice.h |1 + net/core/ethtool.c| 54 - 3 files changed, 62 insertions(+), 1 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 3a63224..ab9d688 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -274,6 +274,8 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data); u32 ethtool_op_get_ufo(struct net_device *dev); int ethtool_op_set_ufo(struct net_device *dev, u32 data); +u32 ethtool_op_get_lro(struct net_device *dev); +int ethtool_op_set_lro(struct net_device *dev, u32 data); /** * ðtool_ops - Alter and report network device settings @@ -305,6 +307,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data); * set_tso: Turn TCP segmentation offload on or off * get_ufo: Report whether UDP fragmentation offload is enabled * set_ufo: Turn UDP fragmentation offload on or off + * get_lro: Report whether large receive offload is enabled + * set_lro: Turn large receive offload on or off * self_test: Run specified self-tests * get_strings: Return a set of strings that describe the requested objects * phys_id: Identify the device @@ -373,6 +377,8 @@ struct ethtool_ops { void(*complete)(struct net_device *); u32 (*get_ufo)(struct net_device *); int (*set_ufo)(struct net_device *, u32); + u32 (*get_lro)(struct net_device *); + int (*set_lro)(struct net_device *, u32); }; #endif /* __KERNEL__ */ @@ -414,6 +420,8 @@ struct ethtool_ops { #define ETHTOOL_SUFO 0x0022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x0023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x0024 /* Set GSO enable (ethtool_value) */ +#define ETHTOOL_GLRO 0x0025 /* Get LRO enable (ethtool_value) */ +#define ETHTOOL_SLRO 0x0026 /* Set LRO enable (ethtool_value) */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4a616d7..4863ffc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -341,6 +341,7 @@ struct net_device #define NETIF_F_GSO2048/* Enable software GSO. */ #define NETIF_F_LLTX 4096/* LockLess TX */ #define NETIF_F_MULTI_QUEUE16384 /* Has multiple TX/RX queues */ +#define NETIF_F_LRO32768 /* Has large receive offload */ /* Segmentation offload features */ #define NETIF_F_GSO_SHIFT 16 diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 0b531e9..23ccaa1 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -104,7 +104,6 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a return 0; } - u32 ethtool_op_get_ufo(struct net_device *dev) { return (dev->features & NETIF_F_UFO) != 0; @@ -119,6 +118,20 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data) return 0; } +u32 ethtool_op_get_lro(struct net_device *dev) +{ + return (dev->features & NETIF_F_LRO) != 0; +} + +int ethtool_op_set_lro(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_LRO; + else + dev->features &= ~NETIF_F_LRO; + return 0; +} + /* Handlers for each ethtool command */ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) @@ -514,6 +527,13 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data) if (err) return err; } + + if (!data && dev->ethtool_ops->set_lro) { + err = dev->ethtool_ops->set_lro(dev, 0); + if (err) + return err; + } + return dev->ethtool_ops->set_sg(dev, data); } @@ -625,6 +645,29 @@ static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr) return dev->ethtool_ops->set_ufo(dev, edata.data); } +static int ethtool_get_lro(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GLRO }; + + edata.data = dev->features & NETIF_F_LRO; + if (copy_to_user(useraddr, &edata, sizeof(edata))) +return -EFAULT; + return 0; +} + +static int ethtool_set_lro(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + if (edata.data) + dev->features |= NETIF_F_LRO; + else + dev->features &= ~NETIF_F_LRO; + return 0; +} + static int ethtool_get_gso(struct net_dev
[PATCH] ethtool: Add LRO support
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool-copy.h |8 ethtool.8 |8 ++-- ethtool.c | 39 +-- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/ethtool-copy.h b/ethtool-copy.h index 3a63224..ab9d688 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -274,6 +274,8 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data); u32 ethtool_op_get_ufo(struct net_device *dev); int ethtool_op_set_ufo(struct net_device *dev, u32 data); +u32 ethtool_op_get_lro(struct net_device *dev); +int ethtool_op_set_lro(struct net_device *dev, u32 data); /** * ðtool_ops - Alter and report network device settings @@ -305,6 +307,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data); * set_tso: Turn TCP segmentation offload on or off * get_ufo: Report whether UDP fragmentation offload is enabled * set_ufo: Turn UDP fragmentation offload on or off + * get_lro: Report whether large receive offload is enabled + * set_lro: Turn large receive offload on or off * self_test: Run specified self-tests * get_strings: Return a set of strings that describe the requested objects * phys_id: Identify the device @@ -373,6 +377,8 @@ struct ethtool_ops { void(*complete)(struct net_device *); u32 (*get_ufo)(struct net_device *); int (*set_ufo)(struct net_device *, u32); + u32 (*get_lro)(struct net_device *); + int (*set_lro)(struct net_device *, u32); }; #endif /* __KERNEL__ */ @@ -414,6 +420,8 @@ struct ethtool_ops { #define ETHTOOL_SUFO 0x0022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x0023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x0024 /* Set GSO enable (ethtool_value) */ +#define ETHTOOL_GLRO 0x0025 /* Get LRO enable (ethtool_value) */ +#define ETHTOOL_SLRO 0x0026 /* Set LRO enable (ethtool_value) */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/ethtool.8 b/ethtool.8 index af51056..89abf08 100644 --- a/ethtool.8 +++ b/ethtool.8 @@ -158,6 +158,7 @@ ethtool \- Display or change ethernet card settings .B2 tso on off .B2 ufo on off .B2 gso on off +.B2 lro on off .B ethtool \-p|\-\-blink .I ethX @@ -289,10 +290,13 @@ Specifies whether scatter-gather should be enabled. Specifies whether TCP segmentation offload should be enabled. .TP .A2 ufo on off -Specifies whether UDP fragmentation offload should be enabled +Specifies whether UDP fragmentation offload should be enabled. .TP .A2 gso on off -Specifies whether generic segmentation offload should be enabled +Specifies whether generic segmentation offload should be enabled. +.TP +.A2 lro on off +Specifies whether large receive offload should be enabled. .TP .B \-p \-\-identify Initiates adapter-specific action intended to enable an operator to diff --git a/ethtool.c b/ethtool.c index b04f747..4c9844a 100644 --- a/ethtool.c +++ b/ethtool.c @@ -151,7 +151,8 @@ static struct option { " [ sg on|off ]\n" " [ tso on|off ]\n" " [ ufo on|off ]\n" - " [ gso on|off ]\n" }, + " [ gso on|off ]\n" + " [ lro on|off ]\n" }, { "-i", "--driver", MODE_GDRV, "Show driver information" }, { "-d", "--register-dump", MODE_GREGS, "Do a register dump", " [ raw on|off ]\n" @@ -200,6 +201,7 @@ static int off_sg_wanted = -1; static int off_tso_wanted = -1; static int off_ufo_wanted = -1; static int off_gso_wanted = -1; +static int off_lro_wanted = -1; static struct ethtool_pauseparam epause; static int gpause_changed = 0; @@ -310,6 +312,7 @@ static struct cmdline_info cmdline_offload[] = { { "tso", CMDL_BOOL, &off_tso_wanted, NULL }, { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL }, { "gso", CMDL_BOOL, &off_gso_wanted, NULL }, + { "lro", CMDL_BOOL, &off_lro_wanted, NULL }, }; static struct cmdline_info cmdline_pause[] = { @@ -1207,7 +1210,7 @@ static int dump_coalesce(void) return 0; } -static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso) +static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso, int lro) { fprintf(stdout, "rx-checksumming: %s\n" @@ -1215,13 +1218,15 @@ static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso) "scatter-gather: %s\n" "tcp segmentation offload: %s\n" "udp fragmenta
[PATCH] [NET] ethtool: Add support for multiple queues
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/ethtool.h | 23 +++ net/core/ethtool.c | 34 ++ 2 files changed, 57 insertions(+), 0 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index ab9d688..aefd580 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -196,6 +196,23 @@ struct ethtool_ringparam { __u32 tx_pending; }; +/* for configuring RX/TX queue count */ +struct ethtool_queueparam { + __u32 cmd;/* ETHTOOL_{G,S}QUEUEPARAM */ + + /* Read only attributes. These indicate the maximum number +* of RX/TX queues the driver will allow the user to set. +*/ + __u32 rx_max; + __u32 tx_max; + + /* Values changeable by the user. The valid values are +* in the range 1 to the "*_max" counterpart above. +*/ + __u32 rx; + __u32 tx; +}; + /* for configuring link flow control parameters */ struct ethtool_pauseparam { __u32 cmd;/* ETHTOOL_{G,S}PAUSEPARAM */ @@ -295,6 +312,8 @@ int ethtool_op_set_lro(struct net_device *dev, u32 data); * set_coalesce: Set interrupt coalescing parameters * get_ringparam: Report ring sizes * set_ringparam: Set ring sizes + * get_queueparam: Report ring sizes + * set_queueparam: Set ring sizes * get_pauseparam: Report pause parameters * set_pauseparam: Set pause paramters * get_rx_csum: Report whether receive checksums are turned on or off @@ -356,6 +375,8 @@ struct ethtool_ops { int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); void(*get_ringparam)(struct net_device *, struct ethtool_ringparam *); int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); + void(*get_queueparam)(struct net_device *, struct ethtool_queueparam *); + int (*set_queueparam)(struct net_device *, struct ethtool_queueparam *); void(*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); u32 (*get_rx_csum)(struct net_device *); @@ -422,6 +443,8 @@ struct ethtool_ops { #define ETHTOOL_SGSO 0x0024 /* Set GSO enable (ethtool_value) */ #define ETHTOOL_GLRO 0x0025 /* Get LRO enable (ethtool_value) */ #define ETHTOOL_SLRO 0x0026 /* Set LRO enable (ethtool_value) */ +#define ETHTOOL_GQUEUEPARAM0x0027 /* Get queue parameters */ +#define ETHTOOL_SQUEUEPARAM0x0028 /* Set queue parameters. */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 23ccaa1..f1a1234 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -443,6 +443,33 @@ static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr) return dev->ethtool_ops->set_ringparam(dev, &ringparam); } +static int ethtool_get_queueparam(struct net_device *dev, void __user *useraddr) +{ + struct ethtool_queueparam queueparam = { ETHTOOL_GQUEUEPARAM }; + + if (!dev->ethtool_ops->get_queueparam) + return -EOPNOTSUPP; + + dev->ethtool_ops->get_queueparam(dev, &queueparam); + + if (copy_to_user(useraddr, &queueparam, sizeof(queueparam))) + return -EFAULT; + return 0; +} + +static int ethtool_set_queueparam(struct net_device *dev, void __user *useraddr) +{ + struct ethtool_queueparam queueparam; + + if (!dev->ethtool_ops->set_queueparam) + return -EOPNOTSUPP; + + if (copy_from_user(&queueparam, useraddr, sizeof(queueparam))) + return -EFAULT; + + return dev->ethtool_ops->set_queueparam(dev, &queueparam); +} + static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) { struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; @@ -875,6 +902,7 @@ int dev_ethtool(struct ifreq *ifr) case ETHTOOL_GMSGLVL: case ETHTOOL_GCOALESCE: case ETHTOOL_GRINGPARAM: + case ETHTOOL_GQUEUEPARAM: case ETHTOOL_GPAUSEPARAM: case ETHTOOL_GRXCSUM: case ETHTOOL_GTXCSUM: @@ -946,6 +974,12 @@ int dev_ethtool(struct ifreq *ifr) case ETHTOOL_SRINGPARAM: rc = ethtool_set_ringparam(dev, useraddr); break; + case ETHTOOL_GQUEUEPARAM: + rc = ethtool_get_queueparam(dev, useraddr); + break; + case ETHTOOL_SQUEUEPARAM: + rc = ethtool_set_queueparam(dev, useraddr); + break; case ETHTOOL_GPAUSEPARAM: rc = ethtool_get_pauseparam(dev, useraddr); break; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ethtool: Add support for setting multiple rx/tx queues
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool-copy.h | 23 + ethtool.8 | 23 + ethtool.c | 103 3 files changed, 149 insertions(+), 0 deletions(-) diff --git a/ethtool-copy.h b/ethtool-copy.h index ab9d688..aefd580 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -196,6 +196,23 @@ struct ethtool_ringparam { __u32 tx_pending; }; +/* for configuring RX/TX queue count */ +struct ethtool_queueparam { + __u32 cmd;/* ETHTOOL_{G,S}QUEUEPARAM */ + + /* Read only attributes. These indicate the maximum number +* of RX/TX queues the driver will allow the user to set. +*/ + __u32 rx_max; + __u32 tx_max; + + /* Values changeable by the user. The valid values are +* in the range 1 to the "*_max" counterpart above. +*/ + __u32 rx; + __u32 tx; +}; + /* for configuring link flow control parameters */ struct ethtool_pauseparam { __u32 cmd;/* ETHTOOL_{G,S}PAUSEPARAM */ @@ -295,6 +312,8 @@ int ethtool_op_set_lro(struct net_device *dev, u32 data); * set_coalesce: Set interrupt coalescing parameters * get_ringparam: Report ring sizes * set_ringparam: Set ring sizes + * get_queueparam: Report ring sizes + * set_queueparam: Set ring sizes * get_pauseparam: Report pause parameters * set_pauseparam: Set pause paramters * get_rx_csum: Report whether receive checksums are turned on or off @@ -356,6 +375,8 @@ struct ethtool_ops { int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); void(*get_ringparam)(struct net_device *, struct ethtool_ringparam *); int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); + void(*get_queueparam)(struct net_device *, struct ethtool_queueparam *); + int (*set_queueparam)(struct net_device *, struct ethtool_queueparam *); void(*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); u32 (*get_rx_csum)(struct net_device *); @@ -422,6 +443,8 @@ struct ethtool_ops { #define ETHTOOL_SGSO 0x0024 /* Set GSO enable (ethtool_value) */ #define ETHTOOL_GLRO 0x0025 /* Get LRO enable (ethtool_value) */ #define ETHTOOL_SLRO 0x0026 /* Set LRO enable (ethtool_value) */ +#define ETHTOOL_GQUEUEPARAM0x0027 /* Get queue parameters */ +#define ETHTOOL_SQUEUEPARAM0x0028 /* Set queue parameters. */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/ethtool.8 b/ethtool.8 index 89abf08..3f2e0c0 100644 --- a/ethtool.8 +++ b/ethtool.8 @@ -120,6 +120,17 @@ ethtool \- Display or change ethernet card settings .RB [ tx .IR N ] + +.B ethtool \-q|\-\-show\-queue +.I ethX + +.B ethtool \-Q|\-\-set\-queue +.I ethX +.RB [ rx +.IR N ] +.RB [ tx +.IR N ] + .B ethtool \-i|\-\-driver .I ethX @@ -243,6 +254,18 @@ Changes the number of ring entries for the Rx Jumbo ring. .BI tx \ N Changes the number of ring entries for the Tx ring. .TP +.B \-q \-\-show\-queue +Queries the specified ethernet device for rx/tx queue parameter information. +.TP +.B \-Q \-\-set\-queue +Changes the rx/tx queue parameters of the specified ethernet device. +.TP +.BI rx \ N +Changes the number of Rx queues. +.TP +.BI tx \ N +Changes the number of Tx queues. +.TP .B \-i \-\-driver Queries the specified ethernet device for associated driver information. .TP diff --git a/ethtool.c b/ethtool.c index 4c9844a..227349f 100644 --- a/ethtool.c +++ b/ethtool.c @@ -64,6 +64,8 @@ static int do_gpause(int fd, struct ifreq *ifr); static int do_spause(int fd, struct ifreq *ifr); static int do_gring(int fd, struct ifreq *ifr); static int do_sring(int fd, struct ifreq *ifr); +static int do_gqueue(int fd, struct ifreq *ifr); +static int do_squeue(int fd, struct ifreq *ifr); static int do_gcoalesce(int fd, struct ifreq *ifr); static int do_scoalesce(int fd, struct ifreq *ifr); static int do_goffload(int fd, struct ifreq *ifr); @@ -87,6 +89,8 @@ static enum { MODE_SCOALESCE, MODE_GRING, MODE_SRING, + MODE_GQUEUE, + MODE_SQUEUE, MODE_GOFFLOAD, MODE_SOFFLOAD, MODE_GSTATS, @@ -144,6 +148,10 @@ static struct option { " [ rx-mini N ]\n" " [ rx-jumbo N ]\n" " [ tx N ]\n" }, +{ "-q", "--show-queue", MODE_GQUEUE, "Query RX/TX queue parameters" }, +{ "-Q", "--set-queue", MODE_SQUEUE, "Set RX/TX queue parameters", + " [ rx N ]\n" + " [ tx N ]\n" }, { "-k"
[PATCH] e1000e: Make a few functions static
After moving code around we can reduce namespace usage by making a few functions static. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |2 -- drivers/net/e1000e/lib.c|2 +- drivers/net/e1000e/netdev.c |2 +- drivers/net/e1000e/phy.c| 10 ++ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 65c31d3..a1394d6 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -365,7 +365,6 @@ extern struct e1000_info e1000_ich9_info; extern struct e1000_info e1000_es2_info; extern s32 e1000_commit_phy(struct e1000_hw *hw); -extern s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); extern bool e1000_enable_mng_pass_thru(struct e1000_hw *hw); @@ -438,7 +437,6 @@ extern s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success); extern s32 e1000_phy_reset_dsp(struct e1000_hw *hw); extern s32 e1000_check_downshift(struct e1000_hw *hw); -extern s32 e1000_wait_autoneg(struct e1000_hw *hw); static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw) { diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index d11b518..3bbe63e 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c @@ -2289,7 +2289,7 @@ bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) * * Writes the command header after does the checksum calculation. **/ -s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, +static s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, struct e1000_host_mng_command_header *hdr) { u16 i, length = sizeof(struct e1000_host_mng_command_header); diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index c8d50cc..dd4eca6 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -48,7 +48,7 @@ char e1000_driver_name[] = "e1000e"; const char e1000_driver_version[] = DRV_VERSION; -const struct e1000_info * e1000_info_tbl[] = { +static const struct e1000_info *e1000_info_tbl[] = { [board_82571] = &e1000_82571_info, [board_82572] = &e1000_82572_info, [board_82573] = &e1000_82573_info, diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index d7947b0..1ccbad7 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c @@ -28,8 +28,10 @@ #include "e1000.h" -static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); -static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw); +static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); +static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw); +static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); +static s32 e1000_wait_autoneg(struct e1000_hw *hw); /* Cable length tables */ static const u16 e1000_m88_cable_length_table[] = @@ -1281,7 +1283,7 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw) * Waits for auto-negotiation to complete or for the auto-negotiation time * limit to expire, which ever happens first. **/ -s32 e1000_wait_autoneg(struct e1000_hw *hw) +static s32 e1000_wait_autoneg(struct e1000_hw *hw) { s32 ret_val = 0; u16 i, phy_status; @@ -1760,7 +1762,7 @@ s32 e1000_commit_phy(struct e1000_hw *hw) * During driver activity, SmartSpeed should be enabled so performance is * maintained. This is a function pointer entry point called by drivers. **/ -s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) +static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) { if (hw->phy.ops.set_d0_lplu_state) return hw->phy.ops.set_d0_lplu_state(hw, active); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000e: remove duplicate shadowing reference to adapter->hw
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index dd4eca6..741965d 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -2981,7 +2981,6 @@ static void e1000_watchdog_task(struct work_struct *work) } else { /* make sure the receive unit is started */ if (adapter->flags & FLAG_RX_NEEDS_RESTART) { - struct e1000_hw *hw = &adapter->hw; u32 rctl = er32(RCTL); ew32(RCTL, rctl | E1000_RCTL_EN); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000e: Fix header includes
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/82571.c |4 drivers/net/e1000e/e1000.h |7 --- drivers/net/e1000e/es2lan.c |5 + drivers/net/e1000e/ethtool.c |3 ++- drivers/net/e1000e/hw.h |2 ++ drivers/net/e1000e/ich8lan.c |5 + drivers/net/e1000e/lib.c |2 ++ drivers/net/e1000e/netdev.c |1 + 8 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index ddf2303..0f8f0ac 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c @@ -37,6 +37,10 @@ * 82573L Gigabit Ethernet Controller */ +#include +#include +#include + #include "e1000.h" #define ID_LED_RESERVED_F746 0xF746 diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index a1394d6..de17537 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -31,10 +31,11 @@ #ifndef _E1000_H_ #define _E1000_H_ +#include +#include +#include +#include #include -#include -#include -#include #include "hw.h" diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index 5604c50..8100d03 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c @@ -31,6 +31,11 @@ * 80003ES2LAN Gigabit Ethernet Controller (Serdes) */ +#include +#include +#include +#include + #include "e1000.h" #define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6c417ea..a8fa1db 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -29,8 +29,9 @@ /* ethtool support for e1000 */ #include - #include +#include +#include #include "e1000.h" diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 4d562c4..848217a 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h @@ -29,6 +29,8 @@ #ifndef _E1000_HW_H_ #define _E1000_HW_H_ +#include + struct e1000_hw; struct e1000_adapter; diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 042abd4..85095af 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c @@ -40,6 +40,11 @@ * 82566MM Gigabit Network Connection */ +#include +#include +#include +#include + #include "e1000.h" #define ICH_FLASH_GFPREG 0x diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 3bbe63e..c92ea77 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c @@ -27,6 +27,8 @@ ***/ #include +#include +#include #include #include "e1000.h" diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 741965d..0ea6eda 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [NET] ethtool: Add LRO support
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- include/linux/ethtool.h |8 +++ include/linux/netdevice.h |1 + net/core/ethtool.c| 53 + 3 files changed, 62 insertions(+), 0 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 23ccea8..a97248e 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -272,6 +272,8 @@ u32 ethtool_op_get_tso(struct net_device *dev); int ethtool_op_set_tso(struct net_device *dev, u32 data); u32 ethtool_op_get_ufo(struct net_device *dev); int ethtool_op_set_ufo(struct net_device *dev, u32 data); +u32 ethtool_op_get_lro(struct net_device *dev); +int ethtool_op_set_lro(struct net_device *dev, u32 data); /** * ðtool_ops - Alter and report network device settings @@ -303,6 +305,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data); * set_tso: Turn TCP segmentation offload on or off * get_ufo: Report whether UDP fragmentation offload is enabled * set_ufo: Turn UDP fragmentation offload on or off + * get_lro: Report whether large receive offload is enabled + * set_lro: Turn large receive offload on or off * self_test: Run specified self-tests * get_strings: Return a set of strings that describe the requested objects * phys_id: Identify the device @@ -369,6 +373,8 @@ struct ethtool_ops { void(*complete)(struct net_device *); u32 (*get_ufo)(struct net_device *); int (*set_ufo)(struct net_device *, u32); + u32 (*get_lro)(struct net_device *); + int (*set_lro)(struct net_device *, u32); }; #endif /* __KERNEL__ */ @@ -410,6 +416,8 @@ struct ethtool_ops { #define ETHTOOL_SUFO 0x0022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x0023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x0024 /* Set GSO enable (ethtool_value) */ +#define ETHTOOL_GLRO 0x0025 /* Get LRO enable (ethtool_value) */ +#define ETHTOOL_SLRO 0x0026 /* Set LRO enable (ethtool_value) */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4a616d7..4863ffc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -341,6 +341,7 @@ struct net_device #define NETIF_F_GSO2048/* Enable software GSO. */ #define NETIF_F_LLTX 4096/* LockLess TX */ #define NETIF_F_MULTI_QUEUE16384 /* Has multiple TX/RX queues */ +#define NETIF_F_LRO32768 /* Has large receive offload */ /* Segmentation offload features */ #define NETIF_F_GSO_SHIFT 16 diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 2ab0a60..65f751b 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -109,6 +109,20 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data) return 0; } +u32 ethtool_op_get_lro(struct net_device *dev) +{ + return (dev->features & NETIF_F_LRO) != 0; +} + +int ethtool_op_set_lro(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_LRO; + else + dev->features &= ~NETIF_F_LRO; + return 0; +} + /* Handlers for each ethtool command */ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) @@ -504,6 +518,13 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data) if (err) return err; } + + if (!data && dev->ethtool_ops->set_lro) { + err = dev->ethtool_ops->set_lro(dev, 0); + if (err) + return err; + } + return dev->ethtool_ops->set_sg(dev, data); } @@ -615,6 +636,29 @@ static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr) return dev->ethtool_ops->set_ufo(dev, edata.data); } +static int ethtool_get_lro(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GLRO }; + + edata.data = dev->features & NETIF_F_LRO; + if (copy_to_user(useraddr, &edata, sizeof(edata))) +return -EFAULT; + return 0; +} + +static int ethtool_set_lro(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + if (edata.data) + dev->features |= NETIF_F_LRO; + else + dev->features &= ~NETIF_F_LRO; + return 0; +} + static int ethtool_get_gso(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { ETHTOOL_GGSO }; @@ -816,6 +860,7 @@ int dev_ethtool(struct ifreq *ifr) case ETHTOOL_GTSO: case ETHTOOL_GPERMADDR: case ETHTOOL_GUFO: + case ETHTOOL_GL
[PATCH] ethtool: Add LRO support
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- ethtool-copy.h |8 ethtool.8 |8 ++-- ethtool.c | 39 +-- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/ethtool-copy.h b/ethtool-copy.h index 3a63224..ab9d688 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -274,6 +274,8 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data); u32 ethtool_op_get_ufo(struct net_device *dev); int ethtool_op_set_ufo(struct net_device *dev, u32 data); +u32 ethtool_op_get_lro(struct net_device *dev); +int ethtool_op_set_lro(struct net_device *dev, u32 data); /** * ðtool_ops - Alter and report network device settings @@ -305,6 +307,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data); * set_tso: Turn TCP segmentation offload on or off * get_ufo: Report whether UDP fragmentation offload is enabled * set_ufo: Turn UDP fragmentation offload on or off + * get_lro: Report whether large receive offload is enabled + * set_lro: Turn large receive offload on or off * self_test: Run specified self-tests * get_strings: Return a set of strings that describe the requested objects * phys_id: Identify the device @@ -373,6 +377,8 @@ struct ethtool_ops { void(*complete)(struct net_device *); u32 (*get_ufo)(struct net_device *); int (*set_ufo)(struct net_device *, u32); + u32 (*get_lro)(struct net_device *); + int (*set_lro)(struct net_device *, u32); }; #endif /* __KERNEL__ */ @@ -414,6 +420,8 @@ struct ethtool_ops { #define ETHTOOL_SUFO 0x0022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x0023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x0024 /* Set GSO enable (ethtool_value) */ +#define ETHTOOL_GLRO 0x0025 /* Get LRO enable (ethtool_value) */ +#define ETHTOOL_SLRO 0x0026 /* Set LRO enable (ethtool_value) */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/ethtool.8 b/ethtool.8 index af51056..89abf08 100644 --- a/ethtool.8 +++ b/ethtool.8 @@ -158,6 +158,7 @@ ethtool \- Display or change ethernet card settings .B2 tso on off .B2 ufo on off .B2 gso on off +.B2 lro on off .B ethtool \-p|\-\-blink .I ethX @@ -289,10 +290,13 @@ Specifies whether scatter-gather should be enabled. Specifies whether TCP segmentation offload should be enabled. .TP .A2 ufo on off -Specifies whether UDP fragmentation offload should be enabled +Specifies whether UDP fragmentation offload should be enabled. .TP .A2 gso on off -Specifies whether generic segmentation offload should be enabled +Specifies whether generic segmentation offload should be enabled. +.TP +.A2 lro on off +Specifies whether large receive offload should be enabled. .TP .B \-p \-\-identify Initiates adapter-specific action intended to enable an operator to diff --git a/ethtool.c b/ethtool.c index b04f747..4c9844a 100644 --- a/ethtool.c +++ b/ethtool.c @@ -151,7 +151,8 @@ static struct option { " [ sg on|off ]\n" " [ tso on|off ]\n" " [ ufo on|off ]\n" - " [ gso on|off ]\n" }, + " [ gso on|off ]\n" + " [ lro on|off ]\n" }, { "-i", "--driver", MODE_GDRV, "Show driver information" }, { "-d", "--register-dump", MODE_GREGS, "Do a register dump", " [ raw on|off ]\n" @@ -200,6 +201,7 @@ static int off_sg_wanted = -1; static int off_tso_wanted = -1; static int off_ufo_wanted = -1; static int off_gso_wanted = -1; +static int off_lro_wanted = -1; static struct ethtool_pauseparam epause; static int gpause_changed = 0; @@ -310,6 +312,7 @@ static struct cmdline_info cmdline_offload[] = { { "tso", CMDL_BOOL, &off_tso_wanted, NULL }, { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL }, { "gso", CMDL_BOOL, &off_gso_wanted, NULL }, + { "lro", CMDL_BOOL, &off_lro_wanted, NULL }, }; static struct cmdline_info cmdline_pause[] = { @@ -1207,7 +1210,7 @@ static int dump_coalesce(void) return 0; } -static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso) +static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso, int lro) { fprintf(stdout, "rx-checksumming: %s\n" @@ -1215,13 +1218,15 @@ static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso) "scatter-gather: %s\n" "tcp segmentation offload: %s\n" "udp fragmenta
[PATCH] e1000: Add device IDs of new 82571 board variants
This patch adds support for 2 new board variants: - A Quad port fiber 82571 board - A blade version of the 82571 quad copper board Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000/e1000_ethtool.c |2 ++ drivers/net/e1000/e1000_hw.c |5 + drivers/net/e1000/e1000_hw.h |3 +++ drivers/net/e1000/e1000_main.c|4 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index c90c92e..4c3785c 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -1706,6 +1706,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol case E1000_DEV_ID_82545EM_COPPER: case E1000_DEV_ID_82546GB_QUAD_COPPER: case E1000_DEV_ID_82546GB_PCIE: + case E1000_DEV_ID_82571EB_SERDES_QUAD: /* these don't support WoL at all */ wol->supported = 0; break; @@ -1723,6 +1724,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol retval = 0; break; case E1000_DEV_ID_82571EB_QUAD_COPPER: + case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: /* quad port adapters only support WoL on port A */ diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 9be4469..ba120f7 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c @@ -384,7 +384,10 @@ e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_82571EB_COPPER: case E1000_DEV_ID_82571EB_FIBER: case E1000_DEV_ID_82571EB_SERDES: + case E1000_DEV_ID_82571EB_SERDES_DUAL: + case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82571EB_QUAD_COPPER: + case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: hw->mac_type = e1000_82571; break; @@ -485,6 +488,8 @@ e1000_set_media_type(struct e1000_hw *hw) case E1000_DEV_ID_82545GM_SERDES: case E1000_DEV_ID_82546GB_SERDES: case E1000_DEV_ID_82571EB_SERDES: +case E1000_DEV_ID_82571EB_SERDES_DUAL: +case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82572EI_SERDES: case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: hw->media_type = e1000_media_type_internal_serdes; diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index bd000b8..fe87146 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h @@ -475,7 +475,10 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); #define E1000_DEV_ID_82571EB_FIBER 0x105F #define E1000_DEV_ID_82571EB_SERDES 0x1060 #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 +#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 #define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC +#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 +#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA #define E1000_DEV_ID_82572EI_COPPER 0x107D #define E1000_DEV_ID_82572EI_FIBER 0x107E #define E1000_DEV_ID_82572EI_SERDES 0x107F diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index f48b659..4a22595 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -100,6 +100,7 @@ static struct pci_device_id e1000_pci_tbl[] = { INTEL_E1000_ETHERNET_DEVICE(0x1099), INTEL_E1000_ETHERNET_DEVICE(0x109A), INTEL_E1000_ETHERNET_DEVICE(0x10A4), + INTEL_E1000_ETHERNET_DEVICE(0x10A5), INTEL_E1000_ETHERNET_DEVICE(0x10B5), INTEL_E1000_ETHERNET_DEVICE(0x10B9), INTEL_E1000_ETHERNET_DEVICE(0x10BA), @@ -107,6 +108,8 @@ static struct pci_device_id e1000_pci_tbl[] = { INTEL_E1000_ETHERNET_DEVICE(0x10BC), INTEL_E1000_ETHERNET_DEVICE(0x10C4), INTEL_E1000_ETHERNET_DEVICE(0x10C5), + INTEL_E1000_ETHERNET_DEVICE(0x10D9), + INTEL_E1000_ETHERNET_DEVICE(0x10DA), /* required last entry */ {0,} }; @@ -1096,6 +1099,7 @@ e1000_probe(struct pci_dev *pdev, break; case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: case E1000_DEV_ID_82571EB_QUAD_COPPER: + case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: /* if quad port adapter, disable WoL on all but port A */ if (global_quad_port_a != 0) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/6] e1000e: Remove two compile warnings
CC [M] drivers/net/e1000e/lib.o drivers/net/e1000e/lib.c: In function 'e1000e_read_nvm_eerd': drivers/net/e1000e/lib.c:1941: warning: 'ret_val' may be used uninitialized in this function CC [M] drivers/net/e1000e/phy.o drivers/net/e1000e/phy.c: In function 'e1000e_phy_has_link_generic': drivers/net/e1000e/phy.c:1324: warning: 'ret_val' may be used uninitialized in this function Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/lib.c |2 +- drivers/net/e1000e/phy.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index a04c1e4..6645c21 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c @@ -1938,7 +1938,7 @@ s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) { struct e1000_nvm_info *nvm = &hw->nvm; u32 i, eerd = 0; - s32 ret_val; + s32 ret_val = 0; /* A check for invalid values: offset too large, too many words, * and not enough words. */ diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 1efb47a..7932318 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c @@ -1321,7 +1321,7 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw) s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success) { - s32 ret_val; + s32 ret_val = 0; u16 i, phy_status; for (i = 0; i < iterations; i++) { - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] e1000e: Fix header includes [v2]
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/82571.c |4 drivers/net/e1000e/e1000.h |7 --- drivers/net/e1000e/es2lan.c |5 + drivers/net/e1000e/ethtool.c |3 ++- drivers/net/e1000e/hw.h |2 ++ drivers/net/e1000e/ich8lan.c |5 + drivers/net/e1000e/lib.c |2 ++ drivers/net/e1000e/netdev.c |2 ++ drivers/net/e1000e/phy.c |2 ++ 9 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index ddf2303..0f8f0ac 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c @@ -37,6 +37,10 @@ * 82573L Gigabit Ethernet Controller */ +#include +#include +#include + #include "e1000.h" #define ID_LED_RESERVED_F746 0xF746 diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index a1394d6..de17537 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -31,10 +31,11 @@ #ifndef _E1000_H_ #define _E1000_H_ +#include +#include +#include +#include #include -#include -#include -#include #include "hw.h" diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index 5604c50..8100d03 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c @@ -31,6 +31,11 @@ * 80003ES2LAN Gigabit Ethernet Controller (Serdes) */ +#include +#include +#include +#include + #include "e1000.h" #define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6c417ea..a8fa1db 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -29,8 +29,9 @@ /* ethtool support for e1000 */ #include - #include +#include +#include #include "e1000.h" diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 4d562c4..848217a 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h @@ -29,6 +29,8 @@ #ifndef _E1000_HW_H_ #define _E1000_HW_H_ +#include + struct e1000_hw; struct e1000_adapter; diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 042abd4..85095af 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c @@ -40,6 +40,11 @@ * 82566MM Gigabit Network Connection */ +#include +#include +#include +#include + #include "e1000.h" #define ICH_FLASH_GFPREG 0x diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 3bbe63e..c92ea77 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c @@ -27,6 +27,8 @@ ***/ #include +#include +#include #include #include "e1000.h" diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 741965d..01a9a4f 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -29,8 +29,10 @@ #include #include #include +#include #include #include +#include #include #include #include diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 1ccbad7..c9304d8 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c @@ -26,6 +26,8 @@ ***/ +#include + #include "e1000.h" static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] e1000e: Use dma_alloc_coherent where possible
Instead of using pci_alloc_consistent at GFP_ATOMIC we can be more reliable at startup and use dma_alloc_coherent instead with GFP_KERNEL. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c | 16 drivers/net/e1000e/netdev.c |9 ++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index c9d74a8..d184116 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -962,13 +962,13 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter) } if (tx_ring->desc) { - pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, - tx_ring->dma); + dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, + tx_ring->dma); tx_ring->desc = NULL; } if (rx_ring->desc) { - pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, - rx_ring->dma); + dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, + rx_ring->dma); rx_ring->desc = NULL; } @@ -1004,8 +1004,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc); tx_ring->size = ALIGN(tx_ring->size, 4096); - tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size, - &tx_ring->dma); + tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, + &tx_ring->dma, GFP_KERNEL); if (!tx_ring->desc) { ret_val = 2; goto err_nomem; @@ -1065,8 +1065,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) memset(rx_ring->buffer_info, 0, size); rx_ring->size = rx_ring->count * sizeof(struct e1000_rx_desc); - rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size, -&rx_ring->dma); + rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, + &rx_ring->dma, GFP_KERNEL); if (!rx_ring->desc) { ret_val = 5; goto err_nomem; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index d711e14..51c9024 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -1344,7 +1344,8 @@ static int e1000_alloc_ring_dma(struct e1000_adapter *adapter, { struct pci_dev *pdev = adapter->pdev; - ring->desc = pci_alloc_consistent(pdev, ring->size, &ring->dma); + ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma, + GFP_KERNEL); if (!ring->desc) return -ENOMEM; @@ -1479,7 +1480,8 @@ void e1000e_free_tx_resources(struct e1000_adapter *adapter) vfree(tx_ring->buffer_info); tx_ring->buffer_info = NULL; - pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma); + dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, + tx_ring->dma); tx_ring->desc = NULL; } @@ -1503,7 +1505,8 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter) kfree(rx_ring->ps_pages); rx_ring->ps_pages = NULL; - pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma); + dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, + rx_ring->dma); rx_ring->desc = NULL; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] e1000e: Use time_after to account for jiffies wrapping
Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index d184116..d14cc4b 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -1411,7 +1411,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) * enough time to complete the receives, if it's * exceeded, break and error off */ - } while (good_cnt < 64 && jiffies < (time + 20)); + } while ((good_cnt < 64) && !time_after(jiffies, time + 20)); if (good_cnt != 64) { ret_val = 13; /* ret_val is the same as mis-compare */ break; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] e1000e: error handling for pci_map_single calls.
Add proper error handling for various callers of pci_map_single. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |2 ++ drivers/net/e1000e/ethtool.c | 16 +++--- drivers/net/e1000e/netdev.c | 49 +++--- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 3475e48..e3cd877 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -220,6 +220,7 @@ struct e1000_adapter { u32 tx_fifo_head; u32 tx_head_addr; u32 tx_fifo_size; + u32 tx_dma_failed; /* * RX @@ -241,6 +242,7 @@ struct e1000_adapter { u64 gorcl_old; u32 gorcl; u32 alloc_rx_buff_failed; + u32 rx_dma_failed; unsigned int rx_ps_pages; u16 rx_ps_bsize0; diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index d14cc4b..0e80406 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -91,6 +91,8 @@ static const struct e1000_stats e1000_gstrings_stats[] = { { "tx_smbus", E1000_STAT(stats.mgptc) }, { "rx_smbus", E1000_STAT(stats.mgprc) }, { "dropped_smbus", E1000_STAT(stats.mgpdc) }, + { "rx_dma_failed", E1000_STAT(rx_dma_failed) }, + { "tx_dma_failed", E1000_STAT(tx_dma_failed) }, }; #define E1000_GLOBAL_STATS_LEN \ @@ -1042,6 +1044,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) tx_ring->buffer_info[i].dma = pci_map_single(pdev, skb->data, skb->len, PCI_DMA_TODEVICE); + if (pci_dma_mapping_error(tx_ring->buffer_info[i].dma)) { + ret_val = 4; + goto err_nomem; + } tx_desc->buffer_addr = cpu_to_le64( tx_ring->buffer_info[i].dma); tx_desc->lower.data = cpu_to_le32(skb->len); @@ -1059,7 +1065,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) size = rx_ring->count * sizeof(struct e1000_buffer); rx_ring->buffer_info = kmalloc(size, GFP_KERNEL); if (!rx_ring->buffer_info) { - ret_val = 4; + ret_val = 5; goto err_nomem; } memset(rx_ring->buffer_info, 0, size); @@ -1068,7 +1074,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, &rx_ring->dma, GFP_KERNEL); if (!rx_ring->desc) { - ret_val = 5; + ret_val = 6; goto err_nomem; } memset(rx_ring->desc, 0, rx_ring->size); @@ -1093,7 +1099,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) skb = alloc_skb(2048 + NET_IP_ALIGN, GFP_KERNEL); if (!skb) { - ret_val = 6; + ret_val = 7; goto err_nomem; } skb_reserve(skb, NET_IP_ALIGN); @@ -1101,6 +1107,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) rx_ring->buffer_info[i].dma = pci_map_single(pdev, skb->data, 2048, PCI_DMA_FROMDEVICE); + if (pci_dma_mapping_error(rx_ring->buffer_info[i].dma)) { + ret_val = 8; + goto err_nomem; + } rx_desc->buffer_addr = cpu_to_le64(rx_ring->buffer_info[i].dma); memset(skb->data, 0x00, skb->len); diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 51c9024..8ebe238 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -195,6 +195,11 @@ map_skb: buffer_info->dma = pci_map_single(pdev, skb->data, adapter->rx_buffer_len, PCI_DMA_FROMDEVICE); + if (pci_dma_mapping_error(buffer_info->dma)) { + dev_err(&pdev->dev, "RX DMA map failed\n"); + adapter->rx_dma_failed++; + break; + } rx_desc = E1000_RX_DESC(*rx_ring, i); rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); @@ -255,6 +260,13 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, ps_page->page,
[PATCH 2/2] ethtool: add register dump support for intel 82598 chipsets (ixgbe driver)
From: Nicholas Nunley <[EMAIL PROTECTED]> Signed-off-by: Nicholas Nunley <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- Makefile.am|2 ethtool-util.h |2 ethtool.c |1 ixgbe.c| 1017 4 files changed, 1021 insertions(+), 1 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7bb58d8..43d1236 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ EXTRA_DIST = ethtool.8 ethtool.spec.in aclocal.m4 ChangeLog autogen.sh sbin_PROGRAMS = ethtool ethtool_SOURCES = ethtool.c ethtool-copy.h ethtool-util.h \ amd8111e.c de2104x.c e100.c e1000.c igb.c \ - fec_8xx.c ibm_emac.c ixgb.c natsemi.c \ + fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c \ pcnet32.c realtek.c tg3.c marvell.c vioc.c\ smsc911x.c diff --git a/ethtool-util.h b/ethtool-util.h index 1621dfe..5572771 100644 --- a/ethtool-util.h +++ b/ethtool-util.h @@ -56,6 +56,8 @@ int ibm_emac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); /* Intel(R) PRO/10GBe Gigabit Adapter Family */ int ixgb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); +int ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); + /* Broadcom Tigon3 Ethernet controller */ int tg3_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); diff --git a/ethtool.c b/ethtool.c index 29562a7..651529e 100644 --- a/ethtool.c +++ b/ethtool.c @@ -1005,6 +1005,7 @@ static struct { { "e1000", e1000_dump_regs }, { "igb", igb_dump_regs }, { "ixgb", ixgb_dump_regs }, + { "ixgbe", ixgbe_dump_regs }, { "natsemi", natsemi_dump_regs }, { "e100", e100_dump_regs }, { "amd8111e", amd8111e_dump_regs }, diff --git a/ixgbe.c b/ixgbe.c new file mode 100644 index 000..03eba6a --- /dev/null +++ b/ixgbe.c @@ -0,0 +1,1017 @@ +/* Copyright (c) 2007 Intel Corporation */ +#include +#include "ethtool-util.h" + +/* Register Bit Masks */ +#define IXGBE_FCTRL_SBP0x0002 +#define IXGBE_FCTRL_MPE0x0100 +#define IXGBE_FCTRL_UPE0x0200 +#define IXGBE_FCTRL_BAM0x0400 +#define IXGBE_FCTRL_PMCF 0x1000 +#define IXGBE_FCTRL_DPF0x2000 +#define IXGBE_FCTRL_RPFCE 0x4000 +#define IXGBE_FCTRL_RFCE 0x8000 +#define IXGBE_VLNCTRL_VET 0x +#define IXGBE_VLNCTRL_CFI 0x1000 +#define IXGBE_VLNCTRL_CFIEN0x2000 +#define IXGBE_VLNCTRL_VFE 0x4000 +#define IXGBE_VLNCTRL_VME 0x8000 +#define IXGBE_LINKS_UP 0x4000 +#define IXGBE_LINKS_SPEED 0x2000 +#define IXGBE_SRRCTL_BSIZEPKT_MASK 0x007F +#define IXGBE_HLREG0_TXCRCEN 0x0001 +#define IXGBE_HLREG0_RXCRCSTRP 0x0002 +#define IXGBE_HLREG0_JUMBOEN 0x0004 +#define IXGBE_HLREG0_TXPADEN 0x0400 +#define IXGBE_HLREG0_LPBK 0x8000 +#define IXGBE_RMCS_TFCE_802_3X 0x0008 +#define IXGBE_RMCS_TFCE_PRIORITY 0x0010 + +int +ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs) +{ + u32 *regs_buff = (u32 *)regs->data; + u32 reg; + u8 i; + u8 version = (u8)(regs->version >> 24); + + if (version != 1) + return -1; + + reg = regs_buff[1065]; + fprintf(stdout, + "0x042A4: LINKS (Link Status register) 0x%08X\n" + " Link Status: %s\n" + " Link Speed:%s\n", + reg, + reg & IXGBE_LINKS_UP ? "up" : "down", + reg & IXGBE_LINKS_SPEED ? "10G" : "1G"); + + reg = regs_buff[515]; + fprintf(stdout, + "0x05080: FCTRL (Filter Control register) 0x%08X\n" + " Receive Flow Control Packets: %s\n" + " Receive Priority Flow Control Packets: %s\n" + " Discard Pause Frames: %s\n" + " Pass MAC Control Frames: %s\n" + " Broadcast Accept: %s\n" + " Unicast Promiscuous: %s\n" + " Multicast Promiscuous: %s\n" + " Store Bad Packets: %s\n", + reg, + reg & IXGBE_FCTRL_RFCE? "enabled" : "disabled", + reg & IXGBE_FCTRL_RPFCE ? "enabled" : "disabl
[PATCH 1/2] ethtool: add register dump support for intel 82575 chipsets (igb driver)
From: Nicholas Nunley <[EMAIL PROTECTED]> Signed-off-by: Nicholas Nunley <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- Makefile.am|2 ethtool-util.h |2 ethtool.c |1 igb.c | 864 4 files changed, 868 insertions(+), 1 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9f4bbd3..7bb58d8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ EXTRA_DIST = ethtool.8 ethtool.spec.in aclocal.m4 ChangeLog autogen.sh sbin_PROGRAMS = ethtool ethtool_SOURCES = ethtool.c ethtool-copy.h ethtool-util.h \ - amd8111e.c de2104x.c e100.c e1000.c \ + amd8111e.c de2104x.c e100.c e1000.c igb.c \ fec_8xx.c ibm_emac.c ixgb.c natsemi.c \ pcnet32.c realtek.c tg3.c marvell.c vioc.c\ smsc911x.c diff --git a/ethtool-util.h b/ethtool-util.h index f429555..1621dfe 100644 --- a/ethtool-util.h +++ b/ethtool-util.h @@ -30,6 +30,8 @@ int de2104x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); /* Intel(R) PRO/1000 Gigabit Adapter Family */ int e1000_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); +int igb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); + /* RealTek PCI */ int realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); diff --git a/ethtool.c b/ethtool.c index b04f747..29562a7 100644 --- a/ethtool.c +++ b/ethtool.c @@ -1003,6 +1003,7 @@ static struct { { "r8169", realtek_dump_regs }, { "de2104x", de2104x_dump_regs }, { "e1000", e1000_dump_regs }, + { "igb", igb_dump_regs }, { "ixgb", ixgb_dump_regs }, { "natsemi", natsemi_dump_regs }, { "e100", e100_dump_regs }, diff --git a/igb.c b/igb.c new file mode 100644 index 000..fadc22e --- /dev/null +++ b/igb.c @@ -0,0 +1,864 @@ +/* Copyright (c) 2007 Intel Corporation */ +#include +#include "ethtool-util.h" + +/* Register Bit Masks */ +/* Device Control */ +#define E1000_CTRL_FD 0x0001 /* Full duplex.0=half; 1=full */ +#define E1000_CTRL_PRIOR 0x0004 /* Priority on PCI. 0=rx,1=fair */ +#define E1000_CTRL_GIOMASTERD 0x0008 /* GIO Master Disable*/ +#define E1000_CTRL_TME0x0010 /* Test mode. 0=normal,1=test */ +#define E1000_CTRL_SLE0x0020 /* Serial Link on 0=dis,1=en */ +#define E1000_CTRL_ASDE 0x0020 /* Auto-speed detect enable */ +#define E1000_CTRL_SLU0x0040 /* Set link up (Force Link) */ +#define E1000_CTRL_ILOS 0x0080 /* Invert Loss-Of Signal */ +#define E1000_CTRL_SPD_SEL0x0300 /* Speed Select Mask */ +#define E1000_CTRL_SPD_10 0x /* Force 10Mb */ +#define E1000_CTRL_SPD_1000x0100 /* Force 100Mb */ +#define E1000_CTRL_SPD_1000 0x0200 /* Force 1Gb */ +#define E1000_CTRL_FRCSPD 0x0800 /* Force Speed */ +#define E1000_CTRL_FRCDPX 0x1000 /* Force Duplex */ +#define E1000_CTRL_SDP0_GPIEN 0x0001 /* General Purpose Interrupt Detection Enable for SDP0 */ +#define E1000_CTRL_SDP1_GPIEN 0x0002 /* General Purpose Interrupt Detection Enable for SDP1 */ +#define E1000_CTRL_SDP0_DATA 0x0004 /* SDP0 Data */ +#define E1000_CTRL_SDP1_DATA 0x0008 /* SDP1 Data */ +#define E1000_CTRL_ADVD3WUC 0x0010 /* D3Cold WakeUp Capability Advertisement Enable */ +#define E1000_CTRL_SDP0_WDE 0x0020 /* Watchdog Indication for SDP0 */ +#define E1000_CTRL_SDP1_IODIR 0x0040 /* SDP1 Directionality */ +#define E1000_CTRL_RST0x0400 /* Global reset */ +#define E1000_CTRL_RFCE 0x0800 /* Receive Flow Control enable */ +#define E1000_CTRL_TFCE 0x1000 /* Transmit flow control enable */ +#define E1000_CTRL_VME0x4000 /* IEEE VLAN mode enable */ +#define E1000_CTRL_PHY_RST0x8000 /* PHY Reset */ + +/* Device Status */ +#define E1000_STATUS_FD 0x0001 /* Full duplex.0=half,1=full */ +#define E1000_STATUS_LU 0x0002 /* Link up.0=no,1=link */ +#define E1000_STATUS_LANID 0x0008 /* LAN ID */ +#define E1000_STATUS_TXOFF 0x0010 /* transmission paused */ +#define E1000_STATUS_TBIMODE 0x0020 /* TBI mode */ +#define E1000_STATUS_SPEED_MASK 0x00C0 /* Speed Mask */ +#define E1000_STATUS_SPEED_100x /* Speed 10Mb/s */ +#define E1000_STATUS_SPEED_100 0x0040 /* Speed 100Mb/s */ +#define E1000_STATUS_SPEED_1000 0x0080 /* Speed 1000Mb/s */ +#define E1000_STATUS_ASDV0x0300 /* Auto speed detect value */ +#define E1000_STATUS_PHYRA 0x0400 /* PHY Reset Asserted */ +#define E1000_STATUS_GIOMASTEREN 0x0008 /* GIO Master Enable Status */ +#define E1000_
[PATCH 1/3] e1000e: retire last_tx_tso workaround
This TSO-related workaround is no longer needed since it's only applicable for 8254x silicon. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h | 15 +++ drivers/net/e1000e/netdev.c | 20 ++-- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index e3cd877..bbe5faf 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -142,18 +142,9 @@ struct e1000_ring { /* array of buffer information structs */ struct e1000_buffer *buffer_info; - union { - /* for TX */ - struct { - bool last_tx_tso; /* used to mark tso desc. */ - }; - /* for RX */ - struct { - /* arrays of page information for packet split */ - struct e1000_ps_page *ps_pages; - struct sk_buff *rx_skb_top; - }; - }; + /* arrays of page information for packet split */ + struct e1000_ps_page *ps_pages; + struct sk_buff *rx_skb_top; struct e1000_queue_stats stats; }; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 8ebe238..4916f7c 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -1483,7 +1483,6 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter) tx_ring->next_to_use = 0; tx_ring->next_to_clean = 0; - tx_ring->last_tx_tso = 0; writel(0, adapter->hw.hw_addr + tx_ring->head); writel(0, adapter->hw.hw_addr + tx_ring->tail); @@ -3216,15 +3215,6 @@ static int e1000_tx_map(struct e1000_adapter *adapter, while (len) { buffer_info = &tx_ring->buffer_info[i]; size = min(len, max_per_txd); - /* Workaround for Controller erratum -- -* descriptor for non-tso packet in a linear SKB that follows a -* tso gets written back prematurely before the data is fully -* DMA'd to the controller */ - if (tx_ring->last_tx_tso && !skb_is_gso(skb)) { - tx_ring->last_tx_tso = 0; - if (!skb->data_len) - size -= 4; - } /* Workaround for premature desc write-backs * in TSO mode. Append 4-byte sentinel desc */ @@ -3497,10 +3487,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) count++; count++; - /* Controller Erratum workaround */ - if (!skb->data_len && tx_ring->last_tx_tso && !skb_is_gso(skb)) - count++; - count += TXD_USE_COUNT(len, max_txd_pwr); nr_frags = skb_shinfo(skb)->nr_frags; @@ -3536,12 +3522,10 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) return NETDEV_TX_OK; } - if (tso) { - tx_ring->last_tx_tso = 1; + if (tso) tx_flags |= E1000_TX_FLAGS_TSO; - } else if (e1000_tx_csum(adapter, skb)) { + else if (e1000_tx_csum(adapter, skb)) tx_flags |= E1000_TX_FLAGS_CSUM; - } /* Old method was to assume IPv4 packet by default if TSO was enabled. * 82571 hardware supports TSO capabilities for IPv6 as well... - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] e1000e: Add read code and printout of PBA number (board identifier)
The PBA number allows customers and support to directly identify the type of board and characteristics such as different skews. Slightly enhance loading messages by adding module name to printout. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/defines.h |6 -- drivers/net/e1000e/e1000.h |2 ++ drivers/net/e1000e/lib.c | 21 + drivers/net/e1000e/netdev.c | 12 +--- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index ca80fde..b32ed45 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h @@ -573,9 +573,11 @@ /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ #define NVM_SUM0xBABA -#define NVM_WORD_SIZE_BASE_SHIFT 6 +/* PBA (printed board assembly) number words */ +#define NVM_PBA_OFFSET_0 8 +#define NVM_PBA_OFFSET_1 9 -/* NVM Commands - Microwire */ +#define NVM_WORD_SIZE_BASE_SHIFT 6 /* NVM Commands - SPI */ #define NVM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index bbe5faf..c57e35a 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -358,6 +358,8 @@ extern struct e1000_info e1000_ich8_info; extern struct e1000_info e1000_ich9_info; extern struct e1000_info e1000_es2_info; +extern s32 e1000e_read_part_num(struct e1000_hw *hw, u32 *part_num); + extern s32 e1000e_commit_phy(struct e1000_hw *hw); extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw); diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 6645c21..3bbfe60 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c @@ -2464,3 +2464,24 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw) return ret_val; } +s32 e1000e_read_part_num(struct e1000_hw *hw, u32 *part_num) +{ + s32 ret_val; + u16 nvm_data; + + ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); + if (ret_val) { + hw_dbg(hw, "NVM Read Error\n"); + return ret_val; + } + *part_num = (u32)(nvm_data << 16); + + ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_1, 1, &nvm_data); + if (ret_val) { + hw_dbg(hw, "NVM Read Error\n"); + return ret_val; + } + *part_num |= nvm_data; + + return 0; +} diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 4916f7c..420e111 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -3966,6 +3966,7 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; struct net_device *netdev = adapter->netdev; + u32 part_num; /* print bus type/speed/width info */ ndev_info(netdev, "(PCI Express:2.5GB/s:%s) " @@ -3980,6 +3981,10 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) ndev_info(netdev, "Intel(R) PRO/%s Network Connection\n", (hw->phy.type == e1000_phy_ife) ? "10/100" : "1000"); + e1000e_read_part_num(hw, &part_num); + ndev_info(netdev, "MAC: %d, PHY: %d, PBA No: %06x-%03x\n", + hw->mac.type, hw->phy.type, + (part_num >> 8), (part_num & 0xff)); } /** @@ -4414,9 +4419,10 @@ static struct pci_driver e1000_driver = { static int __init e1000_init_module(void) { int ret; - printk(KERN_INFO "Intel(R) PRO/1000 Network Driver - %s\n", - e1000e_driver_version); - printk(KERN_INFO "Copyright (c) 1999-2007 Intel Corporation.\n"); + printk(KERN_INFO "%s: Intel(R) PRO/1000 Network Driver - %s\n", + e1000e_driver_name, e1000e_driver_version); + printk(KERN_INFO "%s: Copyright (c) 1999-2007 Intel Corporation.\n", + e1000e_driver_name); ret = pci_register_driver(&e1000_driver); return ret; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] e1000e: Remove conditional packet split disable flag
This flag conflicts with e1000's Kconfig symbol and we'll leave the feature enabled by default for now. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 420e111..372da46 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -2009,7 +2009,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) break; } -#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT /* * 82571 and greater support packet-split where the protocol * header is placed in skb->data and the packet data is @@ -2029,7 +2028,7 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) pages = PAGE_USE_COUNT(adapter->netdev->mtu); if ((pages <= 3) && (PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE)) adapter->rx_ps_pages = pages; -#endif + if (adapter->rx_ps_pages) { /* Configure extra packet-split registers */ rfctl = er32(RFCTL); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [-MM] e1000e: incorporate napi_struct changes from net-2.6.24.git
This incorporates the new napi_struct changes into e1000e. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |2 ++ drivers/net/e1000e/netdev.c | 37 ++--- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index e3cd877..ea6a9fe 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -196,6 +196,8 @@ struct e1000_adapter { struct e1000_ring *tx_ring /* One per active queue */ cacheline_aligned_in_smp; + struct napi_struct napi; + unsigned long tx_queue_len; unsigned int restart_queue; u32 txd_cmd; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 8ebe238..e30eae2 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1663,10 +1663,10 @@ set_itr_now: * e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean(struct net_device *poll_dev, int *budget) +static int e1000_clean(struct napi_struct *napi, int budget) { - struct e1000_adapter *adapter; - int work_to_do = min(*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); + struct net_device *poll_dev = adapter->netdev; int tx_cleaned = 0, work_done = 0; /* Must NOT use netdev_priv macro here. */ @@ -1685,17 +1685,15 @@ static int e1000_clean(struct net_device *poll_dev, int *budget) spin_unlock(&adapter->tx_queue_lock); } - adapter->clean_rx(adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx(adapter, &work_done, budget); /* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done == 0)) || + if ((tx_cleaned && (work_done < budget)) || !netif_running(poll_dev)) { quit_polling: if (adapter->itr_setting & 3) e1000_set_itr(adapter); - netif_rx_complete(poll_dev); + netif_rx_complete(poll_dev, napi); if (test_bit(__E1000_DOWN, &adapter->state)) atomic_dec(&adapter->irq_sem); else @@ -1703,7 +1701,7 @@ quit_polling: return 0; } - return 1; + return work_done; } static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) @@ -2441,7 +2439,7 @@ int e1000e_up(struct e1000_adapter *adapter) clear_bit(__E1000_DOWN, &adapter->state); - netif_poll_enable(adapter->netdev); + napi_enable(&adapter->napi); e1000_irq_enable(adapter); /* fire a link change interrupt to start the watchdog */ @@ -2474,7 +2472,7 @@ void e1000e_down(struct e1000_adapter *adapter) e1e_flush(); msleep(10); - netif_poll_disable(netdev); + napi_disable(&adapter->napi); e1000_irq_disable(adapter); del_timer_sync(&adapter->watchdog_timer); @@ -2607,7 +2605,7 @@ static int e1000_open(struct net_device *netdev) /* From here on the code is the same as e1000e_up() */ clear_bit(__E1000_DOWN, &adapter->state); - netif_poll_enable(netdev); + napi_enable(&adapter->napi); e1000_irq_enable(adapter); @@ -2643,6 +2641,8 @@ static int e10
[PATCH] [-MM, FIX] e1000e: incorporate napi_struct changes from net-2.6.24.git
This incorporates the new napi_struct changes into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |2 ++ drivers/net/e1000e/netdev.c | 35 --- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index e3cd877..ea6a9fe 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -196,6 +196,8 @@ struct e1000_adapter { struct e1000_ring *tx_ring /* One per active queue */ cacheline_aligned_in_smp; + struct napi_struct napi; + unsigned long tx_queue_len; unsigned int restart_queue; u32 txd_cmd; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 8ebe238..0e35d0a 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data) mod_timer(&adapter->watchdog_timer, jiffies + 1); } - if (netif_rx_schedule_prep(netdev)) { + if (netif_rx_schedule_prep(netdev, &adapter->napi)) { adapter->total_tx_bytes = 0; adapter->total_tx_packets = 0; adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; - __netif_rx_schedule(netdev); + __netif_rx_schedule(netdev, &adapter->napi); } else { atomic_dec(&adapter->irq_sem); } @@ -1663,10 +1663,10 @@ set_itr_now: * e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean(struct net_device *poll_dev, int *budget) +static int e1000_clean(struct napi_struct *napi, int budget) { - struct e1000_adapter *adapter; - int work_to_do = min(*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); + struct net_device *poll_dev = adapter->netdev; int tx_cleaned = 0, work_done = 0; /* Must NOT use netdev_priv macro here. */ @@ -1685,17 +1685,15 @@ static int e1000_clean(struct net_device *poll_dev, int *budget) spin_unlock(&adapter->tx_queue_lock); } - adapter->clean_rx(adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx(adapter, &work_done, budget); /* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done == 0)) || + if ((tx_cleaned && (work_done < budget)) || !netif_running(poll_dev)) { quit_polling: if (adapter->itr_setting & 3) e1000_set_itr(adapter); - netif_rx_complete(poll_dev); + netif_rx_complete(poll_dev, napi); if (test_bit(__E1000_DOWN, &adapter->state)) atomic_dec(&adapter->irq_sem); else @@ -1703,7 +1701,7 @@ quit_polling: return 0; } - return 1; + return work_done; } static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) @@ -2441,7 +2439,7 @@ int e1000e_up(struct e1000_adapter *adapter) clear_bit(__E1000_DOWN, &adapter->state); - netif_poll_enable(adapter->netdev); + napi_enable(&adapter->napi); e1000_irq_enable(adapter); /* fire a link change interrupt to start the watchdog */ @@ -2474,7 +2472,7 @@ void e1000e_down(struct e1000_adapter *adapter) e1e_flush(); msleep(10); - netif_poll_disable(netdev); + napi_disable(&adapter->napi); e1000_irq_disable(adapter); del_timer_sync(&adapter->watchdog_timer); @@ -2607,7 +2605,7 @@ static int e1000_open(struct net_device *netdev) /* From here on the code is the same as e1000e_up() */ clear_bit(__E1000_DOWN, &adapter->state); - netif_poll_enable(netdev); + napi_enable(&adapter->napi); e100
[PATCH 2/2] e1000e: fix error checks
From: Adrian Bunk <[EMAIL PROTECTED]> Spotted by the Coverity checker. Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index b7a7e2a..ca06c35 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -1451,11 +1451,11 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) } *data = e1000_setup_desc_rings(adapter); - if (data) + if (*data) goto out; *data = e1000_setup_loopback_test(adapter); - if (data) + if (*data) goto err_loopback; *data = e1000_run_loopback_test(adapter); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] e1000e: Fix debug printk macro
Spotted by Joe Perches. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/hw.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index aa82f1a..6451578 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h @@ -852,7 +852,7 @@ struct e1000_hw { #ifdef DEBUG #define hw_dbg(hw, format, arg...) \ - printk(KERN_DEBUG, "%s: " format, e1000e_get_hw_dev_name(hw), ##arg); + printk(KERN_DEBUG "%s: " format, e1000e_get_hw_dev_name(hw), ##arg) #else static inline int __attribute__ ((format (printf, 2, 3))) hw_dbg(struct e1000_hw *hw, const char *format, ...) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] e1000e: don't poke PHY registers to retreive link status
Apparently poking the link status registers when autonegotiation is running on the PHY might botch the PHY link on 80003es2lan devices. While this is a very rare condition we can completely avoid it alltogether by just using the MAC link bits to provide the proper information to ethtool. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/ethtool.c | 31 +-- 1 files changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index b7a7e2a..983b031 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -110,6 +110,7 @@ static int e1000_get_settings(struct net_device *netdev, { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; + u32 status; if (hw->media_type == e1000_media_type_copper) { @@ -147,16 +148,16 @@ static int e1000_get_settings(struct net_device *netdev, ecmd->transceiver = XCVR_EXTERNAL; } - if (er32(STATUS) & E1000_STATUS_LU) { - - adapter->hw.mac.ops.get_link_up_info(hw, &adapter->link_speed, - &adapter->link_duplex); - ecmd->speed = adapter->link_speed; - - /* unfortunately FULL_DUPLEX != DUPLEX_FULL -*and HALF_DUPLEX != DUPLEX_HALF */ + status = er32(STATUS); + if (status & E1000_STATUS_LU) { + if (status & E1000_STATUS_SPEED_1000) + ecmd->speed = 1000; + else if (status & E1000_STATUS_SPEED_100) + ecmd->speed = 100; + else + ecmd->speed = 10; - if (adapter->link_duplex == FULL_DUPLEX) + if (status & E1000_STATUS_FD) ecmd->duplex = DUPLEX_FULL; else ecmd->duplex = DUPLEX_HALF; @@ -170,6 +171,16 @@ static int e1000_get_settings(struct net_device *netdev, return 0; } +static u32 e1000_get_link(struct net_device *netdev) +{ + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; + u32 status; + + status = er32(STATUS); + return (status & E1000_STATUS_LU); +} + static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) { struct e1000_mac_info *mac = &adapter->hw.mac; @@ -1751,7 +1762,7 @@ static const struct ethtool_ops e1000_ethtool_ops = { .get_msglevel = e1000_get_msglevel, .set_msglevel = e1000_set_msglevel, .nway_reset = e1000_nway_reset, - .get_link = ethtool_op_get_link, + .get_link = e1000_get_link, .get_eeprom_len = e1000_get_eeprom_len, .get_eeprom = e1000_get_eeprom, .set_eeprom = e1000_set_eeprom, - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] e1000e: Fix jumbo frame receive code.
Fix allocation and freeing of jumbo frames where several bugs were recently introduced by cleanups after we forked this code from e1000. This moves ps_pages to buffer_info where it really belongs and makes it a dynamically allocated array. The penalty is not that high since it's allocated outside of the buffer_info struct anyway. Without this patch all jumbo frames are completely broken and the driver panics. Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]> Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |4 +- drivers/net/e1000e/netdev.c | 102 ++- 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index d2499bb..811eada 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -123,6 +123,8 @@ struct e1000_buffer { }; /* RX */ struct page *page; + /* arrays of page information for packet split */ + struct e1000_ps_page *ps_pages; }; }; @@ -142,8 +144,6 @@ struct e1000_ring { /* array of buffer information structs */ struct e1000_buffer *buffer_info; - /* arrays of page information for packet split */ - struct e1000_ps_page *ps_pages; struct sk_buff *rx_skb_top; struct e1000_queue_stats stats; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 033e124..46c5ac6 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -245,37 +245,36 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, rx_desc = E1000_RX_DESC_PS(*rx_ring, i); for (j = 0; j < PS_PAGE_BUFFERS; j++) { - ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) -+ j]; - if (j < adapter->rx_ps_pages) { + ps_page = &buffer_info->ps_pages[j]; + if (j >= adapter->rx_ps_pages) { + /* all unused desc entries get hw null ptr */ + rx_desc->read.buffer_addr[j+1] = ~0; + continue; + } + if (!ps_page->page) { + ps_page->page = alloc_page(GFP_ATOMIC); if (!ps_page->page) { - ps_page->page = alloc_page(GFP_ATOMIC); - if (!ps_page->page) { - adapter->alloc_rx_buff_failed++; - goto no_buffers; - } - ps_page->dma = pci_map_page(pdev, - ps_page->page, - 0, PAGE_SIZE, - PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error( - ps_page->dma)) { - dev_err(&adapter->pdev->dev, - "RX DMA page map failed\n"); - adapter->rx_dma_failed++; - goto no_buffers; - } + adapter->alloc_rx_buff_failed++; + goto no_buffers; + } + ps_page->dma = pci_map_page(pdev, + ps_page->page, + 0, PAGE_SIZE, + PCI_DMA_FROMDEVICE); + if (pci_dma_mapping_error(ps_page->dma)) { + dev_err(&adapter->pdev->dev, + "RX DMA page map failed\n"); + adapter->rx_dma_failed++; + goto no_buffers; } - /* -* Refresh the desc even if buffer_addrs -* didn't change because each write-back -* erases this info. -*/ - rx_desc->read.buffer_addr[j+1] = -cpu_to_le64(ps_page->dma); - } else { -
[PATCH 2/4] e1000e: Fix PBA calculation for jumbo frame packets
Upon inspection the rx FIFO size calculation code was found to have 2 significant flaws: A superfluous minus sign resulting in the wrong size to be used for jumbo frames on 82573 and ich9, as well as that this code rewrote the read-only adapter->pba variable resulting in different values at each run. Without this patch jumbo's will work but performance will be awkward since the TX size is not adequate for two whole frames. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c | 22 +- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 46c5ac6..e87ed31 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -2328,8 +2328,11 @@ void e1000e_reset(struct e1000_adapter *adapter) struct e1000_mac_info *mac = &adapter->hw.mac; struct e1000_hw *hw = &adapter->hw; u32 tx_space, min_tx_space, min_rx_space; + u32 pba; u16 hwm; + ew32(PBA, adapter->pba); + if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) { /* To maintain wire speed transmits, the Tx FIFO should be * large enough to accommodate two full transmit packets, @@ -2337,11 +2340,11 @@ void e1000e_reset(struct e1000_adapter *adapter) * the Rx FIFO should be large enough to accommodate at least * one full receive packet and is similarly rounded up and * expressed in KB. */ - adapter->pba = er32(PBA); + pba = er32(PBA); /* upper 16 bits has Tx packet buffer allocation size in KB */ - tx_space = adapter->pba >> 16; + tx_space = pba >> 16; /* lower 16 bits has Rx packet buffer allocation size in KB */ - adapter->pba &= 0x; + pba &= 0x; /* the tx fifo also stores 16 bytes of information about the tx * but don't include ethernet FCS because hardware appends it */ min_tx_space = (mac->max_frame_size + @@ -2357,20 +2360,21 @@ void e1000e_reset(struct e1000_adapter *adapter) /* If current Tx allocation is less than the min Tx FIFO size, * and the min Tx FIFO size is less than the current Rx FIFO * allocation, take space away from current Rx allocation */ - if (tx_space < min_tx_space && - ((min_tx_space - tx_space) < adapter->pba)) { - adapter->pba -= - (min_tx_space - tx_space); + if ((tx_space < min_tx_space) && + ((min_tx_space - tx_space) < pba)) { + pba -= min_tx_space - tx_space; /* if short on rx space, rx wins and must trump tx * adjustment or use Early Receive if available */ - if ((adapter->pba < min_rx_space) && + if ((pba < min_rx_space) && (!(adapter->flags & FLAG_HAS_ERT))) /* ERT enabled in e1000_configure_rx */ - adapter->pba = min_rx_space; + pba = min_rx_space; } + + ew32(PBA, pba); } - ew32(PBA, adapter->pba); /* flow control settings */ /* The high water mark must be low enough to fit one full frame - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] e1000e: Remove legacy jumbo frame receive code
The legacy jumbo frame receive code is no longer needed since all hardware can do packet split and we're no longer offering a bypass kernel config option to disable packet split. Remove the unused code. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/e1000.h |1 drivers/net/e1000e/netdev.c | 282 --- 2 files changed, 1 insertions(+), 282 deletions(-) diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 811eada..473f78d 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -122,7 +122,6 @@ struct e1000_buffer { u16 next_to_watch; }; /* RX */ - struct page *page; /* arrays of page information for packet split */ struct e1000_ps_page *ps_pages; }; diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 03fcc70..4fd2e23 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -333,94 +333,6 @@ no_buffers: } /** - * e1000_alloc_rx_buffers_jumbo - Replace used jumbo receive buffers - * - * @adapter: address of board private structure - * @cleaned_count: number of buffers to allocate this pass - **/ -static void e1000_alloc_rx_buffers_jumbo(struct e1000_adapter *adapter, -int cleaned_count) -{ - struct net_device *netdev = adapter->netdev; - struct pci_dev *pdev = adapter->pdev; - struct e1000_ring *rx_ring = adapter->rx_ring; - struct e1000_rx_desc *rx_desc; - struct e1000_buffer *buffer_info; - struct sk_buff *skb; - unsigned int i; - unsigned int bufsz = 256 - -16 /*for skb_reserve */ - -NET_IP_ALIGN; - - i = rx_ring->next_to_use; - buffer_info = &rx_ring->buffer_info[i]; - - while (cleaned_count--) { - skb = buffer_info->skb; - if (skb) { - skb_trim(skb, 0); - goto check_page; - } - - skb = netdev_alloc_skb(netdev, bufsz); - if (!skb) { - /* Better luck next round */ - adapter->alloc_rx_buff_failed++; - break; - } - - /* Make buffer alignment 2 beyond a 16 byte boundary -* this will result in a 16 byte aligned IP header after -* the 14 byte MAC header is removed -*/ - skb_reserve(skb, NET_IP_ALIGN); - - buffer_info->skb = skb; -check_page: - /* allocate a new page if necessary */ - if (!buffer_info->page) { - buffer_info->page = alloc_page(GFP_ATOMIC); - if (!buffer_info->page) { - adapter->alloc_rx_buff_failed++; - break; - } - } - - if (!buffer_info->dma) - buffer_info->dma = pci_map_page(pdev, - buffer_info->page, 0, - PAGE_SIZE, - PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(buffer_info->dma)) { - dev_err(&adapter->pdev->dev, "RX DMA page map failed\n"); - adapter->rx_dma_failed++; - break; - } - - rx_desc = E1000_RX_DESC(*rx_ring, i); - rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); - - i++; - if (i == rx_ring->count) - i = 0; - buffer_info = &rx_ring->buffer_info[i]; - } - - if (rx_ring->next_to_use != i) { - rx_ring->next_to_use = i; - if (i-- == 0) - i = (rx_ring->count - 1); - - /* Force memory writes to complete before letting h/w -* know there are new descriptors to fetch. (Only -* applicable for weak-ordered memory model archs, -* such as IA-64). */ - wmb(); - writel(i, adapter->hw.hw_addr + rx_ring->tail); - } -} - -/** * e1000_clean_rx_irq - Send received data up the network stack; legacy * @adapter: board private structure * @@ -549,15 +461,6 @@ next_desc: return cleaned; } -static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb, - u16 length) -{ - bi->page = NULL; - skb->len += length; - skb->data_len += length; - skb->truesize += length; -} - static void e1
[PATCH 3/4] e1000e: Re-enable SECRC - crc stripping
This workaround code performed software stripping instead of the hardware which can do it much faster. None of the e1000e target hardware has issues with this feature and should work fine. This gives us some performance back on receive, and removes some kludging stripping the 4 bytes. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> --- drivers/net/e1000e/netdev.c | 19 ++- 1 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index e87ed31..03fcc70 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -494,10 +494,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, goto next_desc; } - /* adjust length to remove Ethernet CRC */ - length -= 4; - - /* probably a little skewed due to removing CRC */ total_rx_bytes += length; total_rx_packets++; @@ -964,8 +960,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); pci_dma_sync_single_for_device(pdev, ps_page->dma, PAGE_SIZE, PCI_DMA_FROMDEVICE); - /* remove the CRC */ - l1 -= 4; + skb_put(skb, l1); goto copydone; } /* if */ @@ -987,10 +982,6 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, skb->truesize += length; } - /* strip the ethernet crc, problem is we're using pages now so -* this whole operation can get a little cpu intensive */ - pskb_trim(skb, skb->len - 4); - copydone: total_rx_bytes += skb->len; total_rx_packets++; @@ -2034,9 +2025,11 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) ew32(RFCTL, rfctl); - /* disable the stripping of CRC because it breaks -* BMC firmware connected over SMBUS */ - rctl |= E1000_RCTL_DTYP_PS /* | E1000_RCTL_SECRC */; + /* Enable Packet split descriptors */ + rctl |= E1000_RCTL_DTYP_PS; + + /* Enable hardware CRC frame stripping */ + rctl |= E1000_RCTL_SECRC; psrctl |= adapter->rx_ps_bsize0 >> E1000_PSRCTL_BSIZE0_SHIFT; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ
Trivial replacement - use INT_MAX instead here. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] --- drivers/net/sk98lin/skethtool.c |4 ++-- drivers/net/skge.c |8 drivers/net/sky2.c |8 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c index 5a6da89..4549b97 100644 --- a/drivers/net/sk98lin/skethtool.c +++ b/drivers/net/sk98lin/skethtool.c @@ -430,8 +430,8 @@ static int locateDevice(struct net_device *dev, u32 data) DEV_NET *pNet = netdev_priv(dev); SK_AC *pAC = pNet->pAC; - if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) - data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); + if (!data) + data = INT_MAX; /* start blinking */ pAC->LedsOn = 0; diff --git a/drivers/net/skge.c b/drivers/net/skge.c index b9961dc..696a79e 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -783,10 +783,10 @@ static int skge_phys_id(struct net_device *dev, u32 data) unsigned long ms; enum led_mode mode = LED_MODE_TST; - if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) - ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000; - else - ms = data * 1000; + if (!data) + data = INT_MAX; + + ms = data * HZ; while (ms > 0) { skge_led(skge, mode); diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index c27c7d6..1381d04 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -3336,10 +3336,10 @@ static int sky2_phys_id(struct net_device *dev, u32 data) int interrupted; int onoff = 1; - if (!data || data > (u32) (MAX_SCHEDULE_TIMEOUT / HZ)) - ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT); - else - ms = data * 1000; + if (!data) + data = INT_MAX: + + ms = data * HZ; /* save initial values */ spin_lock_bh(&sky2->phy_lock); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] pcnet: fix sparse triviality
Since data can never exceed u32, it can't even be larger than LONG_MAX/HZ. Signed-off-by: Auke Kok <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] --- drivers/net/pcnet32.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index ff92aca..3573e77 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c @@ -1101,9 +1101,8 @@ static int pcnet32_phys_id(struct net_device *dev, u32 data) mod_timer(&lp->blink_timer, jiffies); set_current_state(TASK_INTERRUPTIBLE); - /* AV: the limit here makes no sense whatsoever */ - if ((!data) || (data > (u32) (MAX_SCHEDULE_TIMEOUT / HZ))) - data = (u32) (MAX_SCHEDULE_TIMEOUT / HZ); + if (!data) + data = INT_MAX; msleep_interruptible(data * 1000); del_timer_sync(&lp->blink_timer); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html