diff options
| author | David S. Miller <davem@davemloft.net> | 2014-10-06 00:32:25 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-10-06 00:32:25 -0400 |
| commit | 45d9cc7c609680e921060d3eb4e399043eb5e4be (patch) | |
| tree | a4906c8cba2b6c2d116e7b72a71f9e1020b476cb | |
| parent | c259c132ad284576ab44308d5d17ea6a16c971b5 (diff) | |
| parent | f5796684069e0c71c65bce6a6d4766114aec1396 (diff) | |
Merge branch 'geneve'
Andy Zhou says:
====================
Add Geneve tunnel protocol support
This patch series adds kernel support for Geneve (Generic Network
Virtualization Encapsulation) based on Geneve IETF draft:
http://www.ietf.org/id/draft-gross-geneve-01.txt
Patch 1 implements Geneve tunneling protocol driver
Patch 2-6 adds openvswitch support for creating and using
Geneve tunnels by OVS user space.
v1->v2: Style fixes: use tab instead space for Kconfig
Patch 2-6 are reviewed by Pravin Shetty, add him to acked-by
Patch 6 was reviewed by Thomas Graf when commiting
to openvswitch.org, add him to acked-by.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/net/geneve.h | 91 | ||||
| -rw-r--r-- | include/net/ip_tunnels.h | 19 | ||||
| -rw-r--r-- | include/uapi/linux/openvswitch.h | 5 | ||||
| -rw-r--r-- | net/ipv4/Kconfig | 14 | ||||
| -rw-r--r-- | net/ipv4/Makefile | 1 | ||||
| -rw-r--r-- | net/ipv4/geneve.c | 373 | ||||
| -rw-r--r-- | net/openvswitch/Kconfig | 11 | ||||
| -rw-r--r-- | net/openvswitch/Makefile | 4 | ||||
| -rw-r--r-- | net/openvswitch/actions.c | 5 | ||||
| -rw-r--r-- | net/openvswitch/datapath.c | 44 | ||||
| -rw-r--r-- | net/openvswitch/datapath.h | 2 | ||||
| -rw-r--r-- | net/openvswitch/flow.c | 76 | ||||
| -rw-r--r-- | net/openvswitch/flow.h | 48 | ||||
| -rw-r--r-- | net/openvswitch/flow_netlink.c | 227 | ||||
| -rw-r--r-- | net/openvswitch/vport-geneve.c | 236 | ||||
| -rw-r--r-- | net/openvswitch/vport-gre.c | 16 | ||||
| -rw-r--r-- | net/openvswitch/vport-vxlan.c | 10 | ||||
| -rw-r--r-- | net/openvswitch/vport.c | 9 | ||||
| -rw-r--r-- | net/openvswitch/vport.h | 3 |
19 files changed, 1093 insertions, 101 deletions
diff --git a/include/net/geneve.h b/include/net/geneve.h new file mode 100644 index 000000000000..ce98865318bf --- /dev/null +++ b/include/net/geneve.h | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | #ifndef __NET_GENEVE_H | ||
| 2 | #define __NET_GENEVE_H 1 | ||
| 3 | |||
| 4 | #include <net/udp_tunnel.h> | ||
| 5 | |||
| 6 | struct geneve_sock; | ||
| 7 | |||
| 8 | typedef void (geneve_rcv_t)(struct geneve_sock *gs, struct sk_buff *skb); | ||
| 9 | |||
| 10 | struct geneve_sock { | ||
| 11 | struct hlist_node hlist; | ||
| 12 | geneve_rcv_t *rcv; | ||
| 13 | void *rcv_data; | ||
| 14 | struct work_struct del_work; | ||
| 15 | struct socket *sock; | ||
| 16 | struct rcu_head rcu; | ||
| 17 | atomic_t refcnt; | ||
| 18 | struct udp_offload udp_offloads; | ||
| 19 | }; | ||
| 20 | |||
| 21 | /* Geneve Header: | ||
| 22 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 23 | * |Ver| Opt Len |O|C| Rsvd. | Protocol Type | | ||
| 24 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 25 | * | Virtual Network Identifier (VNI) | Reserved | | ||
| 26 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 27 | * | Variable Length Options | | ||
| 28 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 29 | * | ||
| 30 | * Option Header: | ||
| 31 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 32 | * | Option Class | Type |R|R|R| Length | | ||
| 33 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 34 | * | Variable Option Data | | ||
| 35 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
| 36 | */ | ||
| 37 | |||
| 38 | struct geneve_opt { | ||
| 39 | __be16 opt_class; | ||
| 40 | u8 type; | ||
| 41 | #ifdef __LITTLE_ENDIAN_BITFIELD | ||
| 42 | u8 length:5; | ||
| 43 | u8 r3:1; | ||
| 44 | u8 r2:1; | ||
| 45 | u8 r1:1; | ||
| 46 | #else | ||
| 47 | u8 r1:1; | ||
| 48 | u8 r2:1; | ||
| 49 | u8 r3:1; | ||
| 50 | u8 length:5; | ||
| 51 | #endif | ||
| 52 | u8 opt_data[]; | ||
| 53 | }; | ||
| 54 | |||
| 55 | #define GENEVE_CRIT_OPT_TYPE (1 << 7) | ||
| 56 | |||
| 57 | struct genevehdr { | ||
| 58 | #ifdef __LITTLE_ENDIAN_BITFIELD | ||
| 59 | u8 opt_len:6; | ||
| 60 | u8 ver:2; | ||
| 61 | u8 rsvd1:6; | ||
| 62 | u8 critical:1; | ||
| 63 | u8 oam:1; | ||
| 64 | #else | ||
| 65 | u8 ver:2; | ||
| 66 | u8 opt_len:6; | ||
| 67 | u8 oam:1; | ||
| 68 | u8 critical:1; | ||
| 69 | u8 rsvd1:6; | ||
| 70 | #endif | ||
| 71 | __be16 proto_type; | ||
| 72 | u8 vni[3]; | ||
| 73 | u8 rsvd2; | ||
| 74 | struct geneve_opt options[]; | ||
| 75 | }; | ||
| 76 | |||
| 77 | #define GENEVE_VER 0 | ||
| 78 | #define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr)) | ||
| 79 | |||
| 80 | struct geneve_sock *geneve_sock_add(struct net *net, __be16 port, | ||
| 81 | geneve_rcv_t *rcv, void *data, | ||
| 82 | bool no_share, bool ipv6); | ||
| 83 | |||
| 84 | void geneve_sock_release(struct geneve_sock *vs); | ||
| 85 | |||
| 86 | int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, | ||
| 87 | struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos, | ||
| 88 | __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port, | ||
| 89 | __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt, | ||
| 90 | bool xnet); | ||
| 91 | #endif | ||
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 7f538ba6e267..5bc6edeb7143 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
| @@ -86,15 +86,18 @@ struct ip_tunnel { | |||
| 86 | struct gro_cells gro_cells; | 86 | struct gro_cells gro_cells; |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | #define TUNNEL_CSUM __cpu_to_be16(0x01) | 89 | #define TUNNEL_CSUM __cpu_to_be16(0x01) |
| 90 | #define TUNNEL_ROUTING __cpu_to_be16(0x02) | 90 | #define TUNNEL_ROUTING __cpu_to_be16(0x02) |
| 91 | #define TUNNEL_KEY __cpu_to_be16(0x04) | 91 | #define TUNNEL_KEY __cpu_to_be16(0x04) |
| 92 | #define TUNNEL_SEQ __cpu_to_be16(0x08) | 92 | #define TUNNEL_SEQ __cpu_to_be16(0x08) |
| 93 | #define TUNNEL_STRICT __cpu_to_be16(0x10) | 93 | #define TUNNEL_STRICT __cpu_to_be16(0x10) |
| 94 | #define TUNNEL_REC __cpu_to_be16(0x20) | 94 | #define TUNNEL_REC __cpu_to_be16(0x20) |
| 95 | #define TUNNEL_VERSION __cpu_to_be16(0x40) | 95 | #define TUNNEL_VERSION __cpu_to_be16(0x40) |
| 96 | #define TUNNEL_NO_KEY __cpu_to_be16(0x80) | 96 | #define TUNNEL_NO_KEY __cpu_to_be16(0x80) |
| 97 | #define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) | 97 | #define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) |
| 98 | #define TUNNEL_OAM __cpu_to_be16(0x0200) | ||
| 99 | #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) | ||
| 100 | #define TUNNEL_OPTIONS_PRESENT __cpu_to_be16(0x0800) | ||
| 98 | 101 | ||
| 99 | struct tnl_ptk_info { | 102 | struct tnl_ptk_info { |
| 100 | __be16 flags; | 103 | __be16 flags; |
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h index f7fc507d82ab..435eabc5ffaa 100644 --- a/include/uapi/linux/openvswitch.h +++ b/include/uapi/linux/openvswitch.h | |||
| @@ -192,6 +192,7 @@ enum ovs_vport_type { | |||
| 192 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ | 192 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ |
| 193 | OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ | 193 | OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ |
| 194 | OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ | 194 | OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ |
| 195 | OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ | ||
| 195 | __OVS_VPORT_TYPE_MAX | 196 | __OVS_VPORT_TYPE_MAX |
| 196 | }; | 197 | }; |
| 197 | 198 | ||
| @@ -294,7 +295,7 @@ enum ovs_key_attr { | |||
| 294 | OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ | 295 | OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ |
| 295 | 296 | ||
| 296 | #ifdef __KERNEL__ | 297 | #ifdef __KERNEL__ |
| 297 | OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */ | 298 | OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */ |
| 298 | #endif | 299 | #endif |
| 299 | __OVS_KEY_ATTR_MAX | 300 | __OVS_KEY_ATTR_MAX |
| 300 | }; | 301 | }; |
| @@ -309,6 +310,8 @@ enum ovs_tunnel_key_attr { | |||
| 309 | OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ | 310 | OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ |
| 310 | OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ | 311 | OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ |
| 311 | OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ | 312 | OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ |
| 313 | OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ | ||
| 314 | OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ | ||
| 312 | __OVS_TUNNEL_KEY_ATTR_MAX | 315 | __OVS_TUNNEL_KEY_ATTR_MAX |
| 313 | }; | 316 | }; |
| 314 | 317 | ||
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 69fb37854449..c2035447e649 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
| @@ -453,6 +453,20 @@ config TCP_CONG_BIC | |||
| 453 | increase provides TCP friendliness. | 453 | increase provides TCP friendliness. |
| 454 | See http://www.csc.ncsu.edu/faculty/rhee/export/bitcp/ | 454 | See http://www.csc.ncsu.edu/faculty/rhee/export/bitcp/ |
| 455 | 455 | ||
| 456 | config GENEVE | ||
| 457 | |||
