[PATCH] i40e: only register client on iWarp-capable devices
The client interface is only intended for use on devices that support iWarp). Only register with the client if this is the case. This fixes a panic when loading i40iw on X710 devices. Signed-off-by: Mitch Williams Reported-by: Stefan Assmann --- drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 87d99fa..5e0e44e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -11828,10 +11828,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) round_jiffies(jiffies + pf->service_timer_period)); /* add this PF to client device list and launch a client service task */ - err = i40e_lan_add_device(pf); - if (err) - dev_info(&pdev->dev, "Failed to add PF to client API service list: %d\n", -err); + if (pf->flags & I40E_FLAG_IWARP_ENABLED) { + err = i40e_lan_add_device(pf); + if (err) + dev_info(&pdev->dev, "Failed to add PF to client API service list: %d\n", +err); + } #define PCI_SPEED_SIZE 8 #define PCI_WIDTH_SIZE 8 @@ -12013,10 +12015,11 @@ static void i40e_remove(struct pci_dev *pdev) i40e_vsi_release(pf->vsi[pf->lan_vsi]); /* remove attached clients */ - ret_code = i40e_lan_del_device(pf); - if (ret_code) { - dev_warn(&pdev->dev, "Failed to delete client device: %d\n", -ret_code); + if (pf->flags & I40E_FLAG_IWARP_ENABLED) { + ret_code = i40e_lan_del_device(pf); + if (ret_code) + dev_warn(&pdev->dev, "Failed to delete client device: %d\n", +ret_code); } /* shutdown and destroy the HMC */ -- 2.7.4
[PATCH 1/3] Kernel support for flexible wakeup filters
Add ethtool infrastructure support for Wake-on-Lan flexible filters. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 71d4ada..70b86da 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -56,6 +56,16 @@ struct ethtool_wolinfo { __u8sopass[SOPASS_MAX]; /* SecureOn(tm) password */ }; +#define WOL_FILTER_MAX_LEN 256 +#define WOL_FILTER_IGNORE_OCTET 0x100 +/* wake-on-lan flexible filters */ +struct ethtool_wol_filter { + __u32 cmd; + __u32 index; + __u32 len; + __u16 mask_val[0]; +}; + /* for passing single values */ struct ethtool_value { __u32 cmd; @@ -326,6 +336,8 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data); * get_stats: Return statistics about the device * get_flags: get 32-bit flags bitmap * set_flags: set 32-bit flags bitmap + * get_wol_filter: get user-defined Wake-on-Lan filter + * set_wol_filter: set user-defined Wake-on-Lan filter * * Description: * @@ -391,6 +403,8 @@ struct ethtool_ops { u32 (*get_priv_flags)(struct net_device *); int (*set_priv_flags)(struct net_device *, u32); int (*get_sset_count)(struct net_device *, int); + int (*get_wol_filter)(struct net_device *, struct ethtool_wol_filter *, u16 *); + int (*set_wol_filter)(struct net_device *, struct ethtool_wol_filter *, u16 *); /* the following hooks are obsolete */ int (*self_test_count)(struct net_device *);/* use get_sset_count */ @@ -440,6 +454,9 @@ struct ethtool_ops { #define ETHTOOL_SFLAGS 0x0026 /* Set flags bitmap(ethtool_value) */ #define ETHTOOL_GPFLAGS0x0027 /* Get driver-private flags bitmap */ #define ETHTOOL_SPFLAGS0x0028 /* Set driver-private flags bitmap */ +#define ETHTOOL_GNUMWOLFILT0x0029 /* Get number of WOL filters. */ +#define ETHTOOL_GWOLFILTER 0x002a /* Get WOL filter */ +#define ETHTOOL_SWOLFILTER 0x002b /* Set WOL filter */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET @@ -526,5 +543,6 @@ struct ethtool_ops { #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ +#define WAKE_FILTER(1 << 7) #endif /* _LINUX_ETHTOOL_H */ diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 1163eb2..9ba9eb5 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -272,6 +272,64 @@ static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) return dev->ethtool_ops->set_wol(dev, &wol); } +static int ethtool_get_wol_filter(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_wol_filter wolfilt = { ETHTOOL_GWOLFILTER }; + u16 *data; + + if (!dev->ethtool_ops->get_wol_filter) + return -EOPNOTSUPP; + + data = kmalloc(WOL_FILTER_MAX_LEN * 2, GFP_KERNEL); + if (!data) + return -ENOMEM; + + if (copy_from_user(&wolfilt, useraddr, sizeof(wolfilt))) + return -EFAULT; + + dev->ethtool_ops->get_wol_filter(dev, &wolfilt, data); + + if (copy_to_user(useraddr, &wolfilt, sizeof(wolfilt))) + return -EFAULT; + if (copy_to_user(useraddr + sizeof(wolfilt), data, wolfilt.len * 2)) + return -EFAULT; + + kfree(data); + return 0; +} + +static int ethtool_set_wol_filter(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_wol_filter wolfilt; + u16 *data = NULL; + int ret; + + if (!dev->ethtool_ops->get_wol_filter) + return -EOPNOTSUPP; + + if (copy_from_user(&wolfilt, useraddr, sizeof(wolfilt))) + return -EFAULT; + + if (wolfilt.len > WOL_FILTER_MAX_LEN) + return -EOPNOTSUPP; + + if (wolfilt.len) { + data = kmalloc(wolfilt.len * 2, GFP_KERNEL); + if (!data) + return -ENOMEM; + } + + ret = -EFAULT; + if (copy_from_user(data, useraddr + sizeof(wolfilt), wolfilt.len * 2)) + goto out; + + ret = dev->ethtool_ops->set_wol_filter(dev, &wolfilt, data); +out: + kfree(data); + return ret; + +} + static int ethtool_nway_reset(struct net_device *dev) { if (!dev->ethtool_ops->nway_reset) @@ -964,6 +1022,13 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) rc = ethtool_set_value(dev, useraddr, dev->ethtool_ops->set_priv_flags); break; + case ETHTOOL_GNUMWOLFILT: + case ETHTOOL_GWOLFILTER: + rc = ethtool_get_wol_filter(dev, useraddr); +
[PATCH 3/3] Add flexible wake filter support to ethtool-6
Add support for Wake-on-Lan flexible filters to ethtool.To set a filter: $ ethtool -F ethx where is a string of hex digits (or xx for ignore) describing bytes from the beginning of the expected packet. For example: $ ethtool -F eth0 0 00a055667788449976xx32 To show a filter: $ ethtool -f ethx Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff --git a/ethtool-copy.h b/ethtool-copy.h index 3a63224..dbad8dc 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -55,6 +55,16 @@ struct ethtool_wolinfo { __u8sopass[SOPASS_MAX]; /* SecureOn(tm) password */ }; +#define WOL_FILTER_MAX_LEN 256 +#define WOL_FILTER_IGNORE_OCTET 0x100 +/* wake-on-lan flexible filters */ +struct ethtool_wol_filter { + u32 cmd; + u32 index; + u32 len; + u16 mask_val[0]; +}; + /* for passing single values */ struct ethtool_value { __u32 cmd; @@ -414,6 +424,9 @@ 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_GNUMWOLFILT0x0029 +#define ETHTOOL_GWOLFILTER 0x002a /* Get WOL flex filter */ +#define ETHTOOL_SWOLFILTER 0x002b /* Set WOL flex filter */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET @@ -500,5 +513,6 @@ struct ethtool_ops { #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ +#define WAKE_FILTER(1 << 7) #endif /* _LINUX_ETHTOOL_H */ diff --git a/ethtool.c b/ethtool.c index a668b49..febd7e6 100644 --- a/ethtool.c +++ b/ethtool.c @@ -69,6 +69,9 @@ static int do_scoalesce(int fd, struct ifreq *ifr); static int do_goffload(int fd, struct ifreq *ifr); static int do_soffload(int fd, struct ifreq *ifr); static int do_gstats(int fd, struct ifreq *ifr); +static int do_gwolfilter(int fd, struct ifreq *ifr); +static int do_swolfilter(int fd, struct ifreq *ifr); +static void parse_filter(char *cmdline); static enum { MODE_HELP = -1, @@ -90,6 +93,8 @@ static enum { MODE_GOFFLOAD, MODE_SOFFLOAD, MODE_GSTATS, + MODE_GFILTER, + MODE_SFILTER, } mode = MODE_GSET; static struct option { @@ -170,6 +175,8 @@ static struct option { { "-t", "--test", MODE_TEST, "Execute adapter self test", " [ online | offline ]\n" }, { "-S", "--statistics", MODE_GSTATS, "Show adapter statistics" }, +{ "-f", "--show-filter", MODE_GFILTER, "Show WOL filter N\n"}, +{ "-F", "--change-filter", MODE_SFILTER, "Set WOL filter N\n"}, { "-h", "--help", MODE_HELP, "Show this help" }, {} }; @@ -266,6 +273,10 @@ static int seeprom_changed = 0; static int seeprom_magic = 0; static int seeprom_offset = -1; static int seeprom_value = 0; +static int gfilter_num = 0; +static int sfilter_num = 0; +static u16 filter[WOL_FILTER_MAX_LEN]; +static int filter_len = 0; static enum { ONLINE=0, OFFLINE, @@ -430,6 +441,8 @@ static void parse_cmdline(int argc, char **argp) (mode == MODE_GOFFLOAD) || (mode == MODE_SOFFLOAD) || (mode == MODE_GSTATS) || + (mode == MODE_GFILTER) || + (mode == MODE_SFILTER) || (mode == MODE_PHYS_ID)) { devname = argp[i]; break; @@ -509,6 +522,26 @@ static void parse_cmdline(int argc, char **argp) i = argc; break; } + if (mode == MODE_GFILTER) { + long v; + v = strtol(argp[i], NULL, 0); + if (v < 0) + show_usage(1); + gfilter_num = (int) v; + break; + } + if (mode == MODE_SFILTER) { + long v; + v = strtol(argp[i], NULL, 0); + if (v < 0) + show_usage(1); + sfilter_num = (int) v; + i += 1; + if (i >= argc) + show_usage(1); + parse_filter(argp[i]); + break; + }
[PATCH 2/3] Add flexible wake filter support to e1000e
Add support to e1000e for Wake-on-Lan flexible filters. This feature is supported by all hardware that the driver supports. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 6232c3e..3c18a09 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h @@ -65,6 +65,15 @@ #define E1000_WUFC_BC 0x0010 /* Broadcast Wakeup Enable */ #define E1000_WUFC_ARP 0x0020 /* ARP Request Packet Wakeup Enable */ +/* Four Flexible Filters are supported */ +#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 +#define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */ +#define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ +#define E1000_WUFC_FLX_FILTERS 0x000F /* Mask for the 4 flexible filters */ + +/* Each Flexible Filter is at most 128 (0x80) bytes in length */ +#define E1000_FLEXIBLE_FILTER_SIZE_MAX 128 + /* Extended Device Control */ #define E1000_CTRL_EXT_SDP7_DATA 0x0080 /* Value of SW Defineable Pin 7 */ #define E1000_CTRL_EXT_EE_RST0x2000 /* Reinitialize from EEPROM */ diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 8b88c22..da0538a 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h @@ -267,6 +267,7 @@ struct e1000_adapter { unsigned long led_status; unsigned int flags; + u32 wol_filters; }; struct e1000_info { diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 9fab444..25b7b4f 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -1633,7 +1633,8 @@ static void e1000_get_wol(struct net_device *netdev, wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC | -WAKE_PHY | WAKE_ARP; +WAKE_PHY | WAKE_ARP | +WAKE_FILTER; /* apply any specific unsupported masks here */ if (adapter->flags & FLAG_NO_WAKE_UCAST) { @@ -1656,6 +1657,8 @@ static void e1000_get_wol(struct net_device *netdev, wol->wolopts |= WAKE_PHY; if (adapter->wol & E1000_WUFC_ARP) wol->wolopts |= WAKE_ARP; + if (adapter->wol & E1000_WUFC_FLX_FILTERS) + wol->wolopts |= WAKE_FILTER; } static int e1000_set_wol(struct net_device *netdev, @@ -1684,6 +1687,95 @@ static int e1000_set_wol(struct net_device *netdev, adapter->wol |= E1000_WUFC_LNKC; if (wol->wolopts & WAKE_ARP) adapter->wol |= E1000_WUFC_ARP; + if (wol->wolopts & WAKE_FILTER) + adapter->wol |= adapter->wol_filters; + + return 0; +} + +static int e1000_get_wol_filter(struct net_device *netdev, + struct ethtool_wol_filter *wolfilt, + u16 *mask_val) +{ + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; + u32 mask, mt_val, vt_val, fflt, shift; + int i; + + if (wolfilt->cmd == ETHTOOL_GNUMWOLFILT) { + wolfilt->index = E1000_FLEXIBLE_FILTER_COUNT_MAX; + wolfilt->len = 0; + return 0; + } + + if (wolfilt->index > E1000_FLEXIBLE_FILTER_COUNT_MAX) + return -EOPNOTSUPP; + + mask = 1 << wolfilt->index; + shift = wolfilt->index * 8; + + fflt = E1000_READ_REG_ARRAY(hw, E1000_FFLT, wolfilt->index*2); + wolfilt->len = fflt & 0xff; + for (i = 0; i < wolfilt->len; i++) { + mt_val = E1000_READ_REG_ARRAY(hw, E1000_FFMT, i*2); + vt_val = E1000_READ_REG_ARRAY(hw, E1000_FFVT, i*2); + mt_val &= mask; + vt_val = (vt_val >> shift) & 0xff; + if (!mt_val) + mask_val[i] = WOL_FILTER_IGNORE_OCTET | vt_val; + else + mask_val[i] = vt_val; + } + + return 0; +} + +static int e1000_set_wol_filter(struct net_device *netdev, + struct ethtool_wol_filter *wolfilt, + u16 *mask_val) +{ + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; + int i, shift; + u32 mask, wufc, mt_val, vt_val, fflt; + + if ((wolfilt->index > E1000_FLEXIBLE_FILTER_COUNT_MAX) || + (wolfilt->len > E1000_FLEXIBLE_FILTER_SIZE_MAX)) + return -EOPNOTSUPP; + + wufc = er32(WUFC); + mask = 1 << wolfilt->index; + if (wolfilt->len) { + shift = wolfilt->index * 8; + /* first, disable all filters */ + ew32(WUFC, (wufc & ~E1000_WUFC_FLX_FILTERS)); + for (i = 0; i
[PATCH 0/3] Add flexible wake filter support
This patchset adds support for Wake-on-Lan flexible filters to ethtool and to e1000e. Since this hardware feature is required for certification on Another Operating System(TM), it's likely that most current hardware supports it in one form or another. To set a filter: $ ethtool -F ethx where is a string of hex digits (or xx for ignore) describing bytes from the beginning of the expected packet. For example: $ ethtool -F eth0 0 00a055667788449976xx32 To show a filter: $ ethtool -f ethx This feature gives more wakeup flexibility for people who need it. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> -- 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.24] e1000e: add new wakeup cababilities
Ethtool supports wake-on-ARP and wake-on-link, and so does the hardware supported by e1000e. This patch just introduces the two. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index f2175ea..6232c3e 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h @@ -63,6 +63,7 @@ #define E1000_WUFC_EX 0x0004 /* Directed Exact Wakeup Enable */ #define E1000_WUFC_MC 0x0008 /* Directed Multicast Wakeup Enable */ #define E1000_WUFC_BC 0x0010 /* Broadcast Wakeup Enable */ +#define E1000_WUFC_ARP 0x0020 /* ARP Request Packet Wakeup Enable */ /* Extended Device Control */ #define E1000_CTRL_EXT_SDP7_DATA 0x0080 /* Value of SW Defineable Pin 7 */ diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6d9c27f..9fab444 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -1632,7 +1632,8 @@ static void e1000_get_wol(struct net_device *netdev, return; wol->supported = WAKE_UCAST | WAKE_MCAST | -WAKE_BCAST | WAKE_MAGIC; +WAKE_BCAST | WAKE_MAGIC | +WAKE_PHY | WAKE_ARP; /* apply any specific unsupported masks here */ if (adapter->flags & FLAG_NO_WAKE_UCAST) { @@ -1651,6 +1652,10 @@ static void e1000_get_wol(struct net_device *netdev, wol->wolopts |= WAKE_BCAST; if (adapter->wol & E1000_WUFC_MAG) wol->wolopts |= WAKE_MAGIC; + if (adapter->wol & E1000_WUFC_LNKC) + wol->wolopts |= WAKE_PHY; + if (adapter->wol & E1000_WUFC_ARP) + wol->wolopts |= WAKE_ARP; } static int e1000_set_wol(struct net_device *netdev, @@ -1658,7 +1663,7 @@ static int e1000_set_wol(struct net_device *netdev, { struct e1000_adapter *adapter = netdev_priv(netdev); - if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) + if (wol->wolopts & WAKE_MAGICSECURE) return -EOPNOTSUPP; if (!(adapter->flags & FLAG_HAS_WOL)) @@ -1675,6 +1680,10 @@ static int e1000_set_wol(struct net_device *netdev, adapter->wol |= E1000_WUFC_BC; if (wol->wolopts & WAKE_MAGIC) adapter->wol |= E1000_WUFC_MAG; + if (wol->wolopts & WAKE_PHY) + adapter->wol |= E1000_WUFC_LNKC; + if (wol->wolopts & WAKE_ARP) + adapter->wol |= E1000_WUFC_ARP; return 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 1/2] HW VLAN filtering control (resend)
Add support to the VLAN subsystem for enabling/disabling hardware VLAN filtering at runtime. This is useful for debugging purposes. The existing vconfig utility can be used without modification. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.22.1-clean/include/linux/if_vlan.h linux-2.6.22.1/include/linux/if_vlan.h --- linux-2.6.22.1-clean/include/linux/if_vlan.h2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/include/linux/if_vlan.h 2007-07-26 16:29:00.0 -0700 @@ -106,7 +106,20 @@ struct vlan_priority_tci_mapping { */ struct vlan_priority_tci_mapping *next; }; - +#define VLAN_FLAG_REORDER 1/* (1 << 0) re_order_header This option will cause the +* VLAN code to move around the ethernet header on +* ingress to make the skb look **exactly** like it +* came in from an ethernet port. This destroys some of +* the VLAN information in the skb, but it fixes programs +* like DHCP that use packet-filtering and don't understand +* 802.1Q +*/ + +#define VLAN_FLAG_DISABLE_FILTER 2 /* (1 << 1) disable HW filtering. This flag allows +* devices that perform hardware filtering to +* turn off filtering. This may be useful for +* debugging or for sniffer applications. +*/ /* Holds information that makes sense if this device is a VLAN device. */ struct vlan_dev_info { /** This will be the mapping that correlates skb->priority to @@ -116,14 +129,7 @@ struct vlan_dev_info { struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */ unsigned short vlan_id;/* The VLAN Identifier for this interface. */ - unsigned short flags; /* (1 << 0) re_order_header This option will cause the -* VLAN code to move around the ethernet header on -* ingress to make the skb look **exactly** like it -* came in from an ethernet port. This destroys some of -* the VLAN information in the skb, but it fixes programs -* like DHCP that use packet-filtering and don't understand -* 802.1Q -*/ + unsigned short flags; struct dev_mc_list *old_mc_list; /* old multi-cast list for the VLAN interface.. * we save this so we can tell what changes were * made, in order to feed the right changes down diff -urpN -X dontdiff linux-2.6.22.1-clean/include/linux/netdevice.h linux-2.6.22.1/include/linux/netdevice.h --- linux-2.6.22.1-clean/include/linux/netdevice.h 2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/include/linux/netdevice.h2007-07-26 16:29:00.0 -0700 @@ -522,7 +522,9 @@ struct net_device unsigned short vid); void(*vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); - +#define HAVE_VLAN_FLAGS + int (*vlan_set_flag)(struct net_device *dev, + unsigned int flag, int value); int (*hard_header_parse)(struct sk_buff *skb, unsigned char *haddr); int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); diff -urpN -X dontdiff linux-2.6.22.1-clean/net/8021q/vlan_dev.c linux-2.6.22.1/net/8021q/vlan_dev.c --- linux-2.6.22.1-clean/net/8021q/vlan_dev.c 2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/net/8021q/vlan_dev.c 2007-07-27 11:40:22.0 -0700 @@ -593,37 +593,58 @@ int vlan_dev_set_egress_priority(char *d /* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */ int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val) { + struct net_device *real_dev; struct net_device *dev = dev_get_by_name(dev_name); + int ret = 0; - if (dev) { - if (dev->priv_flags & IFF_802_1Q_VLAN) { - /* verify flag is supported */ - if (flag == 1) {
[PATCH 2/2] HW VLAN filtering control (resend)
Add support to e1000 for enabling/disabling hardware VLAN filtering at runtime. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.22.1-clean/drivers/net/e1000/e1000_main.c linux-2.6.22.1/drivers/net/e1000/e1000_main.c --- linux-2.6.22.1-clean/drivers/net/e1000/e1000_main.c 2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/drivers/net/e1000/e1000_main.c 2007-07-27 13:16:52.0 -0700 @@ -197,6 +197,9 @@ static void e1000_vlan_rx_register(struc static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); static void e1000_restore_vlan(struct e1000_adapter *adapter); +#ifdef HAVE_VLAN_FLAGS +static int e1000_vlan_set_flag(struct net_device *netdev, unsigned int flag, int value); +#endif static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); #ifdef CONFIG_PM @@ -938,6 +941,10 @@ e1000_probe(struct pci_dev *pdev, netdev->vlan_rx_register = e1000_vlan_rx_register; netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid; +#ifdef HAVE_VLAN_FLAGS + netdev->vlan_set_flag = e1000_vlan_set_flag; +#endif + #ifdef CONFIG_NET_POLL_CONTROLLER netdev->poll_controller = e1000_netpoll; #endif @@ -4973,7 +4980,42 @@ e1000_vlan_rx_register(struct net_device e1000_irq_enable(adapter); } +#ifdef HAVE_VLAN_FLAGS +static int +e1000_vlan_set_flag(struct net_device *netdev, unsigned int flag, int value) +{ + struct e1000_adapter *adapter = netdev_priv(netdev); + uint32_t rctl; + /* The only flag we currently care about is bit 1, + which controls HW filtering. */ + e1000_irq_disable(adapter); + if (adapter->hw.mac_type == e1000_ich8lan) + return -EPERM; + + if (flag == VLAN_FLAG_DISABLE_FILTER) { + if (value) { + /* disable VLAN filtering */ + rctl = E1000_READ_REG(&adapter->hw, RCTL); + rctl &= ~E1000_RCTL_VFE; + E1000_WRITE_REG(&adapter->hw, RCTL, rctl); + netdev->features &= ~NETIF_F_HW_VLAN_FILTER; + } else { + /* enable VLAN receive filtering */ + rctl = E1000_READ_REG(&adapter->hw, RCTL); + rctl |= E1000_RCTL_VFE; + rctl &= ~E1000_RCTL_CFIEN; + E1000_WRITE_REG(&adapter->hw, RCTL, rctl); + netdev->features |= NETIF_F_HW_VLAN_FILTER; + e1000_restore_vlan(adapter); + e1000_update_mng_vlan(adapter); + } + } + + e1000_irq_enable(adapter); + return 0; +} +#endif static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) { - 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 0/2] HW VLAN filtering control (resend)
This patchset adds the capability to disable hardware VLAN filtering at runtime via the existing vconfig utility. It's useful for debugging purposes. The first patch modifies the VLAN subsystem to define the flag, and to support passing the flag on to the base driver. The second patch modifies e1000 to support the flag. Since it's only one function, other drivers can be easily modified to support this functionality. vconfig is used without modification to enable or disable filtering: # vconfig [vlan-interface] 2 1 will disable filtering, and # vconfig [vlan-interface] 2 0 will enable filtering. (Now with non-mangled goodness.) Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> - 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 0/2] HW VLAN filtering control
On Fri, 2007-07-27 at 14:06 -0700, Ben Greear wrote: > This looks fine to me. > > Ben > Grr. Except that Evolution mangled them. I'll have to repost. -Mitch - 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] HW VLAN filtering control
Add support to e1000 for enabling/disabling hardware VLAN filtering at runtime. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.22.1-clean/drivers/net/e1000/e1000_main.c linux-2.6.22.1/drivers/net/e1000/e1000_main.c --- linux-2.6.22.1-clean/drivers/net/e1000/e1000_main.c 2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/drivers/net/e1000/e1000_main.c 2007-07-27 13:16:52.0 -0700 @@ -197,6 +197,9 @@ static void e1000_vlan_rx_register(struc static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); static void e1000_restore_vlan(struct e1000_adapter *adapter); +#ifdef HAVE_VLAN_FLAGS +static int e1000_vlan_set_flag(struct net_device *netdev, unsigned int flag, int value); +#endif static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); #ifdef CONFIG_PM @@ -938,6 +941,10 @@ e1000_probe(struct pci_dev *pdev, netdev->vlan_rx_register = e1000_vlan_rx_register; netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid; +#ifdef HAVE_VLAN_FLAGS + netdev->vlan_set_flag = e1000_vlan_set_flag; +#endif + #ifdef CONFIG_NET_POLL_CONTROLLER netdev->poll_controller = e1000_netpoll; #endif @@ -4973,7 +4980,42 @@ e1000_vlan_rx_register(struct net_device e1000_irq_enable(adapter); } +#ifdef HAVE_VLAN_FLAGS +static int +e1000_vlan_set_flag(struct net_device *netdev, unsigned int flag, int value) +{ + struct e1000_adapter *adapter = netdev_priv(netdev); + uint32_t rctl; + /* The only flag we currently care about is bit 1, + which controls HW filtering. */ + e1000_irq_disable(adapter); + if (adapter->hw.mac_type == e1000_ich8lan) + return -EPERM; + + if (flag == VLAN_FLAG_DISABLE_FILTER) { + if (value) { + /* disable VLAN filtering */ + rctl = E1000_READ_REG(&adapter->hw, RCTL); + rctl &= ~E1000_RCTL_VFE; + E1000_WRITE_REG(&adapter->hw, RCTL, rctl); + netdev->features &= ~NETIF_F_HW_VLAN_FILTER; + } else { + /* enable VLAN receive filtering */ + rctl = E1000_READ_REG(&adapter->hw, RCTL); + rctl |= E1000_RCTL_VFE; + rctl &= ~E1000_RCTL_CFIEN; + E1000_WRITE_REG(&adapter->hw, RCTL, rctl); + netdev->features |= NETIF_F_HW_VLAN_FILTER; + e1000_restore_vlan(adapter); + e1000_update_mng_vlan(adapter); + } + } + + e1000_irq_enable(adapter); + return 0; +} +#endif static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) { - 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] HW VLAN filtering control
Add support to the VLAN subsystem for enabling/disabling hardware VLAN filtering at runtime. This is useful for debugging purposes. The existing vconfig utility can be used without modification. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.22.1-clean/include/linux/if_vlan.h linux-2.6.22.1/include/linux/if_vlan.h --- linux-2.6.22.1-clean/include/linux/if_vlan.h2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/include/linux/if_vlan.h 2007-07-26 16:29:00.0 -0700 @@ -106,7 +106,20 @@ struct vlan_priority_tci_mapping { */ struct vlan_priority_tci_mapping *next; }; - +#define VLAN_FLAG_REORDER 1/* (1 << 0) re_order_header This option will cause the +* VLAN code to move around the ethernet header on +* ingress to make the skb look **exactly** like it +* came in from an ethernet port. This destroys some of +* the VLAN information in the skb, but it fixes programs +* like DHCP that use packet-filtering and don't understand +* 802.1Q +*/ + +#define VLAN_FLAG_DISABLE_FILTER 2 /* (1 << 1) disable HW filtering. This flag allows +* devices that perform hardware filtering to +* turn off filtering. This may be useful for +* debugging or for sniffer applications. +*/ /* Holds information that makes sense if this device is a VLAN device. */ struct vlan_dev_info { /** This will be the mapping that correlates skb->priority to @@ -116,14 +129,7 @@ struct vlan_dev_info { struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */ unsigned short vlan_id;/* The VLAN Identifier for this interface. */ - unsigned short flags; /* (1 << 0) re_order_header This option will cause the -* VLAN code to move around the ethernet header on -* ingress to make the skb look **exactly** like it -* came in from an ethernet port. This destroys some of -* the VLAN information in the skb, but it fixes programs -* like DHCP that use packet-filtering and don't understand -* 802.1Q -*/ + unsigned short flags; struct dev_mc_list *old_mc_list; /* old multi-cast list for the VLAN interface.. * we save this so we can tell what changes were * made, in order to feed the right changes down diff -urpN -X dontdiff linux-2.6.22.1-clean/include/linux/netdevice.h linux-2.6.22.1/include/linux/netdevice.h --- linux-2.6.22.1-clean/include/linux/netdevice.h 2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/include/linux/netdevice.h2007-07-26 16:29:00.0 -0700 @@ -522,7 +522,9 @@ struct net_device unsigned short vid); void(*vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); - +#define HAVE_VLAN_FLAGS + int (*vlan_set_flag)(struct net_device *dev, + unsigned int flag, int value); int (*hard_header_parse)(struct sk_buff *skb, unsigned char *haddr); int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); diff -urpN -X dontdiff linux-2.6.22.1-clean/net/8021q/vlan_dev.c linux-2.6.22.1/net/8021q/vlan_dev.c --- linux-2.6.22.1-clean/net/8021q/vlan_dev.c 2007-07-10 11:56:30.0 -0700 +++ linux-2.6.22.1/net/8021q/vlan_dev.c 2007-07-27 11:40:22.0 -0700 @@ -593,37 +593,58 @@ int vlan_dev_set_egress_priority(char *d /* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */ int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val) { + struct net_device *real_dev; struct net_device *dev = dev_get_by_name(dev_name); + int ret = 0; - if (dev) { - if (dev->priv_flags & IFF_802_1Q_VLAN) { - /* verify flag is supported */ - if (flag == 1) { - if (flag_val) { -
[PATCH 0/2] HW VLAN filtering control
This patchset adds the capability to disable hardware VLAN filtering at runtime via the existing vconfig utility. It's useful for debugging purposes. The first patch modifies the VLAN subsystem to define the flag, and to support passing the flag on to the base driver. The second patch modifies e1000 to support the flag. Since it's only one function, other drivers can be easily modified to support this functionality. vconfig is used without modification to enable or disable filtering: # vconfig [vlan-interface] 2 1 will disable filtering, and # vconfig [vlan-interface] 2 0 will enable filtering. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> - 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 1/7] bonding: Add 10 Gig support
Note to self: Do not use Pine EVER AGAIN. Sorry for the badness. Evolution is my new best friend. -Mitch On Wed, 2006-09-06 at 12:22 -0700, Jay Vosburgh wrote: > > [Trying again; /usr/bin/patch didn't complain about Mitch's > original; here's a cg-diff generated from where I checked his in, > git-apply seems ok with it. The problem seems to be the empty line > between "//endallnoun" and "// compare MAC"; in the original it's a > totally empty line, from cg-diff, there's a single space on there. -J] - 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 1/7] bonding: Add 10 Gig support
Add 10 Gig support to bonding. Resent due to corrupt patch. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> Acked-by: Jay Vosburgh <[EMAIL PROTECTED]> diff -urpN -X linux-2.6.18-rc4-clean/Documentation/dontdiff linux-2.6.18-rc4-clean/drivers/net/bonding/bond_3ad.c linux-2.6.18-rc4/drivers/net/bonding/bond_3ad.c --- linux-2.6.18-rc4-clean/drivers/net/bonding/bond_3ad.c 2006-06-17 18:49:35.0 -0700 +++ linux-2.6.18-rc4/drivers/net/bonding/bond_3ad.c 2006-08-30 11:31:45.0 -0700 @@ -85,6 +85,7 @@ #define AD_LINK_SPEED_BITMASK_10MBPS 0x2 #define AD_LINK_SPEED_BITMASK_100MBPS 0x4 #define AD_LINK_SPEED_BITMASK_1000MBPS0x8 +#define AD_LINK_SPEED_BITMASK_1MBPS 0x10 //endalloun // compare MAC addresses @@ -330,7 +331,8 @@ static inline void __release_rx_machine_ * 0, * %AD_LINK_SPEED_BITMASK_10MBPS, * %AD_LINK_SPEED_BITMASK_100MBPS, - * %AD_LINK_SPEED_BITMASK_1000MBPS + * %AD_LINK_SPEED_BITMASK_1000MBPS, + * %AD_LINK_SPEED_BITMASK_1MBPS */ static u16 __get_link_speed(struct port *port) { @@ -357,6 +359,10 @@ static u16 __get_link_speed(struct port speed = AD_LINK_SPEED_BITMASK_1000MBPS; break; + case SPEED_1: + speed = AD_LINK_SPEED_BITMASK_1MBPS; + break; + default: speed = 0; // unknown speed value from ethtool. shouldn't happen break; @@ -775,6 +781,9 @@ static u32 __get_agg_bandwidth(struct ag case AD_LINK_SPEED_BITMASK_1000MBPS: bandwidth = aggregator->num_of_ports * 1000; break; + case AD_LINK_SPEED_BITMASK_1MBPS: + bandwidth = aggregator->num_of_ports * 1; + break; default: bandwidth=0; // to silent the compilor } diff -urpN -X linux-2.6.18-rc4-clean/Documentation/dontdiff linux-2.6.18-rc4-clean/drivers/net/bonding/bond_main.c linux-2.6.18-rc4/drivers/net/bonding/bond_main.c --- linux-2.6.18-rc4-clean/drivers/net/bonding/bond_main.c 2006-08-21 13:28:43.0 -0700 +++ linux-2.6.18-rc4/drivers/net/bonding/bond_main.c2006-08-30 10:49:37.0 -0700 @@ -638,6 +638,7 @@ verify: case SPEED_10: case SPEED_100: case SPEED_1000: + case SPEED_1: break; default: return -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
[RFC] Wake-on-LAN flex filters
Most modern Ethernet hardware supports flexible filters for wake-on-LAN, probably because it's a requirement for certification with Another Operating System. This patch implements this feature on e1000 via Ethtool. The kernel portion of this code is fairly well polished, but the changes to the tool are extremely hacky and ugly. Don't bother to comment on that portion; if people want this feature either Jeff or I will redo it correctly. To create a filter: # ethtool -F where can be from 0 - 3 (at least for e1000), and where filter is a string of hex digits describing what the filtered frame should look like. Each byte MUST be represented by two hex digits, and no whitespace is allowed. If a particular byte should be ignored by the filter, represent it with "xx". For example: # ethtool -F eth0 1 0011223344567890xx To show a filter: # ethtool -f To enable WOL filters (after setting one): # ethtool -s wol f Please review and comment, and thanks. Kernel patch is inline, ethtool patch is attached. -Mitch diff -urpN -X linux-2.6.18-rc4/Documentation/dontdiff linux-2.6.18-rc4-clean/include/linux/ethtool.h linux-2.6.18-rc4/include/linux/ethtool.h --- linux-2.6.18-rc4-clean/include/linux/ethtool.h 2006-08-21 13:28:47.0 -0700 +++ linux-2.6.18-rc4/include/linux/ethtool.h2006-08-21 13:48:59.0 -0700 @@ -53,6 +53,17 @@ struct ethtool_wolinfo { __u32 supported; __u32 wolopts; __u8sopass[SOPASS_MAX]; /* SecureOn(tm) password */ + __u32 n_filters; +}; + +#define WOL_FILTER_MAX 256 +#define WOL_FILTER_IGNORE 0x100 +/* wake-on-lan flexible filters */ +struct ethtool_wol_filter { + __u32 cmd; + __u32 index; + __u32 len; + __u16 mask_val[0]; }; /* for passing single values */ @@ -372,6 +383,8 @@ struct ethtool_ops { void(*complete)(struct net_device *); u32 (*get_ufo)(struct net_device *); int (*set_ufo)(struct net_device *, u32); + int (*get_wol_filter)(struct net_device *, struct ethtool_wol_filter *, u16 *); + int (*set_wol_filter)(struct net_device *, struct ethtool_wol_filter *, u16 *); }; #endif /* __KERNEL__ */ @@ -413,6 +426,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_GWOLFILTER 0x0025 /* Get WOL flex filter */ +#define ETHTOOL_SWOLFILTER 0x0026 /* Set WOL flex filter */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET @@ -497,5 +512,6 @@ struct ethtool_ops { #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ +#define WAKE_FILTER(1 << 7) #endif /* _LINUX_ETHTOOL_H */ diff -urpN -X linux-2.6.18-rc4/Documentation/dontdiff linux-2.6.18-rc4-clean/net/core/ethtool.c linux-2.6.18-rc4/net/core/ethtool.c --- linux-2.6.18-rc4-clean/net/core/ethtool.c 2006-08-21 13:28:48.0 -0700 +++ linux-2.6.18-rc4/net/core/ethtool.c 2006-08-21 13:59:14.0 -0700 @@ -229,6 +229,63 @@ static int ethtool_set_wol(struct net_de return dev->ethtool_ops->set_wol(dev, &wol); } +static int ethtool_get_wol_filter(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_wol_filter wolfilt = { ETHTOOL_GWOLFILTER }; + u16 *data; + + if (!dev->ethtool_ops->get_wol_filter) + return -EOPNOTSUPP; + + data = kmalloc(WOL_FILTER_MAX*2, GFP_KERNEL); + if (!data) + return -ENOMEM; + + if (copy_from_user(&wolfilt, useraddr, sizeof(wolfilt))) + return -EFAULT; + + dev->ethtool_ops->get_wol_filter(dev, &wolfilt, data); + + if (copy_to_user(useraddr, &wolfilt, sizeof(wolfilt))) + return -EFAULT; + if (copy_to_user(useraddr + sizeof(wolfilt), data, wolfilt.len*2)) + return -EFAULT; + + return 0; +} + +static int ethtool_set_wol_filter(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_wol_filter wolfilt; + u16 *data; + int ret; + + if (!dev->ethtool_ops->get_wol_filter) + return -EOPNOTSUPP; + + if (copy_from_user(&wolfilt, useraddr, sizeof(wolfilt))) + return -EFAULT; + + if (wolfilt.len > WOL_FILTER_MAX) + return -EOPNOTSUPP; + + if (wolfilt.len) { + data = kmalloc(wolfilt.len*2, GFP_KERNEL); + if (!data) + return -ENOMEM; + } + + ret = -EFAULT; + if (copy_from_user(data, useraddr + sizeof(wolfilt), wolfilt.len*2)) + goto out; + + ret = dev->ethtool_ops->set_wol_filter(dev, &wolfilt, data); + out:
[RFC] Enable/Disable VLAN HW filters
We've had a few internal requests for a way to enable and disable the hardware VLAN filter at runtime. I'm posting it here for discussion and to see if anybody else is interested in this feature. Originally I had planned to do this as an Ethtool ioctl, but decided instead to handle it through the VLAN module. Ethtool doesn't know anything about VLANs at all. There are no userspace changes required to support this functionality. To disable HW VLAN filtering: # vconfig set_flag 2 1 To enable HW VLAN filtering: # vconfig set_flag 2 0 At this point (somewhat obviously), it's only implemented on e1000, but this ioctl could be easily implemented by other drivers. Originally based on 2.6.17 but applies OK to 2.6.18-rc4 with a little fuzz. diff -urpN -X linux-2.6.17/Documentation/dontdiff linux-2.6.17-clean/include/linux/if_vlan.h linux-2.6.17/include/linux/if_vlan.h --- linux-2.6.17-clean/include/linux/if_vlan.h 2006-06-17 18:49:35.0 -0700 +++ linux-2.6.17/include/linux/if_vlan.h2006-07-13 15:37:41.0 -0700 @@ -87,7 +87,20 @@ struct vlan_priority_tci_mapping { */ struct vlan_priority_tci_mapping *next; }; - +#define VLAN_FLAG_REORDER 1/* (1 << 0) re_order_header This option will cause the +* VLAN code to move around the ethernet header on +* ingress to make the skb look **exactly** like it +* came in from an ethernet port. This destroys some of +* the VLAN information in the skb, but it fixes programs +* like DHCP that use packet-filtering and don't understand +* 802.1Q +*/ + +#define VLAN_FLAG_DISABLE_FILTER 2 /* (1 << 1) disable HW filtering. This flag allows +* devices that perform hardware filtering to +* turn off filtering. This may be useful for +* debugging or for sniffer applications. +*/ /* Holds information that makes sense if this device is a VLAN device. */ struct vlan_dev_info { /** This will be the mapping that correlates skb->priority to @@ -97,14 +110,7 @@ struct vlan_dev_info { struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */ unsigned short vlan_id;/* The VLAN Identifier for this interface. */ - unsigned short flags; /* (1 << 0) re_order_header This option will cause the -* VLAN code to move around the ethernet header on -* ingress to make the skb look **exactly** like it -* came in from an ethernet port. This destroys some of -* the VLAN information in the skb, but it fixes programs -* like DHCP that use packet-filtering and don't understand -* 802.1Q -*/ + unsigned short flags; struct dev_mc_list *old_mc_list; /* old multi-cast list for the VLAN interface.. * we save this so we can tell what changes were * made, in order to feed the right changes down diff -urpN -X linux-2.6.17/Documentation/dontdiff linux-2.6.17-clean/include/linux/netdevice.h linux-2.6.17/include/linux/netdevice.h --- linux-2.6.17-clean/include/linux/netdevice.h2006-06-17 18:49:35.0 -0700 +++ linux-2.6.17/include/linux/netdevice.h 2006-07-17 16:53:26.0 -0700 @@ -484,7 +484,9 @@ struct net_device unsigned short vid); void(*vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); - +#define HAVE_VLAN_FLAGS + int (*vlan_set_flag)(struct net_device *dev, + unsigned int flag, int value); int (*hard_header_parse)(struct sk_buff *skb, unsigned char *haddr); int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); diff -urpN -X linux-2.6.17/Documentation/dontdiff linux-2.6.17-clean/net/8021q/vlan_dev.c linux-2.6.17/net/8021q/vlan_dev.c --- linux-2.6.17-clean/net/8021q/vlan_dev.c 2006-06-17 18:49:35.0 -0700 +++ linux-2.6.17/net/8021q/vlan_dev.c 2006-07-19 10:53:36.0 -0700 @@ -590,37 +590,58 @@ int vlan_dev_set_egress_priori
Re: bonding: cannot remove certain named devices
On Tue, 15 Aug 2006, David Miller wrote: > > I agree that whitespace in device names push the limits of sanity. > > But if we believe that, we should enforce it in dev_valid_name(). > > Does anyone really mind if I add the whitespace check there? > I have no objections. It would certainly make life easier. OTOH, "push[ing] the limits of sanity" probably describes half of the subscribers to netdev. But that's neither here nor there. -Mitch - 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: bonding: cannot remove certain named devices
On Tue, 15 Aug 2006, Bill Nottingham wrote: > > Stephen Hemminger ([EMAIL PROTECTED]) said: > > > They're certainly allowed, and the sysfs directory structure, files, > > > etc. handle it ok. Userspace tends to break in a variety of ways. > > > > > > I believe the only invalid character in an interface name is '/'. > > > > > > > The names "." and ".." are also verboten. > > Right. Well, I suspect they're > verboten-because-some-code-breaks-making-the-directory. > > > Names with : in them are for IP aliases. > So can we use sscanf(buffer, " %[^\n]", command); instead? This should allow for whitespace in the filename. Bad interface names will be caught by the call to dev_valid_name(). (I think I'm reading the man page correctly.) This could have the effect of making the parser way more finicky, though, since we would allow trailing whitespace. Technically I suppose it's legal, but it's sure hard to see on the screen. Anybody have a better solution? -Mitch - 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: bonding: cannot remove certain named devices
On Tue, 15 Aug 2006, Bill Nottingham wrote: > 2.6.17-rc4+. > > Trivial example: > > # modprobe bonding (creates bond0) > # ip link set bond0 name "a b" > # echo "-a b" > /sys/class/net/bonding_masters > bonding: unable to delete non-existent bond a > bash: echo: write error: No such device > Yuck. The problem here is the space in the interface name, which the sysfs code chokes on. The code just does sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ and goes from there. Because of the space, it only gets the first half of the interface name. Suggestions? Do we just omit the sscanf and copy up to the newline (or EOF)? Should there be another delimiter here? Are spaces allowed in interface names anyway? I can't believe that bonding is the only area affected by this. -Mitch BTW this will also break if you try to add/remove a slave with a space in the name through sysfs. - 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 1/2] e1000: fix netpoll with NAPI
Andy Grover <[EMAIL PROTECTED]> is the guy. I'm not sure when he'll be working on this; it's somewhere in his TODO pile. On Thu, 15 Jun 2006, John W. Linville wrote: > > On Wed, Jun 14, 2006 at 04:44:56PM -0700, Mitch Williams wrote: > > > One of our engineers (on the I/O AT team) has been tasked with modifying > > the Linux kernel to properly support multiple hardware queues (both TX and > > RX). We'll make sure that he looks at the netpoll interface as part of > > that process. > > Might I ask who this is? I might like to ping him/her on this topic. > There is potentially some overlap with wireless, at least on the > transmit side. > > John > -- > John W. Linville > [EMAIL PROTECTED] > > > - 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 1/2] e1000: fix netpoll with NAPI
On Wed, 14 Jun 2006, Neil Horman wrote: > Hey, as promised, I've done some rudimentary performance benchmarking on > various > ways that we have talked about to solve this problem. As I previously > mentioned We see the same results here, Neil. However, we've got a much less invasive patch undergoing internal review, and which we will post to netdev once everybody gets happy with it. Basically, we just do our NAPI scheduling on the "real" netdev structure instead of our polling netdev, in the case where we only have one RX queue. Since this is the case for all our currently-shipping parts under Linux, netpoll works again across the board. It's a short-term fix because we do want to support multiple queues going forward, but for now we need to get everybody working. One of our engineers (on the I/O AT team) has been tasked with modifying the Linux kernel to properly support multiple hardware queues (both TX and RX). We'll make sure that he looks at the netpoll interface as part of that process. Stay tuned for our impending patch. -Mitch - 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 1/2] e1000: fix netpoll with NAPI
On Sun, 2006-06-11 at 17:13 -0700, Neil Horman wrote: > Any further thoughts on this guys? I still think my last solution > solves all of > the netpoll problems, and isn't going to have any noticable impact on > performance. > I haven't had time to evaluate performance on your patch (sorry!), but after thinking about it, I agree that it should not have any noticeable impact. OTOH, performance tuning is a funny thing, and things you think won't cause problems often do. Anyway, I'm still not quite ready to ACK this because it's just not future-proof. Eventually, we will need to support multiple RX queues, and this solution will not work in that situation. A simpler short-term solution is just to schedule our NAPI polling on the "real" netdev instead of our polling netdev. This is a trivial change and works correctly with a single queue. But, like your patch, it isn't future-proof. So, I'm still thinking and pondering on this one. If we get a patch in to fix the recursive loop in netpoll, my original patch will work, right? Or is there still another issue? -Mitch - 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 1/2] e1000: fix netpoll with NAPI
On Wed, 2006-06-07 at 11:54 -0700, John W. Linville wrote: > Pedantic objection, but I think this would read easier w/o the extra > newline before disable_irq. Heh. I prefer to have a newline between declarations and code. The real problem is the position of the #ifdef -- that's what makes it difficult to read. The other solution would be { struct e1000_adapter *adapter = netdev_priv(netdev); #ifdef CONFIG_E1000_NAPI int budget = 0; #endif disable_irq(adapter->pdev->irq); #ifdef CONFIG_E1000_NAPI < all that stuff > #else #endif } Which I think is worse to read. -Mitch - 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 1/2] e1000: fix netpoll with NAPI
On Wed, 2006-06-07 at 11:44 -0700, Jeff Moyer wrote: > That patch locks around the tx clean routine. As such, it doesn't > prevent > the problem. The call to netif_rx_schedule_prep provides locking because it sets the __LINK_STATE_RX_SCHED bit atomically. The spinlock around e1000_clean_tx_irq is to protect it from other calls to the transmit routine, not NAPI. -Mitch > > + disable_irq(adapter->pdev->irq); > > + if > (likely(netif_rx_schedule_prep(&adapter->polling_netdev[0]))) { > > + if (spin_trylock(&adapter->tx_queue_lock)) { > > + e1000_clean_tx_irq(adapter, > &adapter->tx_ring[0]); > > + spin_unlock(&adapter->tx_queue_lock); > > + } > > + adapter->clean_rx(adapter, adapter->rx_ring, > > + &budget, netdev->weight); > > + clear_bit(__LINK_STATE_RX_SCHED, > > + &adapter->polling_netdev[0].state); > > -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: [PATCH 1/2] e1000: fix netpoll with NAPI
On Tue, 2006-06-06 at 09:52 -0400, Neil Horman wrote: > I've been speaking about this fix with a Jeff Moyer, and we've come up with > some > concerns regarding its implementation. Specifically the call to > adapter->clean_rx in the case of the e1000 driver is rather a layering > violation in the netpoll code, in the sense that the function pointed to by > clean_rx > is functionality that is nominally used by the dev->poll method. In fact in > this case, it would appear possible since dev->poll is called under the > poll_lock, but dev->poll_controller is not, that is is possible to have cpus > in > a system executing in e1000_clean_rx_irq_[ps] at the same time leading to data > corruption: > > CPU0: > netpoll_poll_dev > dev->poll_controller (e1000_netpoll) > adapter->clean_rx (e1000_clean_rx_irq) > > CPU1: > napi_poll > dev->poll (e1000_clean) > e1000_clean_rx_irq Hmmm. You may have a point. I don't think a spinlock is required, but we do need to check if the poll is already scheduled on another CPU, like netpoll does in poll_napi(). In practice, of course, we never see this. The only netpoll client in the kernel is netconsole, which doesn't do receives. A few Major Distros use netdump, which does do receives, but only after the system has crashed. In that case, all other CPUs are stopped anyway. However, just for the sake of correctness (and paranoia), I'll whip up another patch that does this check. Jeff, please do not commit this patch. -Mitch NB: The root of this problem is that e1000 uses a dummy netdev to schedule NAPI polling. Since netpoll doesn't know about the dummy netdev, it checks the "real" e1000 netdev struct to see if it's scheduled for polling. Since this is never the case, netpoll fails when e1000 is configured to use NAPI. Hence, this patch. Why is the dummy netdev in place? To support multi-queue RX. Our PCIe adapters support this, but the kernel's not _quite_ ready yet. Hopefully, the VJ net channel stuff will enable this feature. - 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.16.11] updated bonding documentation
Added new section describing the sysfs interface. Renumbered sections to be sequential (section 4 was AWOL). Minor spelling corrections. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN linux-2.6.16.11-clean/Documentation/networking/bonding.txt linux-2.6.16.11/Documentation/networking/bonding.txt --- linux-2.6.16.11-clean/Documentation/networking/bonding.txt 2006-04-24 13:20:24.0 -0700 +++ linux-2.6.16.11/Documentation/networking/bonding.txt2006-04-24 16:18:25.0 -0700 @@ -1,7 +1,7 @@ Linux Ethernet Bonding Driver HOWTO - Latest update: 21 June 2005 + Latest update: 24 April 2006 Initial release : Thomas Davis Corrections, HA extensions : 2000/10/03-15 : @@ -12,6 +12,8 @@ Corrections, HA extensions : 2000/10/03- - Jay Vosburgh Reorganized and updated Feb 2005 by Jay Vosburgh +Added Sysfs information: 2006/04/24 + - Mitch Williams Introduction @@ -38,61 +40,62 @@ Table of Contents 2. Bonding Driver Options 3. Configuring Bonding Devices -3.1Configuration with sysconfig support -3.1.1 Using DHCP with sysconfig -3.1.2 Configuring Multiple Bonds with sysconfig -3.2Configuration with initscripts support -3.2.1 Using DHCP with initscripts -3.2.2 Configuring Multiple Bonds with initscripts -3.3Configuring Bonding Manually +3.1Configuration with Sysconfig Support +3.1.1 Using DHCP with Sysconfig +3.1.2 Configuring Multiple Bonds with Sysconfig +3.2Configuration with Initscripts Support +3.2.1 Using DHCP with Initscripts +3.2.2 Configuring Multiple Bonds with Initscripts +3.3Configuring Bonding Manually with Ifenslave 3.3.1 Configuring Multiple Bonds Manually +3.4Configuring Bonding Manually via Sysfs -5. Querying Bonding Configuration -5.1Bonding Configuration -5.2Network Configuration +4. Querying Bonding Configuration +4.1Bonding Configuration +4.2Network Configuration -6. Switch Configuration +5. Switch Configuration -7. 802.1q VLAN Support +6. 802.1q VLAN Support -8. Link Monitoring -8.1ARP Monitor Operation -8.2Configuring Multiple ARP Targets -8.3MII Monitor Operation +7. Link Monitoring +7.1ARP Monitor Operation +7.2Configuring Multiple ARP Targets +7.3MII Monitor Operation -9. Potential Trouble Sources -9.1Adventures in Routing -9.2Ethernet Device Renaming -9.3Painfully Slow Or No Failed Link Detection By Miimon +8. Potential Trouble Sources +8.1Adventures in Routing +8.2Ethernet Device Renaming +8.3Painfully Slow Or No Failed Link Detection By Miimon -10. SNMP agents +9. SNMP agents -11. Promiscuous mode +10. Promiscuous mode -12. Configuring Bonding for High Availability -12.1 High Availability in a Single Switch Topology -12.2 High Availability in a Multiple Switch Topology -12.2.1 HA Bonding Mode Selection for Multiple Switch Topology -12.2.2 HA Link Monitoring for Multiple Switch Topology +11. Configuring Bonding for High Availability +11.1 High Availability in a Single Switch Topology +11.2 High Availability in a Multiple Switch Topology +11.2.1 HA Bonding Mode Selection for Multiple Switch Topology +11.2.2 HA Link Monitoring for Multiple Switch Topology -13. Configuring Bonding for Maximum Throughput -13.1 Maximum Throughput in a Single Switch Topology -13.1.1 MT Bonding Mode Selection for Single Switch Topology -13.1.2 MT Link Monitoring for Single Switch Topology -13.2 Maximum Throughput in a Multiple Switch Topology -13.2.1 MT Bonding Mode Selection for Multiple Switch Topology -13.2.2 MT Link Monitoring for Multiple Switch Topology +12. Configuring Bonding for Maximum Throughput +12.1 Maximum Throughput in a Single Switch Topology +12.1.1 MT Bonding Mode Selection for Single Switch Topology +12.1.2 MT Link Monitoring for Single Switch Topology +12.2 Maximum Throughput in a Multiple Switch Topology +12.2.1 MT Bonding Mode Selection for Multiple Switch Topology +12.2.2 MT Link Monitoring for Multiple Switch Topology -14. Switch Behavior Issues -14.1 Link Establishment and Failover Delays -14.2 Duplicated Incoming Packets +13. Switch Behavior Issues +13.1 Link Establishment and Failover Delays +13.2 Duplicated Incoming Packets -15. Hardware Specific Considerations -15.1 IBM BladeCenter +14. Hardware Specific Considerations +14.1 IBM BladeCenter -16. Frequently Asked Questions +15. Frequently Asked Questions -17. Resources and Links +16. Resources and Links 1. Bonding Driver Installation @@ -156,6 +159,9 @@ you're trying to build it for. Some dis onwards) do not have /usr/include/linux symbolically linked to the default kernel source include directory. +SECOND IMPORTANT NOTE: + If you plan to configure bonding using sysfs, you do not need +to use ife
[PATCH 2.6.14 11/18] move bond creation into separate function
The sysfs interface can create bonds at runtime, so we need a separate function to do this, instead of just doing it in the module init code. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bonding.h linux-2.6.14/drivers/net/bonding/bonding.h --- linux-2.6.14-release/drivers/net/bonding/bonding.h 2005-11-08 11:22:53.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bonding.h 2005-11-08 11:23:07.0 -0800 @@ -263,6 +263,7 @@ extern inline void bond_set_slave_active struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); +int bond_create(char *name, struct bond_params *params, struct bonding **newbond); void bond_deinit(struct net_device *bond_dev); int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:22:53.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:23:07.0 -0800 @@ -4855,81 +4855,90 @@ static int bond_check_params(struct bond return 0; } +/* Create a new bond based on the specified name and bonding parameters. + * Caller must NOT hold rtnl_lock; we need to release it here before we + * set up our sysfs entries. + */ +int bond_create(char *name, struct bond_params *params, struct bonding **newbond) +{ + struct net_device *bond_dev; + int res; + + rtnl_lock(); + bond_dev = alloc_netdev(sizeof(struct bonding), name, ether_setup); + if (!bond_dev) { + printk(KERN_ERR DRV_NAME + ": %s: eek! can't alloc netdev!\n", + name); + res = -ENOMEM; + goto out_rtnl; + } + + /* bond_init() must be called after dev_alloc_name() (for the +* /proc files), but before register_netdevice(), because we +* need to set function pointers. +*/ + + res = bond_init(bond_dev, params); + if (res < 0) { + goto out_netdev; + } + + SET_MODULE_OWNER(bond_dev); + + res = register_netdevice(bond_dev); + if (res < 0) { + goto out_bond; + } + if (newbond) + *newbond = bond_dev->priv; + + rtnl_unlock(); /* allows sysfs registration of net device */ + goto done; +out_bond: + bond_deinit(bond_dev); +out_netdev: + free_netdev(bond_dev); +out_rtnl: + rtnl_unlock(); +done: + return res; +} + static int __init bonding_init(void) { - struct bond_params params; int i; int res; + char new_bond_name[8]; /* Enough room for 999 bonds at init. */ printk(KERN_INFO "%s", version); - res = bond_check_params(¶ms); + res = bond_check_params(&bonding_defaults); if (res) { - return res; + goto out; } - rtnl_lock(); - #ifdef CONFIG_PROC_FS bond_create_proc_dir(); #endif - for (i = 0; i < max_bonds; i++) { - struct net_device *bond_dev; - - bond_dev = alloc_netdev(sizeof(struct bonding), "", ether_setup); - if (!bond_dev) { - res = -ENOMEM; - goto out_err; - } - - res = dev_alloc_name(bond_dev, "bond%d"); - if (res < 0) { - free_netdev(bond_dev); - goto out_err; - } - - /* bond_init() must be called after dev_alloc_name() (for the -* /proc files), but before register_netdevice(), because we -* need to set function pointers. -*/ - res = bond_init(bond_dev, ¶ms); - if (res < 0) { - free_netdev(bond_dev); - goto out_err; - } - - SET_MODULE_OWNER(bond_dev); - - res = register_netdevice(bond_dev); - if (res < 0) { - bond_deinit(bond_dev); - free_netdev(bond_dev); - goto out_err; - } + sprintf(new_bond_name, "bond%d",i); + res = bond_create(new_bond_name,&bonding_defaults, NULL); + if (res) + goto err; } - rtnl_unlock(); register_netdevice_notifier(&bond_netdev_notifier); register_inetaddr_notifier(&bond_inetaddr_notifier); - return 0; - -out_err: - /* -
[PATCH 2.6.14 10/18] make functions not static
The sysfs code needs access these functions, so make them not static, and move the protos to the header file. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bonding.h linux-2.6.14/drivers/net/bonding/bonding.h --- linux-2.6.14-release/drivers/net/bonding/bonding.h 2005-11-08 11:18:32.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bonding.h 2005-11-08 11:18:42.0 -0800 @@ -263,6 +263,18 @@ extern inline void bond_set_slave_active struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); +void bond_deinit(struct net_device *bond_dev); +int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); +int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); +int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev); +void bond_mii_monitor(struct net_device *bond_dev); +void bond_loadbalance_arp_mon(struct net_device *bond_dev); +void bond_activebackup_arp_mon(struct net_device *bond_dev); +void bond_set_mode_ops(struct bonding *bond, int mode); +int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); +const char *bond_mode_name(int mode); +void bond_select_active_slave(struct bonding *bond); +void bond_change_active_slave(struct bonding *bond, struct slave *new_active); #endif /* _LINUX_BONDING_H */ diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:18:32.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:18:42.0 -0800 @@ -632,12 +632,11 @@ struct bond_parm_tbl xmit_hashtype_tbl[] /*-- Forward declarations ---*/ -static inline void bond_set_mode_ops(struct bonding *bond, int mode); static void bond_send_gratuitous_arp(struct bonding *bond); /* General routines -*/ -static const char *bond_mode_name(int mode) +const char *bond_mode_name(int mode) { switch (mode) { case BOND_MODE_ROUNDROBIN : @@ -1453,7 +1452,7 @@ static struct slave *bond_find_best_slav * * Warning: Caller must hold curr_slave_lock for writing. */ -static void bond_change_active_slave(struct bonding *bond, struct slave *new_active) +void bond_change_active_slave(struct bonding *bond, struct slave *new_active) { struct slave *old_active = bond->curr_active_slave; @@ -1527,7 +1526,7 @@ static void bond_change_active_slave(str * * Warning: Caller must hold curr_slave_lock for writing. */ -static void bond_select_active_slave(struct bonding *bond) +void bond_select_active_slave(struct bonding *bond) { struct slave *best_slave; @@ -1595,7 +1594,7 @@ static void bond_detach_slave(struct bon /*-- IOCTL --*/ -static int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev) +int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev) { dprintk("bond_dev=%p\n", bond_dev); dprintk("slave_dev=%p\n", slave_dev); @@ -1643,7 +1642,7 @@ static int bond_compute_features(struct } /* enslave device to bond device */ -static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) +int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) { struct bonding *bond = bond_dev->priv; struct slave *new_slave = NULL; @@ -2010,7 +2009,7 @@ err_undo_flags: * for Bonded connections: * The first up interface should be left on and all others downed. */ -static int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) +int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) { struct bonding *bond = bond_dev->priv; struct slave *slave, *oldcurrent; @@ -2411,7 +2410,7 @@ static int bond_slave_info_query(struct /* Monitoring ---*/ /* this function is called regularly to monitor each slave's link. */ -static void bond_mii_monitor(struct net_device *bond_dev) +void bond_mii_monitor(struct net_device *bond_dev) { struct bonding *bond = bond_dev->priv; struct slave *slave, *oldcurrent; @@ -2842,7 +2841,7 @@ static void bond_send_gratuitous_arp(str * arp is transmitted to generate traffic. see activebackup_arp_monitor for * arp monitoring in active backup mode. */ -static void bond_loadbalance_arp_mon(struct net_device *bond_dev) +void bond_loadbalance_arp_mon(struct net_device *bond_dev) { struct bonding *bond = bond_dev->priv; struct slave *slave, *oldcurrent; @@
[PATCH 2.6.14 16/18] version update
Update the version number for the bonding module. Since we've just added a significant new feature (sysfs support), bump the major number. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bonding.h linux-2.6.14/drivers/net/bonding/bonding.h --- linux-2.6.14-release/drivers/net/bonding/bonding.h 2005-11-08 12:41:03.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bonding.h 2005-11-08 12:43:07.0 -0800 @@ -41,8 +41,8 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION"2.6.4" -#define DRV_RELDATE"September 26, 2005" +#define DRV_VERSION"3.0.0" +#define DRV_RELDATE"November 8, 2005" #define DRV_NAME "bonding" #define DRV_DESCRIPTION"Ethernet Channel Bonding Driver" - 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.14 8/18] explicitly clear RLB flag during ALB init
Explicitly clear RLB flag during ALB init. This is needed for sysfs support, since the bond mode can be changed at runtime via sysfs. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X linux-2.6.13/Documentation/dontdiff linux-2.6.14-rc2-clean/drivers/net/bonding/bond_alb.c linux-2.6.14-rc2/drivers/net/bonding/bond_alb.c --- linux-2.6.14-rc2-clean/drivers/net/bonding/bond_alb.c 2005-09-27 16:15:08.0 -0700 +++ linux-2.6.14-rc2/drivers/net/bonding/bond_alb.c 2005-09-27 16:26:39.0 -0700 @@ -1256,6 +1256,8 @@ int bond_alb_initialize(struct bonding * tlb_deinitialize(bond); return res; } + } else { + bond->alb_info.rlb_enabled = 0; } return 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 2.6.14 14/18] add ARP entries to /proc
Make the /proc files show which ARP targets are in use by each bond. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:27:19.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:27:29.0 -0800 @@ -3267,6 +3267,8 @@ static void bond_info_show_master(struct { struct bonding *bond = seq->private; struct slave *curr; + int i; + u32 target; read_lock(&bond->curr_slave_lock); curr = bond->curr_active_slave; @@ -3298,6 +3300,27 @@ static void bond_info_show_master(struct seq_printf(seq, "Down Delay (ms): %d\n", bond->params.downdelay * bond->params.miimon); + + /* ARP information */ + if(bond->params.arp_interval > 0) { + int printed=0; + seq_printf(seq, "ARP Polling Interval (ms): %d\n", + bond->params.arp_interval); + + seq_printf(seq, "ARP IP target/s (n.n.n.n form):"); + + for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) { + if (!bond->params.arp_targets[i]) + continue; + if (printed) + seq_printf(seq, ","); + target = ntohl(bond->params.arp_targets[i]); + seq_printf(seq, " %d.%d.%d.%d", HIPQUAD(target)); + printed = 1; + } + seq_printf(seq, "\n"); + } + if (bond->params.mode == BOND_MODE_8023AD) { struct ad_info ad_info; - 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.14 9/18] expose some structs
The sysfs code needs to know what these structs look like, so make them not static, and move the definition to the header. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X linux-2.6.13/Documentation/dontdiff linux-2.6.14-rc2-clean/drivers/net/bonding/bonding.h linux-2.6.14-rc2/drivers/net/bonding/bonding.h --- linux-2.6.14-rc2-clean/drivers/net/bonding/bonding.h2005-09-27 16:15:08.0 -0700 +++ linux-2.6.14-rc2/drivers/net/bonding/bonding.h 2005-09-27 16:26:44.0 -0700 @@ -152,6 +152,11 @@ struct bond_params { u32 arp_targets[BOND_MAX_ARP_TARGETS]; }; +struct bond_parm_tbl { + char *modename; + int mode; +}; + struct vlan_entry { struct list_head vlan_list; u32 vlan_ip; diff -urpN -X linux-2.6.13/Documentation/dontdiff linux-2.6.14-rc2-clean/drivers/net/bonding/bond_main.c linux-2.6.14-rc2/drivers/net/bonding/bond_main.c --- linux-2.6.14-rc2-clean/drivers/net/bonding/bond_main.c 2005-09-27 16:15:08.0 -0700 +++ linux-2.6.14-rc2/drivers/net/bonding/bond_main.c2005-09-27 16:30:38.0 -0700 @@ -557,6 +557,7 @@ static char *lacp_rate = NULL; static char *xmit_hash_policy = NULL; static int arp_interval = BOND_LINK_ARP_INTERV; static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; +struct bond_params bonding_defaults; module_param(max_bonds, int, 0); MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); @@ -593,7 +594,7 @@ MODULE_PARM_DESC(arp_ip_target, "arp tar static const char *version = DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n"; -static LIST_HEAD(bond_dev_list); +LIST_HEAD(bond_dev_list); #ifdef CONFIG_PROC_FS static struct proc_dir_entry *bond_proc_dir = NULL; @@ -605,18 +606,14 @@ static int bond_mode = BOND_MODE_ROUNDRO static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2; static int lacp_fast = 0; -struct bond_parm_tbl { - char *modename; - int mode; -}; -static struct bond_parm_tbl bond_lacp_tbl[] = { +struct bond_parm_tbl bond_lacp_tbl[] = { { "slow", AD_LACP_SLOW}, { "fast", AD_LACP_FAST}, { NULL, -1}, }; -static struct bond_parm_tbl bond_mode_tbl[] = { +struct bond_parm_tbl bond_mode_tbl[] = { { "balance-rr", BOND_MODE_ROUNDROBIN}, { "active-backup",BOND_MODE_ACTIVEBACKUP}, { "balance-xor", BOND_MODE_XOR}, @@ -627,7 +624,7 @@ static struct bond_parm_tbl bond_mode_tb { NULL, -1}, }; -static struct bond_parm_tbl xmit_hashtype_tbl[] = { +struct bond_parm_tbl xmit_hashtype_tbl[] = { { "layer2", BOND_XMIT_POLICY_LAYER2}, { "layer3+4", BOND_XMIT_POLICY_LAYER34}, { NULL, -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 2.6.14 15/18] add sysfs functionality to bonding (large)
This large patch adds sysfs functionality to the channel bonding module. Bonds can be added, removed, and reconfigured at runtime without having to reload the module. Multiple bonds with different configurations are easily configured, and ifenslave is no longer required to configure bonds. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bonding.h linux-2.6.14/drivers/net/bonding/bonding.h --- linux-2.6.14-release/drivers/net/bonding/bonding.h 2005-11-08 11:24:27.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bonding.h 2005-11-08 11:35:20.0 -0800 @@ -37,6 +37,7 @@ #include #include #include +#include #include "bond_3ad.h" #include "bond_alb.h" @@ -265,6 +266,12 @@ struct vlan_entry *bond_next_vlan(struct int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); int bond_create(char *name, struct bond_params *params, struct bonding **newbond); void bond_deinit(struct net_device *bond_dev); +int bond_create_sysfs(void); +void bond_destroy_sysfs(void); +void bond_destroy_sysfs_entry(struct bonding *bond); +int bond_create_sysfs_entry(struct bonding *bond); +int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave); +void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave); int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev); diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:28:27.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:36:10.0 -0800 @@ -600,6 +600,7 @@ LIST_HEAD(bond_dev_list); static struct proc_dir_entry *bond_proc_dir = NULL; #endif +extern struct rw_semaphore bonding_rwsem; static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; static int arp_ip_count= 0; static int bond_mode = BOND_MODE_ROUNDROBIN; @@ -1968,6 +1969,10 @@ int bond_enslave(struct net_device *bond write_unlock_bh(&bond->lock); + res = bond_create_slave_symlinks(bond_dev, slave_dev); + if (res) + goto err_unset_master; + printk(KERN_INFO DRV_NAME ": %s: enslaving %s as a%s interface with a%s link.\n", bond_dev->name, slave_dev->name, @@ -2141,6 +2146,9 @@ int bond_release(struct net_device *bond write_unlock_bh(&bond->lock); + /* must do this from outside any spinlocks */ + bond_destroy_slave_symlinks(bond_dev, slave_dev); + bond_del_vlans_from_slave(bond, slave_dev); /* If the mode USES_PRIMARY, then we should only remove its @@ -2232,6 +2240,7 @@ static int bond_release_all(struct net_d */ write_unlock_bh(&bond->lock); + bond_destroy_slave_symlinks(bond_dev, slave_dev); bond_del_vlans_from_slave(bond, slave_dev); /* If the mode USES_PRIMARY, then we should only remove its @@ -3526,7 +3535,10 @@ static int bond_event_changename(struct bond_remove_proc_entry(bond); bond_create_proc_entry(bond); #endif - + down_write(&(bonding_rwsem)); +bond_destroy_sysfs_entry(bond); +bond_create_sysfs_entry(bond); + up_write(&(bonding_rwsem)); return NOTIFY_DONE; } @@ -4003,6 +4015,7 @@ static int bond_do_ioctl(struct net_devi return -EPERM; } + down_write(&(bonding_rwsem)); slave_dev = dev_get_by_name(ifr->ifr_slave); dprintk("slave_dev=%p: \n", slave_dev); @@ -4035,6 +4048,7 @@ static int bond_do_ioctl(struct net_devi dev_put(slave_dev); } + up_write(&(bonding_rwsem)); return res; } @@ -4919,6 +4933,7 @@ int bond_create(char *name, struct bond_ *newbond = bond_dev->priv; rtnl_unlock(); /* allows sysfs registration of net device */ + res = bond_create_sysfs_entry(bond_dev->priv); goto done; out_bond: bond_deinit(bond_dev); @@ -4953,6 +4968,10 @@ static int __init bonding_init(void) goto err; } + res = bond_create_sysfs(); + if (res) + goto err; + register_netdevice_notifier(&bond_netdev_notifier); register_inetaddr_notifier(&bond_inetaddr_notifier); @@ -4960,6 +4979,7 @@ static int __init bonding_init(void) err: rtnl_lock(); bond_free_all(); + bond_destroy_sysfs(); rtnl_unlock(); out: return res; @@ -4973,6 +4993,7 @@ static void __exit bonding_exit(void)
[PATCH 2.6.14 17/18] spelling and whitespace corrections
Minor spelling and whitespace corrections. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_alb.c linux-2.6.14/drivers/net/bonding/bond_alb.c --- linux-2.6.14-release/drivers/net/bonding/bond_alb.c 2005-11-08 11:17:47.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_alb.c 2005-11-08 12:49:23.0 -0800 @@ -1417,7 +1417,7 @@ void bond_alb_monitor(struct bonding *bo read_lock(&bond->curr_slave_lock); bond_for_each_slave(bond, slave, i) { - alb_send_learning_packets(slave,slave->dev->dev_addr); + alb_send_learning_packets(slave, slave->dev->dev_addr); } read_unlock(&bond->curr_slave_lock); diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bonding.h linux-2.6.14/drivers/net/bonding/bonding.h --- linux-2.6.14-release/drivers/net/bonding/bonding.h 2005-11-08 12:49:08.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bonding.h 2005-11-08 12:49:23.0 -0800 @@ -165,7 +165,7 @@ struct vlan_entry { }; struct slave { - struct net_device *dev; /* first - usefull for panic debug */ + struct net_device *dev; /* first - useful for panic debug */ struct slave *next; struct slave *prev; s16delay; @@ -191,7 +191,7 @@ struct slave { *beforehand. */ struct bonding { - struct net_device *dev; /* first - usefull for panic debug */ + struct net_device *dev; /* first - useful for panic debug */ struct slave *first_slave; struct slave *curr_active_slave; struct slave *current_arp_slave; diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 12:41:03.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 12:49:23.0 -0800 @@ -4133,6 +4133,7 @@ static int bond_change_mtu(struct net_de bond_for_each_slave(bond, slave, i) { dprintk("s %p s->p %p c_m %p\n", slave, slave->prev, slave->dev->change_mtu); + res = dev_set_mtu(slave->dev, new_mtu); if (res) { - 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.14 12/18] make bond_init not __init
The sysfs interface can create bonds at runtime, and __init code goes away after module init. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:24:27.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:24:38.0 -0800 @@ -4463,7 +4463,7 @@ static struct ethtool_ops bond_ethtool_o * Does not allocate but creates a /proc entry. * Allowed to fail. */ -static int __init bond_init(struct net_device *bond_dev, struct bond_params *params) +static int bond_init(struct net_device *bond_dev, struct bond_params *params) { struct bonding *bond = bond_dev->priv; - 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.14 7/18] move kmalloc out of spinlock in ALB init
Move memory allocations out of the spinlock during ALB init. This gets rid of a sleeping-inside-spinlock warning and accompanying stack dump. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X linux-2.6.13/Documentation/dontdiff linux-2.6.14-rc2-clean/drivers/net/bonding/bond_alb.c linux-2.6.14-rc2/drivers/net/bonding/bond_alb.c --- linux-2.6.14-rc2-clean/drivers/net/bonding/bond_alb.c 2005-09-27 16:15:08.0 -0700 +++ linux-2.6.14-rc2/drivers/net/bonding/bond_alb.c 2005-09-27 16:26:39.0 -0700 @@ -198,20 +198,21 @@ static int tlb_initialize(struct bonding { struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); + struct tlb_client_info *new_hashtbl; int i; spin_lock_init(&(bond_info->tx_hashtbl_lock)); - _lock_tx_hashtbl(bond); - - bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL); - if (!bond_info->tx_hashtbl) { + new_hashtbl = kmalloc(size, GFP_KERNEL); + if (!new_hashtbl) { printk(KERN_ERR DRV_NAME ": %s: Error: Failed to allocate TLB hash table\n", bond->dev->name); - _unlock_tx_hashtbl(bond); return -1; } + _lock_tx_hashtbl(bond); + + bond_info->tx_hashtbl = new_hashtbl; memset(bond_info->tx_hashtbl, 0, size); @@ -800,21 +797,22 @@ static int rlb_initialize(struct bonding { struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type); + struct rlb_client_info *new_hashtbl; int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); int i; spin_lock_init(&(bond_info->rx_hashtbl_lock)); - _lock_rx_hashtbl(bond); - - bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL); - if (!bond_info->rx_hashtbl) { + new_hashtbl = kmalloc(size, GFP_KERNEL); + if (!new_hashtbl) { printk(KERN_ERR DRV_NAME ": %s: Error: Failed to allocate RLB hash table\n", bond->dev->name); - _unlock_rx_hashtbl(bond); return -1; } + _lock_rx_hashtbl(bond); + + bond_info->rx_hashtbl = new_hashtbl; bond_info->rx_hashtbl_head = RLB_NULL_INDEX; - 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.14 18/18] comments and changelog
Bonding source files still have changelogs in the comments. This, then, is an update to that changelog. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bonding.h linux-2.6.14/drivers/net/bonding/bonding.h --- linux-2.6.14-release/drivers/net/bonding/bonding.h 2005-11-08 12:59:02.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bonding.h 2005-11-08 12:51:14.0 -0800 @@ -29,6 +29,10 @@ * 2005/05/05 - Jason Gabler * - added "xmit_policy" kernel parameter for alternate hashing policy * support for mode 2 + * + * 2005/09/27 - Mitch Williams + * Radheka Godse + * - Added bonding sysfs interface */ #ifndef _LINUX_BONDING_H diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 12:59:02.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 12:52:56.0 -0800 @@ -489,6 +489,28 @@ * Set version to 2.6.3. * 2005/09/26 - Jay Vosburgh <[EMAIL PROTECTED]> * - Removed backwards compatibility for old ifenslaves. Version 2.6.4. + * 2005/09/27 - Mitch Williams + * - Radheka Godse + * - Split out bond creation code to allow for sysfs interface. + * - Removed static declaration on some functions and data items. + * - Added sysfs support, including capability to add/remove/change + *any bond at runtime. + * + * - Miscellaneous: + * - Added bonding: : prefix to sysfs log messages + * - Added arp_ip_targets to /proc entry + * - Allow ARP target table to have empty entries + * - trivial fix: added missing modes description to modinfo + * - Corrected bug in ALB init where kmalloc is called inside + * a held lock + * - Corrected behavior to maintain bond link when changing + * from arp monitor to miimon and vice versa + * - Added missing bonding: : prefix to alb, ad log messages + * - Fixed stack dump warnings seen if changing between miimon + * and arp monitoring when the bond interface is down. + * - Fixed stack dump warnings seen when enslaving an e100 + * driver + * - Set version to 3.0.0 */ //#define BONDING_DEBUG 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 2.6.14 13/18] Allow ARP target table to have empty entries
With the sysfs interface, the user can remove entries from the ARP table at runtime. The ARP monitor code now allows for empty entries in the table. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:25:31.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:25:46.0 -0800 @@ -2737,7 +2737,9 @@ static void bond_arp_send_all(struct bon struct flowi fl; struct rtable *rt; - for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { + for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { + if (!targets[i]) + continue; dprintk("basa: target %x\n", targets[i]); if (list_empty(&bond->vlan_list)) { dprintk("basa: empty vlan: arp_send\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 2.6.14 4/18] expand module param descriptions
Expand and correct the parameter descriptions shown by modinfo. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 10:36:32.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:07:44.0 -0800 @@ -565,17 +565,24 @@ MODULE_PARM_DESC(miimon, "Link check int module_param(updelay, int, 0); MODULE_PARM_DESC(updelay, "Delay before considering link up, in milliseconds"); module_param(downdelay, int, 0); -MODULE_PARM_DESC(downdelay, "Delay before considering link down, in milliseconds"); +MODULE_PARM_DESC(downdelay, "Delay before considering link down, " + "in milliseconds"); module_param(use_carrier, int, 0); -MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default)"); +MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; " + "0 for off, 1 for on (default)"); module_param(mode, charp, 0); -MODULE_PARM_DESC(mode, "Mode of operation : 0 for round robin, 1 for active-backup, 2 for xor"); +MODULE_PARM_DESC(mode, "Mode of operation : 0 for balance-rr, " + "1 for active-backup, 2 for balance-xor, " + "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, " + "6 for balance-alb"); module_param(primary, charp, 0); MODULE_PARM_DESC(primary, "Primary network device to use"); module_param(lacp_rate, charp, 0); -MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)"); +MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner " + "(slow/fast)"); module_param(xmit_hash_policy, charp, 0); -MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method : 0 for layer 2 (default), 1 for layer 3+4"); +MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method: 0 for layer 2 (default)" + ", 1 for layer 3+4"); module_param(arp_interval, int, 0); MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); module_param_array(arp_ip_target, charp, NULL, 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 2.6.14 5/18] Add transmit policy to /proc
Adds information about the recently-added transmit policy setting to each bond's /proc file. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:12:21.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:12:31.0 -0800 @@ -3277,6 +3277,13 @@ static void bond_info_show_master(struct seq_printf(seq, "Bonding Mode: %s\n", bond_mode_name(bond->params.mode)); + if (bond->params.mode == BOND_MODE_XOR || + bond->params.mode == BOND_MODE_8023AD) { + seq_printf(seq, "Transmit Hash Policy: %s (%d)\n", + xmit_hashtype_tbl[bond->params.xmit_policy].modename, + bond->params.xmit_policy); + } + if (USES_PRIMARY(bond->params.mode)) { seq_printf(seq, "Primary Slave: %s\n", (bond->params.primary[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 2.6.14 3/18] add bond name to all error messages
Add the bond name to all error messages so we can tell which one is complaining. Also reformats some error messages to be more consistent. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X linux-2.6.13/Documentation/dontdiff linux-2.6.14-rc2-clean/drivers/net/bonding/bond_3ad.c linux-2.6.14-rc2/drivers/net/bonding/bond_3ad.c --- linux-2.6.14-rc2-clean/drivers/net/bonding/bond_3ad.c 2005-09-27 16:15:08.0 -0700 +++ linux-2.6.14-rc2/drivers/net/bonding/bond_3ad.c 2005-09-27 16:24:42.0 -0700 @@ -1198,10 +1198,10 @@ static void ad_rx_machine(struct lacpdu // detect loopback situation if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) { // INFO_RECEIVED_LOOPBACK_FRAMES - printk(KERN_ERR DRV_NAME ": An illegal loopback occurred on adapter (%s)\n", - port->slave->dev->name); - printk(KERN_ERR "Check the configuration to verify that all Adapters " - "are connected to 802.3ad compliant switch ports\n"); + printk(KERN_ERR DRV_NAME ": %s: An illegal loopback occurred on " + "adapter (%s). Check the configuration to verify that all " + "Adapters are connected to 802.3ad compliant switch ports\n", + port->slave->dev->master->name, port->slave->dev->name); __release_rx_machine_lock(port); return; } @@ -1378,8 +1378,9 @@ static void ad_port_selection_logic(stru } } if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list - printk(KERN_WARNING DRV_NAME ": Warning: Port %d (on %s) was " + printk(KERN_WARNING DRV_NAME ": %s: Warning: Port %d (on %s) was " "related to aggregator %d but was not on its port list\n", + port->slave->dev->master->name, port->actor_port_number, port->slave->dev->name, port->aggregator->aggregator_identifier); } @@ -1450,7 +1451,8 @@ static void ad_port_selection_logic(stru dprintk("Port %d joined LAG %d(new LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier); } else { - printk(KERN_ERR DRV_NAME ": Port %d (on %s) did not find a suitable aggregator\n", + printk(KERN_ERR DRV_NAME ": %s: Port %d (on %s) did not find a suitable aggregator\n", + port->slave->dev->master->name, port->actor_port_number, port->slave->dev->name); } } @@ -1582,8 +1584,9 @@ static void ad_agg_selection_logic(struc // check if any partner replys if (best_aggregator->is_individual) { - printk(KERN_WARNING DRV_NAME ": Warning: No 802.3ad response from the link partner " - "for any adapters in the bond\n"); + printk(KERN_WARNING DRV_NAME ": %s: Warning: No 802.3ad response from " + "the link partner for any adapters in the bond\n", + best_aggregator->slave->dev->master->name); } // check if there are more than one aggregator @@ -1915,7 +1918,8 @@ int bond_3ad_bind_slave(struct slave *sl struct aggregator *aggregator; if (bond == NULL) { - printk(KERN_ERR "The slave %s is not attached to its bond\n", slave->dev->name); + printk(KERN_ERR DRV_NAME ": %s: The slave %s is not attached to its bond\n", + slave->dev->master->name, slave->dev->name); return -1; } @@ -1990,7 +1994,9 @@ void bond_3ad_unbind_slave(struct slave // if slave is null, the whole port is not initialized if (!port->slave) { - printk(KERN_WARNING DRV_NAME ": Trying to unbind an uninitialized port on %s\n", slave->dev->name); + printk(KERN_WARNING DRV_NAME ": Warning: %s: Trying to " + "unbind an uninitialized port on %s\n", +
[PATCH 2.6.14 2/18] make dev_valid_name public
dev_valid_name() is a useful function. Make it public. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-clean/include/linux/netdevice.h linux-2.6.14/include/linux/netdevice.h --- linux-2.6.14-clean/include/linux/netdevice.h2005-10-27 17:02:08.0 -0700 +++ linux-2.6.14/include/linux/netdevice.h 2005-11-08 10:14:00.0 -0800 @@ -683,6 +683,7 @@ extern int netif_rx(struct sk_buff *skb extern int netif_rx_ni(struct sk_buff *skb); #define HAVE_NETIF_RECEIVE_SKB 1 extern int netif_receive_skb(struct sk_buff *skb); +extern int dev_valid_name(const char *name); extern int dev_ioctl(unsigned int cmd, void __user *); extern int dev_ethtool(struct ifreq *); extern unsigneddev_get_flags(const struct net_device *); diff -urpN -X dontdiff linux-2.6.14-clean/net/core/dev.c linux-2.6.14/net/core/dev.c --- linux-2.6.14-clean/net/core/dev.c 2005-10-27 17:02:08.0 -0700 +++ linux-2.6.14/net/core/dev.c 2005-11-08 10:14:00.0 -0800 @@ -626,7 +626,7 @@ struct net_device * dev_get_by_flags(uns * Network device names need to be valid file names to * to allow sysfs to work */ -static int dev_valid_name(const char *name) +int dev_valid_name(const char *name) { return !(*name == '\0' || !strcmp(name, ".") @@ -3243,6 +3243,7 @@ EXPORT_SYMBOL(__dev_get_by_index); EXPORT_SYMBOL(__dev_get_by_name); EXPORT_SYMBOL(__dev_remove_pack); EXPORT_SYMBOL(__skb_linearize); +EXPORT_SYMBOL(dev_valid_name); EXPORT_SYMBOL(dev_add_pack); EXPORT_SYMBOL(dev_alloc_name); EXPORT_SYMBOL(dev_close); - 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.14 6/18] get slave name from actual slave instead of param list
Take the primary slave name shown in /proc from the actual slave dev instead of from the command-line parameter, which won't be present if the bond is created via sysfs. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-release/drivers/net/bonding/bond_main.c linux-2.6.14/drivers/net/bonding/bond_main.c --- linux-2.6.14-release/drivers/net/bonding/bond_main.c2005-11-08 11:15:43.0 -0800 +++ linux-2.6.14/drivers/net/bonding/bond_main.c2005-11-08 11:15:52.0 -0800 @@ -3286,8 +3286,8 @@ static void bond_info_show_master(struct if (USES_PRIMARY(bond->params.mode)) { seq_printf(seq, "Primary Slave: %s\n", - (bond->params.primary[0]) ? - bond->params.primary : "None"); + (bond->primary_slave) ? + bond->primary_slave->dev->name : "None"); seq_printf(seq, "Currently Active Slave: %s\n", (curr) ? curr->dev->name : "None"); - 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.14 0/18] Yet Another Bonding Sysfs patchset
Jay says he's finally ready to take this patch. So here we go again. Rebased against 2.6.14 final. Which turned out to be way more work than I expected. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> - 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.14 1/18] allow newline terminated IP addresses in in_aton
in_aton() gives weird results if it sees a newline at the end of the input. This patch makes it able to handle such input correctly. Signed-off-by: Mitch Williams <[EMAIL PROTECTED]> diff -urpN -X dontdiff linux-2.6.14-clean/net/core/utils.c linux-2.6.14/net/core/utils.c --- linux-2.6.14-clean/net/core/utils.c 2005-10-27 17:02:08.0 -0700 +++ linux-2.6.14/net/core/utils.c 2005-11-08 10:09:49.0 -0800 @@ -175,7 +175,7 @@ __u32 in_aton(const char *str) if (*str != '\0') { val = 0; - while (*str != '\0' && *str != '.') + while (*str != '\0' && *str != '.' && *str != '\n') { val *= 10; val += *str - '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
Re: [PATCH 2.6.13-rc1 8/17] bonding: SYSFS INTERFACE (large)
(Adding vger to Cc: list, so as to spread the joy around.) On Thu, 7 Jul 2005, Greg KH wrote: > > > > Moving the individual bond directories to a bonds/ directory > > is problematic. Because each bond shows up a just another network > > interface, they show up in /sys/class/net automatically. We'd have to > > make a bunch of changes to the device model to account for bonding, and > > we'd break the semantics of the /sys/class/net hierarchy. > > Why not just put them in /sys/class/bond/ instead? As Aaron Brown noted in another reply, it's inappropriate for bonding to do this. Bonding is really just another network driver, and its interfaces show up in /sys/class/net courtesy of the device model. We don't need to replicate this capability; we just need to extend it a bit. Adding /sys/class/bond/ would cause a much larger protest that what we're dealing with now (i.e. pretty much only you). > > reading of Documentation/filesystems/sysfs.txt indicates that such a usage > > is "socially acceptable". (Or at least it was to Patrick Mochel back in > > January of 2003.) > > Pat was just trying to be nice. I'm not. :) Well, if "nice" isn't the policy any more, then the doc needs to change. > Just don't make them readable. Lots of sysfs files are write only. OK, you got me there. I did some poking and you are absolutely correct. However, I did a little more poking, and found a bunch of files that have more than one item in them. HW resource listings, block device scheduling stuff, plenty of examples. Are they socially acceptable? > > bonding_masters. This currently is a problem, since sysfs itself does not > > handle appends properly. > > Because you are not supposed to do that. Sysfs will happily accept O_APPEND opens, and will happily report success on seek attempts, although neither operation is permitted. Whether or not you're supposed to, this behavior is just plain wrong. - 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