mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
datapath: Add support for Geneve tunneling.
This adds support for Geneve - Generic Network Virtualization Encapsulation. The protocol is documented at http://tools.ietf.org/html/draft-gross-geneve-00 The kernel 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. Userspace currently implements only support for basic version of Geneve. It can work with the base header (including the VNI) and is capable of parsing options but does not currently support any particular option definitions. Over time, the intention is to allow options to be matched through OpenFlow without requiring explicit support in OVS userspace. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Thomas Graf <tgraf@suug.ch> Acked-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
@@ -53,11 +53,24 @@ struct ovs_key_ipv4_tunnel {
|
||||
|
||||
struct ovs_tunnel_info {
|
||||
struct ovs_key_ipv4_tunnel tunnel;
|
||||
struct geneve_opt *options;
|
||||
u8 options_len;
|
||||
};
|
||||
|
||||
/* Store options at the end of the array if they are less than the
|
||||
* maximum size. This allows us to get the benefits of variable length
|
||||
* matching for small options.
|
||||
*/
|
||||
#define GENEVE_OPTS(flow_key, opt_len) (struct geneve_opt *) \
|
||||
((flow_key)->tun_opts + \
|
||||
FIELD_SIZEOF(struct sw_flow_key, tun_opts) - \
|
||||
opt_len)
|
||||
|
||||
static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
|
||||
const struct iphdr *iph, __be64 tun_id,
|
||||
__be16 tun_flags)
|
||||
__be16 tun_flags,
|
||||
struct geneve_opt *opts,
|
||||
u8 opts_len)
|
||||
{
|
||||
tun_info->tunnel.tun_id = tun_id;
|
||||
tun_info->tunnel.ipv4_src = iph->saddr;
|
||||
@@ -69,9 +82,14 @@ static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
|
||||
/* clear struct padding. */
|
||||
memset((unsigned char *) &tun_info->tunnel + OVS_TUNNEL_KEY_SIZE, 0,
|
||||
sizeof(tun_info->tunnel) - OVS_TUNNEL_KEY_SIZE);
|
||||
|
||||
tun_info->options = opts;
|
||||
tun_info->options_len = opts_len;
|
||||
}
|
||||
|
||||
struct sw_flow_key {
|
||||
u8 tun_opts[255];
|
||||
u8 tun_opts_len;
|
||||
struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */
|
||||
struct {
|
||||
u32 priority; /* Packet QoS priority. */
|
||||
|
||||
Reference in New Issue
Block a user