@@ -748,7 +748,8 @@ static void am65_cpsw_nuss_rx_csum(struct sk_buff *skb, u32 csum_info)
*/
skb_checksum_none_assert(skb);
- if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM)))
+ if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
+ skb->dev->features)))
return;
if ((csum_info & (AM65_CPSW_RX_PSD_IPV6_VALID |
@@ -1974,19 +1975,23 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
port->ndev->min_mtu = AM65_CPSW_MIN_PACKET_SIZE;
port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE;
- port->ndev->hw_features = NETIF_F_SG |
- NETIF_F_RXCSUM |
- NETIF_F_HW_CSUM |
- NETIF_F_HW_TC;
- port->ndev->features = port->ndev->hw_features |
- NETIF_F_HW_VLAN_CTAG_FILTER;
- port->ndev->vlan_features |= NETIF_F_SG;
+ netdev_feature_zero(&port->ndev->hw_features);
+ netdev_feature_set_bits(NETIF_F_SG |
+ NETIF_F_RXCSUM |
+ NETIF_F_HW_CSUM |
+ NETIF_F_HW_TC,
+ &port->ndev->hw_features);
+ netdev_feature_copy(&port->ndev->features, port->ndev->hw_features);
+ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
+ &port->ndev->features);
+ netdev_feature_set_bit(NETIF_F_SG_BIT, &port->ndev->vlan_features);
port->ndev->netdev_ops = &am65_cpsw_nuss_netdev_ops;
port->ndev->ethtool_ops = &am65_cpsw_ethtool_ops_slave;
/* Disable TX checksum offload by default due to HW bug */
if (common->pdata.quirks & AM65_CPSW_QUIRK_I2027_NO_TX_CSUM)
- port->ndev->features &= ~NETIF_F_HW_CSUM;
+ netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT,
+ &port->ndev->features);
ndev_priv->stats = netdev_alloc_pcpu_stats(struct am65_cpsw_ndev_stats);
if (!ndev_priv->stats)
@@ -1464,7 +1464,8 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv)
priv_sl2->emac_port = 1;
cpsw->slaves[1].ndev = ndev;
- ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
+ NETIF_F_HW_VLAN_CTAG_RX, &ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops;
ndev->ethtool_ops = &cpsw_ethtool_ops;
@@ -1643,7 +1644,8 @@ static int cpsw_probe(struct platform_device *pdev)
cpsw->slaves[0].ndev = ndev;
- ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
+ NETIF_F_HW_VLAN_CTAG_RX, &ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops;
ndev->ethtool_ops = &cpsw_ethtool_ops;
@@ -1406,9 +1406,10 @@ static int cpsw_create_ports(struct cpsw_common *cpsw)
cpsw->slaves[i].ndev = ndev;
- ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
- NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_NETNS_LOCAL;
-
+ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
+ NETIF_F_HW_VLAN_CTAG_RX |
+ NETIF_F_NETNS_LOCAL,
+ &ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops;
ndev->ethtool_ops = &cpsw_ethtool_ops;
SET_NETDEV_DEV(ndev, dev);
@@ -1976,10 +1976,11 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
return -ENOMEM;
}
- ndev->features |= NETIF_F_SG;
- ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
- ndev->hw_features = ndev->features;
- ndev->vlan_features |= NETIF_F_SG;
+ netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features);
+ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
+ &ndev->features);
+ netdev_feature_copy(&ndev->hw_features, ndev->features);
+ netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->vlan_features);
/* MTU range: 68 - 9486 */
ndev->min_mtu = ETH_MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 23 ++++++++++++++--------- drivers/net/ethernet/ti/cpsw.c | 6 ++++-- drivers/net/ethernet/ti/cpsw_new.c | 7 ++++--- drivers/net/ethernet/ti/netcp_core.c | 9 +++++---- 4 files changed, 27 insertions(+), 18 deletions(-)