netxen: write IP address to firmware when using bonding
Subsystems (3)
PATCH v3 1/1 netxen: write IP address to firmware when using bonding
This patch allows LRO aggregation on bonded devices that contain an NX3031 device. It also adds a for_each_netdev_in_bond_rcu(bond, slave) macro which executes for each slave that has bond as master.
V3: After testing and discussing this with Rajesh, I decided to keep the
vlan ip cache and just rename it to ip_cache since it will store bond ip addresses too. A new master flag has been added to the ip cache to denote that the address has been added because of a master device. I've taken care of the enslave/release cases by checking for various combinations of events and flags (e.g. netxen has a master, it's a bond master and it's not marked as a slave means it is being enslaved and is dev_open()ed in bond_enslave).
I've changed netxen_free_ip_list() to have a "master" parameter which causes all IP addresses marked as master to be deleted (used when a netxen is being released). I've made the patch use the new upper device API as well. The following cases were tested:
- bond -> netxen
- vlan -> netxen
- vlan -> bond -> netxen
V2: Remove local ip caching, retrieve addresses dynamically and
restore them if necessary.
Note: Tested with NX3031 adapter.
--- drivers/net/ethernet/qlogic/netxen/netxen_nic.h | 5 +- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 220 ++++++++++++++------- include/linux/netdevice.h | 8 + 3 files changed, 155 insertions(+), 78 deletions(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic.h +3 -2
@@ -955,9 +955,10 @@ typedef struct nx_mac_list_s {uint8_t mac_addr[ETH_ALEN +2 ]; } nx_mac_list_t; -struct nx_vlan_ip_list { +struct nx_ip_list {struct list_head list;__be32 ip_addr; +bool master; };/*
@@ -1605,7 +1606,7 @@ struct netxen_adapter {struct net_device *netdev;struct pci_dev *pdev;struct list_head mac_list; -struct list_head vlan_ip_list; +struct list_head ip_list;spinlock_t tx_clean_lock;
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +144 -76
333 lines not on this page · raw message
include/linux/netdevice.h +8 -0
@@ -1617,6 +1617,9 @@ extern seqcount_t devnet_rename_seq; /* Device rename seq */ list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)#define for_each_netdev_continue_rcu (net, d) \ list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) +#define for_each_netdev_in_bond_rcu (bond, slave) \ + for_each_netdev_rcu(&init_net, slave) \ + if (netdev_master_upper_dev_get_rcu(slave) == bond)#define net_device_entry (lh) list_entry(lh, struct net_device, dev_list)static inline struct net_device *next_net_device (struct net_device *dev)
@@ -2774,6 +2777,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev, dev->gso_max_size = size; } +static inline bool netif_is_bond_master (struct net_device *dev) +{ +return dev->flags &IFF_MASTER && dev->priv_flags &IFF_BONDING ; +} +static inline bool netif_is_bond_slave (struct net_device *dev) {return dev->flags &IFF_SLAVE && dev->priv_flags &IFF_BONDING ;
Signature · 1 line
1.7.11.7
David Miller
maintainerFrom: Nikolay Aleksandrov <[email protected]>
Date: Tue, 12 Mar 2013 13:49:01 +0100
Quoted 3 lines
This patch allows LRO aggregation on bonded devices that contain an NX3031 device. It also adds a
for_each_netdev_in_bond_rcu(bond, slave)macro which executes for each slave that has bond as master.
The new logic looks like it will configure the IPs for bonding but not for VLANs, is that intentional?
Quoted 9 lines · David Miller
From: Nikolay Aleksandrov <[email protected]>
Date: Tue, 12 Mar 2013 13:49:01 +0100Quoted 3 lines
This patch allows LRO aggregation on bonded devices that contain an NX3031 device. It also adds a
for_each_netdev_in_bond_rcu(bond, slave)macro which executes for each slave that has bond as master.The new logic looks like it will configure the IPs for bonding but not for VLANs, is that intentional?
The case bond -> vlan -> netxen was intentionally dropped as it leads to many new issues, if that is what you are referring to. The case vlan -> netxen still works, since the address of orig_dev is unconditionally programmed if the original dev is a netxen. The problem was with a bond acting on a vlan which is configured on a netxen because we would have to keep track of which bonding master the programmed addresses belong to.
-----Original Message-----
Quoted 22 lines
From: Nikolay Aleksandrov [mailto:[email protected]]
Sent: Tuesday, March 12, 2013 6:19 PM
To: netdev
Cc: Rajesh Borundia; David Miller; [email protected]; Sony Chacko
Subject: [PATCH net-next v3] netxen: write IP address to firmware when using bondingThis patch allows LRO aggregation on bonded devices that contain an NX3031 device. It also adds a
for_each_netdev_in_bond_rcu(bond, slave)macro which executes for each slave that has bond as master.V3: After testing and discussing this with Rajesh, I decided to keep the
vlan ip cache and just rename it toip_cachesince it will store
bond
ip addresses too. A new master flag has been added to the ip cache
to
denote that the address has been added because of a master device. I've taken care of the enslave/release cases by checking for various combinations of events and flags (e.g. netxen has a master, it's a bond master and it's not marked as a slave means it is being
enslaved
and is dev_open()ed inbond_enslave).
Quoted 8 lines
I've changed
netxen_free_ip_list()to have a "master" parameter
which
causes all IP addresses marked as master to be deleted (used when a netxen is being released). I've made the patch use the new upper device API as well. The following cases were tested:
- bond -> netxen
- vlan -> netxen
- vlan -> bond -> netxen
From: Rajesh Borundia <[email protected]>
Date: Wed, 13 Mar 2013 11:51:46 +0000
Quoted 32 lines
-----Original Message-----
Quoted 22 lines
From: Nikolay Aleksandrov [mailto:[email protected]]
Sent: Tuesday, March 12, 2013 6:19 PM
To: netdev
Cc: Rajesh Borundia; David Miller; [email protected]; Sony Chacko
Subject: [PATCH net-next v3] netxen: write IP address to firmware when using bondingThis patch allows LRO aggregation on bonded devices that contain an NX3031 device. It also adds a
for_each_netdev_in_bond_rcu(bond, slave)macro which executes for each slave that has bond as master.V3: After testing and discussing this with Rajesh, I decided to keep the
vlan ip cache and just rename it toip_cachesince it will store
bond
ip addresses too. A new master flag has been added to the ip cache
to
denote that the address has been added because of a master device. I've taken care of the enslave/release cases by checking for various combinations of events and flags (e.g. netxen has a master, it's a bond master and it's not marked as a slave means it is being
enslaved
and is dev_open()ed inbond_enslave).Quoted 8 lines
I've changed
netxen_free_ip_list()to have a "master" parameter
which
causes all IP addresses marked as master to be deleted (used when a netxen is being released). I've made the patch use the new upper device API as well. The following cases were tested:
- bond -> netxen
- vlan -> netxen
- vlan -> bond -> netxen
Quoted 1 line
Acked-by Rajesh Borundia <[email protected]>
Applied, thanks.