]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Revert "ptr_ring: move free-space check into separate helper"
authorSimon Schippers <simon.schippers@tu-dortmund.de>
Tue, 28 Jul 2026 09:22:38 +0000 (11:22 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Jul 2026 00:12:27 +0000 (17:12 -0700)
This reverts commit fba362c17d9d9211fc51f272156bb84fc23bdf98.

__ptr_ring_check_produce() has no users left after reverting
commit 1d6e569b7d0c ("tun/tap & vhost-net: avoid ptr_ring tail-drop
when a qdisc is present").

Signed-off-by: Simon Schippers <simon.schippers@tu-dortmund.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://patch.msgid.link/20260728092240.250257-3-simon.schippers@tu-dortmund.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/ptr_ring.h

index c95e891903f0545fe83d46b2f0a7cefa5955111e..d2c3629bbe4517d222a0ac9958b203d530d35c73 100644 (file)
@@ -96,20 +96,6 @@ static inline bool ptr_ring_full_bh(struct ptr_ring *r)
        return ret;
 }
 
-/* Note: callers invoking this in a loop must use a compiler barrier,
- * for example cpu_relax(). Callers must hold producer_lock.
- */
-static inline int __ptr_ring_check_produce(struct ptr_ring *r)
-{
-       if (unlikely(!r->size))
-               return -EINVAL;
-
-       if (data_race(r->queue[r->producer]))
-               return -ENOSPC;
-
-       return 0;
-}
-
 /* Note: callers invoking this in a loop must use a compiler barrier,
  * for example cpu_relax(). Callers must hold producer_lock.
  * Callers are responsible for making sure pointer that is being queued
@@ -117,10 +103,8 @@ static inline int __ptr_ring_check_produce(struct ptr_ring *r)
  */
 static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr)
 {
-       int p = __ptr_ring_check_produce(r);
-
-       if (p)
-               return p;
+       if (unlikely(!r->size) || data_race(r->queue[r->producer]))
+               return -ENOSPC;
 
        /* Make sure the pointer we are storing points to a valid data. */
        /* Pairs with the dependency ordering in __ptr_ring_consume. */