aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c4
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c13
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c107
3 files changed, 93 insertions, 31 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index ae73ef14fdf3..252850d9a3e0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -800,6 +800,10 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
800 return -EINVAL; 800 return -EINVAL;
801 801
802 e_info(drv, "Enabling FCoE offload features.\n"); 802 e_info(drv, "Enabling FCoE offload features.\n");
803
804 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
805 e_warn(probe, "Enabling FCoE on PF will disable legacy VFs\n");
806
803 if (netif_running(netdev)) 807 if (netif_running(netdev))
804 netdev->netdev_ops->ndo_stop(netdev); 808 netdev->netdev_ops->ndo_stop(netdev);
805 809
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index fa3d552e1f4a..e2a6691cbd7c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3263,6 +3263,11 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
3263 max_frame = IXGBE_FCOE_JUMBO_FRAME_SIZE; 3263 max_frame = IXGBE_FCOE_JUMBO_FRAME_SIZE;
3264 3264
3265#endif /* IXGBE_FCOE */ 3265#endif /* IXGBE_FCOE */
3266
3267 /* adjust max frame to be at least the size of a standard frame */
3268 if (max_frame < (ETH_FRAME_LEN + ETH_FCS_LEN))
3269 max_frame = (ETH_FRAME_LEN + ETH_FCS_LEN);
3270
3266 mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD); 3271 mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
3267 if (max_frame != (mhadd >> IXGBE_MHADD_MFS_SHIFT)) { 3272 if (max_frame != (mhadd >> IXGBE_MHADD_MFS_SHIFT)) {
3268 mhadd &= ~IXGBE_MHADD_MFS_MASK; 3273 mhadd &= ~IXGBE_MHADD_MFS_MASK;
@@ -4828,14 +4833,14 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
4828 return -EINVAL; 4833 return -EINVAL;
4829 4834
4830 /* 4835 /*
4831 * For 82599EB we cannot allow PF to change MTU greater than 1500 4836 * For 82599EB we cannot allow legacy VFs to enable their receive
4832 * in SR-IOV mode as it may cause buffer overruns in guest VFs that 4837 * paths when MTU greater than 1500 is configured. So display a
4833 * don't allocate and chain buffers correctly. 4838 * warning that legacy VFs will be disabled.
4834 */ 4839 */
4835 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && 4840 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
4836 (adapter->hw.mac.type == ixgbe_mac_82599EB) && 4841 (adapter->hw.mac.type == ixgbe_mac_82599EB) &&
4837 (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE)) 4842 (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE))
4838 return -EINVAL; 4843 e_warn(probe, "Setting MTU > 1500 will disable legacy VFs\n");
4839 4844
4840 e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu); 4845 e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
4841 4846
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index dce48bf64d96..420766e28ec6 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -150,16 +150,6 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
150 adapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE | 150 adapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE |
151 IXGBE_FLAG2_RSC_ENABLED); 151 IXGBE_FLAG2_RSC_ENABLED);
152 152
153#ifdef IXGBE_FCOE
154 /*
155 * When SR-IOV is enabled 82599 cannot support jumbo frames
156 * so we must disable FCoE because we cannot support FCoE MTU.
157 */
158 if (adapter->hw.mac.type == ixgbe_mac_82599EB)
159 adapter->flags &= ~(IXGBE_FLAG_FCOE_ENABLED |
160 IXGBE_FLAG_FCOE_CAPABLE);
161#endif
162
163 /* enable spoof checking for all VFs */ 153 /* enable spoof checking for all VFs */
164 for (i = 0; i < adapter->num_vfs; i++) 154 for (i = 0; i < adapter->num_vfs; i++)
165 adapter->vfinfo[i].spoofchk_enabled = true; 155 adapter->vfinfo[i].spoofchk_enabled = true;
@@ -353,31 +343,77 @@ static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid,
353 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add); 343 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add);
354} 344}
355 345
356static void ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf) 346static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
357{ 347{
358 struct ixgbe_hw *hw = &adapter->hw; 348 struct ixgbe_hw *hw = &adapter->hw;
359 int new_mtu = msgbuf[1]; 349 int max_frame = msgbuf[1];
360 u32 max_frs; 350 u32 max_frs;
361 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
362 351
363 /* Only X540 supports jumbo frames in IOV mode */ 352 /*
364 if (adapter->hw.mac.type != ixgbe_mac_X540) 353 * For 82599EB we have to keep all PFs and VFs operating with
365 return; 354 * the same max_frame value in order to avoid sending an oversize
355 * frame to a VF. In order to guarantee this is handled correctly
356 * for all cases we have several special exceptions to take into
357 * account before we can enable the VF for receive
358 */
359 if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
360 struct net_device *dev = adapter->netdev;
361 int pf_max_frame = dev->mtu + ETH_HLEN;
362 u32 reg_offset, vf_shift, vfre;
363 s32 err = 0;
364
365#ifdef CONFIG_FCOE
366 if (dev->features & NETIF_F_FCOE_MTU)
367 pf_max_frame = max_t(int, pf_max_frame,
368 IXGBE_FCOE_JUMBO_FRAME_SIZE);
369
370#endif /* CONFIG_FCOE */
371 /*
372 * If the PF or VF are running w/ jumbo frames enabled we
373 * need to shut down the VF Rx path as we cannot support
374 * jumbo frames on legacy VFs
375 */
376 if ((pf_max_frame > ETH_FRAME_LEN) ||
377 (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)))
378 err = -EINVAL;
379
380 /* determine VF receive enable location */
381 vf_shift = vf % 32;
382 reg_offset = vf / 32;
383
384 /* enable or disable receive depending on error */
385 vfre = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset));
386 if (err)
387 vfre &= ~(1 << vf_shift);
388 else
389 vfre |= 1 << vf_shift;
390 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), vfre);
391
392 if (err) {
393 e_err(drv, "VF max_frame %d out of range\n", max_frame);
394 return err;
395 }
396 }
366 397
367 /* MTU < 68 is an error and causes problems on some kernels */ 398 /* MTU < 68 is an error and causes problems on some kernels */
368 if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE)) { 399 if (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) {
369 e_err(drv, "VF mtu %d out of range\n", new_mtu); 400 e_err(drv, "VF max_frame %d out of range\n", max_frame);
370 return; 401 return -EINVAL;
371 } 402 }
372 403
373 max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) & 404 /* pull current max frame size from hardware */
374 IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT; 405 max_frs = IXGBE_READ_REG(hw, IXGBE_MAXFRS);
375 if (max_frs < new_mtu) { 406 max_frs &= IXGBE_MHADD_MFS_MASK;
376 max_frs = new_mtu << IXGBE_MHADD_MFS_SHIFT; 407 max_frs >>= IXGBE_MHADD_MFS_SHIFT;
408
409 if (max_frs < max_frame) {
410 max_frs = max_frame << IXGBE_MHADD_MFS_SHIFT;
377 IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs); 411 IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs);
378 } 412 }
379 413
380 e_info(hw, "VF requests change max MTU to %d\n", new_mtu); 414 e_info(hw, "VF requests change max MTU to %d\n", max_frame);
415
416 return 0;
381} 417}
382 418
383static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe) 419static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe)
@@ -532,11 +568,28 @@ static inline void ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
532 568
533 /* enable transmit and receive for vf */ 569 /* enable transmit and receive for vf */
534 reg = IXGBE_READ_REG(hw, IXGBE_VFTE(reg_offset)); 570 reg = IXGBE_READ_REG(hw, IXGBE_VFTE(reg_offset));
535 reg |= (reg | (1 << vf_shift)); 571 reg |= 1 << vf_shift;
536 IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), reg); 572 IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), reg);
537 573
538 reg = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset)); 574 reg = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset));
539 reg |= (reg | (1 << vf_shift)); 575 reg |= 1 << vf_shift;
576 /*
577 * The 82599 cannot support a mix of jumbo and non-jumbo PF/VFs.
578 * For more info take a look at ixgbe_set_vf_lpe
579 */
580 if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
581 struct net_device *dev = adapter->netdev;
582 int pf_max_frame = dev->mtu + ETH_HLEN;
583
584#ifdef CONFIG_FCOE
585 if (dev->features & NETIF_F_FCOE_MTU)
586 pf_max_frame = max_t(int, pf_max_frame,
587 IXGBE_FCOE_JUMBO_FRAME_SIZE);
588
589#endif /* CONFIG_FCOE */
590 if (pf_max_frame > ETH_FRAME_LEN)
591 reg &= ~(1 << vf_shift);
592 }
540 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), reg); 593 IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), reg);
541 594
542 /* Enable counting of spoofed packets in the SSVPC register */ 595 /* Enable counting of spoofed packets in the SSVPC register */
@@ -633,7 +686,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
633 hash_list, vf); 686 hash_list, vf);
634 break; 687 break;
635 case IXGBE_VF_SET_LPE: 688 case IXGBE_VF_SET_LPE:
636 ixgbe_set_vf_lpe(adapter, msgbuf); 689 retval = ixgbe_set_vf_lpe(adapter, msgbuf, vf);
637 break; 690 break;
638 case IXGBE_VF_SET_VLAN: 691 case IXGBE_VF_SET_VLAN:
639 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) 692 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK)