]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
be2net: Fix a UE caused by passing large frames to the ASIC
authorajit.khaparde@broadcom.com <ajit.khaparde@broadcom.com>
Mon, 22 Feb 2016 19:05:01 +0000 (00:35 +0530)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 8 Jul 2016 01:50:19 +0000 (18:50 -0700)
In QnQ configurations like Flex-10 where the VLANs are inserted by the
ASIC, on rare occasions the HW is encountering a scenario where the
final frame length ends to be greater than what the ASIC can support.

This is because when the TXULP pulls the TX WRB to check the length
of the frame to be transmitted it also adds the size of VLANs to be
inserted by the HW to the length of the frame indicated in the WRB,
which in some cases fails the range check.  This causes a UE.

Avoid this by trimming the skb length to accommodate the VLAN insertion.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: suresh.reddy <suresh.reddy@broadcom.com>
Orabug: 23641442
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_main.c

index c3d8662c12844e24e2c19e2e407852e1c630eb2f..21bf8b559ed286772c6baa8753e02dd0cbcceea8 100644 (file)
@@ -72,6 +72,9 @@
 #define BE_MAX_MTU              (BE_MAX_JUMBO_FRAME_SIZE -     \
                                 (ETH_HLEN + ETH_FCS_LEN))
 
+/* Accommodate for QnQ configurations where VLAN insertion is enabled in HW */
+#define BE_MAX_GSO_SIZE                (65535 - 2 * VLAN_HLEN)
+
 #define BE_NUM_VLANS_SUPPORTED 64
 #define BE_MAX_EQD             128u
 #define        BE_MAX_TX_FRAG_COUNT    30
index e82e8ab5a6f0c31cbb5337b33d5545896546b8b3..8dcf6b84109ba0175158393597a28921c15c0411 100644 (file)
@@ -1123,6 +1123,8 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
                                           struct sk_buff *skb,
                                           struct be_wrb_params *wrb_params)
 {
+       int err;
+
        /* Lancer, SH and BE3 in SRIOV mode have a bug wherein
         * packets that are 32b or less may cause a transmit stall
         * on that port. The workaround is to pad such packets
@@ -1139,6 +1141,13 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
                        return NULL;
        }
 
+       /* The stack can send us skbs with length greater than
+        * what the HW can handle. Trim the extra bytes.
+        */
+       WARN_ON_ONCE(skb->len > BE_MAX_GSO_SIZE);
+       err = pskb_trim(skb, BE_MAX_GSO_SIZE);
+       WARN_ON(err);
+
        return skb;
 }
 
@@ -4854,7 +4863,7 @@ static void be_netdev_init(struct net_device *netdev)
 
        netdev->flags |= IFF_MULTICAST;
 
-       netif_set_gso_max_size(netdev, 65535 - ETH_HLEN);
+       netif_set_gso_max_size(netdev, BE_MAX_GSO_SIZE - ETH_HLEN);
 
        netdev->netdev_ops = &be_netdev_ops;