@@ -380,15 +380,15 @@ static void xenvif_fix_features(struct net_device *dev,
struct xenvif *vif = netdev_priv(dev);
if (!vif->can_sg)
- *features &= ~NETIF_F_SG;
+ netdev_feature_clear_bit(NETIF_F_SG_BIT, features);
if (~(vif->gso_mask) & GSO_BIT(TCPV4))
- *features &= ~NETIF_F_TSO;
+ netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
if (~(vif->gso_mask) & GSO_BIT(TCPV6))
- *features &= ~NETIF_F_TSO6;
+ netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features);
if (!vif->ip_csum)
- *features &= ~NETIF_F_IP_CSUM;
+ netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, features);
if (!vif->ipv6_csum)
- *features &= ~NETIF_F_IPV6_CSUM;
+ netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features);
}
static const struct xenvif_stat {
@@ -532,10 +532,13 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
INIT_LIST_HEAD(&vif->fe_mcast_addr);
dev->netdev_ops = &xenvif_netdev_ops;
- dev->hw_features = NETIF_F_SG |
- NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
- NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST;
- dev->features = dev->hw_features | NETIF_F_RXCSUM;
+ netdev_feature_zero(&dev->hw_features);
+ netdev_feature_set_bits(NETIF_F_SG |
+ NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+ NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST,
+ &dev->hw_features);
+ netdev_feature_copy(&dev->features, dev->hw_features);
+ netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features);
dev->ethtool_ops = &xenvif_ethtool_ops;
dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/xen-netback/interface.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)