diff mbox series

[net,2/5] bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features

Message ID 20241210141245.327886-2-daniel@iogearbox.net (mailing list archive)
State Accepted
Commit d064ea7fe2a24938997b5e88e6b61cbb0a4bb906
Delegated to: Netdev Maintainers
Headers show
Series [net,1/5] net, team, bonding: Add netdev_base_features helper | expand

Checks

Context Check Description
netdev/series_format warning Series does not have a cover letter
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 6 maintainers not CCed: pabeni@redhat.com edumazet@google.com kuba@kernel.org andrew+netdev@lunn.ch andy@greyhouse.net jv@jvosburgh.net
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 13 this patch: 13
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-12--00-00 (tests: 795)

Commit Message

Daniel Borkmann Dec. 10, 2024, 2:12 p.m. UTC
If a bonding device has slave devices, then the current logic to derive
the feature set for the master bond device is limited in that flags which
are fully supported by the underlying slave devices cannot be propagated
up to vlan devices which sit on top of bond devices. Instead, these get
blindly masked out via current NETIF_F_ALL_FOR_ALL logic.

vlan_features and mpls_features should reuse netdev_base_features() in
order derive the set in the same way as ndo_fix_features before iterating
through the slave devices to refine the feature set.

Fixes: a9b3ace44c7d ("bonding: fix vlan_features computing")
Fixes: 2e770b507ccd ("net: bonding: Inherit MPLS features from slave devices")
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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Nikolay Aleksandrov Dec. 11, 2024, 7:44 a.m. UTC | #1
On 12/10/24 16:12, Daniel Borkmann wrote:
> If a bonding device has slave devices, then the current logic to derive
> the feature set for the master bond device is limited in that flags which
> are fully supported by the underlying slave devices cannot be propagated
> up to vlan devices which sit on top of bond devices. Instead, these get
> blindly masked out via current NETIF_F_ALL_FOR_ALL logic.
> 
> vlan_features and mpls_features should reuse netdev_base_features() in
> order derive the set in the same way as ndo_fix_features before iterating
> through the slave devices to refine the feature set.
> 
> Fixes: a9b3ace44c7d ("bonding: fix vlan_features computing")
> Fixes: 2e770b507ccd ("net: bonding: Inherit MPLS features from slave devices")
> 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 | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 42c835c60cd8..320dd71392ef 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1563,8 +1563,9 @@ static void bond_compute_features(struct bonding *bond)
>  
>  	if (!bond_has_slaves(bond))
>  		goto done;
> -	vlan_features &= NETIF_F_ALL_FOR_ALL;
> -	mpls_features &= NETIF_F_ALL_FOR_ALL;
> +
> +	vlan_features = netdev_base_features(vlan_features);
> +	mpls_features = netdev_base_features(mpls_features);
>  
>  	bond_for_each_slave(bond, slave, iter) {
>  		vlan_features = netdev_increment_features(vlan_features,

Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Hangbin Liu Dec. 11, 2024, 9:09 a.m. UTC | #2
On Tue, Dec 10, 2024 at 03:12:42PM +0100, Daniel Borkmann wrote:
> If a bonding device has slave devices, then the current logic to derive
> the feature set for the master bond device is limited in that flags which
> are fully supported by the underlying slave devices cannot be propagated
> up to vlan devices which sit on top of bond devices. Instead, these get
> blindly masked out via current NETIF_F_ALL_FOR_ALL logic.
> 
> vlan_features and mpls_features should reuse netdev_base_features() in
> order derive the set in the same way as ndo_fix_features before iterating
> through the slave devices to refine the feature set.
> 
> Fixes: a9b3ace44c7d ("bonding: fix vlan_features computing")
> Fixes: 2e770b507ccd ("net: bonding: Inherit MPLS features from slave devices")
> 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 | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 42c835c60cd8..320dd71392ef 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1563,8 +1563,9 @@ static void bond_compute_features(struct bonding *bond)
>  
>  	if (!bond_has_slaves(bond))
>  		goto done;
> -	vlan_features &= NETIF_F_ALL_FOR_ALL;
> -	mpls_features &= NETIF_F_ALL_FOR_ALL;
> +
> +	vlan_features = netdev_base_features(vlan_features);
> +	mpls_features = netdev_base_features(mpls_features);
>  
>  	bond_for_each_slave(bond, slave, iter) {
>  		vlan_features = netdev_increment_features(vlan_features,
> -- 
> 2.43.0
> 

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 42c835c60cd8..320dd71392ef 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1563,8 +1563,9 @@  static void bond_compute_features(struct bonding *bond)
 
 	if (!bond_has_slaves(bond))
 		goto done;
-	vlan_features &= NETIF_F_ALL_FOR_ALL;
-	mpls_features &= NETIF_F_ALL_FOR_ALL;
+
+	vlan_features = netdev_base_features(vlan_features);
+	mpls_features = netdev_base_features(mpls_features);
 
 	bond_for_each_slave(bond, slave, iter) {
 		vlan_features = netdev_increment_features(vlan_features,