diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/igb/e1000_mbx.h | 10 | ||||
-rw-r--r-- | drivers/net/igb/igb.h | 2 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 173 |
3 files changed, 125 insertions, 60 deletions
diff --git a/drivers/net/igb/e1000_mbx.h b/drivers/net/igb/e1000_mbx.h index ebc02ea3f198..bb112fb6c3a1 100644 --- a/drivers/net/igb/e1000_mbx.h +++ b/drivers/net/igb/e1000_mbx.h | |||
@@ -58,10 +58,12 @@ | |||
58 | #define E1000_VT_MSGINFO_MASK (0xFF << E1000_VT_MSGINFO_SHIFT) | 58 | #define E1000_VT_MSGINFO_MASK (0xFF << E1000_VT_MSGINFO_SHIFT) |
59 | 59 | ||
60 | #define E1000_VF_RESET 0x01 /* VF requests reset */ | 60 | #define E1000_VF_RESET 0x01 /* VF requests reset */ |
61 | #define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */ | 61 | #define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests to set MAC addr */ |
62 | #define E1000_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ | 62 | #define E1000_VF_SET_MULTICAST 0x03 /* VF requests to set MC addr */ |
63 | #define E1000_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ | 63 | #define E1000_VF_SET_VLAN 0x04 /* VF requests to set VLAN */ |
64 | #define E1000_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ | 64 | #define E1000_VF_SET_LPE 0x05 /* VF requests to set VMOLR.LPE */ |
65 | #define E1000_VF_SET_PROMISC 0x06 /*VF requests to clear VMOLR.ROPE/MPME*/ | ||
66 | #define E1000_VF_SET_PROMISC_MULTICAST (0x02 << E1000_VT_MSGINFO_SHIFT) | ||
65 | 67 | ||
66 | #define E1000_PF_CONTROL_MSG 0x0100 /* PF control message */ | 68 | #define E1000_PF_CONTROL_MSG 0x0100 /* PF control message */ |
67 | 69 | ||
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h index 7801d3f40193..c27dc1a8d0c6 100644 --- a/drivers/net/igb/igb.h +++ b/drivers/net/igb/igb.h | |||
@@ -78,6 +78,8 @@ struct vf_data_storage { | |||
78 | }; | 78 | }; |
79 | 79 | ||
80 | #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */ | 80 | #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */ |
81 | #define IGB_VF_FLAG_UNI_PROMISC 0x00000002 /* VF has unicast promisc */ | ||
82 | #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004 /* VF has multicast promisc */ | ||
81 | 83 | ||
82 | /* RX descriptor control thresholds. | 84 | /* RX descriptor control thresholds. |
83 | * PTHRESH - MAC will consider prefetch if it has fewer than this number of | 85 | * PTHRESH - MAC will consider prefetch if it has fewer than this number of |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index a9e8ba244001..3ab297844d6a 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -129,38 +129,6 @@ static void igb_vmm_control(struct igb_adapter *); | |||
129 | static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *); | 129 | static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *); |
130 | static void igb_restore_vf_multicasts(struct igb_adapter *adapter); | 130 | static void igb_restore_vf_multicasts(struct igb_adapter *adapter); |
131 | 131 | ||
132 | static inline void igb_set_vmolr(struct e1000_hw *hw, int vfn) | ||
133 | { | ||
134 | u32 reg_data; | ||
135 | |||
136 | reg_data = rd32(E1000_VMOLR(vfn)); | ||
137 | reg_data |= E1000_VMOLR_BAM | /* Accept broadcast */ | ||
138 | E1000_VMOLR_ROMPE | /* Accept packets matched in MTA */ | ||
139 | E1000_VMOLR_AUPE | /* Accept untagged packets */ | ||
140 | E1000_VMOLR_STRVLAN; /* Strip vlan tags */ | ||
141 | wr32(E1000_VMOLR(vfn), reg_data); | ||
142 | } | ||
143 | |||
144 | static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, | ||
145 | int vfn) | ||
146 | { | ||
147 | struct e1000_hw *hw = &adapter->hw; | ||
148 | u32 vmolr; | ||
149 | |||
150 | /* if it isn't the PF check to see if VFs are enabled and | ||
151 | * increase the size to support vlan tags */ | ||
152 | if (vfn < adapter->vfs_allocated_count && | ||
153 | adapter->vf_data[vfn].vlans_enabled) | ||
154 | size += VLAN_TAG_SIZE; | ||
155 | |||
156 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
157 | vmolr &= ~E1000_VMOLR_RLPML_MASK; | ||
158 | vmolr |= size | E1000_VMOLR_LPE; | ||
159 | wr32(E1000_VMOLR(vfn), vmolr); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | #ifdef CONFIG_PM | 132 | #ifdef CONFIG_PM |
165 | static int igb_suspend(struct pci_dev *, pm_message_t); | 133 | static int igb_suspend(struct pci_dev *, pm_message_t); |
166 | static int igb_resume(struct pci_dev *); | 134 | static int igb_resume(struct pci_dev *); |
@@ -1115,8 +1083,6 @@ int igb_up(struct igb_adapter *adapter) | |||
1115 | if (adapter->msix_entries) | 1083 | if (adapter->msix_entries) |
1116 | igb_configure_msix(adapter); | 1084 | igb_configure_msix(adapter); |
1117 | 1085 | ||
1118 | igb_set_vmolr(hw, adapter->vfs_allocated_count); | ||
1119 | |||
1120 | /* Clear any pending interrupts. */ | 1086 | /* Clear any pending interrupts. */ |
1121 | rd32(E1000_ICR); | 1087 | rd32(E1000_ICR); |
1122 | igb_irq_enable(adapter); | 1088 | igb_irq_enable(adapter); |
@@ -1892,8 +1858,6 @@ static int igb_open(struct net_device *netdev) | |||
1892 | * clean_rx handler before we do so. */ | 1858 | * clean_rx handler before we do so. */ |
1893 | igb_configure(adapter); | 1859 | igb_configure(adapter); |
1894 | 1860 | ||
1895 | igb_set_vmolr(hw, adapter->vfs_allocated_count); | ||
1896 | |||
1897 | err = igb_request_irq(adapter); | 1861 | err = igb_request_irq(adapter); |
1898 | if (err) | 1862 | if (err) |
1899 | goto err_req_irq; | 1863 | goto err_req_irq; |
@@ -2331,22 +2295,33 @@ void igb_setup_rctl(struct igb_adapter *adapter) | |||
2331 | * if an un-trusted VF does not provide descriptors to hardware. | 2295 | * if an un-trusted VF does not provide descriptors to hardware. |
2332 | */ | 2296 | */ |
2333 | if (adapter->vfs_allocated_count) { | 2297 | if (adapter->vfs_allocated_count) { |
2334 | u32 vmolr; | ||
2335 | |||
2336 | /* set all queue drop enable bits */ | 2298 | /* set all queue drop enable bits */ |
2337 | wr32(E1000_QDE, ALL_QUEUES); | 2299 | wr32(E1000_QDE, ALL_QUEUES); |
2338 | |||
2339 | vmolr = rd32(E1000_VMOLR(adapter->vfs_allocated_count)); | ||
2340 | if (rctl & E1000_RCTL_LPE) | ||
2341 | vmolr |= E1000_VMOLR_LPE; | ||
2342 | if (adapter->num_rx_queues > 1) | ||
2343 | vmolr |= E1000_VMOLR_RSSE; | ||
2344 | wr32(E1000_VMOLR(adapter->vfs_allocated_count), vmolr); | ||
2345 | } | 2300 | } |
2346 | 2301 | ||
2347 | wr32(E1000_RCTL, rctl); | 2302 | wr32(E1000_RCTL, rctl); |
2348 | } | 2303 | } |
2349 | 2304 | ||
2305 | static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, | ||
2306 | int vfn) | ||
2307 | { | ||
2308 | struct e1000_hw *hw = &adapter->hw; | ||
2309 | u32 vmolr; | ||
2310 | |||
2311 | /* if it isn't the PF check to see if VFs are enabled and | ||
2312 | * increase the size to support vlan tags */ | ||
2313 | if (vfn < adapter->vfs_allocated_count && | ||
2314 | adapter->vf_data[vfn].vlans_enabled) | ||
2315 | size += VLAN_TAG_SIZE; | ||
2316 | |||
2317 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
2318 | vmolr &= ~E1000_VMOLR_RLPML_MASK; | ||
2319 | vmolr |= size | E1000_VMOLR_LPE; | ||
2320 | wr32(E1000_VMOLR(vfn), vmolr); | ||
2321 | |||
2322 | return 0; | ||
2323 | } | ||
2324 | |||
2350 | /** | 2325 | /** |
2351 | * igb_rlpml_set - set maximum receive packet size | 2326 | * igb_rlpml_set - set maximum receive packet size |
2352 | * @adapter: board private structure | 2327 | * @adapter: board private structure |
@@ -2366,12 +2341,43 @@ static void igb_rlpml_set(struct igb_adapter *adapter) | |||
2366 | * size and set the VMOLR RLPML to the size we need */ | 2341 | * size and set the VMOLR RLPML to the size we need */ |
2367 | if (pf_id) { | 2342 | if (pf_id) { |
2368 | igb_set_vf_rlpml(adapter, max_frame_size, pf_id); | 2343 | igb_set_vf_rlpml(adapter, max_frame_size, pf_id); |
2369 | max_frame_size = MAX_STD_JUMBO_FRAME_SIZE + VLAN_TAG_SIZE; | 2344 | max_frame_size = MAX_JUMBO_FRAME_SIZE; |
2370 | } | 2345 | } |
2371 | 2346 | ||
2372 | wr32(E1000_RLPML, max_frame_size); | 2347 | wr32(E1000_RLPML, max_frame_size); |
2373 | } | 2348 | } |
2374 | 2349 | ||
2350 | static inline void igb_set_vmolr(struct igb_adapter *adapter, int vfn) | ||
2351 | { | ||
2352 | struct e1000_hw *hw = &adapter->hw; | ||
2353 | u32 vmolr; | ||
2354 | |||
2355 | /* | ||
2356 | * This register exists only on 82576 and newer so if we are older then | ||
2357 | * we should exit and do nothing | ||
2358 | */ | ||
2359 | if (hw->mac.type < e1000_82576) | ||
2360 | return; | ||
2361 | |||
2362 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
2363 | vmolr |= E1000_VMOLR_AUPE | /* Accept untagged packets */ | ||
2364 | E1000_VMOLR_STRVLAN; /* Strip vlan tags */ | ||
2365 | |||
2366 | /* clear all bits that might not be set */ | ||
2367 | vmolr &= ~(E1000_VMOLR_BAM | E1000_VMOLR_RSSE); | ||
2368 | |||
2369 | if (adapter->num_rx_queues > 1 && vfn == adapter->vfs_allocated_count) | ||
2370 | vmolr |= E1000_VMOLR_RSSE; /* enable RSS */ | ||
2371 | /* | ||
2372 | * for VMDq only allow the VFs and pool 0 to accept broadcast and | ||
2373 | * multicast packets | ||
2374 | */ | ||
2375 | if (vfn <= adapter->vfs_allocated_count) | ||
2376 | vmolr |= E1000_VMOLR_BAM; /* Accept broadcast */ | ||
2377 | |||
2378 | wr32(E1000_VMOLR(vfn), vmolr); | ||
2379 | } | ||
2380 | |||
2375 | /** | 2381 | /** |
2376 | * igb_configure_rx_ring - Configure a receive ring after Reset | 2382 | * igb_configure_rx_ring - Configure a receive ring after Reset |
2377 | * @adapter: board private structure | 2383 | * @adapter: board private structure |
@@ -2425,6 +2431,9 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, | |||
2425 | 2431 | ||
2426 | wr32(E1000_SRRCTL(reg_idx), srrctl); | 2432 | wr32(E1000_SRRCTL(reg_idx), srrctl); |
2427 | 2433 | ||
2434 | /* set filtering for VMDQ pools */ | ||
2435 | igb_set_vmolr(adapter, reg_idx & 0x7); | ||
2436 | |||
2428 | /* enable receive descriptor fetching */ | 2437 | /* enable receive descriptor fetching */ |
2429 | rxdctl = rd32(E1000_RXDCTL(reg_idx)); | 2438 | rxdctl = rd32(E1000_RXDCTL(reg_idx)); |
2430 | rxdctl |= E1000_RXDCTL_QUEUE_ENABLE; | 2439 | rxdctl |= E1000_RXDCTL_QUEUE_ENABLE; |
@@ -4101,6 +4110,45 @@ static void igb_ping_all_vfs(struct igb_adapter *adapter) | |||
4101 | } | 4110 | } |
4102 | } | 4111 | } |
4103 | 4112 | ||
4113 | static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf) | ||
4114 | { | ||
4115 | struct e1000_hw *hw = &adapter->hw; | ||
4116 | u32 vmolr = rd32(E1000_VMOLR(vf)); | ||
4117 | struct vf_data_storage *vf_data = &adapter->vf_data[vf]; | ||
4118 | |||
4119 | vf_data->flags |= ~(IGB_VF_FLAG_UNI_PROMISC | | ||
4120 | IGB_VF_FLAG_MULTI_PROMISC); | ||
4121 | vmolr &= ~(E1000_VMOLR_ROPE | E1000_VMOLR_ROMPE | E1000_VMOLR_MPME); | ||
4122 | |||
4123 | if (*msgbuf & E1000_VF_SET_PROMISC_MULTICAST) { | ||
4124 | vmolr |= E1000_VMOLR_MPME; | ||
4125 | *msgbuf &= ~E1000_VF_SET_PROMISC_MULTICAST; | ||
4126 | } else { | ||
4127 | /* | ||
4128 | * if we have hashes and we are clearing a multicast promisc | ||
4129 | * flag we need to write the hashes to the MTA as this step | ||
4130 | * was previously skipped | ||
4131 | */ | ||
4132 | if (vf_data->num_vf_mc_hashes > 30) { | ||
4133 | vmolr |= E1000_VMOLR_MPME; | ||
4134 | } else if (vf_data->num_vf_mc_hashes) { | ||
4135 | int j; | ||
4136 | vmolr |= E1000_VMOLR_ROMPE; | ||
4137 | for (j = 0; j < vf_data->num_vf_mc_hashes; j++) | ||
4138 | igb_mta_set(hw, vf_data->vf_mc_hashes[j]); | ||
4139 | } | ||
4140 | } | ||
4141 | |||
4142 | wr32(E1000_VMOLR(vf), vmolr); | ||
4143 | |||
4144 | /* there are flags left unprocessed, likely not supported */ | ||
4145 | if (*msgbuf & E1000_VT_MSGINFO_MASK) | ||
4146 | return -EINVAL; | ||
4147 | |||
4148 | return 0; | ||
4149 | |||
4150 | } | ||
4151 | |||
4104 | static int igb_set_vf_multicasts(struct igb_adapter *adapter, | 4152 | static int igb_set_vf_multicasts(struct igb_adapter *adapter, |
4105 | u32 *msgbuf, u32 vf) | 4153 | u32 *msgbuf, u32 vf) |
4106 | { | 4154 | { |
@@ -4109,18 +4157,17 @@ static int igb_set_vf_multicasts(struct igb_adapter *adapter, | |||
4109 | struct vf_data_storage *vf_data = &adapter->vf_data[vf]; | 4157 | struct vf_data_storage *vf_data = &adapter->vf_data[vf]; |
4110 | int i; | 4158 | int i; |
4111 | 4159 | ||
4112 | /* only up to 30 hash values supported */ | 4160 | /* salt away the number of multicast addresses assigned |
4113 | if (n > 30) | ||
4114 | n = 30; | ||
4115 | |||
4116 | /* salt away the number of multi cast addresses assigned | ||
4117 | * to this VF for later use to restore when the PF multi cast | 4161 | * to this VF for later use to restore when the PF multi cast |
4118 | * list changes | 4162 | * list changes |
4119 | */ | 4163 | */ |
4120 | vf_data->num_vf_mc_hashes = n; | 4164 | vf_data->num_vf_mc_hashes = n; |
4121 | 4165 | ||
4122 | /* VFs are limited to using the MTA hash table for their multicast | 4166 | /* only up to 30 hash values supported */ |
4123 | * addresses */ | 4167 | if (n > 30) |
4168 | n = 30; | ||
4169 | |||
4170 | /* store the hashes for later use */ | ||
4124 | for (i = 0; i < n; i++) | 4171 | for (i = 0; i < n; i++) |
4125 | vf_data->vf_mc_hashes[i] = hash_list[i]; | 4172 | vf_data->vf_mc_hashes[i] = hash_list[i]; |
4126 | 4173 | ||
@@ -4137,9 +4184,20 @@ static void igb_restore_vf_multicasts(struct igb_adapter *adapter) | |||
4137 | int i, j; | 4184 | int i, j; |
4138 | 4185 | ||
4139 | for (i = 0; i < adapter->vfs_allocated_count; i++) { | 4186 | for (i = 0; i < adapter->vfs_allocated_count; i++) { |
4187 | u32 vmolr = rd32(E1000_VMOLR(i)); | ||
4188 | vmolr &= ~(E1000_VMOLR_ROMPE | E1000_VMOLR_MPME); | ||
4189 | |||
4140 | vf_data = &adapter->vf_data[i]; | 4190 | vf_data = &adapter->vf_data[i]; |
4141 | for (j = 0; j < vf_data->num_vf_mc_hashes; j++) | 4191 | |
4142 | igb_mta_set(hw, vf_data->vf_mc_hashes[j]); | 4192 | if ((vf_data->num_vf_mc_hashes > 30) || |
4193 | (vf_data->flags & IGB_VF_FLAG_MULTI_PROMISC)) { | ||
4194 | vmolr |= E1000_VMOLR_MPME; | ||
4195 | } else if (vf_data->num_vf_mc_hashes) { | ||
4196 | vmolr |= E1000_VMOLR_ROMPE; | ||
4197 | for (j = 0; j < vf_data->num_vf_mc_hashes; j++) | ||
4198 | igb_mta_set(hw, vf_data->vf_mc_hashes[j]); | ||
4199 | } | ||
4200 | wr32(E1000_VMOLR(i), vmolr); | ||
4143 | } | 4201 | } |
4144 | } | 4202 | } |
4145 | 4203 | ||
@@ -4282,7 +4340,7 @@ static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf) | |||
4282 | adapter->vf_data[vf].last_nack = jiffies; | 4340 | adapter->vf_data[vf].last_nack = jiffies; |
4283 | 4341 | ||
4284 | /* reset offloads to defaults */ | 4342 | /* reset offloads to defaults */ |
4285 | igb_set_vmolr(&adapter->hw, vf); | 4343 | igb_set_vmolr(adapter, vf); |
4286 | 4344 | ||
4287 | /* reset vlans for device */ | 4345 | /* reset vlans for device */ |
4288 | igb_clear_vf_vfta(adapter, vf); | 4346 | igb_clear_vf_vfta(adapter, vf); |
@@ -4398,6 +4456,9 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) | |||
4398 | case E1000_VF_SET_MAC_ADDR: | 4456 | case E1000_VF_SET_MAC_ADDR: |
4399 | retval = igb_set_vf_mac_addr(adapter, msgbuf, vf); | 4457 | retval = igb_set_vf_mac_addr(adapter, msgbuf, vf); |
4400 | break; | 4458 | break; |
4459 | case E1000_VF_SET_PROMISC: | ||
4460 | retval = igb_set_vf_promisc(adapter, msgbuf, vf); | ||
4461 | break; | ||
4401 | case E1000_VF_SET_MULTICAST: | 4462 | case E1000_VF_SET_MULTICAST: |
4402 | retval = igb_set_vf_multicasts(adapter, msgbuf, vf); | 4463 | retval = igb_set_vf_multicasts(adapter, msgbuf, vf); |
4403 | break; | 4464 | break; |