| 1 |
|
| 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 | #include <net/rps-types.h>
|
| 12 |
|
| 13 |
|
| 14 | struct netdev_rx_queue {
|
| 15 | struct xdp_rxq_info xdp_rxq;
|
| 16 | #ifdef CONFIG_RPS
|
| 17 | struct rps_map __rcu *rps_map;
|
| 18 | rps_tag_ptr rps_flow_table;
|
| 19 | #endif
|
| 20 | struct kobject kobj;
|
| 21 | const struct attribute_group **groups;
|
| 22 | struct net_device *dev;
|
| 23 | netdevice_tracker dev_tracker;
|
| 24 |
|
| 25 | |
| 26 | * see comment about net_device::lock
|
| 27 |
|
| 28 | #ifdef CONFIG_XDP_SOCKETS
|
| 29 | struct xsk_buff_pool *pool;
|
| 30 | #endif
|
| 31 | struct napi_struct *napi;
|
| 32 | struct netdev_queue_config qcfg;
|
| 33 | struct pp_memory_provider_params mp_params;
|
| 34 |
|
| 35 | |
| 36 | * valid. From the physical device it points to the virtual
|
| 37 | * queue, and from the virtual device it points to the
|
| 38 | * physical queue.
|
| 39 |
|
| 40 | struct netdev_rx_queue *lease;
|
| 41 | netdevice_tracker lease_tracker;
|
| 42 | } ____cacheline_aligned_in_smp;
|
| 43 |
|
| 44 | |
| 45 | * RX queue sysfs structures and functions.
|
| 46 |
|
| 47 | struct rx_queue_attribute {
|
| 48 | struct attribute attr;
|
| 49 | ssize_t (*show)(struct netdev_rx_queue *queue, char *buf);
|
| 50 | ssize_t (*store)(struct netdev_rx_queue *queue,
|
| 51 | const char *buf, size_t len);
|
| 52 | };
|
| 53 |
|
| 54 | static inline struct netdev_rx_queue *
|
| 55 | __netif_get_rx_queue(struct net_device *dev, unsigned int rxq)
|
| 56 | {
|
| 57 | return dev->_rx + rxq;
|
| 58 | }
|
| 59 |
|
| 60 | static inline unsigned int
|
| 61 | get_netdev_rx_queue_index(struct netdev_rx_queue *queue)
|
| 62 | {
|
| 63 | struct net_device *dev = queue->dev;
|
| 64 | int index = queue - dev->_rx;
|
| 65 |
|
| 66 | BUG_ON(index >= dev->num_rx_queues);
|
| 67 | return index;
|
| 68 | }
|
| 69 |
|
| 70 | enum netif_lease_dir {
|
| 71 | NETIF_VIRT_TO_PHYS,
|
| 72 | NETIF_PHYS_TO_VIRT,
|
| 73 | };
|
| 74 |
|
| 75 | struct netdev_rx_queue *
|
| 76 | __netif_get_rx_queue_lease(struct net_device **dev, unsigned int *rxq,
|
| 77 | enum netif_lease_dir dir);
|
| 78 |
|
| 79 | int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq);
|
| 80 | void netdev_rx_queue_lease(struct netdev_rx_queue *rxq_dst,
|
| 81 | struct netdev_rx_queue *rxq_src);
|
| 82 | void netdev_rx_queue_unlease(struct netdev_rx_queue *rxq_dst,
|
| 83 | struct netdev_rx_queue *rxq_src);
|
| 84 | #endif
|