aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-07-23 14:09:12 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-26 12:46:53 -0400
commit5ac1665906559768029c398d9ede8e7cdd73004e (patch)
treee9b24ef5346d28ccd915fffb5047af7ff7cfaf4f /drivers/net/igb
parent28fc06f58b1fe567bb86c7d0e3d93137e5c0126e (diff)
igb: cleanup receive address register initialization
This update cleans up the receive address register initialization. The main purpose of this is to clean out some redundancy that was introduced due to having multiple ways of setting the receive address registers. Instead of having a specialized function to set one register and one to set all of them it makes more sense to just go through the list calling the function that is needed to set the individual registers. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb')
-rw-r--r--drivers/net/igb/e1000_82575.c39
-rw-r--r--drivers/net/igb/e1000_mac.c25
-rw-r--r--drivers/net/igb/e1000_mac.h1
3 files changed, 30 insertions, 35 deletions
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index 5d2c2fbf926b..95360dc4a566 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -765,39 +765,6 @@ static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed,
765} 765}
766 766
767/** 767/**
768 * igb_init_rx_addrs_82575 - Initialize receive address's
769 * @hw: pointer to the HW structure
770 * @rar_count: receive address registers
771 *
772 * Setups the receive address registers by setting the base receive address
773 * register to the devices MAC address and clearing all the other receive
774 * address registers to 0.
775 **/
776static void igb_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count)
777{
778 u32 i;
779 u8 addr[6] = {0,0,0,0,0,0};
780 /*
781 * This function is essentially the same as that of
782 * e1000_init_rx_addrs_generic. However it also takes care
783 * of the special case where the register offset of the
784 * second set of RARs begins elsewhere. This is implicitly taken care by
785 * function e1000_rar_set_generic.
786 */
787
788 hw_dbg("e1000_init_rx_addrs_82575");
789
790 /* Setup the receive address */
791 hw_dbg("Programming MAC Address into RAR[0]\n");
792 hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
793
794 /* Zero out the other (rar_entry_count - 1) receive addresses */
795 hw_dbg("Clearing RAR[1-%u]\n", rar_count-1);
796 for (i = 1; i < rar_count; i++)
797 hw->mac.ops.rar_set(hw, addr, i);
798}
799
800/**
801 * igb_shutdown_fiber_serdes_link_82575 - Remove link during power down 768 * igb_shutdown_fiber_serdes_link_82575 - Remove link during power down
802 * @hw: pointer to the HW structure 769 * @hw: pointer to the HW structure
803 * 770 *
@@ -889,7 +856,8 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
889 wr32(E1000_IMC, 0xffffffff); 856 wr32(E1000_IMC, 0xffffffff);
890 icr = rd32(E1000_ICR); 857 icr = rd32(E1000_ICR);
891 858
892 igb_check_alt_mac_addr(hw); 859 /* Install any alternate MAC address into RAR0 */
860 ret_val = igb_check_alt_mac_addr(hw);
893 861
894 return ret_val; 862 return ret_val;
895} 863}
@@ -918,7 +886,8 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
918 igb_clear_vfta(hw); 886 igb_clear_vfta(hw);
919 887
920 /* Setup the receive address */ 888 /* Setup the receive address */
921 igb_init_rx_addrs_82575(hw, rar_count); 889 igb_init_rx_addrs(hw, rar_count);
890
922 /* Zero out the Multicast HASH table */ 891 /* Zero out the Multicast HASH table */
923 hw_dbg("Zeroing the MTA\n"); 892 hw_dbg("Zeroing the MTA\n");
924 for (i = 0; i < mac->mta_reg_count; i++) 893 for (i = 0; i < mac->mta_reg_count; i++)
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c
index 46e27e98254a..a1e3da78dbb1 100644
--- a/drivers/net/igb/e1000_mac.c
+++ b/drivers/net/igb/e1000_mac.c
@@ -104,6 +104,31 @@ static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
104} 104}
105 105
106/** 106/**
107 * igb_init_rx_addrs - Initialize receive address's
108 * @hw: pointer to the HW structure
109 * @rar_count: receive address registers
110 *
111 * Setups the receive address registers by setting the base receive address
112 * register to the devices MAC address and clearing all the other receive
113 * address registers to 0.
114 **/
115void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
116{
117 u32 i;
118 u8 mac_addr[ETH_ALEN] = {0};
119
120 /* Setup the receive address */
121 hw_dbg("Programming MAC Address into RAR[0]\n");
122
123 hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
124
125 /* Zero out the other (rar_entry_count - 1) receive addresses */
126 hw_dbg("Clearing RAR[1-%u]\n", rar_count-1);
127 for (i = 1; i < rar_count; i++)
128 hw->mac.ops.rar_set(hw, mac_addr, i);
129}
130
131/**
107 * igb_vfta_set - enable or disable vlan in VLAN filter table 132 * igb_vfta_set - enable or disable vlan in VLAN filter table
108 * @hw: pointer to the HW structure 133 * @hw: pointer to the HW structure
109 * @vid: VLAN id to add or remove 134 * @vid: VLAN id to add or remove
diff --git a/drivers/net/igb/e1000_mac.h b/drivers/net/igb/e1000_mac.h
index f9ebfb3f234c..7518af8cbbf5 100644
--- a/drivers/net/igb/e1000_mac.h
+++ b/drivers/net/igb/e1000_mac.h
@@ -62,6 +62,7 @@ void igb_clear_hw_cntrs_base(struct e1000_hw *hw);
62void igb_clear_vfta(struct e1000_hw *hw); 62void igb_clear_vfta(struct e1000_hw *hw);
63s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add); 63s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add);
64void igb_config_collision_dist(struct e1000_hw *hw); 64void igb_config_collision_dist(struct e1000_hw *hw);
65void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
65void igb_mta_set(struct e1000_hw *hw, u32 hash_value); 66void igb_mta_set(struct e1000_hw *hw, u32 hash_value);
66void igb_put_hw_semaphore(struct e1000_hw *hw); 67void igb_put_hw_semaphore(struct e1000_hw *hw);
67void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); 68void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);