net/ice: clean input set macro definition

Currently, the macro of input set use 2 bits, one bit for protocol and
inner/outer, another bit for src/dst field. But this could not
distinguish a rule with inner and outer fields for tunnel packet.
Redefine input set macro to make it clear. Only use these two bits for
protocol and field. Ignore the redundant inner/outer info.

ICE_INSET_TUN_* is used by switch module, should be removed after
switch refactor.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Zhirun Yan 2021-03-02 10:54:02 +08:00 committed by Qi Zhang
parent 34ede45188
commit 2b6d6d71a0
2 changed files with 101 additions and 135 deletions

View File

@ -56,19 +56,19 @@
ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
#define ICE_FDIR_INSET_VXLAN_IPV4 (\
ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
#define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
ICE_FDIR_INSET_VXLAN_IPV4 | \
ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
#define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
ICE_FDIR_INSET_VXLAN_IPV4 | \
ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
ICE_FDIR_INSET_VXLAN_IPV4 | \
ICE_INSET_TUN_SCTP_SRC_PORT | ICE_INSET_TUN_SCTP_DST_PORT)
ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
#define ICE_FDIR_INSET_IPV4_GTPU (\
ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)

View File

@ -9,177 +9,143 @@
/* protocol */
#define ICE_PROT_MAC_INNER (1ULL << 1)
#define ICE_PROT_MAC_OUTER (1ULL << 2)
#define ICE_PROT_VLAN_INNER (1ULL << 3)
#define ICE_PROT_VLAN_OUTER (1ULL << 4)
#define ICE_PROT_IPV4_INNER (1ULL << 5)
#define ICE_PROT_IPV4_OUTER (1ULL << 6)
#define ICE_PROT_IPV6_INNER (1ULL << 7)
#define ICE_PROT_IPV6_OUTER (1ULL << 8)
#define ICE_PROT_TCP_INNER (1ULL << 9)
#define ICE_PROT_TCP_OUTER (1ULL << 10)
#define ICE_PROT_UDP_INNER (1ULL << 11)
#define ICE_PROT_UDP_OUTER (1ULL << 12)
#define ICE_PROT_SCTP_INNER (1ULL << 13)
#define ICE_PROT_SCTP_OUTER (1ULL << 14)
#define ICE_PROT_ICMP4_INNER (1ULL << 15)
#define ICE_PROT_ICMP4_OUTER (1ULL << 16)
#define ICE_PROT_ICMP6_INNER (1ULL << 17)
#define ICE_PROT_ICMP6_OUTER (1ULL << 18)
#define ICE_PROT_VXLAN (1ULL << 19)
#define ICE_PROT_NVGRE (1ULL << 20)
#define ICE_PROT_GTPU (1ULL << 21)
#define ICE_PROT_PPPOE_S (1ULL << 22)
#define ICE_PROT_ESP (1ULL << 23)
#define ICE_PROT_AH (1ULL << 24)
#define ICE_PROT_L2TPV3OIP (1ULL << 25)
#define ICE_PROT_PFCP (1ULL << 26)
#define ICE_PROT_MAC BIT_ULL(1)
#define ICE_PROT_VLAN BIT_ULL(2)
#define ICE_PROT_IPV4 BIT_ULL(3)
#define ICE_PROT_IPV6 BIT_ULL(4)
#define ICE_PROT_TCP BIT_ULL(5)
#define ICE_PROT_UDP BIT_ULL(6)
#define ICE_PROT_SCTP BIT_ULL(7)
#define ICE_PROT_ICMP4 BIT_ULL(8)
#define ICE_PROT_ICMP6 BIT_ULL(9)
#define ICE_PROT_VXLAN BIT_ULL(10)
#define ICE_PROT_NVGRE BIT_ULL(11)
#define ICE_PROT_GTPU BIT_ULL(12)
#define ICE_PROT_PPPOE_S BIT_ULL(13)
#define ICE_PROT_ESP BIT_ULL(14)
#define ICE_PROT_AH BIT_ULL(15)
#define ICE_PROT_L2TPV3OIP BIT_ULL(16)
#define ICE_PROT_PFCP BIT_ULL(17)
/* field */
#define ICE_SMAC (1ULL << 63)
#define ICE_DMAC (1ULL << 62)
#define ICE_ETHERTYPE (1ULL << 61)
#define ICE_IP_SRC (1ULL << 60)
#define ICE_IP_DST (1ULL << 59)
#define ICE_IP_PROTO (1ULL << 58)
#define ICE_IP_TTL (1ULL << 57)
#define ICE_IP_TOS (1ULL << 56)
#define ICE_SPORT (1ULL << 55)
#define ICE_DPORT (1ULL << 54)
#define ICE_ICMP_TYPE (1ULL << 53)
#define ICE_ICMP_CODE (1ULL << 52)
#define ICE_VXLAN_VNI (1ULL << 51)
#define ICE_NVGRE_TNI (1ULL << 50)
#define ICE_GTPU_TEID (1ULL << 49)
#define ICE_GTPU_QFI (1ULL << 48)
#define ICE_PPPOE_SESSION (1ULL << 47)
#define ICE_PPPOE_PROTO (1ULL << 46)
#define ICE_ESP_SPI (1ULL << 45)
#define ICE_AH_SPI (1ULL << 44)
#define ICE_L2TPV3OIP_SESSION_ID (1ULL << 43)
#define ICE_PFCP_SEID (1ULL << 42)
#define ICE_PFCP_S_FIELD (1ULL << 41)
#define ICE_SMAC BIT_ULL(63)
#define ICE_DMAC BIT_ULL(62)
#define ICE_ETHERTYPE BIT_ULL(61)
#define ICE_IP_SRC BIT_ULL(60)
#define ICE_IP_DST BIT_ULL(59)
#define ICE_IP_PROTO BIT_ULL(58)
#define ICE_IP_TTL BIT_ULL(57)
#define ICE_IP_TOS BIT_ULL(56)
#define ICE_SPORT BIT_ULL(55)
#define ICE_DPORT BIT_ULL(54)
#define ICE_ICMP_TYPE BIT_ULL(53)
#define ICE_ICMP_CODE BIT_ULL(52)
#define ICE_VXLAN_VNI BIT_ULL(51)
#define ICE_NVGRE_TNI BIT_ULL(50)
#define ICE_GTPU_TEID BIT_ULL(49)
#define ICE_GTPU_QFI BIT_ULL(48)
#define ICE_PPPOE_SESSION BIT_ULL(47)
#define ICE_PPPOE_PROTO BIT_ULL(46)
#define ICE_ESP_SPI BIT_ULL(45)
#define ICE_AH_SPI BIT_ULL(44)
#define ICE_L2TPV3OIP_SESSION_ID BIT_ULL(43)
#define ICE_PFCP_SEID BIT_ULL(42)
#define ICE_PFCP_S_FIELD BIT_ULL(41)
/* input set */
#define ICE_INSET_NONE 0ULL
#define ICE_INSET_NONE 0ULL
/* non-tunnel */
#define ICE_INSET_SMAC (ICE_SMAC)
#define ICE_INSET_DMAC (ICE_DMAC)
#define ICE_INSET_VLAN (ICE_PROT_VLAN)
#define ICE_INSET_VLAN_INNER (ICE_PROT_VLAN)
#define ICE_INSET_VLAN_OUTER (ICE_PROT_VLAN)
#define ICE_INSET_ETHERTYPE (ICE_ETHERTYPE)
#define ICE_INSET_SMAC (ICE_PROT_MAC_OUTER | ICE_SMAC)
#define ICE_INSET_DMAC (ICE_PROT_MAC_OUTER | ICE_DMAC)
#define ICE_INSET_VLAN_INNER (ICE_PROT_VLAN_INNER)
#define ICE_INSET_VLAN_OUTER (ICE_PROT_VLAN_OUTER)
#define ICE_INSET_ETHERTYPE (ICE_ETHERTYPE)
#define ICE_INSET_IPV4_SRC (ICE_PROT_IPV4 | ICE_IP_SRC)
#define ICE_INSET_IPV4_DST (ICE_PROT_IPV4 | ICE_IP_DST)
#define ICE_INSET_IPV4_TOS (ICE_PROT_IPV4 | ICE_IP_TOS)
#define ICE_INSET_IPV4_PROTO (ICE_PROT_IPV4 | ICE_IP_PROTO)
#define ICE_INSET_IPV4_TTL (ICE_PROT_IPV4 | ICE_IP_TTL)
#define ICE_INSET_IPV6_SRC (ICE_PROT_IPV6 | ICE_IP_SRC)
#define ICE_INSET_IPV6_DST (ICE_PROT_IPV6 | ICE_IP_DST)
#define ICE_INSET_IPV6_NEXT_HDR (ICE_PROT_IPV6 | ICE_IP_PROTO)
#define ICE_INSET_IPV6_HOP_LIMIT (ICE_PROT_IPV6 | ICE_IP_TTL)
#define ICE_INSET_IPV6_TC (ICE_PROT_IPV6 | ICE_IP_TOS)
#define ICE_INSET_IPV4_SRC \
(ICE_PROT_IPV4_OUTER | ICE_IP_SRC)
#define ICE_INSET_IPV4_DST \
(ICE_PROT_IPV4_OUTER | ICE_IP_DST)
#define ICE_INSET_IPV4_TOS \
(ICE_PROT_IPV4_OUTER | ICE_IP_TOS)
#define ICE_INSET_IPV4_PROTO \
(ICE_PROT_IPV4_OUTER | ICE_IP_PROTO)
#define ICE_INSET_IPV4_TTL \
(ICE_PROT_IPV4_OUTER | ICE_IP_TTL)
#define ICE_INSET_IPV6_SRC \
(ICE_PROT_IPV6_OUTER | ICE_IP_SRC)
#define ICE_INSET_IPV6_DST \
(ICE_PROT_IPV6_OUTER | ICE_IP_DST)
#define ICE_INSET_IPV6_NEXT_HDR \
(ICE_PROT_IPV6_OUTER | ICE_IP_PROTO)
#define ICE_INSET_IPV6_HOP_LIMIT \
(ICE_PROT_IPV6_OUTER | ICE_IP_TTL)
#define ICE_INSET_IPV6_TC \
(ICE_PROT_IPV6_OUTER | ICE_IP_TOS)
#define ICE_INSET_TCP_SRC_PORT \
(ICE_PROT_TCP_OUTER | ICE_SPORT)
#define ICE_INSET_TCP_DST_PORT \
(ICE_PROT_TCP_OUTER | ICE_DPORT)
#define ICE_INSET_UDP_SRC_PORT \
(ICE_PROT_UDP_OUTER | ICE_SPORT)
#define ICE_INSET_UDP_DST_PORT \
(ICE_PROT_UDP_OUTER | ICE_DPORT)
#define ICE_INSET_SCTP_SRC_PORT \
(ICE_PROT_SCTP_OUTER | ICE_SPORT)
#define ICE_INSET_SCTP_DST_PORT \
(ICE_PROT_SCTP_OUTER | ICE_DPORT)
#define ICE_INSET_ICMP4_SRC_PORT \
(ICE_PROT_ICMP4_OUTER | ICE_SPORT)
#define ICE_INSET_ICMP4_DST_PORT \
(ICE_PROT_ICMP4_OUTER | ICE_DPORT)
#define ICE_INSET_ICMP6_SRC_PORT \
(ICE_PROT_ICMP6_OUTER | ICE_SPORT)
#define ICE_INSET_ICMP6_DST_PORT \
(ICE_PROT_ICMP6_OUTER | ICE_DPORT)
#define ICE_INSET_ICMP4_TYPE \
(ICE_PROT_ICMP4_OUTER | ICE_ICMP_TYPE)
#define ICE_INSET_ICMP4_CODE \
(ICE_PROT_ICMP4_OUTER | ICE_ICMP_CODE)
#define ICE_INSET_ICMP6_TYPE \
(ICE_PROT_ICMP6_OUTER | ICE_ICMP_TYPE)
#define ICE_INSET_ICMP6_CODE \
(ICE_PROT_ICMP6_OUTER | ICE_ICMP_CODE)
#define ICE_INSET_TCP_SRC_PORT (ICE_PROT_TCP | ICE_SPORT)
#define ICE_INSET_TCP_DST_PORT (ICE_PROT_TCP | ICE_DPORT)
#define ICE_INSET_UDP_SRC_PORT (ICE_PROT_UDP | ICE_SPORT)
#define ICE_INSET_UDP_DST_PORT (ICE_PROT_UDP | ICE_DPORT)
#define ICE_INSET_SCTP_SRC_PORT (ICE_PROT_SCTP | ICE_SPORT)
#define ICE_INSET_SCTP_DST_PORT (ICE_PROT_SCTP | ICE_DPORT)
#define ICE_INSET_ICMP4_SRC_PORT (ICE_PROT_ICMP4 | ICE_SPORT)
#define ICE_INSET_ICMP4_DST_PORT (ICE_PROT_ICMP4 | ICE_DPORT)
#define ICE_INSET_ICMP6_SRC_PORT (ICE_PROT_ICMP6 | ICE_SPORT)
#define ICE_INSET_ICMP6_DST_PORT (ICE_PROT_ICMP6 | ICE_DPORT)
#define ICE_INSET_ICMP4_TYPE (ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
#define ICE_INSET_ICMP4_CODE (ICE_PROT_ICMP4 | ICE_ICMP_CODE)
#define ICE_INSET_ICMP6_TYPE (ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
#define ICE_INSET_ICMP6_CODE (ICE_PROT_ICMP6 | ICE_ICMP_CODE)
/* tunnel */
#define ICE_INSET_TUN_SMAC \
(ICE_PROT_MAC_INNER | ICE_SMAC)
(ICE_PROT_MAC | ICE_SMAC)
#define ICE_INSET_TUN_DMAC \
(ICE_PROT_MAC_INNER | ICE_DMAC)
(ICE_PROT_MAC | ICE_DMAC)
#define ICE_INSET_TUN_IPV4_SRC \
(ICE_PROT_IPV4_INNER | ICE_IP_SRC)
(ICE_PROT_IPV4 | ICE_IP_SRC)
#define ICE_INSET_TUN_IPV4_DST \
(ICE_PROT_IPV4_INNER | ICE_IP_DST)
(ICE_PROT_IPV4 | ICE_IP_DST)
#define ICE_INSET_TUN_IPV4_TTL \
(ICE_PROT_IPV4_INNER | ICE_IP_TTL)
(ICE_PROT_IPV4 | ICE_IP_TTL)
#define ICE_INSET_TUN_IPV4_PROTO \
(ICE_PROT_IPV4_INNER | ICE_IP_PROTO)
(ICE_PROT_IPV4 | ICE_IP_PROTO)
#define ICE_INSET_TUN_IPV4_TOS \
(ICE_PROT_IPV4_INNER | ICE_IP_TOS)
(ICE_PROT_IPV4 | ICE_IP_TOS)
#define ICE_INSET_TUN_IPV6_SRC \
(ICE_PROT_IPV6_INNER | ICE_IP_SRC)
(ICE_PROT_IPV6 | ICE_IP_SRC)
#define ICE_INSET_TUN_IPV6_DST \
(ICE_PROT_IPV6_INNER | ICE_IP_DST)
(ICE_PROT_IPV6 | ICE_IP_DST)
#define ICE_INSET_TUN_IPV6_HOP_LIMIT \
(ICE_PROT_IPV6_INNER | ICE_IP_TTL)
(ICE_PROT_IPV6 | ICE_IP_TTL)
#define ICE_INSET_TUN_IPV6_NEXT_HDR \
(ICE_PROT_IPV6_INNER | ICE_IP_PROTO)
(ICE_PROT_IPV6 | ICE_IP_PROTO)
#define ICE_INSET_TUN_IPV6_TC \
(ICE_PROT_IPV6_INNER | ICE_IP_TOS)
(ICE_PROT_IPV6 | ICE_IP_TOS)
#define ICE_INSET_TUN_TCP_SRC_PORT \
(ICE_PROT_TCP_INNER | ICE_SPORT)
(ICE_PROT_TCP | ICE_SPORT)
#define ICE_INSET_TUN_TCP_DST_PORT \
(ICE_PROT_TCP_INNER | ICE_DPORT)
(ICE_PROT_TCP | ICE_DPORT)
#define ICE_INSET_TUN_UDP_SRC_PORT \
(ICE_PROT_UDP_INNER | ICE_SPORT)
(ICE_PROT_UDP | ICE_SPORT)
#define ICE_INSET_TUN_UDP_DST_PORT \
(ICE_PROT_UDP_INNER | ICE_DPORT)
(ICE_PROT_UDP | ICE_DPORT)
#define ICE_INSET_TUN_SCTP_SRC_PORT \
(ICE_PROT_SCTP_INNER | ICE_SPORT)
(ICE_PROT_SCTP | ICE_SPORT)
#define ICE_INSET_TUN_SCTP_DST_PORT \
(ICE_PROT_SCTP_INNER | ICE_DPORT)
(ICE_PROT_SCTP | ICE_DPORT)
#define ICE_INSET_TUN_ICMP4_SRC_PORT \
(ICE_PROT_ICMP4_INNER | ICE_SPORT)
(ICE_PROT_ICMP4 | ICE_SPORT)
#define ICE_INSET_TUN_ICMP4_DST_PORT \
(ICE_PROT_ICMP4_INNER | ICE_DPORT)
(ICE_PROT_ICMP4 | ICE_DPORT)
#define ICE_INSET_TUN_ICMP6_SRC_PORT \
(ICE_PROT_ICMP6_INNER | ICE_SPORT)
(ICE_PROT_ICMP6 | ICE_SPORT)
#define ICE_INSET_TUN_ICMP6_DST_PORT \
(ICE_PROT_ICMP6_INNER | ICE_DPORT)
(ICE_PROT_ICMP6 | ICE_DPORT)
#define ICE_INSET_TUN_ICMP4_TYPE \
(ICE_PROT_ICMP4_INNER | ICE_ICMP_TYPE)
(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
#define ICE_INSET_TUN_ICMP4_CODE \
(ICE_PROT_ICMP4_INNER | ICE_ICMP_CODE)
(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
#define ICE_INSET_TUN_ICMP6_TYPE \
(ICE_PROT_ICMP6_INNER | ICE_ICMP_TYPE)
(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
#define ICE_INSET_TUN_ICMP6_CODE \
(ICE_PROT_ICMP6_INNER | ICE_ICMP_CODE)
(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
#define ICE_INSET_TUN_VXLAN_VNI \
(ICE_PROT_VXLAN | ICE_VXLAN_VNI)