e1000e: fix and commonize code for setting the receive address registers

Fix e1000e_rar_set() to flush consecutive register writes to avoid write
combining which some parts cannot handle. Update e1000e_init_rx_addrs()
to call the fixed e1000e_rar_set() instead of duplicating code.

Also change e1000e_rar_set() to _not_ set the Address Valid bit if the MAC
address is all zeros.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Bruce Allan and committed by David S. Miller b7a9216c ca777f9c

+15 -9
+15 -9
drivers/net/e1000e/lib.c
··· 125 125 void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) 126 126 { 127 127 u32 i; 128 + u8 mac_addr[ETH_ALEN] = {0}; 128 129 129 130 /* Setup the receive address */ 130 131 e_dbg("Programming MAC Address into RAR[0]\n"); ··· 134 133 135 134 /* Zero out the other (rar_entry_count - 1) receive addresses */ 136 135 e_dbg("Clearing RAR[1-%u]\n", rar_count-1); 137 - for (i = 1; i < rar_count; i++) { 138 - E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1), 0); 139 - e1e_flush(); 140 - E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((i << 1) + 1), 0); 141 - e1e_flush(); 142 - } 136 + for (i = 1; i < rar_count; i++) 137 + e1000e_rar_set(hw, mac_addr, i); 143 138 } 144 139 145 140 /** ··· 161 164 162 165 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); 163 166 164 - rar_high |= E1000_RAH_AV; 167 + /* If MAC address zero, no need to set the AV bit */ 168 + if (rar_low || rar_high) 169 + rar_high |= E1000_RAH_AV; 165 170 166 - E1000_WRITE_REG_ARRAY(hw, E1000_RA, (index << 1), rar_low); 167 - E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((index << 1) + 1), rar_high); 171 + /* 172 + * Some bridges will combine consecutive 32-bit writes into 173 + * a single burst write, which will malfunction on some parts. 174 + * The flushes avoid this. 175 + */ 176 + ew32(RAL(index), rar_low); 177 + e1e_flush(); 178 + ew32(RAH(index), rar_high); 179 + e1e_flush(); 168 180 } 169 181 170 182 /**