From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Nikolay Aleksandrov <nikolay@nvidia.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Roopa Prabhu <roopa@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
Ido Schimmel <idosch@nvidia.com>
Subject: Re: [PATCH net-next 1/5] net: bridge: provide shim definition for br_vlan_flags
Date: Wed, 27 Oct 2021 19:54:43 +0000 [thread overview]
Message-ID: <20211027195442.mwlyvrokj6ygpv7m@skbuf> (raw)
In-Reply-To: <97a4088c-ba81-229b-0f7c-088a0069db41@nvidia.com>
On Wed, Oct 27, 2021 at 10:50:47PM +0300, Nikolay Aleksandrov wrote:
> On 27/10/2021 22:45, Vladimir Oltean wrote:
> > On Wed, Oct 27, 2021 at 10:28:12PM +0300, Nikolay Aleksandrov wrote:
> >> On 27/10/2021 19:21, Vladimir Oltean wrote:
> >>> br_vlan_replay() needs this, and we're preparing to move it to
> >>> br_switchdev.c, which will be compiled regardless of whether or not
> >>> CONFIG_BRIDGE_VLAN_FILTERING is enabled.
> >>>
> >>> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> >>> ---
> >>> net/bridge/br_private.h | 5 +++++
> >>> 1 file changed, 5 insertions(+)
> >>>
> >>> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> >>> index 3c9327628060..cc31c3fe1e02 100644
> >>> --- a/net/bridge/br_private.h
> >>> +++ b/net/bridge/br_private.h
> >>> @@ -1708,6 +1708,11 @@ static inline bool br_vlan_can_enter_range(const struct net_bridge_vlan *v_curr,
> >>> return true;
> >>> }
> >>>
> >>> +static inline u16 br_vlan_flags(const struct net_bridge_vlan *v, u16 pvid)
> >>> +{
> >>> + return 0;
> >>> +}
> >>> +
> >>> static inline int br_vlan_replay(struct net_device *br_dev,
> >>> struct net_device *dev, const void *ctx,
> >>> bool adding, struct notifier_block *nb,
> >>>
> >>
> >> hm, shouldn't the vlan replay be a shim if bridge vlans are not defined?
> >> I.e. shouldn't this rather be turned into br_vlan_replay's shim?
> >>
> >> TBH, I haven't looked into the details just wonder why we would compile all that vlan
> >> code if bridge vlan filtering is not enabled.
> >
> > The main reason is that I would like to avoid #ifdef if possible. If you
> > have a strong opinion otherwise I can follow suit.
> >
>
> Well, I see that we add ifdefs for IGMP, so I don't see a reason why not
> to ifdef out the vlan replay in the same way too.
>
> I don't have a strong preference either way, end result is the same.
Since the caller and the callee are in the same C file, shimming out is
not as clean as providing a static inline function definition with an
empty body, and if I could avoid doing what I did for
br_mdb_replay()
{
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
<some other variables>;
int err;
err = <body>;
if (err)
return err;
#endif
return 0;
}
I'd do it. For br_vlan_replay() I could avoid it, so I left it at that.
next prev parent reply other threads:[~2021-10-27 19:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 16:21 [PATCH net-next 0/5] Code movement to br_switchdev.c Vladimir Oltean
2021-10-27 16:21 ` [PATCH net-next 1/5] net: bridge: provide shim definition for br_vlan_flags Vladimir Oltean
2021-10-27 19:28 ` Nikolay Aleksandrov
2021-10-27 19:45 ` Vladimir Oltean
2021-10-27 19:50 ` Nikolay Aleksandrov
2021-10-27 19:54 ` Vladimir Oltean [this message]
2021-10-28 8:45 ` Nikolay Aleksandrov
2021-10-27 16:21 ` [PATCH net-next 2/5] net: bridge: move br_vlan_replay to br_switchdev.c Vladimir Oltean
2021-10-28 8:46 ` Nikolay Aleksandrov
2021-10-27 16:21 ` [PATCH net-next 3/5] net: bridge: split out the switchdev portion of br_mdb_notify Vladimir Oltean
2021-10-28 8:48 ` Nikolay Aleksandrov
2021-10-27 16:21 ` [PATCH net-next 4/5] net: bridge: mdb: move all switchdev logic to br_switchdev.c Vladimir Oltean
2021-10-28 8:50 ` Nikolay Aleksandrov
2021-10-27 16:21 ` [PATCH net-next 5/5] net: bridge: switchdev: consistent function naming Vladimir Oltean
2021-10-28 8:50 ` Nikolay Aleksandrov
2021-10-29 3:10 ` [PATCH net-next 0/5] Code movement to br_switchdev.c patchwork-bot+netdevbpf
2021-11-01 15:05 ` Jiri Pirko
2021-11-02 11:11 ` Vladimir Oltean
2021-11-02 11:49 ` Jiri Pirko
2021-11-02 12:02 ` Vladimir Oltean
2021-11-02 13:44 ` Jiri Pirko
2021-11-02 17:03 ` Andrew Lunn
2021-11-02 17:20 ` Vladimir Oltean
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=20211027195442.mwlyvrokj6ygpv7m@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=davem@davemloft.net \
--cc=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=roopa@nvidia.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