forked from mirrors/linux
		
	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 <tariqt@nvidia.com> Reviewed-by: Boris Pismenny <borisp@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									007feb87fb
								
							
						
					
					
						commit
						f45583de36
					
				
					 1 changed files with 10 additions and 9 deletions
				
			
		| 
						 | 
					@ -745,17 +745,17 @@ const struct bond_option *bond_opt_get(unsigned int option)
 | 
				
			||||||
	return &bond_opts[option];
 | 
						return &bond_opts[option];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void bond_set_xfrm_features(struct net_device *bond_dev, u64 mode)
 | 
					static bool bond_set_xfrm_features(struct bonding *bond)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!IS_ENABLED(CONFIG_XFRM_OFFLOAD))
 | 
						if (!IS_ENABLED(CONFIG_XFRM_OFFLOAD))
 | 
				
			||||||
		return;
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mode == BOND_MODE_ACTIVEBACKUP)
 | 
						if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
 | 
				
			||||||
		bond_dev->wanted_features |= BOND_XFRM_FEATURES;
 | 
							bond->dev->wanted_features |= BOND_XFRM_FEATURES;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		bond_dev->wanted_features &= ~BOND_XFRM_FEATURES;
 | 
							bond->dev->wanted_features &= ~BOND_XFRM_FEATURES;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	netdev_update_features(bond_dev);
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int bond_option_mode_set(struct bonding *bond,
 | 
					static int bond_option_mode_set(struct bonding *bond,
 | 
				
			||||||
| 
						 | 
					@ -780,13 +780,14 @@ static int bond_option_mode_set(struct bonding *bond,
 | 
				
			||||||
	if (newval->value == BOND_MODE_ALB)
 | 
						if (newval->value == BOND_MODE_ALB)
 | 
				
			||||||
		bond->params.tlb_dynamic_lb = 1;
 | 
							bond->params.tlb_dynamic_lb = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bond->dev->reg_state == NETREG_REGISTERED)
 | 
					 | 
				
			||||||
		bond_set_xfrm_features(bond->dev, newval->value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* don't cache arp_validate between modes */
 | 
						/* don't cache arp_validate between modes */
 | 
				
			||||||
	bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
 | 
						bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
 | 
				
			||||||
	bond->params.mode = newval->value;
 | 
						bond->params.mode = newval->value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (bond->dev->reg_state == NETREG_REGISTERED)
 | 
				
			||||||
 | 
							if (bond_set_xfrm_features(bond))
 | 
				
			||||||
 | 
								netdev_update_features(bond->dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue