Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1412398
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH RFC v7 5/5] skb_array: resize support |
| Date | 2016-06-02 18:10 +0200 |
| Message-ID | <rFDm2-82K-37@gated-at.bofh.it> (permalink) |
| References | <rFDm1-82K-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Update skb_array after ptr_ring API changes.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/linux/skb_array.h | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h
index ed6a2b5..c9bad35 100644
--- a/include/linux/skb_array.h
+++ b/include/linux/skb_array.h
@@ -62,9 +62,9 @@ static inline int skb_array_produce_any(struct skb_array *a, struct sk_buff *skb
return ptr_ring_produce_any(&a->ring, skb);
}
-/* Might be slightly faster than skb_array_empty below, but callers invoking
- * this in a loop must take care to use a compiler barrier, for example
- * cpu_relax().
+/* Might be slightly faster than skb_array_empty below, but only safe if the
+ * array is never resized. Also, callers invoking this in a loop must take care
+ * to use a compiler barrier, for example cpu_relax().
*/
static inline bool __skb_array_empty(struct skb_array *a)
{
@@ -76,6 +76,21 @@ static inline bool skb_array_empty(struct skb_array *a)
return ptr_ring_empty(&a->ring);
}
+static inline bool skb_array_empty_bh(struct skb_array *a)
+{
+ return ptr_ring_empty_bh(&a->ring);
+}
+
+static inline bool skb_array_empty_irq(struct skb_array *a)
+{
+ return ptr_ring_empty_irq(&a->ring);
+}
+
+static inline bool skb_array_empty_any(struct skb_array *a)
+{
+ return ptr_ring_empty_any(&a->ring);
+}
+
static inline struct sk_buff *skb_array_consume(struct skb_array *a)
{
return ptr_ring_consume(&a->ring);
@@ -135,9 +150,19 @@ static inline int skb_array_init(struct skb_array *a, int size, gfp_t gfp)
return ptr_ring_init(&a->ring, size, gfp);
}
+void __skb_array_destroy_skb(void *ptr)
+{
+ kfree_skb(ptr);
+}
+
+int skb_array_resize(struct skb_array *a, int size, gfp_t gfp)
+{
+ return ptr_ring_resize(&a->ring, size, gfp, __skb_array_destroy_skb);
+}
+
static inline void skb_array_cleanup(struct skb_array *a)
{
- ptr_ring_cleanup(&a->ring);
+ ptr_ring_cleanup(&a->ring, __skb_array_destroy_skb);
}
#endif /* _LINUX_SKB_ARRAY_H */
--
MST
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH RFC v7 5/5] skb_array: resize support "Michael S. Tsirkin" <mst@redhat.com> - 2016-06-02 18:10 +0200
csiph-web