]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
queue_api: add subqueue variant netif_subqueue_sent
authorGur Stavi <gur.stavi@huawei.com>
Mon, 9 Jun 2025 15:07:52 +0000 (18:07 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 10 Jun 2025 22:27:18 +0000 (15:27 -0700)
Add a new function, netif_subqueue_sent, which is a wrapper for
netdev_tx_sent_queue.

Drivers that use the subqueue variant macros, netif_subqueue_xxx,
identify queue by index and are not required to obtain
struct netdev_queue explicitly.

Such drivers still need to call netdev_tx_sent_queue which is a
counterpart of netif_subqueue_completed_wake. Allowing drivers to use a
subqueue variant for this purpose improves their code consistency by
always referring to queue by its index.

Signed-off-by: Gur Stavi <gur.stavi@huawei.com>
Link: https://patch.msgid.link/909a5c92db49cad39f0954d6cb86775e6480ef4c.1749038081.git.gur.stavi@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/netdev_queues.h

index ba2eaf39089b38c4e238740b4308739dce50ff4a..6e835972abd1386f43df502b657b5f169e17767c 100644 (file)
@@ -294,6 +294,15 @@ netdev_txq_completed_mb(struct netdev_queue *dev_queue,
                netif_txq_try_stop(_txq, get_desc, start_thrs);         \
        })
 
+static inline void netif_subqueue_sent(const struct net_device *dev,
+                                      unsigned int idx, unsigned int bytes)
+{
+       struct netdev_queue *txq;
+
+       txq = netdev_get_tx_queue(dev, idx);
+       netdev_tx_sent_queue(txq, bytes);
+}
+
 #define netif_subqueue_maybe_stop(dev, idx, get_desc, stop_thrs, start_thrs) \
        ({                                                              \
                struct netdev_queue *_txq;                              \