DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: <dev@dpdk.org>, Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>,
	<stephen@networkplumber.org>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net: adjust layer 2 length on soft VLAN insertion
Date: Sun, 16 Jun 2019 11:10:02 +0100	[thread overview]
Message-ID: <1560679802-20112-1-git-send-email-arybchenko@solarflare.com> (raw)

From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>

Layer 2 length must be updated after the prepend to mbuf to keep
the length right to be used by other Tx offloads.

If the packet has tunnel encapsulation, outer_l2_len should be
updated. Otherwise l2_len should be updated.

Fixes: c974021a5949 ("ether: add soft vlan encap/decap")
Cc: stephen@networkplumber.org
Cc: stable@dpdk.org

Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
The fix is required for net/virtio which supports both VLAN
insertion (using the function) and Tx checksum offloads.

Condition to decide which layer 2 length to update is chosen in accordance
with [1], but could be ((*m)->ol_flags & PKT_TX_TUNNEL_MASK) != 0.

[1] https://patches.dpdk.org/patch/52721/

 lib/librte_net/rte_ether.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 7be9b4890..194570019 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -417,6 +417,11 @@ static inline int rte_vlan_insert(struct rte_mbuf **m)
 
 	(*m)->ol_flags &= ~(PKT_RX_VLAN_STRIPPED | PKT_TX_VLAN);
 
+	if ((*m)->outer_l2_len != 0)
+		(*m)->outer_l2_len += sizeof(struct rte_vlan_hdr);
+	else
+		(*m)->l2_len += sizeof(struct rte_vlan_hdr);
+
 	return 0;
 }
 
-- 
2.17.1


             reply	other threads:[~2019-06-16 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-16 10:10 Andrew Rybchenko [this message]
2019-06-24 13:46 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
2019-07-05 14:51   ` Olivier Matz
2019-07-16 15:32     ` Ferruh Yigit

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=1560679802-20112-1-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=Dilshod.Urazov@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).