All of lore.kernel.org
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Saeed Mahameed <saeedm@mellanox.com>,
	Achiad Shochat <achiad@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH net 1/6] net/mlx5e: Fix inline header size calculation
Date: Thu, 12 Nov 2015 19:35:25 +0200	[thread overview]
Message-ID: <1447349730-19832-2-git-send-email-ogerlitz@mellanox.com> (raw)
In-Reply-To: <1447349730-19832-1-git-send-email-ogerlitz@mellanox.com>

From: Saeed Mahameed <saeedm@mellanox.com>

mlx5e_get_inline_hdr_size didn't take into account the vlan insertion
into the inline WQE segment.
This could lead to max inline violation in cases where
skb_headlen(skb) + VLAN_HLEN >= sq->max_inline.

Fixes: 3ea4891db8d0 ("net/mlx5e: Fix LSO vlan insertion")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index cd8f85a..f687ebf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -118,8 +118,15 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq,
 	 */
 #define MLX5E_MIN_INLINE ETH_HLEN
 
-	if (bf && (skb_headlen(skb) <= sq->max_inline))
-		return skb_headlen(skb);
+	if (bf) {
+		u16 ihs = skb_headlen(skb);
+
+		if (skb_vlan_tag_present(skb))
+			ihs += VLAN_HLEN;
+
+		if (ihs <= sq->max_inline)
+			return skb_headlen(skb);
+	}
 
 	return MLX5E_MIN_INLINE;
 }
-- 
2.3.7

  reply	other threads:[~2015-11-12 17:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 17:35 [PATCH net 0/6] Mellanox NIC driver update, Nov 12, 2015 Or Gerlitz
2015-11-12 17:35 ` Or Gerlitz [this message]
2015-11-12 17:35 ` [PATCH net 2/6] net/mlx5e: Added self loopback prevention Or Gerlitz
2015-11-12 17:35 ` [PATCH net 3/6] net/mlx5e: Max mtu comparison fix Or Gerlitz
2015-11-12 17:35 ` [PATCH net 4/6] net/mlx5e: Use the right DMA free function on TX path Or Gerlitz
2015-11-12 17:35 ` [PATCH net 5/6] net/mlx4_core: Fix sleeping while holding spinlock at rem_slave_counters Or Gerlitz
2015-11-12 17:35 ` [PATCH net 6/6] net/mlx4_core: Avoid returning success in case of an error flow Or Gerlitz
2015-11-15 23:44 ` [PATCH net 0/6] Mellanox NIC driver update, Nov 12, 2015 David Miller

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=1447349730-19832-2-git-send-email-ogerlitz@mellanox.com \
    --to=ogerlitz@mellanox.com \
    --cc=achiad@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    /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.