aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igb/igb_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2017-02-06 21:26:15 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2017-03-17 15:11:44 -0400
commitcfbc871c2174f352542053d25659920d6841ed41 (patch)
treeb80801bef1d5f2a445114bf78088205ddc8c4d1e /drivers/net/ethernet/intel/igb/igb_main.c
parent7cc6fd4c60f267e17b0baef1580d7a6258c0a6f0 (diff)
igb: Limit maximum frame Rx based on MTU
In order to support the use of build_skb going forward it will be necessary to place a maximum limit on the amount of data we can receive when jumbo frames is not enabled. In order to do this I am adding a new upper limit for receive based on the size of a 2K buffer minus padding. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index e541cccaae1b..1bf31224dfac 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4250,7 +4250,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
4250 struct igb_adapter *adapter = netdev_priv(netdev); 4250 struct igb_adapter *adapter = netdev_priv(netdev);
4251 struct e1000_hw *hw = &adapter->hw; 4251 struct e1000_hw *hw = &adapter->hw;
4252 unsigned int vfn = adapter->vfs_allocated_count; 4252 unsigned int vfn = adapter->vfs_allocated_count;
4253 u32 rctl = 0, vmolr = 0; 4253 u32 rctl = 0, vmolr = 0, rlpml = MAX_JUMBO_FRAME_SIZE;
4254 int count; 4254 int count;
4255 4255
4256 /* Check for Promiscuous and All Multicast modes */ 4256 /* Check for Promiscuous and All Multicast modes */
@@ -4308,6 +4308,14 @@ static void igb_set_rx_mode(struct net_device *netdev)
4308 E1000_RCTL_VFE); 4308 E1000_RCTL_VFE);
4309 wr32(E1000_RCTL, rctl); 4309 wr32(E1000_RCTL, rctl);
4310 4310
4311#if (PAGE_SIZE < 8192)
4312 if (!adapter->vfs_allocated_count) {
4313 if (adapter->max_frame_size <= IGB_MAX_FRAME_BUILD_SKB)
4314 rlpml = IGB_MAX_FRAME_BUILD_SKB;
4315 }
4316#endif
4317 wr32(E1000_RLPML, rlpml);
4318
4311 /* In order to support SR-IOV and eventually VMDq it is necessary to set 4319 /* In order to support SR-IOV and eventually VMDq it is necessary to set
4312 * the VMOLR to enable the appropriate modes. Without this workaround 4320 * the VMOLR to enable the appropriate modes. Without this workaround
4313 * we will have issues with VLAN tag stripping not being done for frames 4321 * we will have issues with VLAN tag stripping not being done for frames
@@ -4322,12 +4330,17 @@ static void igb_set_rx_mode(struct net_device *netdev)
4322 vmolr |= rd32(E1000_VMOLR(vfn)) & 4330 vmolr |= rd32(E1000_VMOLR(vfn)) &
4323 ~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE); 4331 ~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE);
4324 4332
4325 /* enable Rx jumbo frames, no need for restriction */ 4333 /* enable Rx jumbo frames, restrict as needed to support build_skb */
4326 vmolr &= ~E1000_VMOLR_RLPML_MASK; 4334 vmolr &= ~E1000_VMOLR_RLPML_MASK;
4327 vmolr |= MAX_JUMBO_FRAME_SIZE | E1000_VMOLR_LPE; 4335#if (PAGE_SIZE < 8192)
4336 if (adapter->max_frame_size <= IGB_MAX_FRAME_BUILD_SKB)
4337 vmolr |= IGB_MAX_FRAME_BUILD_SKB;
4338 else
4339#endif
4340 vmolr |= MAX_JUMBO_FRAME_SIZE;
4341 vmolr |= E1000_VMOLR_LPE;
4328 4342
4329 wr32(E1000_VMOLR(vfn), vmolr); 4343 wr32(E1000_VMOLR(vfn), vmolr);
4330 wr32(E1000_RLPML, MAX_JUMBO_FRAME_SIZE);
4331 4344
4332 igb_restore_vf_multicasts(adapter); 4345 igb_restore_vf_multicasts(adapter);
4333} 4346}