Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit

Permalink
linux/ena: Remove code duplication of XDP supported feature flags
Browse files Browse the repository at this point in the history
XDP supported feature flags are duplicated twice in the code.
Create a single define for all flags and use it in all places.

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
  • Loading branch information
evgeny17387new committed Feb 21, 2024
1 parent 798aae7 commit 2167f9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions kernel/linux/ena/ena_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,9 +1282,7 @@ static int ena_set_channels(struct net_device *netdev,

xdp_clear_features_flag(netdev);
} else {
xdp_set_features_flag(netdev,
NETDEV_XDP_ACT_BASIC |
NETDEV_XDP_ACT_REDIRECT);
xdp_set_features_flag(netdev, ENA_XDP_FEATURES);
}

if (count > adapter->max_num_io_queues)
Expand Down
4 changes: 1 addition & 3 deletions kernel/linux/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4763,9 +4763,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

#ifdef ENA_XDP_NETLINK_ADVERTISEMENT
if (ena_xdp_legal_queue_count(adapter, adapter->num_io_queues))
netdev->xdp_features = NETDEV_XDP_ACT_BASIC |
NETDEV_XDP_ACT_REDIRECT;

netdev->xdp_features = ENA_XDP_FEATURES;
#endif
memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len);

Expand Down
3 changes: 3 additions & 0 deletions kernel/linux/ena/ena_xdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ enum ENA_XDP_ACTIONS {
ENA_XDP_DROP = BIT(2)
};

#define ENA_XDP_FEATURES (NETDEV_XDP_ACT_BASIC | \
NETDEV_XDP_ACT_REDIRECT)

#define ENA_XDP_FORWARDED (ENA_XDP_TX | ENA_XDP_REDIRECT)

int ena_setup_and_create_all_xdp_queues(struct ena_adapter *adapter);
Expand Down

0 comments on commit 2167f9c

Please sign in to comment.