DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Alan Elder <alan.elder@microsoft.com>
Cc: Long Li <longli@microsoft.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v2] net/netvsc: fix parsing of VLAN metadata
Date: Thu, 8 Feb 2024 09:54:19 -0800	[thread overview]
Message-ID: <20240208095419.3b5579eb@hermes.local> (raw)
In-Reply-To: <PA4PR83MB052682FE39BDC7283F4E181497442@PA4PR83MB0526.EURPRD83.prod.outlook.com>

On Thu, 8 Feb 2024 14:42:44 +0000
Alan Elder <alan.elder@microsoft.com> wrote:


> +                             struct ndis_pkt_vlan_info *vlan = (struct ndis_pkt_vlan_info *)pi_data;
> +                             vlan->value = 0;
> +                             vlan->vlanid = (m->vlan_tci & HN_VLAN_VID_MASK);
> +                             vlan->cfi = (!!(m->vlan_tci & HN_VLAN_CFI_MASK));
> +                             vlan->pri = ((m->vlan_tci & HN_VLAN_PRIO_MASK) >> HN_VLAN_PRIO_SHIFT);

Lots of extra parenthesis here, please remove them.

> +struct ndis_pkt_vlan_info {
> +             union {
> +                             struct {
> +                                             uint32_t pri:3; /* User Priority */
> +                                             uint32_t cfi:1; /* Canonical Format ID / DEI */
> +                                             uint32_t vlanid:12; /* VLAN ID */
> +                                             uint32_t reserved:16;
> +                             };
> +                             uint32_t value;
> +             };
> +};

Order of union elements is byte order sensitive, granted Hyper-V/Azure doesn't do big-endian.

Most of this driver came from FreeBSD. Did you look there to make sure naming is the
same. I.e would be good to be able to have same code in both places as much as possible.

  reply	other threads:[~2024-02-08 17:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 14:12 [PATCH] " Alan Elder
2024-02-08 14:42 ` [PATCH v2] " Alan Elder
2024-02-08 17:54   ` Stephen Hemminger [this message]
2024-02-09  1:13     ` Long Li
2024-02-09 15:40       ` Alan Elder

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=20240208095419.3b5579eb@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=alan.elder@microsoft.com \
    --cc=dev@dpdk.org \
    --cc=longli@microsoft.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 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).