DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Robin Jarry <rjarry@redhat.com>,
	dev@dpdk.org, Gregory Etelson <getelson@nvidia.com>
Cc: stable@dpdk.org
Subject: Re: [PATCH dpdk v3] net: fix VLAN packet type
Date: Thu, 23 Apr 2026 11:59:29 +0100	[thread overview]
Message-ID: <8561da5f-4ca7-4404-91d4-0c5ea296bb6e@redhat.com> (raw)
In-Reply-To: <DI0FVI2TG9UU.JRHQ224VBSMW@redhat.com>

On 4/23/26 10:49 AM, Robin Jarry wrote:
> Kevin Traynor, Apr 23, 2026 at 11:19:
>> Not shown in diff, but for:
>>
>> 		pkt_type |=
>> 			proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ?
>> 				 RTE_PTYPE_L2_ETHER_VLAN :
>> 				 RTE_PTYPE_L2_ETHER_QINQ;
>>
>> It seems to be produce the right result, but I'm not sure we should be
>> treating the ptype L2 defines as bitmasks. Maybe I'm wrong and it was
>> planned, but it looks like a coincidence it works now because QINQ (0x7)
>> happens to be a superset of VLAN (0x6) for the OR.
>>
>> Perhaps you could check vlan_depth and assign VLAN or QINQ based on that?
> 
> I hadn't considered this. It would make sense to have something like:
> 
> l3:
> 	switch (vlan_depth) {
> 	case 0:
> 		pkt_type = RTE_PTYPE_L2_ETHER;
> 		break;
> 	case 1:
> 		pkt_type = RTE_PTYPE_L2_ETHER_VLAN;
> 		break;
> 	default:
> 		pkt_type = RTE_PTYPE_L2_ETHER_QINQ;
> 		break;
> 	}
> 
> Mind that this will report RTE_PTYPE_L2_ETHER_QINQ even if we have
> double stacked 802.1Q tags (ether type 0x8100) and no 802.1ad S-tag
> (QinQ 0x88A8). I don't think this is an issue, but I'll let you judge.
> 

I'm not sure about this.

> I can send a v4 with this if that suits you.
> 

Setting pkt_type later has some implications for early returns (now i
notice that's present in v3 too)

Would this work ?

@@ -358,10 +358,12 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
                struct rte_vlan_hdr vh_copy;

+               if (vlan_depth == 0) {
+                       pkt_type =
+                               proto ==
rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ?
+                                        RTE_PTYPE_L2_ETHER_VLAN :
+                                        RTE_PTYPE_L2_ETHER_QINQ;
+               }
                if (++vlan_depth > RTE_NET_VLAN_MAX_DEPTH)
                        return 0;
-               pkt_type |=
-                       proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ?
-                                RTE_PTYPE_L2_ETHER_VLAN :
-                                RTE_PTYPE_L2_ETHER_QINQ;
                vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy);
                if (unlikely(vh == NULL))






  reply	other threads:[~2026-04-23 10:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22 10:28 [PATCH dpdk] net: fix L2 ptype assignment in VLAN loop Robin Jarry
2026-04-22 10:35 ` Robin Jarry
2026-04-22 10:38 ` [PATCH dpdk v2] " Robin Jarry
2026-04-22 13:16   ` Thomas Monjalon
2026-04-22 13:18     ` Robin Jarry
2026-04-22 13:23   ` David Marchand
2026-04-22 13:32 ` [PATCH dpdk v3] net: fix VLAN packet type Robin Jarry
2026-04-23  9:19   ` Kevin Traynor
2026-04-23  9:49     ` Robin Jarry
2026-04-23 10:59       ` Kevin Traynor [this message]
2026-04-23 11:11         ` Robin Jarry
2026-04-23 11:24 ` [PATCH dpdk v4] " Robin Jarry
2026-04-24 16:18   ` Kevin Traynor
2026-04-25  8:40   ` David Marchand
2026-04-27 10:47     ` Robin Jarry
2026-04-27 15:53       ` Thomas Monjalon
2026-04-30 10:12         ` David Marchand
2026-04-30 11:06           ` Morten Brørup
2026-05-15 11:17     ` Kevin Traynor

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=8561da5f-4ca7-4404-91d4-0c5ea296bb6e@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=dev@dpdk.org \
    --cc=getelson@nvidia.com \
    --cc=rjarry@redhat.com \
    --cc=stable@dpdk.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