Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5796684 authored by Jesse Gross's avatar Jesse Gross Committed by David S. Miller
Browse files

openvswitch: Add support for Geneve tunneling.



The Openvswitch implementation is completely agnostic to the options
that are in use and can handle newly defined options without
further work. It does this by simply matching on a byte array
of options and allowing userspace to setup flows on this array.

Signed-off-by: default avatarJesse Gross <jesse@nicira.com>
Singed-off-by: default avatarAnsis Atteka <aatteka@nicira.com>
Signed-off-by: default avatarAndy Zhou <azhou@nicira.com>
Acked-by: default avatarThomas Graf <tgraf@noironetworks.com>
Acked-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6b205b2c
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ struct ip_tunnel {
#define TUNNEL_DONT_FRAGMENT    __cpu_to_be16(0x0100)
#define TUNNEL_OAM		__cpu_to_be16(0x0200)
#define TUNNEL_CRIT_OPT		__cpu_to_be16(0x0400)
#define TUNNEL_OPTIONS_PRESENT	__cpu_to_be16(0x0800)

struct tnl_ptk_info {
	__be16 flags;
+2 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ enum ovs_vport_type {
	OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
	OVS_VPORT_TYPE_GRE,      /* GRE tunnel. */
	OVS_VPORT_TYPE_VXLAN,	 /* VXLAN tunnel. */
	OVS_VPORT_TYPE_GENEVE,	 /* Geneve tunnel. */
	__OVS_VPORT_TYPE_MAX
};

@@ -310,6 +311,7 @@ enum ovs_tunnel_key_attr {
	OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT,      /* No argument, set DF. */
	OVS_TUNNEL_KEY_ATTR_CSUM,               /* No argument. CSUM packet. */
	OVS_TUNNEL_KEY_ATTR_OAM,                /* No argument. OAM frame.  */
	OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS,        /* Array of Geneve options. */
	__OVS_TUNNEL_KEY_ATTR_MAX
};

+11 −0
Original line number Diff line number Diff line
@@ -54,3 +54,14 @@ config OPENVSWITCH_VXLAN
	  Say N to exclude this support and reduce the binary size.

	  If unsure, say Y.

config OPENVSWITCH_GENEVE
	bool "Open vSwitch Geneve tunneling support"
	depends on INET
	depends on OPENVSWITCH
	depends on GENEVE && !(OPENVSWITCH=y && GENEVE=m)
	default y
	---help---
	  If you say Y here, then the Open vSwitch will be able create geneve vport.

	  Say N to exclude this support and reduce the binary size.
+4 −0
Original line number Diff line number Diff line
@@ -15,6 +15,10 @@ openvswitch-y := \
	vport-internal_dev.o \
	vport-netdev.o

ifneq ($(CONFIG_OPENVSWITCH_GENEVE),)
openvswitch-y += vport-geneve.o
endif

ifneq ($(CONFIG_OPENVSWITCH_VXLAN),)
openvswitch-y += vport-vxlan.o
endif
+4 −1
Original line number Diff line number Diff line
@@ -370,6 +370,7 @@ static size_t key_attr_size(void)
		  + nla_total_size(0)   /* OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT */
		  + nla_total_size(0)   /* OVS_TUNNEL_KEY_ATTR_CSUM */
		  + nla_total_size(0)   /* OVS_TUNNEL_KEY_ATTR_OAM */
		  + nla_total_size(256)   /* OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS */
		+ nla_total_size(4)   /* OVS_KEY_ATTR_IN_PORT */
		+ nla_total_size(4)   /* OVS_KEY_ATTR_SKB_MARK */
		+ nla_total_size(12)  /* OVS_KEY_ATTR_ETHERNET */
@@ -556,10 +557,12 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)

	err = ovs_nla_copy_actions(a[OVS_PACKET_ATTR_ACTIONS],
				   &flow->key, 0, &acts);
	rcu_assign_pointer(flow->sf_acts, acts);
	if (err)
		goto err_flow_free;

	rcu_assign_pointer(flow->sf_acts, acts);

	OVS_CB(packet)->egress_tun_info = NULL;
	OVS_CB(packet)->flow = flow;
	packet->priority = flow->key.phy.priority;
	packet->mark = flow->key.phy.skb_mark;
Loading