be2net: Fix to avoid a crash seen on PPC with LRO and Jumbo frames.
Subsystems (2)
PATCH 1/1 be2net: Fix to avoid a crash seen on PPC with LRO and Jumbo frames.
While testing the driver on PPC, we ran into a crash with LRO, Jumbo frames.
With CONFIG_PPC_64K_PAGES configured (a default in PPC), MAX_SKB_FRAGS drops to 3 and we were crossing the array limits on skb_shinfo(skb)->frags[]. Now we coalesce the frags from the same physical page into one slot in
skb_shinfo(skb)->frags[] and go to the next index when the frag is from
different physical page.
This patch is against the net-2.6 tree.
--- drivers/net/benet/be.h | 2 +- drivers/net/benet/be_ethtool.c | 4 +- drivers/net/benet/be_main.c | 45 ++++++++++++++++++++++++++++----------- 3 files changed, 35 insertions(+), 16 deletions(-)
drivers/net/benet/be.h +1 -1
@@ -73,7 +73,7 @@ static inline char *nic_name(struct pci_dev *pdev)#define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST)#define BE_MAX_LRO_DESCRIPTORS 16 -#define BE_MAX_FRAGS_PER_FRAME 16 +#define BE_MAX_FRAGS_PER_FRAME (min((u32) 16, (u32) MAX_SKB_FRAGS))struct be_dma_mem {void *va;
drivers/net/benet/be_ethtool.c +2 -2
@@ -162,8 +162,8 @@ be_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)return -EINVAL ; adapter->max_rx_coal = coalesce->rx_max_coalesced_frames; -if (adapter->max_rx_coal >MAX_SKB_FRAGS ) - adapter->max_rx_coal =MAX_SKB_FRAGS -1 ; +if (adapter->max_rx_coal >BE_MAX_FRAGS_PER_FRAME ) + adapter->max_rx_coal =BE_MAX_FRAGS_PER_FRAME ;/* if AIC is being turned on now, start with an EQD of 0 */ if (rx_eq->enable_aic == 0 &&
drivers/net/benet/be_main.c +32 -13
88 lines not on this page · raw message
Signature · 1 line
1.6.0.4
David Miller
maintainerFrom: Ajit Khaparde <[email protected]>
Date: Fri, 26 Jun 2009 18:21:07 +0530
Quoted 9 lines
While testing the driver on PPC, we ran into a crash with LRO, Jumbo frames.
WithCONFIG_PPC_64K_PAGESconfigured (a default in PPC),MAX_SKB_FRAGSdrops to 3 and we were crossing the array limits on skb_shinfo(skb)->frags[]. Now we coalesce the frags from the same physical page into one slot in
skb_shinfo(skb)->frags[] and go to the next index when the frag is from
different physical page.This patch is against the net-2.6 tree.
Signed-off-by Ajit Khaparde <[email protected]>
This patch looks good, applied, thanks!