[ovs-dev] [PATCH 2/4] datapath: New kernel function to insert packets async

Chris Luke chrisy at flirble.org
Tue Jan 14 16:43:26 UTC 2014


If available, use netif_receive_skb_finish() to asynchronously
return packets to the network input path after the point where
they were handed to us when the flow action is back_to_kernel.

Signed-off-by: Chris Luke <chris_luke at cable.comcast.com>
---
 acinclude.m4            |    3 +++
 datapath/vport-netdev.c |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 8ff5828..1dfb90b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -291,6 +291,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/openvswitch.h], [openvswitch_handle_frame_hook],
                   [OVS_DEFINE([HAVE_RHEL_OVS_HOOK])])
 
+  OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netif_receive_skb_finish],
+                  [OVS_DEFINE([HAVE_NETIF_RECEIVE_SKB_FINISH])])
+
   OVS_CHECK_LOG2_H
 
   if cmp -s datapath/linux/kcompat.h.new \
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 196c851..0d09f82 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -291,7 +291,11 @@ static int netdev_insert(struct sk_buff *skb)
 	/* The skb will have gone when we want this later. */
 	len = skb->len;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+#ifdef HAVE_NETIF_RECEIVE_SKB_FINISH
+	/* Deliver to the lower-half of the network receive path. */
+	ret = netif_receive_skb_finish(skb);
+
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
 #ifdef CONFIG_NET_CLS_ACT
 	/* This flag will skip the top half of the
 	 * code in __netif_receive_skb(). */
-- 
1.7.9.5




More information about the dev mailing list