Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_NETDEV_RX_QUEUE_H
3#define _LINUX_NETDEV_RX_QUEUE_H
4
5#include <linux/kobject.h>
6#include <linux/netdevice.h>
7#include <linux/sysfs.h>
8#include <net/xdp.h>
9#include <net/page_pool/types.h>
10#include <net/netdev_queues.h>
11
12/* This structure contains an instance of an RX queue. */
13struct netdev_rx_queue {
14 struct xdp_rxq_info xdp_rxq;
15#ifdef CONFIG_RPS
16 struct rps_map __rcu *rps_map;
17 struct rps_dev_flow_table __rcu *rps_flow_table;
18#endif
19 struct kobject kobj;
20 const struct attribute_group **groups;
21 struct net_device *dev;
22 netdevice_tracker dev_tracker;
23
24 /* All fields below are "ops protected",
25 * see comment about net_device::lock
26 */
27#ifdef CONFIG_XDP_SOCKETS
28 struct xsk_buff_pool *pool;
29#endif
30 struct napi_struct *napi;
31 struct netdev_queue_config qcfg;
32 struct pp_memory_provider_params mp_params;
33} ____cacheline_aligned_in_smp;
34
35/*
36 * RX queue sysfs structures and functions.
37 */
38struct rx_queue_attribute {
39 struct attribute attr;
40 ssize_t (*show)(struct netdev_rx_queue *queue, char *buf);
41 ssize_t (*store)(struct netdev_rx_queue *queue,
42 const char *buf, size_t len);
43};
44
45static inline struct netdev_rx_queue *
46__netif_get_rx_queue(struct net_device *dev, unsigned int rxq)
47{
48 return dev->_rx + rxq;
49}
50
51static inline unsigned int
52get_netdev_rx_queue_index(struct netdev_rx_queue *queue)
53{
54 struct net_device *dev = queue->dev;
55 int index = queue - dev->_rx;
56
57 BUG_ON(index >= dev->num_rx_queues);
58 return index;
59}
60
61int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq);
62
63#endif