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").
Unified · Split
| @@ -96,20 +96,6 @@ static inline bool ptr_ring_full_bh(struct ptr_ring *r) · 95 unmodified lines | ||
| 96 | 96 | return ret; |
| 97 | 97 | } |
| 98 | 98 | |
| 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 | − | |
| 113 | 99 | /* Note: callers invoking this in a loop must use a compiler barrier, |
| 114 | 100 | * for example cpu_relax(). Callers must hold producer_lock. |
| 115 | 101 | * 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 | ||
| 117 | 103 | */ |
| 118 | 104 | static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr) |
| 119 | 105 | { |
| 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; | |
| 124 | 108 | |
| 125 | 109 | /* Make sure the pointer we are storing points to a valid data. */ |
| 126 | 110 | /* Pairs with the dependency ordering in __ptr_ring_consume. */ |