[ovs-dev] [PATCH v2 4/5] datapath: nsh: add GSO support

Yi Yang yi.y.yang at intel.com
Wed Jan 31 13:53:05 UTC 2018


Upstream commit:
  commit c411ed854584a71b0e86ac3019b60e4789d88086
  Author: Jiri Benc <jbenc at redhat.com>
  Date:   Mon Aug 28 21:43:24 2017 +0200

    nsh: add GSO support

    Add a new nsh/ directory. It currently holds only GSO functions but more
    will come: in particular, code shared by openvswitch and tc to manipulate
    NSH headers.

    For now, assume there's no hardware support for NSH segmentation. We can
    always introduce netdev->nsh_features later.

    Signed-off-by: Jiri Benc <jbenc at redhat.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>

Signed-off-by: Yi Yang <yi.y.yang at intel.com>
---
 datapath/Modules.mk                     | 4 +++-
 datapath/datapath.c                     | 4 ++++
 datapath/linux/compat/include/net/nsh.h | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/datapath/Modules.mk b/datapath/Modules.mk
index 21f04a0..3643da4 100644
--- a/datapath/Modules.mk
+++ b/datapath/Modules.mk
@@ -26,13 +26,15 @@ openvswitch_sources = \
 	flow_table.c \
 	vport.c \
 	vport-internal_dev.c \
-	vport-netdev.c
+	vport-netdev.c \
+	nsh.c
 
 vport_geneve_sources = vport-geneve.c
 vport_vxlan_sources = vport-vxlan.c
 vport_gre_sources = vport-gre.c
 vport_lisp_sources = vport-lisp.c
 vport_stt_sources = vport-stt.c
+nsh_sources = nsh.c
 
 openvswitch_headers = \
 	compat.h \
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 1780819..4272227 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -51,6 +51,7 @@
 #include <net/genetlink.h>
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
+#include <net/nsh.h>
 
 #include "datapath.h"
 #include "conntrack.h"
@@ -2408,6 +2409,7 @@ static int __init dp_init(void)
 
 	pr_info("Open vSwitch switching datapath %s\n", VERSION);
 
+	ovs_nsh_init();
 	err = action_fifos_init();
 	if (err)
 		goto error;
@@ -2463,6 +2465,7 @@ error_unreg_rtnl_link:
 error_action_fifos_exit:
 	action_fifos_exit();
 error:
+	ovs_nsh_cleanup();
 	return err;
 }
 
@@ -2478,6 +2481,7 @@ static void dp_cleanup(void)
 	ovs_flow_exit();
 	ovs_internal_dev_rtnl_link_unregister();
 	action_fifos_exit();
+	ovs_nsh_cleanup();
 }
 
 module_init(dp_init);
diff --git a/datapath/linux/compat/include/net/nsh.h b/datapath/linux/compat/include/net/nsh.h
index a1eaea2..c9c30e0 100644
--- a/datapath/linux/compat/include/net/nsh.h
+++ b/datapath/linux/compat/include/net/nsh.h
@@ -304,4 +304,7 @@ static inline void nsh_set_flags_ttl_len(struct nshhdr *nsh, u8 flags,
 			NSH_FLAGS_MASK | NSH_TTL_MASK | NSH_LEN_MASK);
 }
 
+int ovs_nsh_init(void);
+void ovs_nsh_cleanup(void);
+
 #endif /* __NET_NSH_H */
-- 
2.1.0



More information about the dev mailing list