1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_NETDEV_RX_QUEUE_H
3 #define _LINUX_NETDEV_RX_QUEUE_H
5 #include <linux/kobject.h>
6 #include <linux/netdevice.h>
7 #include <linux/sysfs.h>
10 /* This structure contains an instance of an RX queue. */
11 struct netdev_rx_queue {
12 struct xdp_rxq_info xdp_rxq;
14 struct rps_map __rcu *rps_map;
15 struct rps_dev_flow_table __rcu *rps_flow_table;
18 struct net_device *dev;
19 netdevice_tracker dev_tracker;
21 #ifdef CONFIG_XDP_SOCKETS
22 struct xsk_buff_pool *pool;
24 } ____cacheline_aligned_in_smp;
27 * RX queue sysfs structures and functions.
29 struct rx_queue_attribute {
30 struct attribute attr;
31 ssize_t (*show)(struct netdev_rx_queue *queue, char *buf);
32 ssize_t (*store)(struct netdev_rx_queue *queue,
33 const char *buf, size_t len);
36 static inline struct netdev_rx_queue *
37 __netif_get_rx_queue(struct net_device *dev, unsigned int rxq)
39 return dev->_rx + rxq;
43 static inline unsigned int
44 get_netdev_rx_queue_index(struct netdev_rx_queue *queue)
46 struct net_device *dev = queue->dev;
47 int index = queue - dev->_rx;
49 BUG_ON(index >= dev->num_rx_queues);