queue_api: define queue api
authorMina Almasry <almasrymina@google.com>
Wed, 1 May 2024 23:25:40 +0000 (23:25 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 May 2024 13:35:33 +0000 (14:35 +0100)
This API enables the net stack to reset the queues used for devmem TCP.

Signed-off-by: Mina Almasry <almasrymina@google.com>
Signed-off-by: Shailend Chand <shailend@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
include/net/netdev_queues.h

index 2814a15eed73bfe27be6dc490b2e030158f86ead..cf261fb89d73b67f70317789b94a24d3a7e384e2 100644 (file)
@@ -1957,6 +1957,7 @@ enum netdev_reg_state {
  *     @sysfs_rx_queue_group:  Space for optional per-rx queue attributes
  *     @rtnl_link_ops: Rtnl_link_ops
  *     @stat_ops:      Optional ops for queue-aware statistics
+ *     @queue_mgmt_ops:        Optional ops for queue management
  *
  *     @gso_max_size:  Maximum size of generic segmentation offload
  *     @tso_max_size:  Device (as in HW) limit on the max TSO request size
@@ -2340,6 +2341,8 @@ struct net_device {
 
        const struct netdev_stat_ops *stat_ops;
 
+       const struct netdev_queue_mgmt_ops *queue_mgmt_ops;
+
        /* for setting kernel sock attribute on TCP connection setup */
 #define GSO_MAX_SEGS           65535u
 #define GSO_LEGACY_MAX_SIZE    65536u
index c7ac4539eafc55e062806e5d2d2512853b94ec80..e7b84f018ceecf6b620b4e9fb8b4b87ef88850bb 100644 (file)
@@ -87,6 +87,37 @@ struct netdev_stat_ops {
                               struct netdev_queue_stats_tx *tx);
 };
 
+/**
+ * struct netdev_queue_mgmt_ops - netdev ops for queue management
+ *
+ * @ndo_queue_mem_size: Size of the struct that describes a queue's memory.
+ *
+ * @ndo_queue_mem_alloc: Allocate memory for an RX queue at the specified index.
+ *                      The new memory is written at the specified address.
+ *
+ * @ndo_queue_mem_free:        Free memory from an RX queue.
+ *
+ * @ndo_queue_start:   Start an RX queue with the specified memory and at the
+ *                     specified index.
+ *
+ * @ndo_queue_stop:    Stop the RX queue at the specified index. The stopped
+ *                     queue's memory is written at the specified address.
+ */
+struct netdev_queue_mgmt_ops {
+       size_t                  ndo_queue_mem_size;
+       int                     (*ndo_queue_mem_alloc)(struct net_device *dev,
+                                                      void *per_queue_mem,
+                                                      int idx);
+       void                    (*ndo_queue_mem_free)(struct net_device *dev,
+                                                     void *per_queue_mem);
+       int                     (*ndo_queue_start)(struct net_device *dev,
+                                                  void *per_queue_mem,
+                                                  int idx);
+       int                     (*ndo_queue_stop)(struct net_device *dev,
+                                                 void *per_queue_mem,
+                                                 int idx);
+};
+
 /**
  * DOC: Lockless queue stopping / waking helpers.
  *