@@ -1382,9 +1382,8 @@ static void bond_fix_features(struct net_device *dev,
*features |= NETIF_F_ALL_FOR_ALL;
bond_for_each_slave(bond, slave, iter) {
- *features = netdev_increment_features(*features,
- slave->dev->features,
- mask);
+ netdev_increment_features(features, *features,
+ slave->dev->features, mask);
}
netdev_add_tso_features(features, mask);
}
@@ -1423,22 +1422,23 @@ static void bond_compute_features(struct bonding *bond)
mpls_features &= NETIF_F_ALL_FOR_ALL;
bond_for_each_slave(bond, slave, iter) {
- vlan_features = netdev_increment_features(vlan_features,
- slave->dev->vlan_features, BOND_VLAN_FEATURES);
+ netdev_increment_features(&vlan_features, vlan_features,
+ slave->dev->vlan_features,
+ BOND_VLAN_FEATURES);
- enc_features = netdev_increment_features(enc_features,
- slave->dev->hw_enc_features,
- BOND_ENC_FEATURES);
+ netdev_increment_features(&enc_features, enc_features,
+ slave->dev->hw_enc_features,
+ BOND_ENC_FEATURES);
#ifdef CONFIG_XFRM_OFFLOAD
- xfrm_features = netdev_increment_features(xfrm_features,
- slave->dev->hw_enc_features,
- BOND_XFRM_FEATURES);
+ netdev_increment_features(&xfrm_features, xfrm_features,
+ slave->dev->hw_enc_features,
+ BOND_XFRM_FEATURES);
#endif /* CONFIG_XFRM_OFFLOAD */
- mpls_features = netdev_increment_features(mpls_features,
- slave->dev->mpls_features,
- BOND_MPLS_FEATURES);
+ netdev_increment_features(&mpls_features, mpls_features,
+ slave->dev->mpls_features,
+ BOND_MPLS_FEATURES);
dst_release_flag &= slave->dev->priv_flags;
if (slave->dev->hard_header_len > max_hard_header_len)
@@ -242,8 +242,8 @@ static void ipvlan_fix_features(struct net_device *dev,
*features |= NETIF_F_ALL_FOR_ALL;
*features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES);
- *features = netdev_increment_features(ipvlan->phy_dev->features,
- *features, *features);
+ netdev_increment_features(features, ipvlan->phy_dev->features,
+ *features, *features);
*features |= IPVLAN_ALWAYS_ON;
*features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON);
}
@@ -1079,7 +1079,7 @@ static void macvlan_fix_features(struct net_device *dev,
mask = *features;
lowerdev_features &= (*features | ~NETIF_F_LRO);
- *features = netdev_increment_features(lowerdev_features, *features, mask);
+ netdev_increment_features(features, lowerdev_features, *features, mask);
*features |= ALWAYS_ON_FEATURES;
*features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES);
}
@@ -390,14 +390,12 @@ static void net_failover_compute_features(struct net_device *dev)
primary_dev = rcu_dereference(nfo_info->primary_dev);
if (primary_dev) {
- vlan_features =
- netdev_increment_features(vlan_features,
- primary_dev->vlan_features,
- FAILOVER_VLAN_FEATURES);
- enc_features =
- netdev_increment_features(enc_features,
- primary_dev->hw_enc_features,
- FAILOVER_ENC_FEATURES);
+ netdev_increment_features(&vlan_features, vlan_features,
+ primary_dev->vlan_features,
+ FAILOVER_VLAN_FEATURES);
+ netdev_increment_features(&enc_features, enc_features,
+ primary_dev->hw_enc_features,
+ FAILOVER_ENC_FEATURES);
dst_release_flag &= primary_dev->priv_flags;
if (primary_dev->hard_header_len > max_hard_header_len)
@@ -406,14 +404,12 @@ static void net_failover_compute_features(struct net_device *dev)
standby_dev = rcu_dereference(nfo_info->standby_dev);
if (standby_dev) {
- vlan_features =
- netdev_increment_features(vlan_features,
- standby_dev->vlan_features,
- FAILOVER_VLAN_FEATURES);
- enc_features =
- netdev_increment_features(enc_features,
- standby_dev->hw_enc_features,
- FAILOVER_ENC_FEATURES);
+ netdev_increment_features(&vlan_features, vlan_features,
+ standby_dev->vlan_features,
+ FAILOVER_VLAN_FEATURES);
+ netdev_increment_features(&enc_features, enc_features,
+ standby_dev->hw_enc_features,
+ FAILOVER_ENC_FEATURES);
dst_release_flag &= standby_dev->priv_flags;
if (standby_dev->hard_header_len > max_hard_header_len)
@@ -994,14 +994,12 @@ static void __team_compute_features(struct team *team)
rcu_read_lock();
list_for_each_entry_rcu(port, &team->port_list, list) {
- vlan_features = netdev_increment_features(vlan_features,
- port->dev->vlan_features,
- TEAM_VLAN_FEATURES);
- enc_features =
- netdev_increment_features(enc_features,
- port->dev->hw_enc_features,
- TEAM_ENC_FEATURES);
-
+ netdev_increment_features(&vlan_features, vlan_features,
+ port->dev->vlan_features,
+ TEAM_VLAN_FEATURES);
+ netdev_increment_features(&enc_features, enc_features,
+ port->dev->hw_enc_features,
+ TEAM_ENC_FEATURES);
dst_release_flag &= port->dev->priv_flags;
if (port->dev->hard_header_len > max_hard_header_len)
@@ -2008,9 +2006,8 @@ static void team_fix_features(struct net_device *dev,
rcu_read_lock();
list_for_each_entry_rcu(port, &team->port_list, list) {
- *features = netdev_increment_features(*features,
- port->dev->features,
- mask);
+ netdev_increment_features(features, *features,
+ port->dev->features, mask);
}
rcu_read_unlock();
@@ -5036,8 +5036,8 @@ static inline void netdev_get_wanted_features(struct net_device *dev,
{
*wanted = (dev->features & ~dev->hw_features) | dev->wanted_features;
}
-netdev_features_t netdev_increment_features(netdev_features_t all,
- netdev_features_t one, netdev_features_t mask);
+void netdev_increment_features(netdev_features_t *ret, netdev_features_t all,
+ netdev_features_t one, netdev_features_t mask);
/* Allow TSO being used on stacked device :
* Performing the GSO segmentation before last device
@@ -5046,7 +5046,7 @@ netdev_features_t netdev_increment_features(netdev_features_t all,
static inline void netdev_add_tso_features(netdev_features_t *features,
netdev_features_t mask)
{
- *features = netdev_increment_features(*features, NETIF_F_ALL_TSO, mask);
+ netdev_increment_features(features, *features, NETIF_F_ALL_TSO, mask);
}
int __netdev_update_features(struct net_device *dev);
@@ -544,8 +544,8 @@ void br_features_recompute(struct net_bridge *br, netdev_features_t *features)
*features &= ~NETIF_F_ONE_FOR_ALL;
list_for_each_entry(p, &br->port_list, list) {
- *features = netdev_increment_features(*features,
- p->dev->features, mask);
+ netdev_increment_features(features, *features, p->dev->features,
+ mask);
}
netdev_add_tso_features(features, mask);
}
@@ -11311,6 +11311,7 @@ static int dev_cpu_dead(unsigned int oldcpu)
/**
* netdev_increment_features - increment feature set by one
+ * @ret: result feature set
* @all: current feature set
* @one: new feature set
* @mask: mask feature set
@@ -11319,8 +11320,8 @@ static int dev_cpu_dead(unsigned int oldcpu)
* @one to the master device with current feature set @all. Will not
* enable anything that is off in @mask. Returns the new feature set.
*/
-netdev_features_t netdev_increment_features(netdev_features_t all,
- netdev_features_t one, netdev_features_t mask)
+void netdev_increment_features(netdev_features_t *ret, netdev_features_t all,
+ netdev_features_t one, netdev_features_t mask)
{
if (mask & NETIF_F_HW_CSUM)
mask |= NETIF_F_CSUM_MASK;
@@ -11333,7 +11334,7 @@ netdev_features_t netdev_increment_features(netdev_features_t all,
if (all & NETIF_F_HW_CSUM)
all &= ~(NETIF_F_CSUM_MASK & ~NETIF_F_HW_CSUM);
- return all;
+ *ret = all;
}
EXPORT_SYMBOL(netdev_increment_features);
@@ -194,9 +194,8 @@ static netdev_features_t hsr_features_recompute(struct hsr_priv *hsr,
*/
features &= ~NETIF_F_ONE_FOR_ALL;
hsr_for_each_port(hsr, port)
- features = netdev_increment_features(features,
- port->dev->features,
- mask);
+ netdev_increment_features(&features, features,
+ port->dev->features, mask);
return features;
}
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_increment_features for adaption. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/bonding/bond_main.c | 28 ++++++++++++++-------------- drivers/net/ipvlan/ipvlan_main.c | 4 ++-- drivers/net/macvlan.c | 2 +- drivers/net/net_failover.c | 28 ++++++++++++---------------- drivers/net/team/team.c | 19 ++++++++----------- include/linux/netdevice.h | 6 +++--- net/bridge/br_if.c | 4 ++-- net/core/dev.c | 7 ++++--- net/hsr/hsr_device.c | 5 ++--- 9 files changed, 48 insertions(+), 55 deletions(-)