: Secondary unicast address support v2
Subsystems (2)
cover : Secondary unicast address support v2
This is an updated version of the secondary unicast address patches. I've introduced a common structure and helpers for both unicast and multicast addresses to make it easier for virtual software devices that want to synchronize addresses to a lower device to reuse code. Additionally I fixed a deadlock when putting the device into promiscous mode, renamed dev->set_address_list to dev->set_rx_mode and cleaned the code up a bit.
One remaining question is how to handle the case that too many unicast addresses are configured and the device is put into promiscous mode or unicast filtering is disabled by the driver. In that case we're not getting the message that is normally printed by dev_set_promiscous and no audit log. Not sure if that can already happen when configuring multicast, I thought it was worth mentioning.
drivers/net/e1000/e1000_main.c | 47 ++++++--- include/linux/netdevice.h | 40 +++++--- net/core/dev.c | 213 ++++++++++++++++++++++++++++++++++++--- net/core/dev_mcast.c | 128 +++--------------------- net/decnet/dn_dev.c | 3 - 5 files changed, 269 insertions(+), 162 deletions(-)
Patrick McHardy (5):
[NET]: dev_mcast: unexport dev_mc_upload
[NET]: dev: introduce generic net_device address lists [NET]: dev_mcast: switch to generic net_device address lists [NET]: dev: secondary unicast address support [E1000]: Secondary unicast address support
PATCH 1/5 : dev_mcast: unexport dev_mc_upload
[NET]: dev_mcast: unexport dev_mc_upload
dev_mc_add/dev_mc_delete take care of uploading the list when necessary and thats the only interface other code should use. Also remove two incorrect calls in DECnet.
---
commit cdf660f0bd4cca9d2cbe86a31adc60d6fa8a60ec
tree 2f08c8240b7da9b17725896c3f7eb9c7a960c92c
parent 45da27ba265dba3c740c45d47f584c30d7066f82
author Patrick McHardy <[email protected]> Fri, 22 Jun 2007 00:56:00 +0200 committer Patrick McHardy <[email protected]> Fri, 22 Jun 2007 00:56:00 +0200
net/core/dev_mcast.c | 1 - net/decnet/dn_dev.c | 3 --- 2 files changed, 0 insertions(+), 4 deletions(-)
net/core/dev_mcast.c +0 -1
@@ -292,4 +292,3 @@ void __init dev_mcast_init(void)EXPORT_SYMBOL (dev_mc_add);EXPORT_SYMBOL (dev_mc_delete); -EXPORT_SYMBOL (dev_mc_upload);
net/decnet/dn_dev.c +0 -3
@@ -461,7 +461,6 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)if (ifa->ifa_local !=dn_eth2dn (dev->dev_addr)) {dn_dn2eth (mac_addr, ifa->ifa_local);dev_mc_add (dev, mac_addr,ETH_ALEN ,0 ); -dev_mc_upload (dev); } }
@@ -1064,8 +1063,6 @@ static int dn_eth_up(struct net_device *dev)else dev_mc_add (dev, dn_rt_all_rt_mcast,ETH_ALEN ,0 ); -dev_mc_upload (dev); - dn_db->use_long =1 ;return 0 ;
PATCH 2/5 : dev: introduce generic net_device address lists
In reply to Patrick McHardy[NET]: dev: introduce generic net_device address lists
Introduce struct dev_addr_list and list maintenance functions based on dev_mc_list and the related functions. This will be used by follow-up patches for both multicast and secondary unicast addresses.
---
commit 6d8fd140951de7cc8faab4922dba74dd1db3cae5
tree b80412116a867d544808f140e76cdf22bbc8b248
parent cdf660f0bd4cca9d2cbe86a31adc60d6fa8a60ec
author Patrick McHardy <[email protected]> Fri, 22 Jun 2007 03:25:26 +0200 committer Patrick McHardy <[email protected]> Fri, 22 Jun 2007 03:25:26 +0200
include/linux/netdevice.h | 11 +++++++ net/core/dev.c | 69 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 0 deletions(-)
include/linux/netdevice.h +11 -0
@@ -177,6 +177,14 @@ struct netif_rx_stats DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); +struct dev_addr_list +{ +struct dev_addr_list *next; +u8 da_addr[MAX_ADDR_LEN ]; +u8 da_addrlen; +int da_users; +int da_gusers; +};/* * We tag multicasts with these structures.
@@ -1004,6 +1012,9 @@ extern void dev_mc_upload(struct net_device *dev);extern int dev_mc_delete (struct net_device *dev,void *addr,int alen,int all);extern int dev_mc_add (struct net_device *dev,void *addr,int alen,int newonly);extern void dev_mc_discard (struct net_device *dev); +extern int __dev_addr_delete (struct dev_addr_list **list,void *addr,int alen,int all); +extern int __dev_addr_add (struct dev_addr_list **list,void *addr,int alen,int newonly); +extern void __dev_addr_discard (struct dev_addr_list **list);extern void dev_set_promiscuity (struct net_device *dev,int inc);extern void dev_set_allmulti (struct net_device *dev,int inc);extern void netdev_state_change (struct net_device *dev);
net/core/dev.c +69 -0
75 lines not on this page · raw message
PATCH 3/5 : dev_mcast: switch to generic net_device address lists
In reply to Patrick McHardy[NET]: dev_mcast: switch to generic net_device address lists
Use generic net_device address lists for multicast list handling. Some defines are used to keep drivers working.
---
commit 02536a101d6fd8b1924b1e05c44409c7b4568335
tree 6624b4f7f6fb0b10bac091ca43b733dfd1609afc
parent 6d8fd140951de7cc8faab4922dba74dd1db3cae5
author Patrick McHardy <[email protected]> Fri, 22 Jun 2007 03:25:28 +0200 committer Patrick McHardy <[email protected]> Fri, 22 Jun 2007 03:25:28 +0200
include/linux/netdevice.h | 17 +++----- net/core/dev_mcast.c | 96 +++++++-------------------------------------- 2 files changed, 22 insertions(+), 91 deletions(-)
include/linux/netdevice.h +7 -10
@@ -189,15 +189,12 @@ struct dev_addr_list/* * We tag multicasts with these structures. */ - -struct dev_mc_list -{ -struct dev_mc_list *next; -__u8 dmi_addr[MAX_ADDR_LEN ]; -unsigned char dmi_addrlen; -int dmi_users; -int dmi_gusers; -}; + +#define dev_mc_list dev_addr_list +#define dmi_addr da_addr +#define dmi_addrlen da_addrlen +#define dmi_users da_users +#define dmi_gusers da_gusersstruct hh_cache {
@@ -396,7 +393,7 @@ struct net_deviceunsigned char addr_len;/* hardware address length */ unsigned short dev_id;/* for shared network cards */ -struct dev_mc_list *mc_list;/* Multicast mac addresses */ +struct dev_addr_list *mc_list;/* Multicast mac addresses */ int mc_count;/* Number of installed mcasts */ int promiscuity;int allmulti;
net/core/dev_mcast.c +15 -81
131 lines not on this page · raw message
PATCH 4/5 : dev: secondary unicast address support
In reply to Patrick McHardy[NET]: dev: secondary unicast address support
Add support for configuring secondary unicast addresses on network devices. To support this devices capable of filtering multiple unicast addresses need to change their set_multicast_list function to configure unicast filters as well and assign it to dev->set_rx_mode instead of dev->set_multicast_list. Other devices are put into promiscous mode when secondary unicast addresses are present.
---
commit 099e4ab74adb9418155132b093533f152a31b583
tree 7c8f52672f7b6e1323a479545225d88a2eb35670
parent 02536a101d6fd8b1924b1e05c44409c7b4568335
author Patrick McHardy <[email protected]> Fri, 22 Jun 2007 14:13:46 +0200 committer Patrick McHardy <[email protected]> Fri, 22 Jun 2007 14:13:46 +0200
include/linux/netdevice.h | 12 +++- net/core/dev.c | 144 ++++++++++++++++++++++++++++++++++++++++----- net/core/dev_mcast.c | 37 +----------- 3 files changed, 139 insertions(+), 54 deletions(-)
include/linux/netdevice.h +10 -2
@@ -393,6 +393,9 @@ struct net_deviceunsigned char addr_len;/* hardware address length */ unsigned short dev_id;/* for shared network cards */ +struct dev_addr_list *uc_list;/* Secondary unicast mac addresses */ +int uc_count;/* Number of installed ucasts */ +int uc_promisc;struct dev_addr_list *mc_list;/* Multicast mac addresses */ int mc_count;/* Number of installed mcasts */ int promiscuity;
@@ -498,6 +501,8 @@ struct net_devicevoid *saddr, unsigned len);int (*rebuild_header)(struct sk_buff *skb); +#define HAVE_SET_RX_MODE +void (*set_rx_mode)(struct net_device *dev);#define HAVE_MULTICAST void (*set_multicast_list)(struct net_device *dev);#define HAVE_SET_MAC_ADDR
@@ -1004,8 +1009,11 @@ extern struct net_device *alloc_netdev(int sizeof_priv, const char *name, void (*setup)(struct net_device *));extern int register_netdev (struct net_device *dev);extern void unregister_netdev (struct net_device *dev); -/* Functions used for multicast support */ -extern void dev_mc_upload (struct net_device *dev); +/* Functions used for secondary unicast and multicast support */ +extern void dev_set_rx_mode (struct net_device *dev); +extern void __dev_set_rx_mode (struct net_device *dev); +extern int dev_unicast_delete (struct net_device *dev,void *addr,int alen); +extern int dev_unicast_add (struct net_device *dev,void *addr,int alen);extern int dev_mc_delete (struct net_device *dev,void *addr,int alen,int all);extern int dev_mc_add (struct net_device *dev,void *addr,int alen,int newonly);extern void dev_mc_discard (struct net_device *dev);
net/core/dev.c +127 -17
199 lines not on this page · raw message
net/core/dev_mcast.c +2 -35
@@ -64,39 +64,6 @@*/ /* -* Update the multicast list into the physical NIC controller. -*/ - -static void __dev_mc_upload (struct net_device *dev) -{ -/* Don't do anything till we up the interface -* [dev_open will call this function so the list will -* stay sane] -*/ - -if (!(dev->flags&IFF_UP )) -return ; - -/* -* Devices with no set multicast or which have been -* detached don't get set. -*/ - -if (dev->set_multicast_list ==NULL || - !netif_device_present (dev)) -return ; - - dev->set_multicast_list (dev); -} - -void dev_mc_upload (struct net_device *dev) -{ -netif_tx_lock_bh (dev); -__dev_mc_upload (dev); -netif_tx_unlock_bh (dev); -} - -/* * Delete a device level multicast */
@@ -114,7 +81,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)* loaded filter is now wrong. Fix it */ -__dev_mc_upload (dev); +__dev_set_rx_mode (dev); }netif_tx_unlock_bh (dev);return err;
@@ -132,7 +99,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) err =__dev_addr_add (&dev->mc_list, addr, alen, glbl);if (!err) { dev->mc_count++; -__dev_mc_upload (dev); +__dev_set_rx_mode (dev); }netif_tx_unlock_bh (dev);return err;
PATCH 5/5 : Secondary unicast address support
In reply to Patrick McHardy[E1000]: Secondary unicast address support
Add support for configuring secondary unicast addresses. Unicast addresses take precendece over multicast addresses when filling the exact address filters to avoid going to promiscous mode. When more unicast addresses are present than filter slots, unicast filtering is disabled and all slots can be used for multicast addresses.
---
commit 9613e4e4017b8bb68fcdd28cf5f9ae00bff18e28
tree e19261eea046a0404af0b26e2b99725ee33ae3c2
parent 099e4ab74adb9418155132b093533f152a31b583
author Patrick McHardy <[email protected]> Fri, 22 Jun 2007 14:13:48 +0200 committer Patrick McHardy <[email protected]> Fri, 22 Jun 2007 14:13:48 +0200
drivers/net/e1000/e1000_main.c | 47 ++++++++++++++++++++++++++-------------- 1 files changed, 31 insertions(+), 16 deletions(-)
drivers/net/e1000/e1000_main.c +31 -16
@@ -149,7 +149,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring);static void e1000_clean_rx_ring (struct e1000_adapter *adapter,struct e1000_rx_ring *rx_ring); -static void e1000_set_multi (struct net_device *netdev); +static void e1000_set_rx_mode (struct net_device *netdev);static void e1000_update_phy_info (unsigned long data);static void e1000_watchdog (unsigned long data);static void e1000_82547_tx_fifo_stall (unsigned long data);
@@ -513,7 +513,7 @@ static void e1000_configure(struct e1000_adapter *adapter)struct net_device *netdev = adapter->netdev;int i; -e1000_set_multi (netdev); +e1000_set_rx_mode (netdev);e1000_restore_vlan (adapter);e1000_init_manageability (adapter);
@@ -924,7 +924,7 @@ e1000_probe(struct pci_dev *pdev, netdev->stop = &e1000_close; netdev->hard_start_xmit = &e1000_xmit_frame; netdev->get_stats = &e1000_get_stats; - netdev->set_multicast_list = &e1000_set_multi; + netdev->set_rx_mode = &e1000_set_rx_mode; netdev->set_mac_address = &e1000_set_mac; netdev->change_mtu = &e1000_change_mtu; netdev->do_ioctl = &e1000_ioctl;
@@ -2412,21 +2412,22 @@ e1000_set_mac(struct net_device *netdev, void *p) }/** -* e1000_set_multi - Multicast and Promiscuous mode set +* e1000_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set * @netdev: network interface device structure * -* The set_multi entry point is called whenever the multicast address -* list or the network interface flags are updated. This routine is -* responsible for configuring the hardware for proper multicast, +* The set_rx_mode entry point is called whenever the unicast or multicast +* address lists or the network interface flags are updated. This routine is +* responsible for configuring the hardware for proper unicast, multicast, * promiscuous mode, and all-multi behavior. **/ static void -e1000_set_multi (struct net_device *netdev) +e1000_set_rx_mode (struct net_device *netdev) {struct e1000_adapter *adapter =netdev_priv (netdev);struct e1000_hw *hw = &adapter->hw; -struct dev_mc_list *mc_ptr; +struct dev_addr_list *uc_ptr; +struct dev_addr_list *mc_ptr;uint32_t rctl;uint32_t hash_value;int i, rar_entries =E1000_RAR_ENTRIES ;
@@ -2449,9 +2450,16 @@ e1000_set_multi(struct net_device *netdev) rctl |= (E1000_RCTL_UPE |E1000_RCTL_MPE ); }else if (netdev->flags &IFF_ALLMULTI ) { rctl |=E1000_RCTL_MPE ; - rctl &= ~E1000_RCTL_UPE ; }else { - rctl &= ~(E1000_RCTL_UPE |E1000_RCTL_MPE ); + rctl &= ~E1000_RCTL_MPE ; + } + + uc_ptr =NULL ; +if (netdev->uc_count > rar_entries -1 ) { + rctl |=E1000_RCTL_UPE ; + }else if (!(netdev->flags &IFF_PROMISC )) { + rctl &= ~E1000_RCTL_UPE ; + uc_ptr = netdev->uc_list; }E1000_WRITE_REG (hw,RCTL , rctl);
@@ -2461,7 +2469,10 @@ e1000_set_multi(struct net_device *netdev)if (hw->mac_type == e1000_82542_rev2_0)e1000_enter_82542_rst (adapter); -/* load the first 14 multicast address into the exact filters 1-14 +/* load the first 14 addresses into the exact filters 1-14. Unicast +* addresses take precedence to avoid disabling unicast filtering +* when possible. +* * RAR 0 is used for the station MAC adddress * if there are not 14 addresses, go ahead and clear the filters * -- with 82571 controllers only 0-13 entries are filled here
@@ -2469,8 +2480,11 @@ e1000_set_multi(struct net_device *netdev) mc_ptr = netdev->mc_list;for (i =1 ; i < rar_entries; i++) { -if (mc_ptr) { -e1000_rar_set (hw, mc_ptr->dmi_addr, i); +if (uc_ptr) { +e1000_rar_set (hw, uc_ptr->da_addr, i); + uc_ptr = uc_ptr->next; + }else if (mc_ptr) { +e1000_rar_set (hw, mc_ptr->da_addr, i); mc_ptr = mc_ptr->next; }else {E1000_WRITE_REG_ARRAY (hw,RA , i <<1 ,0 );
@@ -2479,6 +2493,7 @@ e1000_set_multi(struct net_device *netdev)E1000_WRITE_FLUSH (hw); } } +WARN_ON (uc_ptr !=NULL );/* clear the old settings from the multicast hash table */
@@ -2490,7 +2505,7 @@ e1000_set_multi(struct net_device *netdev)/* load any remaining addresses into the hash table */ for (; mc_ptr; mc_ptr = mc_ptr->next) { - hash_value =e1000_hash_mc_addr (hw, mc_ptr->dmi_addr); + hash_value =e1000_hash_mc_addr (hw, mc_ptr->da_addr);e1000_mta_set (hw, hash_value); }
@@ -5098,7 +5113,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)if (wufc) {e1000_setup_rctl (adapter); -e1000_set_multi (netdev); +e1000_set_rx_mode (netdev);/* turn on all-multi mode if wake on multicast is enabled */ if (wufc &E1000_WUFC_MC ) {
Re: [E1000 05/05]: Secondary unicast address support
Quoted 144 lines · Patrick McHardy
[E1000]: Secondary unicast address support
Add support for configuring secondary unicast addresses. Unicast addresses take precendece over multicast addresses when filling the exact address filters to avoid going to promiscous mode. When more unicast addresses are present than filter slots, unicast filtering is disabled and all slots can be used for multicast addresses.
Signed-off-by Patrick McHardy <[email protected]>---
commit9613e4e4017b8bb68fcdd28cf5f9ae00bff18e28
treee19261eea046a0404af0b26e2b99725ee33ae3c2
parent099e4ab74adb9418155132b093533f152a31b583
author Patrick McHardy <[email protected]> Fri, 22 Jun 2007 14:13:48 +0200 committer Patrick McHardy <[email protected]> Fri, 22 Jun 2007 14:13:48 +0200drivers/net/e1000/e1000_main.c | 47 ++++++++++++++++++++++++++-------------- 1 files changed, 31 insertions(+), 16 deletions(-)drivers/net/e1000/e1000_main.c +30
-15@@ -149,7 +149,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring);static void e1000_clean_rx_ring (struct e1000_adapter *adapter,struct e1000_rx_ring *rx_ring); -static void e1000_set_multi (struct net_device *netdev); +static void e1000_set_rx_mode (struct net_device *netdev);static void e1000_update_phy_info (unsigned long data);static void e1000_watchdog (unsigned long data);static void e1000_82547_tx_fifo_stall (unsigned long data);@@ -513,7 +513,7 @@ static void e1000_configure(struct e1000_adapter *adapter)struct net_device *netdev = adapter->netdev;int i; -e1000_set_multi (netdev); +e1000_set_rx_mode (netdev);e1000_restore_vlan (adapter);e1000_init_manageability (adapter);@@ -924,7 +924,7 @@ e1000_probe(struct pci_dev *pdev, netdev->stop = &e1000_close; netdev->hard_start_xmit = &e1000_xmit_frame; netdev->get_stats = &e1000_get_stats; - netdev->set_multicast_list = &e1000_set_multi; + netdev->set_rx_mode = &e1000_set_rx_mode; netdev->set_mac_address = &e1000_set_mac; netdev->change_mtu = &e1000_change_mtu; netdev->do_ioctl = &e1000_ioctl;@@ -2412,21 +2412,22 @@ e1000_set_mac(struct net_device *netdev, void *p) }/** -* e1000_set_multi - Multicast and Promiscuous mode set +* e1000_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set * @netdev: network interface device structure * -* The set_multi entry point is called whenever the multicast address -* list or the network interface flags are updated. This routine is -* responsible for configuring the hardware for proper multicast, +* The set_rx_mode entry point is called whenever the unicast or multicast +* address lists or the network interface flags are updated. This routine is +* responsible for configuring the hardware for proper unicast, multicast, * promiscuous mode, and all-multi behavior. **/ static void -e1000_set_multi (struct net_device *netdev) +e1000_set_rx_mode (struct net_device *netdev) {struct e1000_adapter *adapter =netdev_priv (netdev);struct e1000_hw *hw = &adapter->hw; -struct dev_mc_list *mc_ptr; +struct dev_addr_list *uc_ptr; +struct dev_addr_list *mc_ptr;uint32_t rctl;uint32_t hash_value;int i, rar_entries =E1000_RAR_ENTRIES ;@@ -2449,9 +2450,16 @@ e1000_set_multi(struct net_device *netdev) rctl |= (E1000_RCTL_UPE |E1000_RCTL_MPE ); }else if (netdev->flags &IFF_ALLMULTI ) { rctl |=E1000_RCTL_MPE ; - rctl &= ~E1000_RCTL_UPE ; }else { - rctl &= ~(E1000_RCTL_UPE |E1000_RCTL_MPE ); + rctl &= ~E1000_RCTL_MPE ; + } + + uc_ptr =NULL ; +if (netdev->uc_count > rar_entries -1 ) { + rctl |=E1000_RCTL_UPE ; + }else if (!(netdev->flags &IFF_PROMISC )) { + rctl &= ~E1000_RCTL_UPE ; + uc_ptr = netdev->uc_list; }E1000_WRITE_REG (hw,RCTL , rctl);@@ -2461,7 +2469,10 @@ e1000_set_multi(struct net_device *netdev)if (hw->mac_type == e1000_82542_rev2_0)e1000_enter_82542_rst (adapter); -/* load the first 14 multicast address into the exact filters 1-14 +/* load the first 14 addresses into the exact filters 1-14. Unicast +* addresses take precedence to avoid disabling unicast filtering +* when possible. +* * RAR 0 is used for the station MAC adddress * if there are not 14 addresses, go ahead and clear the filters * -- with 82571 controllers only 0-13 entries are filled here @@ -2469,8 +2480,11 @@ e1000_set_multi(struct net_device *netdev) mc_ptr = netdev->mc_list;for (i =1 ; i < rar_entries; i++) { -if (mc_ptr) { -e1000_rar_set (hw, mc_ptr->dmi_addr, i); +if (uc_ptr) { +e1000_rar_set (hw, uc_ptr->da_addr, i); + uc_ptr = uc_ptr->next; + }else if (mc_ptr) { +e1000_rar_set (hw, mc_ptr->da_addr, i); mc_ptr = mc_ptr->next; }else {E1000_WRITE_REG_ARRAY (hw,RA , i <<1 ,0 );@@ -2479,6 +2493,7 @@ e1000_set_multi(struct net_device *netdev)E1000_WRITE_FLUSH (hw); } } +WARN_ON (uc_ptr !=NULL );/* clear the old settings from the multicast hash table */ @@ -2490,7 +2505,7 @@ e1000_set_multi(struct net_device *netdev)/* load any remaining addresses into the hash table */ for (; mc_ptr; mc_ptr = mc_ptr->next) { - hash_value =e1000_hash_mc_addr (hw, mc_ptr->dmi_addr); + hash_value =e1000_hash_mc_addr (hw, mc_ptr->da_addr);e1000_mta_set (hw, hash_value); }
drivers/net/e1000/e1000_main.c e1000_suspend(struct pci_dev *pdev, pm_message_t state)
Quoted 9 lines
drivers/net/e1000/e1000_main.c +1
-2@@ -5098,7 +5113,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)if (wufc) {e1000_setup_rctl (adapter); -e1000_set_multi (netdev); +e1000_set_rx_mode (netdev);/* turn on all-multi mode if wake on multicast is enabled */ if (wufc &E1000_WUFC_MC ) { -
noted. I'm (like a lot of people) on the road and still need to dig into this deeper. I think it's OK for as far as I can see, except the WARN_ON, can't we pre-check to see if we have enough room in the rar_entries first?
Auke
Re: [E1000 05/05]: Secondary unicast address support
Quoted 46 lines · Auke
Quoted 45 lines · Patrick McHardy
drivers/net/e1000/e1000_main.c +18
-5@@ -2449,9 +2450,16 @@ e1000_set_multi(struct net_device *netdev) rctl |= (E1000_RCTL_UPE |E1000_RCTL_MPE ); }else if (netdev->flags &IFF_ALLMULTI ) { rctl |=E1000_RCTL_MPE ; - rctl &= ~E1000_RCTL_UPE ; }else { - rctl &= ~(E1000_RCTL_UPE |E1000_RCTL_MPE ); + rctl &= ~E1000_RCTL_MPE ; + } + + uc_ptr =NULL ; +if (netdev->uc_count > rar_entries -1 ) { + rctl |=E1000_RCTL_UPE ; + }else if (!(netdev->flags &IFF_PROMISC )) { + rctl &= ~E1000_RCTL_UPE ; + uc_ptr = netdev->uc_list; }E1000_WRITE_REG (hw,RCTL , rctl);@@ -2461,7 +2469,10 @@ e1000_set_multi(struct net_device *netdev)if (hw->mac_type == e1000_82542_rev2_0)e1000_enter_82542_rst (adapter); -/* load the first 14 multicast address into the exact filters 1-14 +/* load the first 14 addresses into the exact filters 1-14. Unicast +* addresses take precedence to avoid disabling unicast filtering +* when possible. +* * RAR 0 is used for the station MAC adddress * if there are not 14 addresses, go ahead and clear the filters * -- with 82571 controllers only 0-13 entries are filled here @@ -2469,8 +2480,11 @@ e1000_set_multi(struct net_device *netdev) mc_ptr = netdev->mc_list;for (i =1 ; i < rar_entries; i++) { -if (mc_ptr) { -e1000_rar_set (hw, mc_ptr->dmi_addr, i); +if (uc_ptr) { +e1000_rar_set (hw, uc_ptr->da_addr, i); + uc_ptr = uc_ptr->next; + }else if (mc_ptr) { +e1000_rar_set (hw, mc_ptr->da_addr, i); mc_ptr = mc_ptr->next; }else {E1000_WRITE_REG_ARRAY (hw,RA , i <<1 ,0 );
Quoted 8 lines
drivers/net/e1000/e1000_main.c e1000_set_multi(struct net_device *netdev) · line 2497
Quoted 6 lines
drivers/net/e1000/e1000_main.c +1
-0@@ -2479,6 +2493,7 @@ e1000_set_multi(struct net_device *netdev)E1000_WRITE_FLUSH (hw); } } +WARN_ON (uc_ptr !=NULL );noted. I'm (like a lot of people) on the road and still need to dig into this deeper.
Please take your time, this was mainly an example and for testing. If its OK I wouldn't object to you applying it of course :)
Quoted 1 line
I think it's OK for as far as I can see, except the
WARN_ON, can't we pre-check to see if we have enough room in therar_entriesfirst?
It does, the WARN_ON would only trigger if I made a mistake:
+ if (netdev->uc_count > rar_entries - 1) {
Re: [NET 01/05]: dev_mcast: unexport dev_mc_upload
In reply to Patrick McHardyFrom: Patrick McHardy <[email protected]>
Date: Fri, 22 Jun 2007 14:24:07 +0200 (MEST)
Quoted 7 lines
[NET]:
dev_mcast: unexportdev_mc_uploaddev_mc_add/dev_mc_delete take care of uploading the list when necessary and thats the only interface other code should use. Also remove two incorrect calls in DECnet.
Signed-off-by Patrick McHardy <[email protected]>
Applied to net-2.6.23, thanks Patrick.
Re: [NET 02/05]: dev: introduce generic net_device address lists
In reply to Patrick McHardyFrom: Patrick McHardy <[email protected]>
Date: Fri, 22 Jun 2007 14:24:09 +0200 (MEST)
Quoted 8 lines
[NET]: dev: introduce generic
net_deviceaddress listsIntroduce struct
dev_addr_listand list maintenance functions based ondev_mc_listand the related functions. This will be used by follow-up patches for both multicast and secondary unicast addresses.Signed-off-by Patrick McHardy <[email protected]>
Applied to net-2.6.23
Re: [NET 03/05]: dev_mcast: switch to generic net_device address lists
In reply to Patrick McHardyFrom: Patrick McHardy <[email protected]>
Date: Fri, 22 Jun 2007 14:24:10 +0200 (MEST)
Quoted 6 lines
[NET]:
dev_mcast: switch to genericnet_deviceaddress listsUse generic
net_deviceaddress lists for multicast list handling. Some defines are used to keep drivers working.Signed-off-by Patrick McHardy <[email protected]>
Applied, thanks Patrick.
Hopefully we can convert the drivers over time and eventually at some future point kill the macros.
David Miller
maintainerRe: [NET 04/05]: dev: secondary unicast address support
In reply to Patrick McHardyFrom: Patrick McHardy <[email protected]>
Date: Fri, 22 Jun 2007 14:24:12 +0200 (MEST)
Quoted 10 lines
[NET]: dev: secondary unicast address support
Add support for configuring secondary unicast addresses on network devices. To support this devices capable of filtering multiple unicast addresses need to change their
set_multicast_listfunction to configure unicast filters as well and assign it todev->set_rx_modeinstead ofdev->set_multicast_list. Other devices are put into promiscous mode when secondary unicast addresses are present.Signed-off-by Patrick McHardy <[email protected]>
Also applied, thanks for doing this work Patrick.
I'll let the driver maintainers approve and merge individual device support.
Thanks again.
Re: [NET 04/05]: dev: secondary unicast address support
Quoted 13 lines · David Miller
From: Patrick McHardy <[email protected]>
Date: Fri, 22 Jun 2007 14:24:12 +0200 (MEST)Quoted 9 lines
[NET]: dev: secondary unicast address support
Add support for configuring secondary unicast addresses on network devices. To support this devices capable of filtering multiple unicast addresses need to change their
set_multicast_listfunction to configure unicast filters as well and assign it todev->set_rx_modeinstead ofdev->set_multicast_list. Other devices are put into promiscous mode when secondary unicast addresses are present.
Quoted 4 lines
Quoted 1 line
Signed-off-by Patrick McHardy <[email protected]>Also applied, thanks for doing this work Patrick.
Thanks. Please hold off on the MACVLAN patch, I want to convert it to use this stuff before adding it.
David Miller
maintainerRe: [NET 04/05]: dev: secondary unicast address support
From: Patrick McHardy <[email protected]>
Date: Wed, 27 Jun 2007 10:30:09 +0200
Quoted 14 lines
Quoted 13 lines · David Miller
From: Patrick McHardy <[email protected]>
Date: Fri, 22 Jun 2007 14:24:12 +0200 (MEST)Quoted 9 lines
[NET]: dev: secondary unicast address support
Add support for configuring secondary unicast addresses on network devices. To support this devices capable of filtering multiple unicast addresses need to change their
set_multicast_listfunction to configure unicast filters as well and assign it todev->set_rx_modeinstead ofdev->set_multicast_list. Other devices are put into promiscous mode when secondary unicast addresses are present.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Patrick McHardy <[email protected]>Also applied, thanks for doing this work Patrick.
Thanks. Please hold off on the MACVLAN patch, I want to convert it to use this stuff before adding it.
Ok.