This patch merges the notifiers for VXLAN and GENEVE into a single UDP tunnel notifier. The idea is that we will want to only have to make one notifier call to receive the list of ports for VXLAN and GENEVE tunnels that need to be offloaded. In addition we add a new set of ndo functions named ndo_udp_tunnel_add and ndo_udp_tunnel_del that are meant to allow us to track the tunnel meta-data such as port and address family as tunnels are added and removed. The tunnel meta-data is now transported in a structure named udp_tunnel_info which for now carries the type, address family, and port number. In the future this could be updated so that we can include a tuple of values including things such as the destination IP address and other fields. I also ended up going with a naming scheme that consisted of using the prefix udp_tunnel on function names. I applied this to the notifier and ndo ops as well so that it hopefully points to the fact that these are primarily used in the udp_tunnel functions. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
73 lines
1.7 KiB
C
73 lines
1.7 KiB
C
#ifndef __NET_GENEVE_H
|
|
#define __NET_GENEVE_H 1
|
|
|
|
#include <net/udp_tunnel.h>
|
|
|
|
/* Geneve Header:
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
* |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
* | Virtual Network Identifier (VNI) | Reserved |
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
* | Variable Length Options |
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
*
|
|
* Option Header:
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
* | Option Class | Type |R|R|R| Length |
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
* | Variable Option Data |
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
*/
|
|
|
|
struct geneve_opt {
|
|
__be16 opt_class;
|
|
u8 type;
|
|
#ifdef __LITTLE_ENDIAN_BITFIELD
|
|
u8 length:5;
|
|
u8 r3:1;
|
|
u8 r2:1;
|
|
u8 r1:1;
|
|
#else
|
|
u8 r1:1;
|
|
u8 r2:1;
|
|
u8 r3:1;
|
|
u8 length:5;
|
|
#endif
|
|
u8 opt_data[];
|
|
};
|
|
|
|
#define GENEVE_CRIT_OPT_TYPE (1 << 7)
|
|
|
|
struct genevehdr {
|
|
#ifdef __LITTLE_ENDIAN_BITFIELD
|
|
u8 opt_len:6;
|
|
u8 ver:2;
|
|
u8 rsvd1:6;
|
|
u8 critical:1;
|
|
u8 oam:1;
|
|
#else
|
|
u8 ver:2;
|
|
u8 opt_len:6;
|
|
u8 oam:1;
|
|
u8 critical:1;
|
|
u8 rsvd1:6;
|
|
#endif
|
|
__be16 proto_type;
|
|
u8 vni[3];
|
|
u8 rsvd2;
|
|
struct geneve_opt options[];
|
|
};
|
|
|
|
static inline void geneve_get_rx_port(struct net_device *netdev)
|
|
{
|
|
udp_tunnel_get_rx_info(netdev);
|
|
}
|
|
|
|
#ifdef CONFIG_INET
|
|
struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
|
|
u8 name_assign_type, u16 dst_port);
|
|
#endif /*ifdef CONFIG_INET */
|
|
|
|
#endif /*ifdef__NET_GENEVE_H */
|