Skip to content

Commit f45583d

Browse files
Tariq Toukankuba-moo
authored andcommitted
net/bonding: Take update_features call out of XFRM funciton
In preparation for more cases that call netdev_update_features(). While here, move the features logic to the stage where struct bond is already updated, and pass it as the only parameter to function bond_set_xfrm_features(). Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Boris Pismenny <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 007feb8 commit f45583d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

drivers/net/bonding/bond_options.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -745,17 +745,17 @@ const struct bond_option *bond_opt_get(unsigned int option)
745745
return &bond_opts[option];
746746
}
747747

748-
static void bond_set_xfrm_features(struct net_device *bond_dev, u64 mode)
748+
static bool bond_set_xfrm_features(struct bonding *bond)
749749
{
750750
if (!IS_ENABLED(CONFIG_XFRM_OFFLOAD))
751-
return;
751+
return false;
752752

753-
if (mode == BOND_MODE_ACTIVEBACKUP)
754-
bond_dev->wanted_features |= BOND_XFRM_FEATURES;
753+
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
754+
bond->dev->wanted_features |= BOND_XFRM_FEATURES;
755755
else
756-
bond_dev->wanted_features &= ~BOND_XFRM_FEATURES;
756+
bond->dev->wanted_features &= ~BOND_XFRM_FEATURES;
757757

758-
netdev_update_features(bond_dev);
758+
return true;
759759
}
760760

761761
static int bond_option_mode_set(struct bonding *bond,
@@ -780,13 +780,14 @@ static int bond_option_mode_set(struct bonding *bond,
780780
if (newval->value == BOND_MODE_ALB)
781781
bond->params.tlb_dynamic_lb = 1;
782782

783-
if (bond->dev->reg_state == NETREG_REGISTERED)
784-
bond_set_xfrm_features(bond->dev, newval->value);
785-
786783
/* don't cache arp_validate between modes */
787784
bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
788785
bond->params.mode = newval->value;
789786

787+
if (bond->dev->reg_state == NETREG_REGISTERED)
788+
if (bond_set_xfrm_features(bond))
789+
netdev_update_features(bond->dev);
790+
790791
return 0;
791792
}
792793

0 commit comments

Comments
 (0)