sky2: don't do GRO on second port
authorstephen hemminger <shemminger@vyatta.com>
Mon, 30 Aug 2010 07:51:17 +0000 (07:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Sep 2010 21:49:33 +0000 (14:49 -0700)
There's something very important I forgot to tell you.
 What?

 Don't cross the GRO streams.
 Why?

 It would be bad.
 I'm fuzzy on the whole good/bad thing. What do you mean, "bad"?

 Try to imagine all the Internet as you know it stopping instantaneously
  and every bit in every packet swapping at the speed of light.
 Total packet reordering.
 Right. That's bad. Okay. All right. Important safety tip. Thanks, Hubert

The simplest way to stop this is just avoid doing GRO on the second port.
Very few Marvell boards support two ports per ring, and GRO is just
an optimization.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/sky2.c

index 194e5cf..a6ff113 100644 (file)
@@ -2520,24 +2520,27 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
        }
 }
 
-static inline void sky2_skb_rx(const struct sky2_port *sky2,
+static inline void sky2_skb_rx(struct napi_struct *napi,
+                              const struct sky2_port *sky2,
                               u32 status, struct sk_buff *skb)
 {
 #ifdef SKY2_VLAN_TAG_USED
-       u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
        if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
-               if (skb->ip_summed == CHECKSUM_NONE)
+               u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
+
+               if (skb->ip_summed == CHECKSUM_NONE ||
+                   sky2->netdev != napi->dev)
                        vlan_hwaccel_receive_skb(skb, sky2->vlgrp, vlan_tag);
                else
-                       vlan_gro_receive(&sky2->hw->napi, sky2->vlgrp,
-                                        vlan_tag, skb);
+                       vlan_gro_receive(napi, sky2->vlgrp, vlan_tag, skb);
                return;
        }
 #endif
-       if (skb->ip_summed == CHECKSUM_NONE)
+       if (skb->ip_summed == CHECKSUM_NONE ||
+           sky2->netdev != napi->dev)
                netif_receive_skb(skb);
        else
-               napi_gro_receive(&sky2->hw->napi, skb);
+               napi_gro_receive(napi, skb);
 }
 
 static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port,
@@ -2638,7 +2641,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
 
                        skb->protocol = eth_type_trans(skb, dev);
 
-                       sky2_skb_rx(sky2, status, skb);
+                       sky2_skb_rx(&hw->napi, sky2, status, skb);
 
                        /* Stop after net poll weight */
                        if (++work_done >= to_do)