From: Hangbin Liu <liuhangbin@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, mkubecek@suse.cz,
Nikolay Aleksandrov <razor@blackwall.org>,
Ido Schimmel <idosch@idosch.org>, Jiri Pirko <jiri@nvidia.com>
Subject: Re: [PATCH net 1/5] net, team, bonding: Add netdev_base_features helper
Date: Wed, 11 Dec 2024 01:33:33 +0000 [thread overview]
Message-ID: <Z1jr7Vl4O7iEu0A0@fedora> (raw)
In-Reply-To: <20241210141245.327886-1-daniel@iogearbox.net>
On Tue, Dec 10, 2024 at 03:12:41PM +0100, Daniel Borkmann wrote:
> Both bonding and team driver have logic to derive the base feature
> flags before iterating over their slave devices to refine the set
> via netdev_increment_features().
>
> Add a small helper netdev_base_features() so this can be reused
> instead of having it open-coded multiple times.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Nikolay Aleksandrov <razor@blackwall.org>
> Cc: Ido Schimmel <idosch@idosch.org>
> Cc: Jiri Pirko <jiri@nvidia.com>
> ---
> drivers/net/bonding/bond_main.c | 4 +---
> drivers/net/team/team_core.c | 3 +--
> include/linux/netdev_features.h | 7 +++++++
> 3 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 49dd4fe195e5..42c835c60cd8 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1520,9 +1520,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
> struct slave *slave;
>
> mask = features;
> -
> - features &= ~NETIF_F_ONE_FOR_ALL;
> - features |= NETIF_F_ALL_FOR_ALL;
> + features = netdev_base_features(features);
>
> bond_for_each_slave(bond, slave, iter) {
> features = netdev_increment_features(features,
> diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
> index a1b27b69f010..1df062c67640 100644
> --- a/drivers/net/team/team_core.c
> +++ b/drivers/net/team/team_core.c
> @@ -2011,8 +2011,7 @@ static netdev_features_t team_fix_features(struct net_device *dev,
> netdev_features_t mask;
>
> mask = features;
> - features &= ~NETIF_F_ONE_FOR_ALL;
> - features |= NETIF_F_ALL_FOR_ALL;
> + features = netdev_base_features(features);
>
> rcu_read_lock();
> list_for_each_entry_rcu(port, &team->port_list, list) {
> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index 66e7d26b70a4..11be70a7929f 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -253,4 +253,11 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
> NETIF_F_GSO_UDP_TUNNEL | \
> NETIF_F_GSO_UDP_TUNNEL_CSUM)
>
> +static inline netdev_features_t netdev_base_features(netdev_features_t features)
> +{
> + features &= ~NETIF_F_ONE_FOR_ALL;
> + features |= NETIF_F_ALL_FOR_ALL;
> + return features;
> +}
> +
> #endif /* _LINUX_NETDEV_FEATURES_H */
> --
> 2.43.0
>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
next prev parent reply other threads:[~2024-12-11 1:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 14:12 [PATCH net 1/5] net, team, bonding: Add netdev_base_features helper Daniel Borkmann
2024-12-10 14:12 ` [PATCH net 2/5] bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features Daniel Borkmann
2024-12-11 7:44 ` Nikolay Aleksandrov
2024-12-11 9:09 ` Hangbin Liu
2024-12-10 14:12 ` [PATCH net 3/5] bonding: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL Daniel Borkmann
2024-12-11 7:46 ` Nikolay Aleksandrov
2024-12-11 9:18 ` Hangbin Liu
2024-12-10 14:12 ` [PATCH net 4/5] team: Fix initial vlan_feature set in __team_compute_features Daniel Borkmann
2024-12-11 7:47 ` Nikolay Aleksandrov
2024-12-11 9:10 ` Hangbin Liu
2024-12-10 14:12 ` [PATCH net 5/5] team: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL Daniel Borkmann
2024-12-11 7:47 ` Nikolay Aleksandrov
2024-12-11 9:19 ` Hangbin Liu
2024-12-11 1:33 ` Hangbin Liu [this message]
2024-12-11 7:39 ` [PATCH net 1/5] net, team, bonding: Add netdev_base_features helper Nikolay Aleksandrov
2024-12-12 10:58 ` Paolo Abeni
2024-12-12 12:07 ` Daniel Borkmann
2024-12-12 11:10 ` patchwork-bot+netdevbpf
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=Z1jr7Vl4O7iEu0A0@fedora \
--to=liuhangbin@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=idosch@idosch.org \
--cc=jiri@nvidia.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.org \
/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