Thread (12 messages) flat view 12 messages, 3 authors, 2016-06-06

Re: [PATCH RFC v7 3/5] skb_array: array based FIFO for skbs

From: Jesper Dangaard Brouer <hidden>
Date: 2016-06-03 17:05:48
Also in: kvm, lkml

Could not compile this new version of skb_array.h, it complains about
implicit declaration of function 'skb_vlan_tag_present' and
'VLAN_HLEN' being undeclared.

Fix this by including linux/if_vlan.h, but is that correct?


On Thu, 2 Jun 2016 19:08:26 +0300 "Michael S. Tsirkin" [off-list ref] wrote:
quoted hunk ↗ jump to hunk
A simple array based FIFO of pointers.  Intended for net stack so uses
skbs for type safety. Implemented as a set of wrappers around ptr_array.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/linux/skb_array.h | 143 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 143 insertions(+)
 create mode 100644 include/linux/skb_array.h
diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h
new file mode 100644
index 0000000..ed6a2b5
--- /dev/null
+++ b/include/linux/skb_array.h
@@ -0,0 +1,143 @@
[...]
+
+#ifndef _LINUX_SKB_ARRAY_H
+#define _LINUX_SKB_ARRAY_H 1
+
+#ifdef __KERNEL__
+#include <linux/ptr_ring.h>
+#include <linux/skbuff.h>
Added:
+#include <linux/if_vlan.h>

+#endif
[...]
+static inline int __skb_array_len_with_tag(struct sk_buff *skb)
+{
+	if (likely(skb)) {
+		int len = skb->len;
+
+		if (skb_vlan_tag_present(skb))
+			len += VLAN_HLEN;
+
+		return len;
+	} else {
+		return 0;
+	}
+}
+
+static inline int skb_array_peek_len(struct skb_array *a)
+{
+	return PTR_RING_PEEK_CALL(&a->ring, __skb_array_len_with_tag);
+}
+
[...]

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help