struct xdp_umem_fq_reuse *xsk_reuseq_swap(struct xdp_umem *umem,
                                          struct xdp_umem_fq_reuse *newq);
 void xsk_reuseq_free(struct xdp_umem_fq_reuse *rq);
+struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev, u16 queue_id);
 
 static inline char *xdp_umem_get_data(struct xdp_umem *umem, u64 addr)
 {
 {
 }
 
+static inline struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev,
+                                                    u16 queue_id)
+{
+       return NULL;
+}
+
 static inline char *xdp_umem_get_data(struct xdp_umem *umem, u64 addr)
 {
        return NULL;
 
 #include <linux/rtnetlink.h>
 #include <linux/sched/signal.h>
 #include <linux/net.h>
+#include <net/xdp_sock.h>
 
 /*
  * Some useful ethtool_ops methods that're device independent.
                                                   void __user *useraddr)
 {
        struct ethtool_channels channels, curr = { .cmd = ETHTOOL_GCHANNELS };
+       u16 from_channel, to_channel;
        u32 max_rx_in_use = 0;
+       unsigned int i;
 
        if (!dev->ethtool_ops->set_channels || !dev->ethtool_ops->get_channels)
                return -EOPNOTSUPP;
            (channels.combined_count + channels.rx_count) <= max_rx_in_use)
            return -EINVAL;
 
+       /* Disabling channels, query zero-copy AF_XDP sockets */
+       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 (xdp_get_umem_from_qid(dev, i))
+                       return -EINVAL;
+
        return dev->ethtool_ops->set_channels(dev, &channels);
 }
 
 
                dev->_tx[queue_id].umem = umem;
 }
 
-static struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev,
-                                             u16 queue_id)
+struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev,
+                                      u16 queue_id)
 {
        if (queue_id < dev->real_num_rx_queues)
                return dev->_rx[queue_id].umem;