diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/e1000e/82571.c | 28 | ||||
-rw-r--r-- | drivers/net/e1000e/e1000.h | 4 | ||||
-rw-r--r-- | drivers/net/e1000e/hw.h | 6 | ||||
-rw-r--r-- | drivers/net/e1000e/lib.c | 58 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 20 |
5 files changed, 27 insertions, 89 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index 7674a91824b..3c95acb3a87 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -1234,32 +1234,6 @@ static s32 e1000_led_on_82574(struct e1000_hw *hw) | |||
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | /** | 1236 | /** |
1237 | * e1000_update_mc_addr_list_82571 - Update Multicast addresses | ||
1238 | * @hw: pointer to the HW structure | ||
1239 | * @mc_addr_list: array of multicast addresses to program | ||
1240 | * @mc_addr_count: number of multicast addresses to program | ||
1241 | * @rar_used_count: the first RAR register free to program | ||
1242 | * @rar_count: total number of supported Receive Address Registers | ||
1243 | * | ||
1244 | * Updates the Receive Address Registers and Multicast Table Array. | ||
1245 | * The caller must have a packed mc_addr_list of multicast addresses. | ||
1246 | * The parameter rar_count will usually be hw->mac.rar_entry_count | ||
1247 | * unless there are workarounds that change this. | ||
1248 | **/ | ||
1249 | static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw, | ||
1250 | u8 *mc_addr_list, | ||
1251 | u32 mc_addr_count, | ||
1252 | u32 rar_used_count, | ||
1253 | u32 rar_count) | ||
1254 | { | ||
1255 | if (e1000e_get_laa_state_82571(hw)) | ||
1256 | rar_count--; | ||
1257 | |||
1258 | e1000e_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count, | ||
1259 | rar_used_count, rar_count); | ||
1260 | } | ||
1261 | |||
1262 | /** | ||
1263 | * e1000_setup_link_82571 - Setup flow control and link settings | 1237 | * e1000_setup_link_82571 - Setup flow control and link settings |
1264 | * @hw: pointer to the HW structure | 1238 | * @hw: pointer to the HW structure |
1265 | * | 1239 | * |
@@ -1731,7 +1705,7 @@ static struct e1000_mac_operations e82571_mac_ops = { | |||
1731 | /* .get_link_up_info: media type dependent */ | 1705 | /* .get_link_up_info: media type dependent */ |
1732 | /* .led_on: mac type dependent */ | 1706 | /* .led_on: mac type dependent */ |
1733 | .led_off = e1000e_led_off_generic, | 1707 | .led_off = e1000e_led_off_generic, |
1734 | .update_mc_addr_list = e1000_update_mc_addr_list_82571, | 1708 | .update_mc_addr_list = e1000e_update_mc_addr_list_generic, |
1735 | .write_vfta = e1000_write_vfta_generic, | 1709 | .write_vfta = e1000_write_vfta_generic, |
1736 | .clear_vfta = e1000_clear_vfta_82571, | 1710 | .clear_vfta = e1000_clear_vfta_82571, |
1737 | .reset_hw = e1000_reset_hw_82571, | 1711 | .reset_hw = e1000_reset_hw_82571, |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 8b311ce0400..aec378e7441 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -518,9 +518,7 @@ extern void e1000_clear_vfta_generic(struct e1000_hw *hw); | |||
518 | extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); | 518 | extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); |
519 | extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, | 519 | extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, |
520 | u8 *mc_addr_list, | 520 | u8 *mc_addr_list, |
521 | u32 mc_addr_count, | 521 | u32 mc_addr_count); |
522 | u32 rar_used_count, | ||
523 | u32 rar_count); | ||
524 | extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); | 522 | extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); |
525 | extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw); | 523 | extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw); |
526 | extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop); | 524 | extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop); |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 9cac5d9b94b..8bdcd5f24ef 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -753,7 +753,7 @@ struct e1000_mac_operations { | |||
753 | s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); | 753 | s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); |
754 | s32 (*led_on)(struct e1000_hw *); | 754 | s32 (*led_on)(struct e1000_hw *); |
755 | s32 (*led_off)(struct e1000_hw *); | 755 | s32 (*led_off)(struct e1000_hw *); |
756 | void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32); | 756 | void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32); |
757 | s32 (*reset_hw)(struct e1000_hw *); | 757 | s32 (*reset_hw)(struct e1000_hw *); |
758 | s32 (*init_hw)(struct e1000_hw *); | 758 | s32 (*init_hw)(struct e1000_hw *); |
759 | s32 (*setup_link)(struct e1000_hw *); | 759 | s32 (*setup_link)(struct e1000_hw *); |
@@ -819,6 +819,10 @@ struct e1000_mac_info { | |||
819 | u16 ifs_ratio; | 819 | u16 ifs_ratio; |
820 | u16 ifs_step_size; | 820 | u16 ifs_step_size; |
821 | u16 mta_reg_count; | 821 | u16 mta_reg_count; |
822 | |||
823 | /* Maximum size of the MTA register table in all supported adapters */ | ||
824 | #define MAX_MTA_REG 128 | ||
825 | u32 mta_shadow[MAX_MTA_REG]; | ||
822 | u16 rar_entry_count; | 826 | u16 rar_entry_count; |
823 | 827 | ||
824 | u8 forced_speed_duplex; | 828 | u8 forced_speed_duplex; |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 5f6b17148d3..2425ed11d5c 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -340,62 +340,34 @@ static u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) | |||
340 | * @hw: pointer to the HW structure | 340 | * @hw: pointer to the HW structure |
341 | * @mc_addr_list: array of multicast addresses to program | 341 | * @mc_addr_list: array of multicast addresses to program |
342 | * @mc_addr_count: number of multicast addresses to program | 342 | * @mc_addr_count: number of multicast addresses to program |
343 | * @rar_used_count: the first RAR register free to program | ||
344 | * @rar_count: total number of supported Receive Address Registers | ||
345 | * | 343 | * |
346 | * Updates the Receive Address Registers and Multicast Table Array. | 344 | * Updates entire Multicast Table Array. |
347 | * The caller must have a packed mc_addr_list of multicast addresses. | 345 | * The caller must have a packed mc_addr_list of multicast addresses. |
348 | * The parameter rar_count will usually be hw->mac.rar_entry_count | ||
349 | * unless there are workarounds that change this. | ||
350 | **/ | 346 | **/ |
351 | void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, | 347 | void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, |
352 | u8 *mc_addr_list, u32 mc_addr_count, | 348 | u8 *mc_addr_list, u32 mc_addr_count) |
353 | u32 rar_used_count, u32 rar_count) | ||
354 | { | 349 | { |
355 | u32 i; | 350 | u32 hash_value, hash_bit, hash_reg; |
356 | u32 *mcarray = kzalloc(hw->mac.mta_reg_count * sizeof(u32), GFP_ATOMIC); | 351 | int i; |
357 | 352 | ||
358 | if (!mcarray) { | 353 | /* clear mta_shadow */ |
359 | printk(KERN_ERR "multicast array memory allocation failed\n"); | 354 | memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); |
360 | return; | ||
361 | } | ||
362 | 355 | ||
363 | /* | 356 | /* update mta_shadow from mc_addr_list */ |
364 | * Load the first set of multicast addresses into the exact | 357 | for (i = 0; (u32) i < mc_addr_count; i++) { |
365 | * filters (RAR). If there are not enough to fill the RAR | ||
366 | * array, clear the filters. | ||
367 | */ | ||
368 | for (i = rar_used_count; i < rar_count; i++) { | ||
369 | if (mc_addr_count) { | ||
370 | e1000e_rar_set(hw, mc_addr_list, i); | ||
371 | mc_addr_count--; | ||
372 | mc_addr_list += ETH_ALEN; | ||
373 | } else { | ||
374 | E1000_WRITE_REG_ARRAY(hw, E1000_RA, i << 1, 0); | ||
375 | e1e_flush(); | ||
376 | E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1) + 1, 0); | ||
377 | e1e_flush(); | ||
378 | } | ||
379 | } | ||
380 | |||
381 | /* Load any remaining multicast addresses into the hash table. */ | ||
382 | for (; mc_addr_count > 0; mc_addr_count--) { | ||
383 | u32 hash_value, hash_reg, hash_bit, mta; | ||
384 | hash_value = e1000_hash_mc_addr(hw, mc_addr_list); | 358 | hash_value = e1000_hash_mc_addr(hw, mc_addr_list); |
385 | e_dbg("Hash value = 0x%03X\n", hash_value); | 359 | |
386 | hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); | 360 | hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); |
387 | hash_bit = hash_value & 0x1F; | 361 | hash_bit = hash_value & 0x1F; |
388 | mta = (1 << hash_bit); | ||
389 | mcarray[hash_reg] |= mta; | ||
390 | mc_addr_list += ETH_ALEN; | ||
391 | } | ||
392 | 362 | ||
393 | /* write the hash table completely */ | 363 | hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); |
394 | for (i = 0; i < hw->mac.mta_reg_count; i++) | 364 | mc_addr_list += (ETH_ALEN); |
395 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, mcarray[i]); | 365 | } |
396 | 366 | ||
367 | /* replace the entire MTA table */ | ||
368 | for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) | ||
369 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); | ||
397 | e1e_flush(); | 370 | e1e_flush(); |
398 | kfree(mcarray); | ||
399 | } | 371 | } |
400 | 372 | ||
401 | /** | 373 | /** |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 0d5ef4c5c6d..3d57ca5482f 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -2536,22 +2536,14 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
2536 | * @hw: pointer to the HW structure | 2536 | * @hw: pointer to the HW structure |
2537 | * @mc_addr_list: array of multicast addresses to program | 2537 | * @mc_addr_list: array of multicast addresses to program |
2538 | * @mc_addr_count: number of multicast addresses to program | 2538 | * @mc_addr_count: number of multicast addresses to program |
2539 | * @rar_used_count: the first RAR register free to program | ||
2540 | * @rar_count: total number of supported Receive Address Registers | ||
2541 | * | 2539 | * |
2542 | * Updates the Receive Address Registers and Multicast Table Array. | 2540 | * Updates the Multicast Table Array. |
2543 | * The caller must have a packed mc_addr_list of multicast addresses. | 2541 | * The caller must have a packed mc_addr_list of multicast addresses. |
2544 | * The parameter rar_count will usually be hw->mac.rar_entry_count | ||
2545 | * unless there are workarounds that change this. Currently no func pointer | ||
2546 | * exists and all implementations are handled in the generic version of this | ||
2547 | * function. | ||
2548 | **/ | 2542 | **/ |
2549 | static void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, | 2543 | static void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, |
2550 | u32 mc_addr_count, u32 rar_used_count, | 2544 | u32 mc_addr_count) |
2551 | u32 rar_count) | ||
2552 | { | 2545 | { |
2553 | hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, mc_addr_count, | 2546 | hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, mc_addr_count); |
2554 | rar_used_count, rar_count); | ||
2555 | } | 2547 | } |
2556 | 2548 | ||
2557 | /** | 2549 | /** |
@@ -2567,7 +2559,6 @@ static void e1000_set_multi(struct net_device *netdev) | |||
2567 | { | 2559 | { |
2568 | struct e1000_adapter *adapter = netdev_priv(netdev); | 2560 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2569 | struct e1000_hw *hw = &adapter->hw; | 2561 | struct e1000_hw *hw = &adapter->hw; |
2570 | struct e1000_mac_info *mac = &hw->mac; | ||
2571 | struct dev_mc_list *mc_ptr; | 2562 | struct dev_mc_list *mc_ptr; |
2572 | u8 *mta_list; | 2563 | u8 *mta_list; |
2573 | u32 rctl; | 2564 | u32 rctl; |
@@ -2609,15 +2600,14 @@ static void e1000_set_multi(struct net_device *netdev) | |||
2609 | mc_ptr = mc_ptr->next; | 2600 | mc_ptr = mc_ptr->next; |
2610 | } | 2601 | } |
2611 | 2602 | ||
2612 | e1000_update_mc_addr_list(hw, mta_list, i, 1, | 2603 | e1000_update_mc_addr_list(hw, mta_list, i); |
2613 | mac->rar_entry_count); | ||
2614 | kfree(mta_list); | 2604 | kfree(mta_list); |
2615 | } else { | 2605 | } else { |
2616 | /* | 2606 | /* |
2617 | * if we're called from probe, we might not have | 2607 | * if we're called from probe, we might not have |
2618 | * anything to do here, so clear out the list | 2608 | * anything to do here, so clear out the list |
2619 | */ | 2609 | */ |
2620 | e1000_update_mc_addr_list(hw, NULL, 0, 1, mac->rar_entry_count); | 2610 | e1000_update_mc_addr_list(hw, NULL, 0); |
2621 | } | 2611 | } |
2622 | } | 2612 | } |
2623 | 2613 | ||