igb: prevent skb_over panic w/ mtu smaller than 1K

A panic has been observed with frame sizes smaller than 1K.  This has been
root caused to the hardware spanning larger frames across multiple buffers
and then reporting the original frame size in the first descriptor.  To
prevent this we can enable set the LPE bit which in turn will restrict
packet sizes to those set in the RLPML register.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Alexander Duyck 2009-01-31 00:52:57 -08:00 committed by David S. Miller
parent bbd98fe48a
commit ec54d7d6e4
1 changed files with 4 additions and 4 deletions

View File

@ -1834,11 +1834,11 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
rctl |= E1000_RCTL_SECRC;
/*
* disable store bad packets, long packet enable, and clear size bits.
* disable store bad packets and clear size bits.
*/
rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_LPE | E1000_RCTL_SZ_256);
rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_SZ_256);
if (adapter->netdev->mtu > ETH_DATA_LEN)
/* enable LPE when to prevent packets larger than max_frame_size */
rctl |= E1000_RCTL_LPE;
/* Setup buffer sizes */
@ -1864,7 +1864,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
*/
/* allocations using alloc_page take too long for regular MTU
* so only enable packet split for jumbo frames */
if (rctl & E1000_RCTL_LPE) {
if (adapter->netdev->mtu > ETH_DATA_LEN) {
adapter->rx_ps_hdr_size = IGB_RXBUFFER_128;
srrctl |= adapter->rx_ps_hdr_size <<
E1000_SRRCTL_BSIZEHDRSIZE_SHIFT;