Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/dsa/xrs700x/xrs700x.c | 6 ++++-- net/dsa/slave.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c index 130abb0..898426c 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -639,7 +639,8 @@ static int xrs700x_hsr_join(struct dsa_switch *ds, int port, hsr_pair[1] = partner->index; for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; - slave->features |= XRS7000X_SUPPORTED_HSR_FEATURES; + netdev_feature_set_bits(XRS7000X_SUPPORTED_HSR_FEATURES, + &slave->features); }
return 0; @@ -693,7 +694,8 @@ static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, hsr_pair[1] = partner->index; for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; - slave->features &= ~XRS7000X_SUPPORTED_HSR_FEATURES; + netdev_feature_clear_bits(XRS7000X_SUPPORTED_HSR_FEATURES, + &slave->features); }
return 0; diff --git a/net/dsa/slave.c b/net/dsa/slave.c index acf73db..8ddfed4 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1815,13 +1815,16 @@ void dsa_slave_setup_tagger(struct net_device *slave)
p->xmit = cpu_dp->tag_ops->xmit;
- slave->features = master->vlan_features | NETIF_F_HW_TC; + netdev_feature_copy(&slave->features, master->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->features); if (ds->ops->port_vlan_add && ds->ops->port_vlan_del) - slave->features |= NETIF_F_HW_VLAN_CTAG_FILTER; - slave->hw_features |= NETIF_F_HW_TC; - slave->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &slave->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &slave->features); if (slave->needed_tailroom) - slave->features &= ~(NETIF_F_SG | NETIF_F_FRAGLIST); + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_FRAGLIST, + &slave->features); }
static struct lock_class_key dsa_slave_netdev_xmit_lock_key; @@ -1900,7 +1903,7 @@ int dsa_slave_create(struct dsa_port *port)
SET_NETDEV_DEV(slave_dev, port->ds->dev); slave_dev->dev.of_node = port->dn; - slave_dev->vlan_features = master->vlan_features; + netdev_feature_copy(&slave_dev->features, master->vlan_features);
p = netdev_priv(slave_dev); slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);