diff options
author | Bruce Allan <bruce.w.allan@intel.com> | 2009-12-01 10:46:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-02 03:35:51 -0500 |
commit | caaddaf83501c79fe11b183c8972e60d8b7d5d56 (patch) | |
tree | 5ddaf752e1a4622e969dea9d3e8ec76ac655f767 /drivers/net | |
parent | ff9c38bba37937adb909cceb2a6521f2e92e17c6 (diff) |
e1000e: provide family-specific functions to manage VLAN filter arrays
The two MAC-families that have VLAN filter table register arrays manage
each a bit differently from one another, so provide family-specific
functions for managing the register arrays and function pointers to access
the appropriate function. Also make sure attempts to access these
register arrays are not done on parts not supporting that feature.
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/e1000e/82571.c | 9 | ||||
-rw-r--r-- | drivers/net/e1000e/e1000.h | 4 | ||||
-rw-r--r-- | drivers/net/e1000e/es2lan.c | 4 | ||||
-rw-r--r-- | drivers/net/e1000e/hw.h | 2 | ||||
-rw-r--r-- | drivers/net/e1000e/lib.c | 21 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 21 |
6 files changed, 45 insertions, 16 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index 62bbc6e0a76a..8ea3ed7e5364 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -65,6 +65,7 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); | |||
65 | static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); | 65 | static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); |
66 | static s32 e1000_setup_link_82571(struct e1000_hw *hw); | 66 | static s32 e1000_setup_link_82571(struct e1000_hw *hw); |
67 | static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); | 67 | static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); |
68 | static void e1000_clear_vfta_82571(struct e1000_hw *hw); | ||
68 | static bool e1000_check_mng_mode_82574(struct e1000_hw *hw); | 69 | static bool e1000_check_mng_mode_82574(struct e1000_hw *hw); |
69 | static s32 e1000_led_on_82574(struct e1000_hw *hw); | 70 | static s32 e1000_led_on_82574(struct e1000_hw *hw); |
70 | static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); | 71 | static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); |
@@ -949,7 +950,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) | |||
949 | 950 | ||
950 | /* Disabling VLAN filtering */ | 951 | /* Disabling VLAN filtering */ |
951 | e_dbg("Initializing the IEEE VLAN\n"); | 952 | e_dbg("Initializing the IEEE VLAN\n"); |
952 | e1000e_clear_vfta(hw); | 953 | mac->ops.clear_vfta(hw); |
953 | 954 | ||
954 | /* Setup the receive address. */ | 955 | /* Setup the receive address. */ |
955 | /* | 956 | /* |
@@ -1128,13 +1129,13 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) | |||
1128 | } | 1129 | } |
1129 | 1130 | ||
1130 | /** | 1131 | /** |
1131 | * e1000e_clear_vfta - Clear VLAN filter table | 1132 | * e1000_clear_vfta_82571 - Clear VLAN filter table |
1132 | * @hw: pointer to the HW structure | 1133 | * @hw: pointer to the HW structure |
1133 | * | 1134 | * |
1134 | * Clears the register array which contains the VLAN filter table by | 1135 | * Clears the register array which contains the VLAN filter table by |
1135 | * setting all the values to 0. | 1136 | * setting all the values to 0. |
1136 | **/ | 1137 | **/ |
1137 | void e1000e_clear_vfta(struct e1000_hw *hw) | 1138 | static void e1000_clear_vfta_82571(struct e1000_hw *hw) |
1138 | { | 1139 | { |
1139 | u32 offset; | 1140 | u32 offset; |
1140 | u32 vfta_value = 0; | 1141 | u32 vfta_value = 0; |
@@ -1656,6 +1657,8 @@ static struct e1000_mac_operations e82571_mac_ops = { | |||
1656 | /* .led_on: mac type dependent */ | 1657 | /* .led_on: mac type dependent */ |
1657 | .led_off = e1000e_led_off_generic, | 1658 | .led_off = e1000e_led_off_generic, |
1658 | .update_mc_addr_list = e1000_update_mc_addr_list_82571, | 1659 | .update_mc_addr_list = e1000_update_mc_addr_list_82571, |
1660 | .write_vfta = e1000_write_vfta_generic, | ||
1661 | .clear_vfta = e1000_clear_vfta_82571, | ||
1659 | .reset_hw = e1000_reset_hw_82571, | 1662 | .reset_hw = e1000_reset_hw_82571, |
1660 | .init_hw = e1000_init_hw_82571, | 1663 | .init_hw = e1000_init_hw_82571, |
1661 | .setup_link = e1000_setup_link_82571, | 1664 | .setup_link = e1000_setup_link_82571, |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 3102d738cfd1..4c08752b824d 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -509,7 +509,7 @@ extern s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw); | |||
509 | extern s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw); | 509 | extern s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw); |
510 | extern s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw); | 510 | extern s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw); |
511 | extern s32 e1000e_setup_link(struct e1000_hw *hw); | 511 | extern s32 e1000e_setup_link(struct e1000_hw *hw); |
512 | extern void e1000e_clear_vfta(struct e1000_hw *hw); | 512 | extern void e1000_clear_vfta_generic(struct e1000_hw *hw); |
513 | extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); | 513 | extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); |
514 | extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, | 514 | extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, |
515 | u8 *mc_addr_list, | 515 | u8 *mc_addr_list, |
@@ -525,7 +525,7 @@ extern void e1000e_config_collision_dist(struct e1000_hw *hw); | |||
525 | extern s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw); | 525 | extern s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw); |
526 | extern s32 e1000e_force_mac_fc(struct e1000_hw *hw); | 526 | extern s32 e1000e_force_mac_fc(struct e1000_hw *hw); |
527 | extern s32 e1000e_blink_led(struct e1000_hw *hw); | 527 | extern s32 e1000e_blink_led(struct e1000_hw *hw); |
528 | extern void e1000e_write_vfta(struct e1000_hw *hw, u32 offset, u32 value); | 528 | extern void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value); |
529 | extern void e1000e_reset_adaptive(struct e1000_hw *hw); | 529 | extern void e1000e_reset_adaptive(struct e1000_hw *hw); |
530 | extern void e1000e_update_adaptive(struct e1000_hw *hw); | 530 | extern void e1000e_update_adaptive(struct e1000_hw *hw); |
531 | 531 | ||
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index e50579859e06..3ff932f02f29 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c | |||
@@ -807,7 +807,7 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) | |||
807 | 807 | ||
808 | /* Disabling VLAN filtering */ | 808 | /* Disabling VLAN filtering */ |
809 | e_dbg("Initializing the IEEE VLAN\n"); | 809 | e_dbg("Initializing the IEEE VLAN\n"); |
810 | e1000e_clear_vfta(hw); | 810 | mac->ops.clear_vfta(hw); |
811 | 811 | ||
812 | /* Setup the receive address. */ | 812 | /* Setup the receive address. */ |
813 | e1000e_init_rx_addrs(hw, mac->rar_entry_count); | 813 | e1000e_init_rx_addrs(hw, mac->rar_entry_count); |
@@ -1350,6 +1350,8 @@ static struct e1000_mac_operations es2_mac_ops = { | |||
1350 | .led_on = e1000e_led_on_generic, | 1350 | .led_on = e1000e_led_on_generic, |
1351 | .led_off = e1000e_led_off_generic, | 1351 | .led_off = e1000e_led_off_generic, |
1352 | .update_mc_addr_list = e1000e_update_mc_addr_list_generic, | 1352 | .update_mc_addr_list = e1000e_update_mc_addr_list_generic, |
1353 | .write_vfta = e1000_write_vfta_generic, | ||
1354 | .clear_vfta = e1000_clear_vfta_generic, | ||
1353 | .reset_hw = e1000_reset_hw_80003es2lan, | 1355 | .reset_hw = e1000_reset_hw_80003es2lan, |
1354 | .init_hw = e1000_init_hw_80003es2lan, | 1356 | .init_hw = e1000_init_hw_80003es2lan, |
1355 | .setup_link = e1000e_setup_link, | 1357 | .setup_link = e1000e_setup_link, |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 426155c15cef..6c3d55fc7753 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -741,6 +741,7 @@ struct e1000_mac_operations { | |||
741 | s32 (*check_for_link)(struct e1000_hw *); | 741 | s32 (*check_for_link)(struct e1000_hw *); |
742 | s32 (*cleanup_led)(struct e1000_hw *); | 742 | s32 (*cleanup_led)(struct e1000_hw *); |
743 | void (*clear_hw_cntrs)(struct e1000_hw *); | 743 | void (*clear_hw_cntrs)(struct e1000_hw *); |
744 | void (*clear_vfta)(struct e1000_hw *); | ||
744 | s32 (*get_bus_info)(struct e1000_hw *); | 745 | s32 (*get_bus_info)(struct e1000_hw *); |
745 | s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); | 746 | s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); |
746 | s32 (*led_on)(struct e1000_hw *); | 747 | s32 (*led_on)(struct e1000_hw *); |
@@ -751,6 +752,7 @@ struct e1000_mac_operations { | |||
751 | s32 (*setup_link)(struct e1000_hw *); | 752 | s32 (*setup_link)(struct e1000_hw *); |
752 | s32 (*setup_physical_interface)(struct e1000_hw *); | 753 | s32 (*setup_physical_interface)(struct e1000_hw *); |
753 | s32 (*setup_led)(struct e1000_hw *); | 754 | s32 (*setup_led)(struct e1000_hw *); |
755 | void (*write_vfta)(struct e1000_hw *, u32, u32); | ||
754 | }; | 756 | }; |
755 | 757 | ||
756 | /* Function pointers for the PHY. */ | 758 | /* Function pointers for the PHY. */ |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index f690a1055b41..e3976ea668d0 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -82,7 +82,24 @@ s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * e1000e_write_vfta - Write value to VLAN filter table | 85 | * e1000_clear_vfta_generic - Clear VLAN filter table |
86 | * @hw: pointer to the HW structure | ||
87 | * | ||
88 | * Clears the register array which contains the VLAN filter table by | ||
89 | * setting all the values to 0. | ||
90 | **/ | ||
91 | void e1000_clear_vfta_generic(struct e1000_hw *hw) | ||
92 | { | ||
93 | u32 offset; | ||
94 | |||
95 | for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { | ||
96 | E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, 0); | ||
97 | e1e_flush(); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * e1000_write_vfta_generic - Write value to VLAN filter table | ||
86 | * @hw: pointer to the HW structure | 103 | * @hw: pointer to the HW structure |
87 | * @offset: register offset in VLAN filter table | 104 | * @offset: register offset in VLAN filter table |
88 | * @value: register value written to VLAN filter table | 105 | * @value: register value written to VLAN filter table |
@@ -90,7 +107,7 @@ s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw) | |||
90 | * Writes value at the given offset in the register array which stores | 107 | * Writes value at the given offset in the register array which stores |
91 | * the VLAN filter table. | 108 | * the VLAN filter table. |
92 | **/ | 109 | **/ |
93 | void e1000e_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) | 110 | void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) |
94 | { | 111 | { |
95 | E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value); | 112 | E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value); |
96 | e1e_flush(); | 113 | e1e_flush(); |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index e546b4ebf155..2381cb76f17c 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -2031,11 +2031,14 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) | |||
2031 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && | 2031 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && |
2032 | (vid == adapter->mng_vlan_id)) | 2032 | (vid == adapter->mng_vlan_id)) |
2033 | return; | 2033 | return; |
2034 | |||
2034 | /* add VID to filter table */ | 2035 | /* add VID to filter table */ |
2035 | index = (vid >> 5) & 0x7F; | 2036 | if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
2036 | vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index); | 2037 | index = (vid >> 5) & 0x7F; |
2037 | vfta |= (1 << (vid & 0x1F)); | 2038 | vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index); |
2038 | e1000e_write_vfta(hw, index, vfta); | 2039 | vfta |= (1 << (vid & 0x1F)); |
2040 | hw->mac.ops.write_vfta(hw, index, vfta); | ||
2041 | } | ||
2039 | } | 2042 | } |
2040 | 2043 | ||
2041 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) | 2044 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) |
@@ -2060,10 +2063,12 @@ static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) | |||
2060 | } | 2063 | } |
2061 | 2064 | ||
2062 | /* remove VID from filter table */ | 2065 | /* remove VID from filter table */ |
2063 | index = (vid >> 5) & 0x7F; | 2066 | if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
2064 | vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index); | 2067 | index = (vid >> 5) & 0x7F; |
2065 | vfta &= ~(1 << (vid & 0x1F)); | 2068 | vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index); |
2066 | e1000e_write_vfta(hw, index, vfta); | 2069 | vfta &= ~(1 << (vid & 0x1F)); |
2070 | hw->mac.ops.write_vfta(hw, index, vfta); | ||
2071 | } | ||
2067 | } | 2072 | } |
2068 | 2073 | ||
2069 | static void e1000_update_mng_vlan(struct e1000_adapter *adapter) | 2074 | static void e1000_update_mng_vlan(struct e1000_adapter *adapter) |