@@ -1534,7 +1534,8 @@ static void ena_rx_checksum(struct ena_ring *rx_ring,
struct sk_buff *skb)
{
/* Rx csum disabled */
- if (unlikely(!(rx_ring->netdev->features & NETIF_F_RXCSUM))) {
+ if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
+ rx_ring->netdev->features))) {
skb->ip_summed = CHECKSUM_NONE;
return;
}
@@ -1592,7 +1593,8 @@ static void ena_set_rx_hash(struct ena_ring *rx_ring,
{
enum pkt_hash_types hash_type;
- if (likely(rx_ring->netdev->features & NETIF_F_RXHASH)) {
+ if (likely(netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
+ rx_ring->netdev->features))) {
if (likely((ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) ||
(ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)))
@@ -4024,42 +4026,46 @@ static u32 ena_calc_max_io_queue_num(struct pci_dev *pdev,
static void ena_set_dev_offloads(struct ena_com_dev_get_features_ctx *feat,
struct net_device *netdev)
{
- netdev_features_t dev_features = 0;
+ netdev_features_t dev_features;
+
+ netdev_feature_zero(&dev_features);
/* Set offload features */
if (feat->offload.tx &
ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK)
- dev_features |= NETIF_F_IP_CSUM;
+ netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &dev_features);
if (feat->offload.tx &
ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK)
- dev_features |= NETIF_F_IPV6_CSUM;
+ netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK)
- dev_features |= NETIF_F_TSO;
+ netdev_feature_set_bit(NETIF_F_TSO_BIT, &dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK)
- dev_features |= NETIF_F_TSO6;
+ netdev_feature_set_bit(NETIF_F_TSO6_BIT, &dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK)
- dev_features |= NETIF_F_TSO_ECN;
+ netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &dev_features);
if (feat->offload.rx_supported &
ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK)
- dev_features |= NETIF_F_RXCSUM;
+ netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev_features);
if (feat->offload.rx_supported &
ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK)
- dev_features |= NETIF_F_RXCSUM;
-
- netdev->features =
- dev_features |
- NETIF_F_SG |
- NETIF_F_RXHASH |
- NETIF_F_HIGHDMA;
-
- netdev->hw_features |= netdev->features;
- netdev->vlan_features |= netdev->features;
+ netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev_features);
+
+ netdev_feature_copy(&netdev->features, dev_features);
+ netdev_feature_set_bits(NETIF_F_SG |
+ NETIF_F_RXHASH |
+ NETIF_F_HIGHDMA,
+ &netdev->features);
+
+ netdev_feature_or(&netdev->hw_features, netdev->hw_features,
+ netdev->features);
+ netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
+ netdev->features);
}
static void ena_set_conf_feat_params(struct ena_adapter *adapter,
Use netdev_feature_xxx helpers to replace the logical operation for netdev features. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 44 +++++++++++--------- 1 file changed, 25 insertions(+), 19 deletions(-)