Skip to contentSkip to conversation

be2net: Fix to avoid a crash seen on PPC with LRO and Jumbo frames.

PATCH In review Ajit Khaparde 2 participants 2 messages Jun 26, 2009 – Jun 29, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index f703758..5b4bf3d 100644
@@ -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
index 9592f22..cccc541 100644
@@ -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
maintainer
#1 lore raw

From: 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.
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.

This patch looks good, applied, thanks!