Commit 7e8d6386 authored by Guangbin Huang's avatar Guangbin Huang Committed by Jiantao Xiao
Browse files

net: ethtool: add VxLAN to the NFC API

driver inclusion
category:feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I61CGU



----------------------------------------------------------------------

To support for steering VxLAN flows using the ethtool NFC interface, this
patch adds flow specifications for vxlan4(VxLAN with inner IPv4) and vxlan6
(VxLAN with inner IPv6).

Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent c5a37a37
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -889,6 +889,28 @@ struct ethtool_usrip4_spec {
	__u8    proto;
};

/**
 * struct ethtool_vxlan4_spec - general flow specification for VxLAN IPv4
 * @vni: VxLAN network identifier
 * @dst: Inner destination eth addr
 * @src: Inner source eth addr
 * @eth_type: Inner ethernet type
 * @tos: Inner type-of-service
 * @l4_proto: Inner transport protocol number
 * @ip4src: Inner source host
 * @ip4dst: Inner destination host
 */
struct ethtool_vxlan4_spec {
	__be32	vni;
	__u8	dst[ETH_ALEN];
	__u8	src[ETH_ALEN];
	__be16	eth_type;
	__u8	tos;
	__u8	l4_proto;
	__be32	ip4src;
	__be32	ip4dst;
};

/**
 * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
 * @ip6src: Source host
@@ -939,6 +961,28 @@ struct ethtool_usrip6_spec {
	__u8    l4_proto;
};

/**
 * struct ethtool_vxlan6_spec - general flow specification for VxLAN IPv6
 * @vni: VxLAN network identifier
 * @dst: Inner destination eth addr
 * @src: Inner source eth addr
 * @eth_type: Inner ethernet type
 * @tclass: Inner traffic Class
 * @l4_proto: Inner transport protocol number
 * @ip6src: Inner source host
 * @ip6dst: Inner destination host
 */
struct ethtool_vxlan6_spec {
	__be32	vni;
	__u8	dst[ETH_ALEN];
	__u8	src[ETH_ALEN];
	__be16	eth_type;
	__u8	tclass;
	__u8	l4_proto;
	__be32	ip6src[4];
	__be32	ip6dst[4];
};

union ethtool_flow_union {
	struct ethtool_tcpip4_spec		tcp_ip4_spec;
	struct ethtool_tcpip4_spec		udp_ip4_spec;
@@ -954,6 +998,10 @@ union ethtool_flow_union {
	struct ethtool_usrip6_spec		usr_ip6_spec;
	struct ethhdr				ether_spec;
	__u8					hdata[52];
#ifndef __GENKSYMS__
	struct ethtool_vxlan4_spec  vxlan_ip4_spec;
	struct ethtool_vxlan6_spec  vxlan_ip6_spec;
#endif
};

/**
@@ -1830,6 +1878,8 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define	IPV4_FLOW	0x10	/* hash only */
#define	IPV6_FLOW	0x11	/* hash only */
#define	ETHER_FLOW	0x12	/* spec only (ether_spec) */
#define	VXLAN_V4_FLOW	0x43	/* spec only (vxlan_ip4_spec) */
#define	VXLAN_V6_FLOW	0x44	/* spec only (vxlan_ip6_spec) */
/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
#define	FLOW_EXT	0x80000000
#define	FLOW_MAC_EXT	0x40000000