Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __NET_GENEVE_H
0003 #define __NET_GENEVE_H  1
0004 
0005 #include <net/udp_tunnel.h>
0006 
0007 #define GENEVE_UDP_PORT     6081
0008 
0009 /* Geneve Header:
0010  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0011  *  |Ver|  Opt Len  |O|C|    Rsvd.  |          Protocol Type        |
0012  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0013  *  |        Virtual Network Identifier (VNI)       |    Reserved   |
0014  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0015  *  |                    Variable Length Options                    |
0016  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0017  *
0018  * Option Header:
0019  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0020  *  |          Option Class         |      Type     |R|R|R| Length  |
0021  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0022  *  |                      Variable Option Data                     |
0023  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0024  */
0025 
0026 struct geneve_opt {
0027     __be16  opt_class;
0028     u8  type;
0029 #ifdef __LITTLE_ENDIAN_BITFIELD
0030     u8  length:5;
0031     u8  r3:1;
0032     u8  r2:1;
0033     u8  r1:1;
0034 #else
0035     u8  r1:1;
0036     u8  r2:1;
0037     u8  r3:1;
0038     u8  length:5;
0039 #endif
0040     u8  opt_data[];
0041 };
0042 
0043 #define GENEVE_CRIT_OPT_TYPE (1 << 7)
0044 
0045 struct genevehdr {
0046 #ifdef __LITTLE_ENDIAN_BITFIELD
0047     u8 opt_len:6;
0048     u8 ver:2;
0049     u8 rsvd1:6;
0050     u8 critical:1;
0051     u8 oam:1;
0052 #else
0053     u8 ver:2;
0054     u8 opt_len:6;
0055     u8 oam:1;
0056     u8 critical:1;
0057     u8 rsvd1:6;
0058 #endif
0059     __be16 proto_type;
0060     u8 vni[3];
0061     u8 rsvd2;
0062     struct geneve_opt options[];
0063 };
0064 
0065 static inline bool netif_is_geneve(const struct net_device *dev)
0066 {
0067     return dev->rtnl_link_ops &&
0068            !strcmp(dev->rtnl_link_ops->kind, "geneve");
0069 }
0070 
0071 #ifdef CONFIG_INET
0072 struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
0073                     u8 name_assign_type, u16 dst_port);
0074 #endif /*ifdef CONFIG_INET */
0075 
0076 #endif /*ifdef__NET_GENEVE_H */