[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4275a6d14b8e209331251fa7a3a1f3094ee60915@linux.dev>
Date: Tue, 22 Oct 2024 01:48:03 +0000
From: "Yajun Deng" <yajun.deng@...ux.dev>
To: "Guillaume Nault" <gnault@...hat.com>, "Ido Schimmel" <idosch@...sch.org>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 net-next] net: vlan: Use vlan_prio instead of vlan_qos
in mapping
October 22, 2024 at 12:27 AM, "Guillaume Nault" <gnault@...hat.com> wrote:
>
> 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.
>
Okay, that's a better way.
Powered by blists - more mailing lists