netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: Yajun Deng <yajun.deng@linux.dev>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 net-next] net: vlan: Use vlan_prio instead of vlan_qos in mapping
Date: Mon, 21 Oct 2024 18:27:43 +0200	[thread overview]
Message-ID: <ZxaA/6zaqgbrcHX/@debian> (raw)
In-Reply-To: <ZxT3oVQ27erIoTVz@shredder.mtl.com>

On Sun, Oct 20, 2024 at 03:29:21PM +0300, Ido Schimmel wrote:
> On Fri, Oct 18, 2024 at 10:12:33PM +0800, Yajun Deng wrote:
> > The vlan_qos member is used to save the vlan qos, but we only save the
> > priority. Also, we will get the priority in vlan netlink and proc.
> > We can just save the vlan priority using vlan_prio, so we can use vlan_prio
> > to get the priority directly.
> > 
> > For flexibility, we introduced vlan_dev_get_egress_priority() helper
> > function. After this patch, we will call vlan_dev_get_egress_priority()
> > instead of vlan_dev_get_egress_qos_mask() in irdma.ko and rdma_cm.ko.
> > Because we don't need the shift and mask operations anymore.
> > 
> > There is no functional changes.
> 
> Not sure I understand the motivation.
> 
> IIUC, currently, struct vlan_priority_tci_mapping::vlan_qos is shifted
> and masked in the control path (vlan_dev_set_egress_priority) so that
> these calculations would not need to be performed in the data path where
> the VLAN header is constructed (vlan_dev_hard_header /
> vlan_dev_hard_start_xmit).
> 
> This patch seems to move these calculations to the data path so that
> they would not need to be performed in the control path when dumping the
> priority mapping via netlink / proc.
> 
> Why is it a good trade-off?

I agree with Ido. The commit description doesn't explain why these
changes are made and I also can't see how this patch can improve
performances.

If it's about code readability, why not just add a helper that gets a
struct vlan_priority_tci_mapping pointer as input and returns a __u8
corresponding to the priority? This way, the /proc and netlink handlers
(and other potential users) wouldn't have to do the bit shifting and
masking manually.


  parent reply	other threads:[~2024-10-21 16:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 14:12 [PATCH v3 net-next] net: vlan: Use vlan_prio instead of vlan_qos in mapping Yajun Deng
2024-10-19  8:30 ` Simon Horman
2024-10-20 12:29 ` Ido Schimmel
2024-10-21  2:23   ` Yajun Deng
2024-10-21 16:27   ` Guillaume Nault [this message]
2024-10-22  1:48     ` Yajun Deng

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=ZxaA/6zaqgbrcHX/@debian \
    --to=gnault@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@idosch.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yajun.deng@linux.dev \
    /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).