Commit 3c249fe4 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jakub Kicinski

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: 66c0e13a ("drivers: net: turn on XDP features")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f85949f9
......@@ -735,14 +735,19 @@ static int nicvf_set_channels(struct net_device *dev,
if (channel->tx_count > nic->max_queues)
return -EINVAL;
if (nic->xdp_prog &&
((channel->tx_count + channel->rx_count) > nic->max_queues)) {
if (channel->tx_count + channel->rx_count > nic->max_queues) {
if (nic->xdp_prog) {
netdev_err(nic->netdev,
"XDP mode, RXQs + TXQs > Max %d\n",
nic->max_queues);
return -EINVAL;
}
xdp_clear_features_flag(nic->netdev);
} else if (!pass1_silicon(nic->pdev)) {
xdp_set_features_flag(dev, NETDEV_XDP_ACT_BASIC);
}
if (if_up)
nicvf_stop(dev);
......
......@@ -2218,6 +2218,8 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->netdev_ops = &nicvf_netdev_ops;
netdev->watchdog_timeo = NICVF_TX_TIMEOUT;
if (!pass1_silicon(nic->pdev) &&
nic->rx_queues + nic->tx_queues <= nic->max_queues)
netdev->xdp_features = NETDEV_XDP_ACT_BASIC;
/* MTU range: 64 - 9200 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment