Re: [PATCH bpf-next v2 2/3] net: move struct netdev_rx_queue out of netdevice.h
From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: 2023-08-03 15:53:07
Also in:
bpf
From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: 2023-08-03 15:53:07
Also in:
bpf
From: Jakub Kicinski <kuba@kernel.org> Date: Wed, 2 Aug 2023 18:02:29 -0700
struct netdev_rx_queue is touched in only a few places and having it defined in netdevice.h brings in the dependency on xdp.h, because struct xdp_rxq_info gets embedded in struct netdev_rx_queue.
[...]
+static inline struct netdev_rx_queue *
+__netif_get_rx_queue(struct net_device *dev, unsigned int rxq)
+{
+ return dev->_rx + rxq;
+}
+
+#ifdef CONFIG_SYSFS
+static inline unsigned int
+get_netdev_rx_queue_index(struct netdev_rx_queue *queue)
+{
+ struct net_device *dev = queue->dev;
+ int index = queue - dev->_rx;
+
+ BUG_ON(index >= dev->num_rx_queues);
+ return index;
+}
+#endif
+#endifLooks a bit confusing :s Could you separate then by a NL and leave a comment near each one with the corresponding definition? Like return index; } #endif /* CONFIG_SYSFS */ #endif /* _LINUX_NETDEV_RX_QUEUE_H */ Maybe Alex could do that when applying, given that there are no more change requests.
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 7d47f53f20c1..0aac76c13fd4 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c@@ -20,6 +20,7 @@
[...] Thanks, Olek