History

Revert "ptr_ring: move free-space check into separate helper"

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").

Simon Schippers committed 3 months ago

Commit 6bc85571 parent f11b48a1 file · +2 −18Browse files

Unified · Split

include/linux/ptr_ring.h+2−18
@@ -96,20 +96,6 @@ static inline bool ptr_ring_full_bh(struct ptr_ring *r) · 95 unmodified lines
9696 return ret;
9797 }
9898
99−/* Note: callers invoking this in a loop must use a compiler barrier,
100− * for example cpu_relax(). Callers must hold producer_lock.
101− */
102−static inline int __ptr_ring_check_produce(struct ptr_ring *r)
103−{
104− if (unlikely(!r->size))
105− return -EINVAL;
106−
107− if (data_race(r->queue[r->producer]))
108− return -ENOSPC;
109−
110− return 0;
111−}
112−
11399 /* Note: callers invoking this in a loop must use a compiler barrier,
114100 * for example cpu_relax(). Callers must hold producer_lock.
115101 * 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) · 1 unmodified line
117103 */
118104 static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr)
119105 {
120− int p = __ptr_ring_check_produce(r);
121−
122− if (p)
123− return p;
106+ if (unlikely(!r->size) || data_race(r->queue[r->producer]))
107+ return -ENOSPC;
124108
125109 /* Make sure the pointer we are storing points to a valid data. */
126110 /* Pairs with the dependency ordering in __ptr_ring_consume. */