// SPDX-License-Identifier: GPL-2.0-only
-#include <net/xdp_sock_drv.h>
+#include <net/netdev_queues.h>
#include "netlink.h"
#include "common.h"
if (ret)
return ret;
- /* Disabling channels, query zero-copy AF_XDP sockets */
+ /* ensure channels are not busy at the moment */
from_channel = channels.combined_count +
min(channels.rx_count, channels.tx_count);
- for (i = from_channel; i < old_total; i++)
- if (xsk_get_pool_from_qid(dev, i)) {
- GENL_SET_ERR_MSG(info, "requested channel counts are too low for existing zerocopy AF_XDP sockets");
+ for (i = from_channel; i < old_total; i++) {
+ if (netdev_queue_busy(dev, i, NULL)) {
+ GENL_SET_ERR_MSG(info,
+ "requested channel counts are too low due to busy queues (AF_XDP or queue leasing)");
return -EINVAL;
}
+ }
ret = dev->ethtool_ops->set_channels(dev, &channels);
return ret < 0 ? ret : 1;
#include <linux/net.h>
#include <linux/pm_runtime.h>
#include <linux/utsname.h>
+#include <linux/ethtool_netlink.h>
#include <net/devlink.h>
#include <net/ipv6.h>
-#include <net/xdp_sock_drv.h>
#include <net/flow_offload.h>
#include <net/netdev_lock.h>
-#include <linux/ethtool_netlink.h>
+#include <net/netdev_queues.h>
+
#include "common.h"
/* State held across locks and calls for commands which have devlink fallback */
if (ret)
return ret;
- /* Disabling channels, query zero-copy AF_XDP sockets */
+ /* Disabling channels, query busy queues (AF_XDP, queue leasing) */
from_channel = channels.combined_count +
min(channels.rx_count, channels.tx_count);
to_channel = curr.combined_count + max(curr.rx_count, curr.tx_count);
for (i = from_channel; i < to_channel; i++)
- if (xsk_get_pool_from_qid(dev, i))
+ if (netdev_queue_busy(dev, i, NULL))
return -EINVAL;
ret = dev->ethtool_ops->set_channels(dev, &channels);