Skip to content

Commit 3c249fe

Browse files
LorenzoBianconikuba-moo
authored andcommitted
net: thunderx: take into account xdp_features setting tx/rx queues
thunderx nic allows xdp just if enough hw queues are available for XDP. Take into account queues configuration setting xdp_features. Fixes: 66c0e13 ("drivers: net: turn on XDP features") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f85949f commit 3c249fe

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,17 @@ static int nicvf_set_channels(struct net_device *dev,
735735
if (channel->tx_count > nic->max_queues)
736736
return -EINVAL;
737737

738-
if (nic->xdp_prog &&
739-
((channel->tx_count + channel->rx_count) > nic->max_queues)) {
740-
netdev_err(nic->netdev,
741-
"XDP mode, RXQs + TXQs > Max %d\n",
742-
nic->max_queues);
743-
return -EINVAL;
738+
if (channel->tx_count + channel->rx_count > nic->max_queues) {
739+
if (nic->xdp_prog) {
740+
netdev_err(nic->netdev,
741+
"XDP mode, RXQs + TXQs > Max %d\n",
742+
nic->max_queues);
743+
return -EINVAL;
744+
}
745+
746+
xdp_clear_features_flag(nic->netdev);
747+
} else if (!pass1_silicon(nic->pdev)) {
748+
xdp_set_features_flag(dev, NETDEV_XDP_ACT_BASIC);
744749
}
745750

746751
if (if_up)

drivers/net/ethernet/cavium/thunder/nicvf_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,9 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
22182218
netdev->netdev_ops = &nicvf_netdev_ops;
22192219
netdev->watchdog_timeo = NICVF_TX_TIMEOUT;
22202220

2221-
netdev->xdp_features = NETDEV_XDP_ACT_BASIC;
2221+
if (!pass1_silicon(nic->pdev) &&
2222+
nic->rx_queues + nic->tx_queues <= nic->max_queues)
2223+
netdev->xdp_features = NETDEV_XDP_ACT_BASIC;
22222224

22232225
/* MTU range: 64 - 9200 */
22242226
netdev->min_mtu = NIC_HW_MIN_FRS;

0 commit comments

Comments
 (0)