All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens.net>
To: netdev@vger.kernel.org
Cc: Daniel Axtens <dja@axtens.net>,
	Manish.Chopra@cavium.com, Jason Wang <jasowang@redhat.com>,
	Pravin Shelar <pshelar@ovn.org>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Subject: [PATCH v3 2/2] bnx2x: disable GSO where gso_size is too big for hardware
Date: Tue, 30 Jan 2018 12:14:47 +1100	[thread overview]
Message-ID: <20180130011447.24916-3-dja@axtens.net> (raw)
In-Reply-To: <20180130011447.24916-1-dja@axtens.net>

If a bnx2x card is passed a GSO packet with a gso_size larger than
~9700 bytes, it will cause a firmware error that will bring the card
down:

bnx2x: [bnx2x_attn_int_deasserted3:4323(enP24p1s0f0)]MC assert!
bnx2x: [bnx2x_mc_assert:720(enP24p1s0f0)]XSTORM_ASSERT_LIST_INDEX 0x2
bnx2x: [bnx2x_mc_assert:736(enP24p1s0f0)]XSTORM_ASSERT_INDEX 0x0 = 0x00000000 0x25e43e47 0x00463e01 0x00010052
bnx2x: [bnx2x_mc_assert:750(enP24p1s0f0)]Chip Revision: everest3, FW Version: 7_13_1
... (dump of values continues) ...

Detect when the mac length of a GSO packet is greater than the maximum
packet size (9700 bytes) and disable GSO.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---

v3: use skb_gso_validate_mac_len to get the actual size, to allow
    jumbo frames to work.

I don't have local access to a bnx2x card and sending this off to the
user who does would add about a month of round-trip time, so this
particular spin is build-tested only. (Earlier spins were tested on
real hardware.)

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 7b08323e3f3d..fbb08e360625 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12934,6 +12934,15 @@ static netdev_features_t bnx2x_features_check(struct sk_buff *skb,
 					      struct net_device *dev,
 					      netdev_features_t features)
 {
+	/*
+	 * A skb with gso_size + header length > 9700 will cause a
+	 * firmware panic. Drop GSO support.
+	 *
+	 * Eventually the upper layer should not pass these packets down.
+	 */
+	if (unlikely(skb_is_gso(skb) && !skb_gso_validate_mac_len(skb, 9700)))
+		features &= ~NETIF_F_GSO_MASK;
+
 	features = vlan_features_check(skb, features);
 	return vxlan_features_check(skb, features);
 }
-- 
2.14.1

  parent reply	other threads:[~2018-01-30  1:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  1:14 [PATCH v3 0/2] bnx2x: disable GSO on too-large packets Daniel Axtens
2018-01-30  1:14 ` [PATCH v3 1/2] net: create skb_gso_validate_mac_len() Daniel Axtens
2018-01-30  1:46   ` Eric Dumazet
2018-01-30  1:59     ` Eric Dumazet
2018-01-30  2:42       ` Daniel Axtens
2018-01-30  8:17   ` Marcelo Ricardo Leitner
2018-01-30 13:08     ` Daniel Axtens
2018-01-30 16:59   ` kbuild test robot
2018-01-30 17:00   ` kbuild test robot
2018-01-30  1:14 ` Daniel Axtens [this message]
2018-01-30  8:20 ` [PATCH v3 0/2] bnx2x: disable GSO on too-large packets Marcelo Ricardo Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180130011447.24916-3-dja@axtens.net \
    --to=dja@axtens.net \
    --cc=Manish.Chopra@cavium.com \
    --cc=jasowang@redhat.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.