e1000: convert to use netdev_for_each_mc_addr
Subsystems (2)
PATCH 1/1 e1000: convert to use netdev_for_each_mc_addr
--- drivers/net/e1000/e1000_main.c | 37 +++++++++++++++++-------------------- 1 files changed, 17 insertions(+), 20 deletions(-)
drivers/net/e1000/e1000_main.c +17 -20
@@ -2161,29 +2161,26 @@ static void e1000_set_rx_mode(struct net_device *netdev)WARN_ON (i == rar_entries); - mc_ptr = netdev->mc_list; - -for (; i < rar_entries; i++) { -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 ); -E1000_WRITE_FLUSH (); -E1000_WRITE_REG_ARRAY (hw,RA , (i <<1 ) +1 ,0 ); -E1000_WRITE_FLUSH (); +netdev_for_each_mc_addr (mc_ptr, netdev) { +if (i == rar_entries) { +/* load any remaining addresses into the hash table */ +u32 hash_reg, hash_bit, mta; + hash_value =e1000_hash_mc_addr (hw, mc_ptr->da_addr); + hash_reg = (hash_value >>5 ) &0x7F ; + hash_bit = hash_value &0x1F ; + mta = (1 << hash_bit); + mcarray[hash_reg] |= mta; + } +else { +e1000_rar_set (hw, mc_ptr->da_addr, i++); } } -/* load any remaining addresses into the hash table */ - -for (; mc_ptr; mc_ptr = mc_ptr->next) { -u32 hash_reg, hash_bit, mta; - hash_value =e1000_hash_mc_addr (hw, mc_ptr->da_addr); - hash_reg = (hash_value >>5 ) &0x7F ; - hash_bit = hash_value &0x1F ; - mta = (1 << hash_bit); - mcarray[hash_reg] |= mta; +for (; i < rar_entries; i++) { +E1000_WRITE_REG_ARRAY (hw,RA , i <<1 ,0 ); +E1000_WRITE_FLUSH (); +E1000_WRITE_REG_ARRAY (hw,RA , (i <<1 ) +1 ,0 ); +E1000_WRITE_FLUSH (); }/* write the hash table completely, write from bottom to avoid
Signature · 1 line
1.6.6
From: Jiri Pirko <[email protected]>
Date: Mon, 22 Feb 2010 20:10:44 +0100
Quoted 2 lines
Signed-off-by Jiri Pirko <[email protected]>
Applied.
Quoted 26 lines · Jiri Pirko
Signed-off-by Jiri Pirko <[email protected]>---
drivers/net/e1000/e1000_main.c | 37 +++++++++++++++++--------------------1 files changed, 17 insertions(+), 20 deletions(-)drivers/net/e1000/e1000_main.c +1
-11@@ -2161,29 +2161,26 @@ static void e1000_set_rx_mode(struct net_device *netdev) WARN_ON(i == rar_entries); - mc_ptr = netdev->mc_list; - - for (; i < rar_entries; i++) { - 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); - E1000_WRITE_FLUSH(); - E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); - E1000_WRITE_FLUSH(); + netdev_for_each_mc_addr(mc_ptr, netdev) {
drivers/net/e1000/e1000_main.c static void e1000_set_rx_mode(struct net_device *netdev) · line 2174
Quoted 10 lines
drivers/net/e1000/e1000_main.c +10
-0+ if (i == rar_entries) { + /* load any remaining addresses into the hash table */ + u32 hash_reg, hash_bit, mta; + hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr); + hash_reg = (hash_value >> 5) & 0x7F; + hash_bit = hash_value & 0x1F; + mta = (1 << hash_bit); + mcarray[hash_reg] |= mta; + } + else {
nit - else should be in the same line like "} else {"
Quoted 11 lines
drivers/net/e1000/e1000_main.c +1
-7+ e1000_rar_set(hw, mc_ptr->da_addr, i++); } } - /* load any remaining addresses into the hash table */ - - for (; mc_ptr; mc_ptr = mc_ptr->next) { - u32 hash_reg, hash_bit, mta; - hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr); - hash_reg = (hash_value >> 5) & 0x7F; - hash_bit = hash_value & 0x1F;
drivers/net/e1000/e1000_main.c static void e1000_set_rx_mode(struct net_device *netdev) · line 2186
Quoted 10 lines
drivers/net/e1000/e1000_main.c +5
-2- mta = (1 << hash_bit); - mcarray[hash_reg] |= mta; + for (; i < rar_entries; i++) { + E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); + E1000_WRITE_FLUSH(); + E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); + E1000_WRITE_FLUSH(); } /* write the hash table completely, write from bottom to avoid
otherwise seems okay. Thanks for your work on cleaning this stuff, we'll be testing it as part of the net next testing already going on.
Quoted 31 lines · Tue, Feb 23, 2010 at 01:54:13AM CET, [email protected] wrote:
Quoted 30 lines · Jiri Pirko
Signed-off-by Jiri Pirko <[email protected]>---
drivers/net/e1000/e1000_main.c | 37 +++++++++++++++++--------------------1 files changed, 17 insertions(+), 20 deletions(-)drivers/net/e1000/e1000_main.c +5
-11@@ -2161,29 +2161,26 @@ static void e1000_set_rx_mode(struct net_device *netdev) WARN_ON(i == rar_entries); - mc_ptr = netdev->mc_list; - - for (; i < rar_entries; i++) { - 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); - E1000_WRITE_FLUSH(); - E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); - E1000_WRITE_FLUSH(); + netdev_for_each_mc_addr(mc_ptr, netdev) { + if (i == rar_entries) { + /* load any remaining addresses into the hash table */ + u32 hash_reg, hash_bit, mta; + hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr);
Quoted 8 lines
drivers/net/e1000/e1000_main.c static void e1000_set_rx_mode(struct net_device *netdev) · line 2174
Quoted 6 lines
drivers/net/e1000/e1000_main.c +6
-0+ hash_reg = (hash_value >> 5) & 0x7F; + hash_bit = hash_value & 0x1F; + mta = (1 << hash_bit); + mcarray[hash_reg] |= mta; + } + else {nit - else should be in the same line like "} else {"
Oh right, but patch is already applied. Will post correction.
Quoted 21 lines
Quoted 21 lines
drivers/net/e1000/e1000_main.c +6
-9+ e1000_rar_set(hw, mc_ptr->da_addr, i++); } } - /* load any remaining addresses into the hash table */ - - for (; mc_ptr; mc_ptr = mc_ptr->next) { - u32 hash_reg, hash_bit, mta; - hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr); - hash_reg = (hash_value >> 5) & 0x7F; - hash_bit = hash_value & 0x1F; - mta = (1 << hash_bit); - mcarray[hash_reg] |= mta; + for (; i < rar_entries; i++) { + E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); + E1000_WRITE_FLUSH(); + E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); + E1000_WRITE_FLUSH(); }
Quoted 4 lines
drivers/net/e1000/e1000_main.c static void e1000_set_rx_mode(struct net_device *netdev) · line 2186
Quoted 1 line
drivers/net/e1000/e1000_main.c +0
-0/* write the hash table completely, write from bottom to avoidotherwise seems okay. Thanks for your work on cleaning this stuff, we'll be testing it as part of the net next testing already going on.
Cool, thanks
Jirka