[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <000001daa806$d4554880$7cffd980$@trustnetic.com>
Date: Fri, 17 May 2024 11:03:44 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Jakub Kicinski'" <kuba@...nel.org>
Cc: <davem@...emloft.net>,
<edumazet@...gle.com>,
<pabeni@...hat.com>,
<rmk+kernel@...linux.org.uk>,
<andrew@...n.ch>,
<netdev@...r.kernel.org>,
<mengyuanlou@...-swift.com>,
<duanqiangwen@...-swift.com>,
"'Sai Krishna'" <saikrishnag@...vell.com>,
"'Simon Horman'" <horms@...nel.org>
Subject: RE: [PATCH net v4 2/3] net: wangxun: match VLAN CTAG and STAG features
On Fri, May 17, 2024 10:46 AM, Jakub Kicinski wrote:
> On Tue, 14 May 2024 15:23:29 +0800 Jiawen Wu wrote:
> > +#define NETIF_VLAN_STRIPPING_FEATURES (NETIF_F_HW_VLAN_CTAG_RX | \
> > + NETIF_F_HW_VLAN_STAG_RX)
>
>
> > + if (changed & NETIF_VLAN_STRIPPING_FEATURES) {
> > + if (features & NETIF_F_HW_VLAN_CTAG_RX &&
> > + features & NETIF_F_HW_VLAN_STAG_RX) {
> > + features |= NETIF_VLAN_STRIPPING_FEATURES;
>
> this is a noop, right? It's like checking:
>
> if (value & 1)
> value |= 1;
>
> features already have both bits set ORing them in doesn't change much.
> Or am I misreading?
>
> All I would have expected was:
>
> if (features & NETIF_VLAN_STRIPPING_FEATURES != NETIF_VLAN_STRIPPING_FEATURES) {
> /* your "else" clause which resets both */
> }
>
> > + } else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) &&
> > + !(features & NETIF_F_HW_VLAN_STAG_RX)) {
> > + features &= ~NETIF_VLAN_STRIPPING_FEATURES;
> > + } else {
> > + features &= ~NETIF_VLAN_STRIPPING_FEATURES;
> > + features |= netdev->features & NETIF_VLAN_STRIPPING_FEATURES;
> > + wx_err(wx, "802.1Q and 802.1ad VLAN stripping must be either both on or both off.");
> > + }
> > + }
Right. Looks like I just need to keep the "else" part and remove others.
Powered by blists - more mailing lists