Refactor FDIR pattern parser
cover Refactor FDIR pattern parser
This patch set refactor FDIR pattern parser.
Redefine input set. Ignore the redundant inner/outer info. Align the parser action with hardware, using input_set_f for outer, input_set_l for inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.
Zhirun Yan (5):
net/ice: clean input set macro definition
net/ice: refactor flow pattern parser
net/ice: add outer input set mask to distinguish outer fields net/ice: add outer input set mask check
net/ice: enable FDIR outer/inner fields for VXLAN
drivers/net/ice/ice_fdir_filter.c | 593 ++++++++++++++-------------- drivers/net/ice/ice_generic_flow.c | 2 + drivers/net/ice/ice_generic_flow.h | 235 +++++------ drivers/net/ice/ice_hash.c | 192 ++++----- drivers/net/ice/ice_switch_filter.c | 348 ++++++---------- 5 files changed, 573 insertions(+), 797 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/5 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.
--- drivers/net/ice/ice_fdir_filter.c | 8 +- drivers/net/ice/ice_generic_flow.h | 234 ++++++++++++----------------- 2 files changed, 104 insertions(+), 138 deletions(-)
drivers/net/ice/ice_fdir_filter.c +4 -4
@@ -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)
drivers/net/ice/ice_generic_flow.h +100 -134
277 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 2/5 net/ice: refactor flow pattern parser
In reply to Zhirun YanDistinguish inner/outer input set. And avoid too many nested conditionals in each type's parser. input_set_f is used for outer fields, input_set_l is used for inner or non-tunnel fields.
--- drivers/net/ice/ice_fdir_filter.c | 467 +++++++++++++++--------------- 1 file changed, 229 insertions(+), 238 deletions(-)
drivers/net/ice/ice_fdir_filter.c +229 -238
@@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask;const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; -uint64_t input_set =ICE_INSET_NONE ; +uint64_t input_set_l =ICE_INSET_NONE ; +uint64_t input_set_f =ICE_INSET_NONE ; +uint64_t *input_set;uint8_t flow_type =ICE_FLTR_PTYPE_NONF_NONE ;uint8_t ipv6_addr_mask[16 ] = {0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,
@@ -1655,289 +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,uint32_t vtc_flow_cpu;uint16_t ether_type;enum rte_flow_item_type next_type; +bool is_outer = true; +struct ice_fdir_extra *p_ext_data; +struct ice_fdir_v4 *p_v4; +struct ice_fdir_v6 *p_v6; +for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) { +if (item->type ==RTE_FLOW_ITEM_TYPE_VXLAN ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTPU ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTP_PSC ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; + } + +/* This loop parse flow pattern and distinguish Non-tunnel and tunnel +* flow. input_set_l is used for non-tunnel and tunnel inner part. +*/ for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) {if (item->last) {rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Not support range" ); +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Not support range" );return -rte_errno; } item_type = item->type; + input_set = (tunnel_type && is_outer) ? + &input_set_f : &input_set_l; + +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4; +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6; +switch (item_type) {case RTE_FLOW_ITEM_TYPE_ETH : + flow_type =ICE_FLTR_PTYPE_NON_IP_L2 ; eth_spec = item->spec; eth_mask = item->mask; - next_type = (item +1 )->type; -if (eth_spec && eth_mask) { -if (!rte_is_zero_ether_addr (ð_mask->dst)) { - input_set |=ICE_INSET_DMAC ; -rte_memcpy (&filter->input.ext_data.dst_mac, - ð_spec->dst, -RTE_ETHER_ADDR_LEN ); - } +if (!(eth_spec && eth_mask)) +break ; -if (!rte_is_zero_ether_addr (ð_mask->src)) { - input_set |=ICE_INSET_SMAC ; -rte_memcpy (&filter->input.ext_data.src_mac, - ð_spec->src, -RTE_ETHER_ADDR_LEN ); - } +if (!rte_is_zero_ether_addr (ð_mask->dst)) + *input_set |=ICE_INSET_DMAC ; +if (!rte_is_zero_ether_addr (ð_mask->src)) + *input_set |=ICE_INSET_SMAC ; -/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */ -if (eth_mask->type ==RTE_BE16 (0xffff ) && - next_type ==RTE_FLOW_ITEM_TYPE_END ) { - input_set |=ICE_INSET_ETHERTYPE ; - ether_type =rte_be_to_cpu_16 (eth_spec->type); - -if (ether_type ==RTE_ETHER_TYPE_IPV4 || - ether_type ==RTE_ETHER_TYPE_IPV6 ) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Unsupported ether_type." ); -return -rte_errno; - } - -rte_memcpy (&filter->input.ext_data.ether_type, - ð_spec->type, -sizeof (eth_spec->type)); - flow_type =ICE_FLTR_PTYPE_NON_IP_L2 ; + next_type = (item +1 )->type; +/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */ +if (eth_mask->type ==RTE_BE16 (0xffff ) && + next_type ==RTE_FLOW_ITEM_TYPE_END ) { + *input_set |=ICE_INSET_ETHERTYPE ; + ether_type =rte_be_to_cpu_16 (eth_spec->type); + +if (ether_type ==RTE_ETHER_TYPE_IPV4 || + ether_type ==RTE_ETHER_TYPE_IPV6 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unsupported ether_type." ); +return -rte_errno; } } + + p_ext_data = (tunnel_type && is_outer) ? + &filter->input.ext_data_outer : + &filter->input.ext_data; +rte_memcpy (&p_ext_data->src_mac, + ð_spec->src,RTE_ETHER_ADDR_LEN ); +rte_memcpy (&p_ext_data->dst_mac, + ð_spec->dst,RTE_ETHER_ADDR_LEN ); +rte_memcpy (&p_ext_data->ether_type, + ð_spec->type,sizeof (eth_spec->type));break ;case RTE_FLOW_ITEM_TYPE_IPV4 : + flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; l3 =RTE_FLOW_ITEM_TYPE_IPV4 ; ipv4_spec = item->spec; ipv4_mask = item->mask; -if (ipv4_spec && ipv4_mask) { -/* Check IPv4 mask and update input set */ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.hdr_checksum) { -rte_flow_error_set (error,EINVAL , +if (!(ipv4_spec && ipv4_mask)) +break ; + +/* Check IPv4 mask and update input set */ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid IPv4 mask." ); -return -rte_errno; - } -if (ipv4_mask->hdr.src_addr ==UINT32_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_IPV4_SRC : -ICE_INSET_IPV4_SRC ; -if (ipv4_mask->hdr.dst_addr ==UINT32_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_IPV4_DST : -ICE_INSET_IPV4_DST ; -if (ipv4_mask->hdr.type_of_service ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_TOS ; -if (ipv4_mask->hdr.time_to_live ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_TTL ; -if (ipv4_mask->hdr.next_proto_id ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_PROTO ; - - filter->input.ip.v4.dst_ip = - ipv4_spec->hdr.dst_addr; - filter->input.ip.v4.src_ip = - ipv4_spec->hdr.src_addr; - filter->input.ip.v4.tos = - ipv4_spec->hdr.type_of_service; - filter->input.ip.v4.ttl = - ipv4_spec->hdr.time_to_live; - filter->input.ip.v4.proto = - ipv4_spec->hdr.next_proto_id; +return -rte_errno; } - flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; +if (ipv4_mask->hdr.dst_addr ==UINT32_MAX ) + *input_set |=ICE_INSET_IPV4_DST ; +if (ipv4_mask->hdr.src_addr ==UINT32_MAX ) + *input_set |=ICE_INSET_IPV4_SRC ; +if (ipv4_mask->hdr.type_of_service ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_TOS ; + + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4; + p_v4->dst_ip = ipv4_spec->hdr.dst_addr; + p_v4->src_ip = ipv4_spec->hdr.src_addr; + p_v4->tos = ipv4_spec->hdr.type_of_service;break ;case RTE_FLOW_ITEM_TYPE_IPV6 : + flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; l3 =RTE_FLOW_ITEM_TYPE_IPV6 ; ipv6_spec = item->spec; ipv6_mask = item->mask; -if (ipv6_spec && ipv6_mask) { -/* Check IPv6 mask and update input set */ -if (ipv6_mask->hdr.payload_len) { -rte_flow_error_set (error,EINVAL , +if (!(ipv6_spec && ipv6_mask)) +break ; + +/* Check IPv6 mask and update input set */ +if (ipv6_mask->hdr.payload_len) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid IPv6 mask" ); -return -rte_errno; - } - -if (!memcmp (ipv6_mask->hdr.src_addr, - ipv6_addr_mask, -RTE_DIM (ipv6_mask->hdr.src_addr))) - input_set |=ICE_INSET_IPV6_SRC ; -if (!memcmp (ipv6_mask->hdr.dst_addr, - ipv6_addr_mask, -RTE_DIM (ipv6_mask->hdr.dst_addr))) - input_set |=ICE_INSET_IPV6_DST ; - -if ((ipv6_mask->hdr.vtc_flow & -rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) - ==rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) - input_set |=ICE_INSET_IPV6_TC ; -if (ipv6_mask->hdr.proto ==UINT8_MAX ) - input_set |=ICE_INSET_IPV6_NEXT_HDR ; -if (ipv6_mask->hdr.hop_limits ==UINT8_MAX ) - input_set |=ICE_INSET_IPV6_HOP_LIMIT ; - -rte_memcpy (filter->input.ip.v6.dst_ip, - ipv6_spec->hdr.dst_addr,16 ); -rte_memcpy (filter->input.ip.v6.src_ip, - ipv6_spec->hdr.src_addr,16 ); - - vtc_flow_cpu = -rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); - filter->input.ip.v6.tc = - (uint8_t )(vtc_flow_cpu >> -ICE_FDIR_IPV6_TC_OFFSET ); - filter->input.ip.v6.proto = - ipv6_spec->hdr.proto; - filter->input.ip.v6.hlim = - ipv6_spec->hdr.hop_limits; +return -rte_errno; } - flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; +if (!memcmp (ipv6_mask->hdr.src_addr, ipv6_addr_mask, +RTE_DIM (ipv6_mask->hdr.src_addr))) + *input_set |=ICE_INSET_IPV6_SRC ; +if (!memcmp (ipv6_mask->hdr.dst_addr, ipv6_addr_mask, +RTE_DIM (ipv6_mask->hdr.dst_addr))) + *input_set |=ICE_INSET_IPV6_DST ; + +if ((ipv6_mask->hdr.vtc_flow & +rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) + ==rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) + *input_set |=ICE_INSET_IPV6_TC ; +if (ipv6_mask->hdr.proto ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV6_NEXT_HDR ; +if (ipv6_mask->hdr.hop_limits ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV6_HOP_LIMIT ; + + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6; +rte_memcpy (&p_v6->dst_ip, ipv6_spec->hdr.dst_addr,16 ); +rte_memcpy (&p_v6->src_ip, ipv6_spec->hdr.src_addr,16 ); + vtc_flow_cpu =rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); + p_v6->tc = (uint8_t )(vtc_flow_cpu >>ICE_FDIR_IPV6_TC_OFFSET ); + p_v6->proto = ipv6_spec->hdr.proto; + p_v6->hlim = ipv6_spec->hdr.hop_limits;break ;case RTE_FLOW_ITEM_TYPE_TCP : - tcp_spec = item->spec; - tcp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_TCP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_TCP ; -if (tcp_spec && tcp_mask) { -/* Check TCP mask and update input set */ -if (tcp_mask->hdr.sent_seq || - tcp_mask->hdr.recv_ack || - tcp_mask->hdr.data_off || - tcp_mask->hdr.tcp_flags || - tcp_mask->hdr.rx_win || - tcp_mask->hdr.cksum || - tcp_mask->hdr.tcp_urp) { -rte_flow_error_set (error,EINVAL , + tcp_spec = item->spec; + tcp_mask = item->mask; + +if (!(tcp_spec && tcp_mask)) +break ; + +/* Check TCP mask and update input set */ +if (tcp_mask->hdr.sent_seq || + tcp_mask->hdr.recv_ack || + tcp_mask->hdr.data_off || + tcp_mask->hdr.tcp_flags || + tcp_mask->hdr.rx_win || + tcp_mask->hdr.cksum || + tcp_mask->hdr.tcp_urp) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid TCP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (tcp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_TCP_SRC_PORT : -ICE_INSET_TCP_SRC_PORT ; -if (tcp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_TCP_DST_PORT : -ICE_INSET_TCP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - tcp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - tcp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.dst_port = - tcp_spec->hdr.dst_port; - filter->input.ip.v6.src_port = - tcp_spec->hdr.src_port; - } +if (tcp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_TCP_SRC_PORT ; +if (tcp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_TCP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { + p_v4->dst_port = tcp_spec->hdr.dst_port; + p_v4->src_port = tcp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { + p_v6->dst_port = tcp_spec->hdr.dst_port; + p_v6->src_port = tcp_spec->hdr.src_port; }break ;case RTE_FLOW_ITEM_TYPE_UDP : - udp_spec = item->spec; - udp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_UDP ; -if (udp_spec && udp_mask) { -/* Check UDP mask and update input set*/ -if (udp_mask->hdr.dgram_len || - udp_mask->hdr.dgram_cksum) { -rte_flow_error_set (error,EINVAL , + udp_spec = item->spec; + udp_mask = item->mask; + +if (!(udp_spec && udp_mask)) +break ; + +/* Check UDP mask and update input set*/ +if (udp_mask->hdr.dgram_len || + udp_mask->hdr.dgram_cksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid UDP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (udp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_UDP_SRC_PORT : -ICE_INSET_UDP_SRC_PORT ; -if (udp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_UDP_DST_PORT : -ICE_INSET_UDP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - udp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - udp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.src_port = - udp_spec->hdr.src_port; - filter->input.ip.v6.dst_port = - udp_spec->hdr.dst_port; - } +if (udp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_UDP_SRC_PORT ; +if (udp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_UDP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { + p_v4->dst_port = udp_spec->hdr.dst_port; + p_v4->src_port = udp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { + p_v6->src_port = udp_spec->hdr.src_port; + p_v6->dst_port = udp_spec->hdr.dst_port; }break ;case RTE_FLOW_ITEM_TYPE_SCTP : - sctp_spec = item->spec; - sctp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_SCTP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_SCTP ; -if (sctp_spec && sctp_mask) { -/* Check SCTP mask and update input set */ -if (sctp_mask->hdr.cksum) { -rte_flow_error_set (error,EINVAL , + sctp_spec = item->spec; + sctp_mask = item->mask; + +if (!(sctp_spec && sctp_mask)) +break ; + +/* Check SCTP mask and update input set */ +if (sctp_mask->hdr.cksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid UDP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (sctp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_SCTP_SRC_PORT : -ICE_INSET_SCTP_SRC_PORT ; -if (sctp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_SCTP_DST_PORT : -ICE_INSET_SCTP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - sctp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - sctp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.dst_port = - sctp_spec->hdr.dst_port; - filter->input.ip.v6.src_port = - sctp_spec->hdr.src_port; - } +if (sctp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_SCTP_SRC_PORT ; +if (sctp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_SCTP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { + p_v4->dst_port = sctp_spec->hdr.dst_port; + p_v4->src_port = sctp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { + p_v6->dst_port = sctp_spec->hdr.dst_port; + p_v6->src_port = sctp_spec->hdr.src_port; }break ;case RTE_FLOW_ITEM_TYPE_VOID :
@@ -1946,6 +1935,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, l3 =RTE_FLOW_ITEM_TYPE_END ; vxlan_spec = item->spec; vxlan_mask = item->mask; + is_outer = false;if (vxlan_spec || vxlan_mask) { rte_flow_error_set(error, EINVAL,
@@ -1955,50 +1945,50 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,return -rte_errno; } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ;break ;case RTE_FLOW_ITEM_TYPE_GTPU : l3 =RTE_FLOW_ITEM_TYPE_END ; gtp_spec = item->spec; gtp_mask = item->mask; + is_outer = false; -if (gtp_spec && gtp_mask) { -if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len) { -rte_flow_error_set (error,EINVAL , +if (!(gtp_spec && gtp_mask)) +break ; + +if (gtp_mask->v_pt_rsv_flags || + gtp_mask->msg_type || + gtp_mask->msg_len) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid GTP mask" ); -return -rte_errno; - } - -if (gtp_mask->teid ==UINT32_MAX ) - input_set |=ICE_INSET_GTPU_TEID ; - - filter->input.gtpu_data.teid = gtp_spec->teid; +return -rte_errno; } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; +if (gtp_mask->teid ==UINT32_MAX ) + *input_set |=ICE_INSET_GTPU_TEID ; + + filter->input.gtpu_data.teid = gtp_spec->teid;break ;case RTE_FLOW_ITEM_TYPE_GTP_PSC : gtp_psc_spec = item->spec; gtp_psc_mask = item->mask; + is_outer = false; -if (gtp_psc_spec && gtp_psc_mask) { -if (gtp_psc_mask->qfi ==UINT8_MAX ) - input_set |=ICE_INSET_GTPU_QFI ; +if (!(gtp_psc_spec && gtp_psc_mask)) +break ; - filter->input.gtpu_data.qfi = - gtp_psc_spec->qfi; - } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; +if (gtp_psc_mask->qfi ==UINT8_MAX ) + *input_set |=ICE_INSET_GTPU_QFI ; + + filter->input.gtpu_data.qfi = + gtp_psc_spec->qfi;break ;default :rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Invalid pattern item." ); +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid pattern item." );return -rte_errno; } }
@@ -2018,7 +2008,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; - filter->input_set = input_set; + filter->input_set = input_set_l; + filter->outer_input_set = input_set_f;return 0 ; }
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser
Quoted 57 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, December 21, 2020 2:52 PM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 2/5] net/ice: refactor flow pattern parserDistinguish inner/outer input set. And avoid too many nested conditionals in each type's parser.
input_set_fis used for outer fields,input_set_lis used for inner or non-tunnel fields.Signed-off-by Zhirun Yan <[email protected]>--- drivers/net/ice/ice_fdir_filter.c | 467 +++++++++++++++--------------- 1 file changed, 229 insertions(+), 238 deletions(-)drivers/net/ice/ice_fdir_filter.c +19
-1@@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask;const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; -uint64_t input_set =ICE_INSET_NONE ; +uint64_t input_set_l =ICE_INSET_NONE ; +uint64_t input_set_f =ICE_INSET_NONE ; +uint64_t *input_set;uint8_t flow_type =ICE_FLTR_PTYPE_NONF_NONE ;uint8_t ipv6_addr_mask[16 ] = {0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,@@ -1655,289 +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,uint32_t vtc_flow_cpu;uint16_t ether_type;enum rte_flow_item_type next_type; +bool is_outer = true; +struct ice_fdir_extra *p_ext_data; +struct ice_fdir_v4 *p_v4; +struct ice_fdir_v6 *p_v6; +for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) { +if (item->type ==RTE_FLOW_ITEM_TYPE_VXLAN ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTPU ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTP_PSC ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; + } + +/* This loop parse flow pattern and distinguish Non-tunnel and tunnel +* flow. input_set_l is used for non-tunnel and tunnel inner part. +*/
...
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1688
Quoted 3 lines
drivers/net/ice/ice_fdir_filter.c +2
-0+ input_set = (tunnel_type && is_outer) ? + &input_set_f : &input_set_l;
[Cao, Yahui] input_set_l used for inner filed or non-tunnel filed looks confusing, can we just use input_set_l as non-tunnel filed or tunnel outer field ?
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1698
Quoted 10 lines
drivers/net/ice/ice_fdir_filter.c +10
-0+ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4; +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6; +
[Cao, Yahui] p_v4 and p_v6 pointer assignment looks redundant since it will be assigned in IPV4 and IPV6 switch case statement.
Quoted 1 line
switch (
item_type) {
...
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1693
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4
-0+ + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4;
[Cao, Yahui] it is assigned here again
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +3
-0+ p_v4->dst_ip = ipv4_spec->hdr.dst_addr; + p_v4->src_ip = ipv4_spec->hdr.src_addr; + p_v4->tos = ipv4_spec->hdr.type_of_service;break ;
......
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1697
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4
-0+ + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6;
[Cao, Yahui] it is assigned here again
Quoted 7 lines
drivers/net/ice/ice_fdir_filter.c +6
-0+rte_memcpy (&p_v6->dst_ip, ipv6_spec->hdr.dst_addr,16 ); +rte_memcpy (&p_v6->src_ip, ipv6_spec->hdr.src_addr,16 ); + vtc_flow_cpu =rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); + p_v6->tc = (uint8_t )(vtc_flow_cpu >>ICE_FDIR_IPV6_TC_OFFSET ); + p_v6->proto = ipv6_spec->hdr.proto; + p_v6->hlim = ipv6_spec->hdr.hop_limits;break ;
......
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 2012
Quoted 5 lines
drivers/net/ice/ice_fdir_filter.c +2
-1filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; - filter->input_set = input_set; + filter->input_set = input_set_l; + filter->outer_input_set = input_set_f;
[Cao, Yahui] Correspondingly here, input_set and outer_input_set naming is also confusing.
Quoted 5 lines
return 0;
}
--
2.25.1
Re: [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser
Quoted 79 lines
-----Original Message-----
From: Cao, Yahui
Sent: Friday, December 25, 2020 1:22 PM
To: Yan, Zhirun <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>
Subject: RE: [PATCH v1 2/5] net/ice: refactor flow pattern parserdrivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct
Quoted 27 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, December 21, 2020 2:52 PM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 2/5] net/ice: refactor flow pattern parserDistinguish inner/outer input set. And avoid too many nested conditionals in each type's parser.
input_set_fis used for outer fields,input_set_lis used for inner or non-tunnel fields.Signed-off-by Zhirun Yan <[email protected]>--- drivers/net/ice/ice_fdir_filter.c | 467 +++++++++++++++--------------- 1 file changed, 229 insertions(+), 238 deletions(-)drivers/net/ice/ice_fdir_filter.c +0
-0@@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct
ice_adapter*ad,drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
Quoted 11 lines
drivers/net/ice/ice_fdir_filter.c +4
-1const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask;const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; -uint64_t input_set =ICE_INSET_NONE ; +uint64_t input_set_l =ICE_INSET_NONE ; +uint64_t input_set_f =ICE_INSET_NONE ; +uint64_t *input_set;uint8_t flow_type =ICE_FLTR_PTYPE_NONF_NONE ; uint8_t ipv6_addr_mask[16] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -1655,289 +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter*ad,
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
Quoted 9 lines
drivers/net/ice/ice_fdir_filter.c +5
-0uint32_t vtc_flow_cpu;uint16_t ether_type;enum rte_flow_item_type next_type; +bool is_outer = true; +struct ice_fdir_extra *p_ext_data; +struct ice_fdir_v4 *p_v4; +struct ice_fdir_v6 *p_v6; + for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END;item++) {
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
Quoted 9 lines
drivers/net/ice/ice_fdir_filter.c +9
-0+if (item->type ==RTE_FLOW_ITEM_TYPE_VXLAN ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTPU ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTP_PSC ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; + } + +/* This loop parse flow pattern and distinguish Non-tunnel and tunnel
Quoted 2 lines
drivers/net/ice/ice_fdir_filter.c +2
-0+* flow. input_set_l is used for non-tunnel and tunnel inner part. +*/ ...
Quoted 1 line
Quoted 5 lines
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1688
Quoted 2 lines
drivers/net/ice/ice_fdir_filter.c +2
-0+ input_set = (tunnel_type && is_outer) ? + &input_set_f : &input_set_l;[Cao, Yahui]
input_set_lused for inner filed or non-tunnel filed looks confusing, can we just useinput_set_las non-tunnel filed or tunnel outer field ?
Yes, both are OK.
In my view, Non-tunnel and inner part have no tunnel layer info, they can be the same definition. But for tunnel type, the outer part is different. It may contain tunnel layer info like VNI in VXLAN. Only this part is specific with tunnel type.
Quoted 4 lines
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4
-0+ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 :
Quoted 8 lines
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1698
Quoted 6 lines
drivers/net/ice/ice_fdir_filter.c +6
-0+ &filter->input.ip.v4; +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6; +[Cao, Yahui]
p_v4andp_v6pointer assignment looks redundant since it will be assigned in IPV4 and IPV6 switch case statement.
If L3 has no fields, then we could not know whether it is ipv4 or ipv6 for L4 case. You are right. The p_v4/6 assignment can be set earlier in L3 layer parse.
Quoted 8 lines
Quoted 1 line
switch (
item_type) {...
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1693
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4
-0+ + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4;[Cao, Yahui] it is assigned here again
Yes, I will move this earlier when set flow item type.
Quoted 11 lines
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +3
-0+ p_v4->dst_ip = ipv4_spec->hdr.dst_addr; + p_v4->src_ip = ipv4_spec->hdr.src_addr; + p_v4->tos = ipv4_spec->hdr.type_of_service;break ;......
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1697
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4
-0+ + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6;[Cao, Yahui] it is assigned here again
Yes, I will fix it.
Quoted 12 lines
drivers/net/ice/ice_fdir_filter.c
Quoted 7 lines
drivers/net/ice/ice_fdir_filter.c +1
-0+ rte_memcpy(&p_v6->dst_ip, ipv6_spec-hdr.dst_addr, 16);
drivers/net/ice/ice_fdir_filter.c +1
-0+ rte_memcpy(&p_v6->src_ip, ipv6_spec-hdr.src_addr, 16);
drivers/net/ice/ice_fdir_filter.c +1
-0+ vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec-hdr.vtc_flow);
drivers/net/ice/ice_fdir_filter.c +1
-0+ p_v6->tc = (uint8_t)(vtc_flow_cpu >>
ICE_FDIR_IPV6_TC_OFFSET);Quoted 3 lines
drivers/net/ice/ice_fdir_filter.c +2
-0+ p_v6->proto = ipv6_spec->hdr.proto; + p_v6->hlim = ipv6_spec->hdr.hop_limits;break ;......
Quoted 7 lines
drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 2012
Quoted 5 lines
drivers/net/ice/ice_fdir_filter.c +2
-1filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; - filter->input_set = input_set; + filter->input_set = input_set_l; + filter->outer_input_set = input_set_f;[Cao, Yahui] Correspondingly here,
input_setandouter_input_setnaming is also confusing.
input_set is used for tunnel inner part and non-tunnel type. outer_input_set is only for tunnel outer part. Thanks.
Quoted 5 lines
Quoted 5 lines
return 0;
}
--
2.25.1
PATCH 3/5 net/ice: add outer input set mask to distinguish outer fields
In reply to Zhirun YanAdd 64-bit input_set_mask_f for outer input set. input_set_mask_f is used for inner fields or non-tunnel fields. Adjust indentation of ice_pattern_match_item list in switch, RSS and FDIR for easy review. For fields in tunnel layer, like GTPU TEID, put them in outer part.
--- drivers/net/ice/ice_fdir_filter.c | 110 ++++----- drivers/net/ice/ice_generic_flow.h | 1 + drivers/net/ice/ice_hash.c | 192 ++++++--------- drivers/net/ice/ice_switch_filter.c | 348 ++++++++++------------------ 4 files changed, 231 insertions(+), 420 deletions(-)
drivers/net/ice/ice_fdir_filter.c +46 -64
@@ -55,92 +55,74 @@ ICE_FDIR_INSET_ETH_IPV6 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -#define ICE_FDIR_INSET_VXLAN_IPV4 (\ +#define ICE_FDIR_INSET_VXLAN_IPV4_L (\ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST) -#define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\ - ICE_FDIR_INSET_VXLAN_IPV4 | \ +#define ICE_FDIR_INSET_VXLAN_IPV4_TCP_L (\ + ICE_FDIR_INSET_VXLAN_IPV4_L | \ ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT) -#define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\ - ICE_FDIR_INSET_VXLAN_IPV4 | \ +#define ICE_FDIR_INSET_VXLAN_IPV4_UDP_L (\ + ICE_FDIR_INSET_VXLAN_IPV4_L | \ ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT) -#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\ - ICE_FDIR_INSET_VXLAN_IPV4 | \ +#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L (\ + ICE_FDIR_INSET_VXLAN_IPV4_L | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) -#define ICE_FDIR_INSET_IPV4_GTPU (\ +#define ICE_FDIR_INSET_IPV4_GTPU_F (\ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID) -#define ICE_FDIR_INSET_IPV4_GTPU_EH (\ +#define ICE_FDIR_INSET_IPV4_GTPU_EH_F (\ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \ ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI) -#define ICE_FDIR_INSET_IPV6_GTPU (\ +#define ICE_FDIR_INSET_IPV6_GTPU_F (\ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | ICE_INSET_GTPU_TEID) -#define ICE_FDIR_INSET_IPV6_GTPU_EH (\ +#define ICE_FDIR_INSET_IPV6_GTPU_EH_F (\ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \ ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI)static struct ice_pattern_match_item ice_fdir_pattern_os[] = { - {pattern_eth_ipv4,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp,ICE_FDIR_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_tcp,ICE_FDIR_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_sctp,ICE_FDIR_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv6,ICE_FDIR_INSET_ETH_IPV6 ,ICE_INSET_NONE }, - {pattern_eth_ipv6_udp,ICE_FDIR_INSET_ETH_IPV6_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv6_tcp,ICE_FDIR_INSET_ETH_IPV6_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv6_sctp,ICE_FDIR_INSET_ETH_IPV6_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4, -ICE_FDIR_INSET_VXLAN_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4_udp, -ICE_FDIR_INSET_VXLAN_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, -ICE_FDIR_INSET_VXLAN_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, -ICE_FDIR_INSET_VXLAN_IPV4_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, -ICE_FDIR_INSET_VXLAN_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, -ICE_FDIR_INSET_VXLAN_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, -ICE_FDIR_INSET_VXLAN_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, -ICE_FDIR_INSET_VXLAN_IPV4_SCTP ,ICE_INSET_NONE }, + {pattern_eth_ipv4,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, + {pattern_eth_ipv6,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV6 ,ICE_INSET_NONE }, + {pattern_eth_ipv6_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV6_UDP ,ICE_INSET_NONE }, + {pattern_eth_ipv6_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV6_TCP ,ICE_INSET_NONE }, + {pattern_eth_ipv6_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV6_SCTP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_UDP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_TCP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_UDP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_TCP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L ,ICE_INSET_NONE }, };static struct ice_pattern_match_item ice_fdir_pattern_comms[] = { - {pattern_ethertype,ICE_FDIR_INSET_ETH ,ICE_INSET_NONE }, - {pattern_eth_ipv4,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp,ICE_FDIR_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_tcp,ICE_FDIR_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_sctp,ICE_FDIR_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv6,ICE_FDIR_INSET_ETH_IPV6 ,ICE_INSET_NONE }, - {pattern_eth_ipv6_udp,ICE_FDIR_INSET_ETH_IPV6_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv6_tcp,ICE_FDIR_INSET_ETH_IPV6_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv6_sctp,ICE_FDIR_INSET_ETH_IPV6_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4, -ICE_FDIR_INSET_VXLAN_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4_udp, -ICE_FDIR_INSET_VXLAN_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, -ICE_FDIR_INSET_VXLAN_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, -ICE_FDIR_INSET_VXLAN_IPV4_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, -ICE_FDIR_INSET_VXLAN_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, -ICE_FDIR_INSET_VXLAN_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, -ICE_FDIR_INSET_VXLAN_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, -ICE_FDIR_INSET_VXLAN_IPV4_SCTP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_gtpu,ICE_FDIR_INSET_IPV4_GTPU ,ICE_INSET_NONE }, - {pattern_eth_ipv4_gtpu_eh,ICE_FDIR_INSET_IPV4_GTPU_EH ,ICE_INSET_NONE }, - {pattern_eth_ipv6_gtpu,ICE_FDIR_INSET_IPV6_GTPU ,ICE_INSET_NONE }, - {pattern_eth_ipv6_gtpu_eh,ICE_FDIR_INSET_IPV6_GTPU_EH ,ICE_INSET_NONE }, + {pattern_ethertype,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH ,ICE_INSET_NONE }, + {pattern_eth_ipv4,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4 ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, + {pattern_eth_ipv6,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV6 ,ICE_INSET_NONE }, + {pattern_eth_ipv6_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_ETH_IPV6_UDP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_UDP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_TCP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_ipv4_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_UDP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_TCP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,ICE_INSET_NONE ,ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L ,ICE_INSET_NONE }, + {pattern_eth_ipv4_gtpu,ICE_FDIR_INSET_IPV4_GTPU_F ,ICE_INSET_NONE ,ICE_INSET_NONE }, + {pattern_eth_ipv4_gtpu_eh,ICE_FDIR_INSET_IPV4_GTPU_EH_F ,ICE_INSET_NONE ,ICE_INSET_NONE }, + {pattern_eth_ipv6_gtpu,ICE_FDIR_INSET_IPV6_GTPU_F ,ICE_INSET_NONE ,ICE_INSET_NONE }, + {pattern_eth_ipv6_gtpu_eh,ICE_FDIR_INSET_IPV6_GTPU_EH_F ,ICE_INSET_NONE ,ICE_INSET_NONE }, };static struct ice_flow_parser ice_fdir_parser_os;
drivers/net/ice/ice_generic_flow.h +1 -0
@@ -473,6 +473,7 @@ enum ice_flow_classification_stage {struct ice_pattern_match_item {enum rte_flow_item_type *pattern_list;/* pattern_list must end with RTE_FLOW_ITEM_TYPE_END */ +uint64_t input_set_mask_f;uint64_t input_set_mask;void *meta; };
drivers/net/ice/ice_hash.c +67 -125
202 lines not on this page · raw message
drivers/net/ice/ice_switch_filter.c +117 -231
378 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields
Quoted 31 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, December 21, 2020 2:52 PM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fieldsAdd 64-bit
input_set_mask_ffor outer input set.input_set_mask_fis used for inner fields or non-tunnel fields. Adjust indentation ofice_pattern_match_itemlist in switch, RSS and FDIR for easy review. For fields in tunnel layer, like GTPU TEID, put them in outer part.Signed-off-by Zhirun Yan <[email protected]>--- drivers/net/ice/ice_fdir_filter.c | 110 ++++----- drivers/net/ice/ice_generic_flow.h | 1 + drivers/net/ice/ice_hash.c | 192 ++++++--------- drivers/net/ice/ice_switch_filter.c | 348 ++++++++++------------------ 4 files changed, 231 insertions(+), 420 deletions(-)drivers/net/ice/ice_fdir_filter.c +0
-0@@ -55,92 +55,74 @@
...
Quoted 8 lines
drivers/net/ice/ice_fdir_filter.c +7
-0+ {pattern_eth_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV4, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV4_UDP, ICE_INSET_NONE}, + {pattern_eth_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV4_TCP, ICE_INSET_NONE}, + {pattern_eth_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE}, + {pattern_eth_ipv6, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6, ICE_INSET_NONE}, + {pattern_eth_ipv6_udp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_UDP, ICE_INSET_NONE}, + {pattern_eth_ipv6_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_TCP, ICE_INSET_NONE},
drivers/net/ice/ice_fdir_filter.c line 104
Quoted 10 lines
drivers/net/ice/ice_fdir_filter.c +9
-0+ {pattern_eth_ipv6_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_SCTP, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, };
[Cao, Yahui] Why is the mask put in the 3rd column instead of 2nd column ? I prefer the way that 2nd column is for outer field and 3rd column is for inner field.
Quoted 4 lines
static int
--
2.25.1
Re: [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields
Quoted 96 lines
-----Original Message-----
From: Cao, Yahui
Sent: Friday, December 25, 2020 1:28 PM
To: Yan, Zhirun <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>
Subject: RE: [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fieldsQuoted 33 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, December 21, 2020 2:52 PM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fieldsAdd 64-bit
input_set_mask_ffor outer input set.input_set_mask_fis used for inner fields or non-tunnel fields. Adjust indentation ofice_pattern_match_itemlist in switch, RSS and FDIR for easy review. For fields in tunnel layer, like GTPU TEID, put them in outer part.Signed-off-by Zhirun Yan <[email protected]>--- drivers/net/ice/ice_fdir_filter.c | 110 ++++----- drivers/net/ice/ice_generic_flow.h | 1 + drivers/net/ice/ice_hash.c | 192 ++++++--------- drivers/net/ice/ice_switch_filter.c | 348 ++++++++++------------------ 4 files changed, 231 insertions(+), 420 deletions(-)drivers/net/ice/ice_fdir_filter.c +0
-0@@ -55,92 +55,74 @@...
drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4, ICE_INSET_NONE,ICE_FDIR_INSET_ETH_IPV4, ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp,
ICE_INSET_NONE,ICE_FDIR_INSET_ETH_IPV4_UDP,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_tcp,ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV4_TCP, ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_sctp,
ICE_INSET_NONE,ICE_FDIR_INSET_ETH_IPV4_SCTP,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv6, ICE_INSET_NONE,ICE_FDIR_INSET_ETH_IPV6, ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv6_udp,
ICE_INSET_NONE,ICE_FDIR_INSET_ETH_IPV6_UDP,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv6_tcp,ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_TCP, ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv6_sctp,
ICE_INSET_NONE,ICE_FDIR_INSET_ETH_IPV6_SCTP,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_INSET_NONE,
ICE_FDIR_INSET_VXLAN_IPV4_L,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_ipv4_udp,
ICE_INSET_NONE,ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_ipv4_tcp,
ICE_INSET_NONE,ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_ipv4_sctp,
ICE_INSET_NONE,ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4,ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_INSET_NONE,
ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_INSET_NONE,
ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,
ICE_INSET_NONE},drivers/net/ice/ice_fdir_filter.c
Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1
-0+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_INSET_NONE,
ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,
ICE_INSET_NONE},
Quoted 6 lines
Quoted 2 lines
};
[Cao, Yahui] Why is the mask put in the 3rd column instead of 2nd column ? I prefer the way that 2nd column is for outer field and 3rd column is for inner field.
Both are OK. But for my way, the 2nd column is only for tunnel outer. The 3rd can be reused by non-tunnel and tunnel inner part. I will redefine the macro.
Quoted 4 lines
Quoted 4 lines
static int
--
2.25.1
PATCH 4/5 net/ice: add outer input set mask check
In reply to Zhirun YanDistinguish input set mask for inner/outer. Add outer input set mask check.
--- drivers/net/ice/ice_fdir_filter.c | 3 ++- drivers/net/ice/ice_generic_flow.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ice/ice_fdir_filter.c +2 -1
@@ -2020,7 +2020,8 @@ ice_fdir_parse(struct ice_adapter *ad,if (ret) goto error; input_set = filter->input_set | filter->outer_input_set; -if (!input_set || input_set & ~item->input_set_mask) { +if (!input_set || filter->input_set & ~item->input_set_mask || + filter->outer_input_set & ~item->input_set_mask_f) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
drivers/net/ice/ice_generic_flow.c +2 -0
@@ -2088,6 +2088,8 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[], items)) { pattern_match_item->input_set_mask = array[i].input_set_mask; + pattern_match_item->input_set_mask_f = + array[i].input_set_mask_f; pattern_match_item->pattern_list = array[i].pattern_list; pattern_match_item->meta = array[i].meta;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check
I suggest that you can merge this commit into the Patch 3/5, since they are all about input set mask changes.
Quoted 47 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, December 21, 2020 2:52 PM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 4/5] net/ice: add outer input set mask checkDistinguish input set mask for inner/outer. Add outer input set mask check.
Signed-off-by Zhirun Yan <[email protected]>--- drivers/net/ice/ice_fdir_filter.c | 3 ++- drivers/net/ice/ice_generic_flow.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/net/ice/ice_fdir_filter.c +2
-1@@ -2020,7 +2020,8 @@ ice_fdir_parse(struct ice_adapter *ad,if (ret) goto error; input_set = filter->input_set | filter->outer_input_set; -if (!input_set || input_set & ~item->input_set_mask) { +if (!input_set || filter->input_set & ~item->input_set_mask || + filter->outer_input_set & ~item->input_set_mask_f) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,drivers/net/ice/ice_generic_flow.c +2
-1@@ -2088,6 +2088,8 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[], items)) { pattern_match_item->input_set_mask = array[i].input_set_mask; + pattern_match_item->input_set_mask_f = + array[i].input_set_mask_f; pattern_match_item->pattern_list = array[i].pattern_list; pattern_match_item->meta = array[i].meta; --2.25.1
Re: [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check
Quoted 12 lines
-----Original Message-----
From: Cao, Yahui
Sent: Friday, December 25, 2020 1:29 PM
To: Yan, Zhirun <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>
Subject: RE: [PATCH v1 4/5] net/ice: add outer input set mask check
Quoted 3 lines
I suggest that you can merge this commit into the Patch 3/5, since they are all about input set mask changes.
Yes. I will meld into previous commit. Thanks.
Quoted 52 lines
drivers/net/ice/ice_generic_flow.c ice_search_pattern_match_item(const struct
Quoted 41 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, December 21, 2020 2:52 PM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 4/5] net/ice: add outer input set mask checkDistinguish input set mask for inner/outer. Add outer input set mask check.
Signed-off-by Zhirun Yan <[email protected]>--- drivers/net/ice/ice_fdir_filter.c | 3 ++- drivers/net/ice/ice_generic_flow.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/net/ice/ice_fdir_filter.c +2
-1@@ -2020,7 +2020,8 @@ ice_fdir_parse(struct ice_adapter *ad,if (ret) goto error; input_set = filter->input_set | filter->outer_input_set; -if (!input_set || input_set & ~item->input_set_mask) { +if (!input_set || filter->input_set & ~item->input_set_mask || + filter->outer_input_set & ~item->input_set_mask_f) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,drivers/net/ice/ice_generic_flow.c +0
-0@@ -2088,6 +2088,8 @@ ice_search_pattern_match_item(const struct
rte_flow_itempattern[],Quoted 10 lines
drivers/net/ice/ice_generic_flow.c +2
-1items)) { pattern_match_item->input_set_mask = array[i].input_set_mask; + pattern_match_item->input_set_mask_f = + array[i].input_set_mask_f; pattern_match_item->pattern_list = array[i].pattern_list; pattern_match_item->meta = array[i].meta; --2.25.1
PATCH 5/5 net/ice: enable FDIR outer/inner fields for VXLAN
In reply to Zhirun YanEnable FDIR outer fields L2/L3 fields and inner L2/L3 for VXLAN.
--- drivers/net/ice/ice_fdir_filter.c | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/net/ice/ice_fdir_filter.c +21 -16
@@ -55,7 +55,12 @@ ICE_FDIR_INSET_ETH_IPV6 | \ ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) +#define ICE_FDIR_INSET_VXLAN_IPV4_F (\ + ICE_FDIR_INSET_ETH | \ + ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST) +#define ICE_FDIR_INSET_VXLAN_IPV4_L (\ + ICE_FDIR_INSET_ETH | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)#define ICE_FDIR_INSET_VXLAN_IPV4_TCP_L (\
@@ -93,14 +98,14 @@ static struct ice_pattern_match_item ice_fdir_pattern_os[] = { {pattern_eth_ipv6_udp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_UDP, ICE_INSET_NONE}, {pattern_eth_ipv6_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_TCP, ICE_INSET_NONE}, {pattern_eth_ipv6_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_SCTP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_udp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, }; static struct ice_pattern_match_item ice_fdir_pattern_comms[] = {
@@ -111,14 +116,14 @@ static struct ice_pattern_match_item ice_fdir_pattern_comms[] = { {pattern_eth_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE}, {pattern_eth_ipv6, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6, ICE_INSET_NONE}, {pattern_eth_ipv6_udp, ICE_INSET_NONE, ICE_FDIR_INSET_ETH_IPV6_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_INSET_NONE, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_udp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, ICE_INSET_NONE}, + {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_FDIR_INSET_VXLAN_IPV4_F, ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, ICE_INSET_NONE}, {pattern_eth_ipv4_gtpu, ICE_FDIR_INSET_IPV4_GTPU_F, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_eth_ipv4_gtpu_eh, ICE_FDIR_INSET_IPV4_GTPU_EH_F, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_eth_ipv6_gtpu, ICE_FDIR_INSET_IPV6_GTPU_F, ICE_INSET_NONE, ICE_INSET_NONE},
Signature · 1 line
2.25.1
v2 cover Refactor FDIR pattern parser
In reply to Zhirun YanV2:
Meld patch 4,5 into 3.
Update ACL input set.
Clear PPPoE GTPU input set in RSS.
Put p_v4/6 assignment earlier to reduce redundant code in FDIR.
This patch set refactor FDIR pattern parser.
Redefine input set. Ignore the redundant inner/outer info. Align the parser action with hardware, using input_set_f for outer, input_set_l for inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.
Zhirun Yan (3):
net/ice: clean input set macro definition
net/ice: refactor flow pattern parser
net/ice: add outer input set mask to distinguish outer fields
drivers/net/ice/ice_acl_filter.c | 8 +- drivers/net/ice/ice_fdir_filter.c | 558 ++++++++++++++-------------- drivers/net/ice/ice_generic_flow.c | 2 + drivers/net/ice/ice_generic_flow.h | 235 +++++------- drivers/net/ice/ice_hash.c | 243 ++++++------ drivers/net/ice/ice_switch_filter.c | 294 +++++---------- 6 files changed, 590 insertions(+), 750 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/3 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 ccould 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.
--- drivers/net/ice/ice_fdir_filter.c | 8 +- drivers/net/ice/ice_generic_flow.h | 234 ++++++++++++----------------- 2 files changed, 104 insertions(+), 138 deletions(-)
drivers/net/ice/ice_fdir_filter.c +4 -4
@@ -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)
drivers/net/ice/ice_generic_flow.h +100 -134
277 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 2/3 net/ice: refactor flow pattern parser
In reply to Zhirun YanDistinguish inner/outer input_set. And avoid too many nested conditionals in each type's parser. input_set_f is used for outer fields, input_set_l is used for inner or non-tunnel fields.
To align with shared code behavior, set GTPU as non-tunnel flow. Ideally, GTPU packet should be parsed as tunnel and QFI, TEID should set into input_set_f.
todo:
1. Distinguish gtpu input set. Put QFI, TEID into input set outer.
--- drivers/net/ice/ice_fdir_filter.c | 478 +++++++++++++++--------------- 1 file changed, 239 insertions(+), 239 deletions(-)
drivers/net/ice/ice_fdir_filter.c +239 -239
@@ -1610,7 +1610,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask;const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; -uint64_t input_set =ICE_INSET_NONE ; +uint64_t input_set_l =ICE_INSET_NONE ;/* non-tunnel and tunnel inner */ +uint64_t input_set_f =ICE_INSET_NONE ;/* only for tunnel outer */ +uint64_t *input_set;uint8_t flow_type =ICE_FLTR_PTYPE_NONF_NONE ;uint8_t ipv6_addr_mask[16 ] = {0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,
@@ -1619,289 +1621,283 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,uint32_t vtc_flow_cpu;uint16_t ether_type;enum rte_flow_item_type next_type; +bool is_outer = true; +struct ice_fdir_extra *p_ext_data; +struct ice_fdir_v4 *p_v4 =NULL ; +struct ice_fdir_v6 *p_v6 =NULL ; +for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) { +if (item->type ==RTE_FLOW_ITEM_TYPE_VXLAN ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ; +if (item->type ==RTE_FLOW_ITEM_TYPE_GTPU ) { + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; + is_outer = false; + } +if (item->type ==RTE_FLOW_ITEM_TYPE_GTP_PSC ) { + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; + is_outer = false; + } + } + +/* This loop parse flow pattern and distinguish Non-tunnel and tunnel +* flow. input_set_l is used for non-tunnel and tunnel inner part. +*/ for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) {if (item->last) {rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Not support range" ); +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Not support range" );return -rte_errno; } item_type = item->type; + input_set = (tunnel_type && is_outer) ? + &input_set_f : &input_set_l; +switch (item_type) {case RTE_FLOW_ITEM_TYPE_ETH : + flow_type =ICE_FLTR_PTYPE_NON_IP_L2 ; eth_spec = item->spec; eth_mask = item->mask; - next_type = (item +1 )->type; -if (eth_spec && eth_mask) { -if (!rte_is_zero_ether_addr (ð_mask->dst)) { - input_set |=ICE_INSET_DMAC ; -rte_memcpy (&filter->input.ext_data.dst_mac, - ð_spec->dst, -RTE_ETHER_ADDR_LEN ); - } +if (!(eth_spec && eth_mask)) +break ; -if (!rte_is_zero_ether_addr (ð_mask->src)) { - input_set |=ICE_INSET_SMAC ; -rte_memcpy (&filter->input.ext_data.src_mac, - ð_spec->src, -RTE_ETHER_ADDR_LEN ); - } +if (!rte_is_zero_ether_addr (ð_mask->dst)) + *input_set |=ICE_INSET_DMAC ; +if (!rte_is_zero_ether_addr (ð_mask->src)) + *input_set |=ICE_INSET_SMAC ; -/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */ -if (eth_mask->type ==RTE_BE16 (0xffff ) && - next_type ==RTE_FLOW_ITEM_TYPE_END ) { - input_set |=ICE_INSET_ETHERTYPE ; - ether_type =rte_be_to_cpu_16 (eth_spec->type); - -if (ether_type ==RTE_ETHER_TYPE_IPV4 || - ether_type ==RTE_ETHER_TYPE_IPV6 ) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Unsupported ether_type." ); -return -rte_errno; - } - -rte_memcpy (&filter->input.ext_data.ether_type, - ð_spec->type, -sizeof (eth_spec->type)); - flow_type =ICE_FLTR_PTYPE_NON_IP_L2 ; + next_type = (item +1 )->type; +/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */ +if (eth_mask->type ==RTE_BE16 (0xffff ) && + next_type ==RTE_FLOW_ITEM_TYPE_END ) { + *input_set |=ICE_INSET_ETHERTYPE ; + ether_type =rte_be_to_cpu_16 (eth_spec->type); + +if (ether_type ==RTE_ETHER_TYPE_IPV4 || + ether_type ==RTE_ETHER_TYPE_IPV6 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unsupported ether_type." ); +return -rte_errno; } } + + p_ext_data = (tunnel_type && is_outer) ? + &filter->input.ext_data_outer : + &filter->input.ext_data; +rte_memcpy (&p_ext_data->src_mac, + ð_spec->src,RTE_ETHER_ADDR_LEN ); +rte_memcpy (&p_ext_data->dst_mac, + ð_spec->dst,RTE_ETHER_ADDR_LEN ); +rte_memcpy (&p_ext_data->ether_type, + ð_spec->type,sizeof (eth_spec->type));break ;case RTE_FLOW_ITEM_TYPE_IPV4 : + flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; l3 =RTE_FLOW_ITEM_TYPE_IPV4 ; ipv4_spec = item->spec; ipv4_mask = item->mask; - -if (ipv4_spec && ipv4_mask) { -/* Check IPv4 mask and update input set */ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.hdr_checksum) { -rte_flow_error_set (error,EINVAL , + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4; + +if (!(ipv4_spec && ipv4_mask)) +break ; + +/* Check IPv4 mask and update input set */ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid IPv4 mask." ); -return -rte_errno; - } -if (ipv4_mask->hdr.src_addr ==UINT32_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_IPV4_SRC : -ICE_INSET_IPV4_SRC ; -if (ipv4_mask->hdr.dst_addr ==UINT32_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_IPV4_DST : -ICE_INSET_IPV4_DST ; -if (ipv4_mask->hdr.type_of_service ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_TOS ; -if (ipv4_mask->hdr.time_to_live ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_TTL ; -if (ipv4_mask->hdr.next_proto_id ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_PROTO ; - - filter->input.ip.v4.dst_ip = - ipv4_spec->hdr.dst_addr; - filter->input.ip.v4.src_ip = - ipv4_spec->hdr.src_addr; - filter->input.ip.v4.tos = - ipv4_spec->hdr.type_of_service; - filter->input.ip.v4.ttl = - ipv4_spec->hdr.time_to_live; - filter->input.ip.v4.proto = - ipv4_spec->hdr.next_proto_id; +return -rte_errno; } - flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; +if (ipv4_mask->hdr.dst_addr ==UINT32_MAX ) + *input_set |=ICE_INSET_IPV4_DST ; +if (ipv4_mask->hdr.src_addr ==UINT32_MAX ) + *input_set |=ICE_INSET_IPV4_SRC ; +if (ipv4_mask->hdr.time_to_live ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_TTL ; +if (ipv4_mask->hdr.next_proto_id ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_PROTO ; +if (ipv4_mask->hdr.type_of_service ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_TOS ; + + p_v4->dst_ip = ipv4_spec->hdr.dst_addr; + p_v4->src_ip = ipv4_spec->hdr.src_addr; + p_v4->ttl = ipv4_spec->hdr.time_to_live; + p_v4->proto = ipv4_spec->hdr.next_proto_id; + p_v4->tos = ipv4_spec->hdr.type_of_service;break ;case RTE_FLOW_ITEM_TYPE_IPV6 : + flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; l3 =RTE_FLOW_ITEM_TYPE_IPV6 ; ipv6_spec = item->spec; ipv6_mask = item->mask; + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6; -if (ipv6_spec && ipv6_mask) { -/* Check IPv6 mask and update input set */ -if (ipv6_mask->hdr.payload_len) { -rte_flow_error_set (error,EINVAL , +if (!(ipv6_spec && ipv6_mask)) +break ; + +/* Check IPv6 mask and update input set */ +if (ipv6_mask->hdr.payload_len) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid IPv6 mask" ); -return -rte_errno; - } - -if (!memcmp (ipv6_mask->hdr.src_addr, - ipv6_addr_mask, -RTE_DIM (ipv6_mask->hdr.src_addr))) - input_set |=ICE_INSET_IPV6_SRC ; -if (!memcmp (ipv6_mask->hdr.dst_addr, - ipv6_addr_mask, -RTE_DIM (ipv6_mask->hdr.dst_addr))) - input_set |=ICE_INSET_IPV6_DST ; - -if ((ipv6_mask->hdr.vtc_flow & -rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) - ==rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) - input_set |=ICE_INSET_IPV6_TC ; -if (ipv6_mask->hdr.proto ==UINT8_MAX ) - input_set |=ICE_INSET_IPV6_NEXT_HDR ; -if (ipv6_mask->hdr.hop_limits ==UINT8_MAX ) - input_set |=ICE_INSET_IPV6_HOP_LIMIT ; - -rte_memcpy (filter->input.ip.v6.dst_ip, - ipv6_spec->hdr.dst_addr,16 ); -rte_memcpy (filter->input.ip.v6.src_ip, - ipv6_spec->hdr.src_addr,16 ); - - vtc_flow_cpu = -rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); - filter->input.ip.v6.tc = - (uint8_t )(vtc_flow_cpu >> -ICE_FDIR_IPV6_TC_OFFSET ); - filter->input.ip.v6.proto = - ipv6_spec->hdr.proto; - filter->input.ip.v6.hlim = - ipv6_spec->hdr.hop_limits; +return -rte_errno; } - flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; +if (!memcmp (ipv6_mask->hdr.src_addr, ipv6_addr_mask, +RTE_DIM (ipv6_mask->hdr.src_addr))) + *input_set |=ICE_INSET_IPV6_SRC ; +if (!memcmp (ipv6_mask->hdr.dst_addr, ipv6_addr_mask, +RTE_DIM (ipv6_mask->hdr.dst_addr))) + *input_set |=ICE_INSET_IPV6_DST ; + +if ((ipv6_mask->hdr.vtc_flow & +rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) + ==rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) + *input_set |=ICE_INSET_IPV6_TC ; +if (ipv6_mask->hdr.proto ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV6_NEXT_HDR ; +if (ipv6_mask->hdr.hop_limits ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV6_HOP_LIMIT ; + +rte_memcpy (&p_v6->dst_ip, ipv6_spec->hdr.dst_addr,16 ); +rte_memcpy (&p_v6->src_ip, ipv6_spec->hdr.src_addr,16 ); + vtc_flow_cpu =rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); + p_v6->tc = (uint8_t )(vtc_flow_cpu >>ICE_FDIR_IPV6_TC_OFFSET ); + p_v6->proto = ipv6_spec->hdr.proto; + p_v6->hlim = ipv6_spec->hdr.hop_limits;break ;case RTE_FLOW_ITEM_TYPE_TCP : - tcp_spec = item->spec; - tcp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_TCP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_TCP ; -if (tcp_spec && tcp_mask) { -/* Check TCP mask and update input set */ -if (tcp_mask->hdr.sent_seq || - tcp_mask->hdr.recv_ack || - tcp_mask->hdr.data_off || - tcp_mask->hdr.tcp_flags || - tcp_mask->hdr.rx_win || - tcp_mask->hdr.cksum || - tcp_mask->hdr.tcp_urp) { -rte_flow_error_set (error,EINVAL , + tcp_spec = item->spec; + tcp_mask = item->mask; + +if (!(tcp_spec && tcp_mask)) +break ; + +/* Check TCP mask and update input set */ +if (tcp_mask->hdr.sent_seq || + tcp_mask->hdr.recv_ack || + tcp_mask->hdr.data_off || + tcp_mask->hdr.tcp_flags || + tcp_mask->hdr.rx_win || + tcp_mask->hdr.cksum || + tcp_mask->hdr.tcp_urp) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid TCP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (tcp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_TCP_SRC_PORT : -ICE_INSET_TCP_SRC_PORT ; -if (tcp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_TCP_DST_PORT : -ICE_INSET_TCP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - tcp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - tcp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.dst_port = - tcp_spec->hdr.dst_port; - filter->input.ip.v6.src_port = - tcp_spec->hdr.src_port; - } +if (tcp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_TCP_SRC_PORT ; +if (tcp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_TCP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { +assert (p_v4); + p_v4->dst_port = tcp_spec->hdr.dst_port; + p_v4->src_port = tcp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { +assert (p_v6); + p_v6->dst_port = tcp_spec->hdr.dst_port; + p_v6->src_port = tcp_spec->hdr.src_port; }break ;case RTE_FLOW_ITEM_TYPE_UDP : - udp_spec = item->spec; - udp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_UDP ; -if (udp_spec && udp_mask) { -/* Check UDP mask and update input set*/ -if (udp_mask->hdr.dgram_len || - udp_mask->hdr.dgram_cksum) { -rte_flow_error_set (error,EINVAL , + udp_spec = item->spec; + udp_mask = item->mask; + +if (!(udp_spec && udp_mask)) +break ; + +/* Check UDP mask and update input set*/ +if (udp_mask->hdr.dgram_len || + udp_mask->hdr.dgram_cksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid UDP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (udp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_UDP_SRC_PORT : -ICE_INSET_UDP_SRC_PORT ; -if (udp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_UDP_DST_PORT : -ICE_INSET_UDP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - udp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - udp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.src_port = - udp_spec->hdr.src_port; - filter->input.ip.v6.dst_port = - udp_spec->hdr.dst_port; - } +if (udp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_UDP_SRC_PORT ; +if (udp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_UDP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { +assert (p_v4); + p_v4->dst_port = udp_spec->hdr.dst_port; + p_v4->src_port = udp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { +assert (p_v6); + p_v6->src_port = udp_spec->hdr.src_port; + p_v6->dst_port = udp_spec->hdr.dst_port; }break ;case RTE_FLOW_ITEM_TYPE_SCTP : - sctp_spec = item->spec; - sctp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_SCTP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_SCTP ; -if (sctp_spec && sctp_mask) { -/* Check SCTP mask and update input set */ -if (sctp_mask->hdr.cksum) { -rte_flow_error_set (error,EINVAL , + sctp_spec = item->spec; + sctp_mask = item->mask; + +if (!(sctp_spec && sctp_mask)) +break ; + +/* Check SCTP mask and update input set */ +if (sctp_mask->hdr.cksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid UDP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (sctp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_SCTP_SRC_PORT : -ICE_INSET_SCTP_SRC_PORT ; -if (sctp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_SCTP_DST_PORT : -ICE_INSET_SCTP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - sctp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - sctp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.dst_port = - sctp_spec->hdr.dst_port; - filter->input.ip.v6.src_port = - sctp_spec->hdr.src_port; - } +if (sctp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_SCTP_SRC_PORT ; +if (sctp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_SCTP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { +assert (p_v4); + p_v4->dst_port = sctp_spec->hdr.dst_port; + p_v4->src_port = sctp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { +assert (p_v6); + p_v6->dst_port = sctp_spec->hdr.dst_port; + p_v6->src_port = sctp_spec->hdr.src_port; }break ;case RTE_FLOW_ITEM_TYPE_VOID :
@@ -1910,6 +1906,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, l3 =RTE_FLOW_ITEM_TYPE_END ; vxlan_spec = item->spec; vxlan_mask = item->mask; + is_outer = false;if (vxlan_spec || vxlan_mask) { rte_flow_error_set(error, EINVAL,
@@ -1919,50 +1916,52 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,return -rte_errno; } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ;break ;case RTE_FLOW_ITEM_TYPE_GTPU : l3 =RTE_FLOW_ITEM_TYPE_END ; gtp_spec = item->spec; gtp_mask = item->mask; + is_outer = false; -if (gtp_spec && gtp_mask) { -if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len) { -rte_flow_error_set (error,EINVAL , +if (!(gtp_spec && gtp_mask)) +break ; + +if (gtp_mask->v_pt_rsv_flags || + gtp_mask->msg_type || + gtp_mask->msg_len) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid GTP mask" ); -return -rte_errno; - } - -if (gtp_mask->teid ==UINT32_MAX ) - input_set |=ICE_INSET_GTPU_TEID ; - - filter->input.gtpu_data.teid = gtp_spec->teid; +return -rte_errno; } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; +/* To align with shared code behavior, set TEID in input_set_l */ +if (gtp_mask->teid ==UINT32_MAX ) + input_set_l |=ICE_INSET_GTPU_TEID ; + + filter->input.gtpu_data.teid = gtp_spec->teid;break ;case RTE_FLOW_ITEM_TYPE_GTP_PSC : gtp_psc_spec = item->spec; gtp_psc_mask = item->mask; + is_outer = false; -if (gtp_psc_spec && gtp_psc_mask) { -if (gtp_psc_mask->qfi ==UINT8_MAX ) - input_set |=ICE_INSET_GTPU_QFI ; +if (!(gtp_psc_spec && gtp_psc_mask)) +break ; - filter->input.gtpu_data.qfi = - gtp_psc_spec->qfi; - } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; +/* To align with shared code behavior, set TEID in input_set_l */ +if (gtp_psc_mask->qfi ==UINT8_MAX ) + input_set_l |=ICE_INSET_GTPU_QFI ; + + filter->input.gtpu_data.qfi = + gtp_psc_spec->qfi;break ;default :rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Invalid pattern item." ); +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid pattern item." );return -rte_errno; } }
@@ -1982,7 +1981,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; - filter->input_set = input_set; + filter->input_set = input_set_l; + filter->outer_input_set = input_set_f;return 0 ; }
Signature · 1 line
2.25.1
PATCH v2 3/3 net/ice: add outer input set mask to distinguish outer fields
In reply to Zhirun YanAdd 64-bit input_set_mask_f for outer inputset. input_set_mask_f is used for inner fields or non-tunnel fields. Adjust indentation of ice_pattern_match_item list in switch, ACL, RSS and FDIR for easy review. For fields in tunnel layer, put them in outer part.
--- drivers/net/ice/ice_acl_filter.c | 8 +- drivers/net/ice/ice_fdir_filter.c | 72 ++++--- drivers/net/ice/ice_generic_flow.c | 2 + drivers/net/ice/ice_generic_flow.h | 1 + drivers/net/ice/ice_hash.c | 243 ++++++++++------------- drivers/net/ice/ice_switch_filter.c | 294 ++++++++++------------------ 6 files changed, 247 insertions(+), 373 deletions(-)
drivers/net/ice/ice_acl_filter.c +4 -4
@@ -50,10 +50,10 @@ struct acl_rule {static struct ice_pattern_match_item ice_acl_pattern[] = { - {pattern_eth_ipv4,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_tcp,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_sctp,ICE_ACL_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, + {pattern_eth_ipv4,ICE_INSET_NONE ,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp,ICE_INSET_NONE ,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_tcp,ICE_INSET_NONE ,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, + {pattern_eth_ipv4_sctp,ICE_INSET_NONE ,ICE_ACL_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, }; static int
drivers/net/ice/ice_fdir_filter.c +35 -37
98 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.c +2 -0
@@ -2216,6 +2216,8 @@ ice_search_pattern_match_item(struct ice_adapter *ad,for (i =0 ; i < array_len; i++) {if (ice_match_pattern (array[i].pattern_list, items)) { + pattern_match_item->input_set_mask_f = + array[i].input_set_mask_f; pattern_match_item->input_set_mask = array[i].input_set_mask; pattern_match_item->pattern_list =
drivers/net/ice/ice_generic_flow.h +1 -0
@@ -473,6 +473,7 @@ enum ice_flow_classification_stage {/* pattern structure */ struct ice_pattern_match_item {enum rte_flow_item_type *pattern_list; +uint64_t input_set_mask_f;/* only used for tunnel outer fields */ /* pattern_list must end with RTE_FLOW_ITEM_TYPE_END */ uint64_t input_set_mask;void *meta;
drivers/net/ice/ice_hash.c +107 -136
285 lines not on this page · raw message
drivers/net/ice/ice_switch_filter.c +98 -196
304 lines not on this page · raw message
Signature · 1 line
2.25.1
v3 cover Refactor FDIR pattern parser
In reply to Zhirun YanV3:
Clear the variable name of input_set_o and input_set_i. Use input_set_o for tunnerl outer or non-tunnel fields, let ice_pattern_match_item 3rd columns all none in ACL, RSS, switch. Add new patch to use seg_tun[1] to record tunnel inner part. Add new patch to clean GTPU inner flow type for PF.
V2:
Meld patch 4,5 into 3.
Update ACL input set.
Clear PPPoE GTPU input set in RSS.
Put p_v4/6 assignment earlier to reduce redundant code in FDIR.
This patch set refactor FDIR pattern parser.
Redefine input set. Ignore the redundant inner/outer info. Align the parser action with hardware, using input_set_f for outer, input_set_l for inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.
Zhirun Yan (6):
net/ice: clean input set macro definition
net/ice: refactor structure field
net/ice: refactor flow pattern parser
net/ice: refactor input set conf
net/ice: add outer input set mask to distinguish outer fields net/ice: clean GTPU flow_type for FDIR
drivers/net/ice/ice_acl_filter.c | 10 +- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ice/ice_fdir_filter.c | 590 ++++++++++++++-------------- drivers/net/ice/ice_generic_flow.c | 6 +- drivers/net/ice/ice_generic_flow.h | 237 +++++------ drivers/net/ice/ice_hash.c | 214 +++++----- drivers/net/ice/ice_switch_filter.c | 296 +++++--------- 7 files changed, 605 insertions(+), 752 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/6 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.
--- drivers/net/ice/ice_fdir_filter.c | 8 +- drivers/net/ice/ice_generic_flow.h | 234 ++++++++++++----------------- 2 files changed, 104 insertions(+), 138 deletions(-)
drivers/net/ice/ice_fdir_filter.c +4 -4
@@ -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)
drivers/net/ice/ice_generic_flow.h +100 -134
277 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 2/6 net/ice: refactor structure field
In reply to Zhirun YanThis patch use input_set_o and input_set_i to distinguish inner/outer input set. input_set_i is only used for inner field.
--- drivers/net/ice/ice_ethdev.h | 4 ++-- drivers/net/ice/ice_fdir_filter.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ice/ice_ethdev.h +2 -2
@@ -301,8 +301,8 @@ struct ice_fdir_filter_conf {struct ice_fdir_counter *counter;/* flow specific counter context */ struct rte_flow_action_count act_count; -uint64_t input_set; -uint64_t outer_input_set;/* only for tunnel packets outer fields */ +uint64_t input_set_o;/* used for non-tunnel or tunnel outer fields */ +uint64_t input_set_i;/* only for tunnel inner fields */ uint32_t mark_flag; };
drivers/net/ice/ice_fdir_filter.c +3 -3
@@ -1249,7 +1249,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, is_tun =ice_fdir_is_tunnel_profile (filter->tunnel_type); ret =ice_fdir_input_set_conf (pf, filter->input.flow_type, - filter->input_set, filter->outer_input_set, + filter->input_set_i, filter->input_set_o, filter->tunnel_type);if (ret) { rte_flow_error_set(error, -ret,
@@ -1982,7 +1982,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; - filter->input_set = input_set; + filter->input_set_o = input_set;return 0 ; }
@@ -2011,7 +2011,7 @@ ice_fdir_parse(struct ice_adapter *ad, ret =ice_fdir_parse_pattern (ad, pattern, error, filter);if (ret) goto error; - input_set = filter->input_set | filter->outer_input_set; + input_set = filter->input_set_o | filter->input_set_i;if (!input_set || input_set & ~item->input_set_mask) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
Signature · 1 line
2.25.1
PATCH v3 3/6 net/ice: refactor flow pattern parser
In reply to Zhirun YanDistinguish inner/outer input_set. And avoid too many nested conditionals in each type's parser. input_set_o is used for tunnel outer fields or non-tunnel fields , input_set_i is only used for inner fields.
For GTPU, store the outer IP fields in inner part to align with shared code behavior.
--- drivers/net/ice/ice_fdir_filter.c | 475 +++++++++++++++--------------- 1 file changed, 236 insertions(+), 239 deletions(-)
drivers/net/ice/ice_fdir_filter.c +236 -239
@@ -1610,7 +1610,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask;const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; -uint64_t input_set =ICE_INSET_NONE ; +uint64_t input_set_i =ICE_INSET_NONE ;/* only for tunnel inner */ +uint64_t input_set_o =ICE_INSET_NONE ;/* non-tunnel and tunnel outer */ +uint64_t *input_set;uint8_t flow_type =ICE_FLTR_PTYPE_NONF_NONE ;uint8_t ipv6_addr_mask[16 ] = {0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,
@@ -1619,289 +1621,282 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,uint32_t vtc_flow_cpu;uint16_t ether_type;enum rte_flow_item_type next_type; +bool is_outer = true; +struct ice_fdir_extra *p_ext_data; +struct ice_fdir_v4 *p_v4 =NULL ; +struct ice_fdir_v6 *p_v6 =NULL ; +for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) { +if (item->type ==RTE_FLOW_ITEM_TYPE_VXLAN ) + tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ; +/* To align with shared code behavior, save gtpu outer +* fields in inner struct. +*/ +if (item->type ==RTE_FLOW_ITEM_TYPE_GTPU || + item->type ==RTE_FLOW_ITEM_TYPE_GTP_PSC ) { + is_outer = false; + } + } + +/* This loop parse flow pattern and distinguish Non-tunnel and tunnel +* flow. input_set_i is used for inner part. +*/ for (item = pattern; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) {if (item->last) {rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Not support range" ); +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Not support range" );return -rte_errno; } item_type = item->type; + input_set = (tunnel_type && !is_outer) ? + &input_set_i : &input_set_o; +switch (item_type) {case RTE_FLOW_ITEM_TYPE_ETH : + flow_type =ICE_FLTR_PTYPE_NON_IP_L2 ; eth_spec = item->spec; eth_mask = item->mask; - next_type = (item +1 )->type; -if (eth_spec && eth_mask) { -if (!rte_is_zero_ether_addr (ð_mask->dst)) { - input_set |=ICE_INSET_DMAC ; -rte_memcpy (&filter->input.ext_data.dst_mac, - ð_spec->dst, -RTE_ETHER_ADDR_LEN ); - } +if (!(eth_spec && eth_mask)) +break ; -if (!rte_is_zero_ether_addr (ð_mask->src)) { - input_set |=ICE_INSET_SMAC ; -rte_memcpy (&filter->input.ext_data.src_mac, - ð_spec->src, -RTE_ETHER_ADDR_LEN ); - } +if (!rte_is_zero_ether_addr (ð_mask->dst)) + *input_set |=ICE_INSET_DMAC ; +if (!rte_is_zero_ether_addr (ð_mask->src)) + *input_set |=ICE_INSET_SMAC ; -/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */ -if (eth_mask->type ==RTE_BE16 (0xffff ) && - next_type ==RTE_FLOW_ITEM_TYPE_END ) { - input_set |=ICE_INSET_ETHERTYPE ; - ether_type =rte_be_to_cpu_16 (eth_spec->type); - -if (ether_type ==RTE_ETHER_TYPE_IPV4 || - ether_type ==RTE_ETHER_TYPE_IPV6 ) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Unsupported ether_type." ); -return -rte_errno; - } - -rte_memcpy (&filter->input.ext_data.ether_type, - ð_spec->type, -sizeof (eth_spec->type)); - flow_type =ICE_FLTR_PTYPE_NON_IP_L2 ; + next_type = (item +1 )->type; +/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */ +if (eth_mask->type ==RTE_BE16 (0xffff ) && + next_type ==RTE_FLOW_ITEM_TYPE_END ) { + *input_set |=ICE_INSET_ETHERTYPE ; + ether_type =rte_be_to_cpu_16 (eth_spec->type); + +if (ether_type ==RTE_ETHER_TYPE_IPV4 || + ether_type ==RTE_ETHER_TYPE_IPV6 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unsupported ether_type." ); +return -rte_errno; } } + + p_ext_data = (tunnel_type && is_outer) ? + &filter->input.ext_data_outer : + &filter->input.ext_data; +rte_memcpy (&p_ext_data->src_mac, + ð_spec->src,RTE_ETHER_ADDR_LEN ); +rte_memcpy (&p_ext_data->dst_mac, + ð_spec->dst,RTE_ETHER_ADDR_LEN ); +rte_memcpy (&p_ext_data->ether_type, + ð_spec->type,sizeof (eth_spec->type));break ;case RTE_FLOW_ITEM_TYPE_IPV4 : + flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; l3 =RTE_FLOW_ITEM_TYPE_IPV4 ; ipv4_spec = item->spec; ipv4_mask = item->mask; - -if (ipv4_spec && ipv4_mask) { -/* Check IPv4 mask and update input set */ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.hdr_checksum) { -rte_flow_error_set (error,EINVAL , + p_v4 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v4 : + &filter->input.ip.v4; + +if (!(ipv4_spec && ipv4_mask)) +break ; + +/* Check IPv4 mask and update input set */ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid IPv4 mask." ); -return -rte_errno; - } -if (ipv4_mask->hdr.src_addr ==UINT32_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_IPV4_SRC : -ICE_INSET_IPV4_SRC ; -if (ipv4_mask->hdr.dst_addr ==UINT32_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_IPV4_DST : -ICE_INSET_IPV4_DST ; -if (ipv4_mask->hdr.type_of_service ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_TOS ; -if (ipv4_mask->hdr.time_to_live ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_TTL ; -if (ipv4_mask->hdr.next_proto_id ==UINT8_MAX ) - input_set |=ICE_INSET_IPV4_PROTO ; - - filter->input.ip.v4.dst_ip = - ipv4_spec->hdr.dst_addr; - filter->input.ip.v4.src_ip = - ipv4_spec->hdr.src_addr; - filter->input.ip.v4.tos = - ipv4_spec->hdr.type_of_service; - filter->input.ip.v4.ttl = - ipv4_spec->hdr.time_to_live; - filter->input.ip.v4.proto = - ipv4_spec->hdr.next_proto_id; +return -rte_errno; } - flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; +if (ipv4_mask->hdr.dst_addr ==UINT32_MAX ) + *input_set |=ICE_INSET_IPV4_DST ; +if (ipv4_mask->hdr.src_addr ==UINT32_MAX ) + *input_set |=ICE_INSET_IPV4_SRC ; +if (ipv4_mask->hdr.time_to_live ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_TTL ; +if (ipv4_mask->hdr.next_proto_id ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_PROTO ; +if (ipv4_mask->hdr.type_of_service ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV4_TOS ; + + p_v4->dst_ip = ipv4_spec->hdr.dst_addr; + p_v4->src_ip = ipv4_spec->hdr.src_addr; + p_v4->ttl = ipv4_spec->hdr.time_to_live; + p_v4->proto = ipv4_spec->hdr.next_proto_id; + p_v4->tos = ipv4_spec->hdr.type_of_service;break ;case RTE_FLOW_ITEM_TYPE_IPV6 : + flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; l3 =RTE_FLOW_ITEM_TYPE_IPV6 ; ipv6_spec = item->spec; ipv6_mask = item->mask; + p_v6 = (tunnel_type && is_outer) ? + &filter->input.ip_outer.v6 : + &filter->input.ip.v6; -if (ipv6_spec && ipv6_mask) { -/* Check IPv6 mask and update input set */ -if (ipv6_mask->hdr.payload_len) { -rte_flow_error_set (error,EINVAL , +if (!(ipv6_spec && ipv6_mask)) +break ; + +/* Check IPv6 mask and update input set */ +if (ipv6_mask->hdr.payload_len) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid IPv6 mask" ); -return -rte_errno; - } - -if (!memcmp (ipv6_mask->hdr.src_addr, - ipv6_addr_mask, -RTE_DIM (ipv6_mask->hdr.src_addr))) - input_set |=ICE_INSET_IPV6_SRC ; -if (!memcmp (ipv6_mask->hdr.dst_addr, - ipv6_addr_mask, -RTE_DIM (ipv6_mask->hdr.dst_addr))) - input_set |=ICE_INSET_IPV6_DST ; - -if ((ipv6_mask->hdr.vtc_flow & -rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) - ==rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) - input_set |=ICE_INSET_IPV6_TC ; -if (ipv6_mask->hdr.proto ==UINT8_MAX ) - input_set |=ICE_INSET_IPV6_NEXT_HDR ; -if (ipv6_mask->hdr.hop_limits ==UINT8_MAX ) - input_set |=ICE_INSET_IPV6_HOP_LIMIT ; - -rte_memcpy (filter->input.ip.v6.dst_ip, - ipv6_spec->hdr.dst_addr,16 ); -rte_memcpy (filter->input.ip.v6.src_ip, - ipv6_spec->hdr.src_addr,16 ); - - vtc_flow_cpu = -rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); - filter->input.ip.v6.tc = - (uint8_t )(vtc_flow_cpu >> -ICE_FDIR_IPV6_TC_OFFSET ); - filter->input.ip.v6.proto = - ipv6_spec->hdr.proto; - filter->input.ip.v6.hlim = - ipv6_spec->hdr.hop_limits; +return -rte_errno; } - flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; +if (!memcmp (ipv6_mask->hdr.src_addr, ipv6_addr_mask, +RTE_DIM (ipv6_mask->hdr.src_addr))) + *input_set |=ICE_INSET_IPV6_SRC ; +if (!memcmp (ipv6_mask->hdr.dst_addr, ipv6_addr_mask, +RTE_DIM (ipv6_mask->hdr.dst_addr))) + *input_set |=ICE_INSET_IPV6_DST ; + +if ((ipv6_mask->hdr.vtc_flow & +rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) + ==rte_cpu_to_be_32 (ICE_IPV6_TC_MASK )) + *input_set |=ICE_INSET_IPV6_TC ; +if (ipv6_mask->hdr.proto ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV6_NEXT_HDR ; +if (ipv6_mask->hdr.hop_limits ==UINT8_MAX ) + *input_set |=ICE_INSET_IPV6_HOP_LIMIT ; + +rte_memcpy (&p_v6->dst_ip, ipv6_spec->hdr.dst_addr,16 ); +rte_memcpy (&p_v6->src_ip, ipv6_spec->hdr.src_addr,16 ); + vtc_flow_cpu =rte_be_to_cpu_32 (ipv6_spec->hdr.vtc_flow); + p_v6->tc = (uint8_t )(vtc_flow_cpu >>ICE_FDIR_IPV6_TC_OFFSET ); + p_v6->proto = ipv6_spec->hdr.proto; + p_v6->hlim = ipv6_spec->hdr.hop_limits;break ;case RTE_FLOW_ITEM_TYPE_TCP : - tcp_spec = item->spec; - tcp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_TCP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_TCP ; -if (tcp_spec && tcp_mask) { -/* Check TCP mask and update input set */ -if (tcp_mask->hdr.sent_seq || - tcp_mask->hdr.recv_ack || - tcp_mask->hdr.data_off || - tcp_mask->hdr.tcp_flags || - tcp_mask->hdr.rx_win || - tcp_mask->hdr.cksum || - tcp_mask->hdr.tcp_urp) { -rte_flow_error_set (error,EINVAL , + tcp_spec = item->spec; + tcp_mask = item->mask; + +if (!(tcp_spec && tcp_mask)) +break ; + +/* Check TCP mask and update input set */ +if (tcp_mask->hdr.sent_seq || + tcp_mask->hdr.recv_ack || + tcp_mask->hdr.data_off || + tcp_mask->hdr.tcp_flags || + tcp_mask->hdr.rx_win || + tcp_mask->hdr.cksum || + tcp_mask->hdr.tcp_urp) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid TCP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (tcp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_TCP_SRC_PORT : -ICE_INSET_TCP_SRC_PORT ; -if (tcp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_TCP_DST_PORT : -ICE_INSET_TCP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - tcp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - tcp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.dst_port = - tcp_spec->hdr.dst_port; - filter->input.ip.v6.src_port = - tcp_spec->hdr.src_port; - } +if (tcp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_TCP_SRC_PORT ; +if (tcp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_TCP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { +assert (p_v4); + p_v4->dst_port = tcp_spec->hdr.dst_port; + p_v4->src_port = tcp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { +assert (p_v6); + p_v6->dst_port = tcp_spec->hdr.dst_port; + p_v6->src_port = tcp_spec->hdr.src_port; }break ;case RTE_FLOW_ITEM_TYPE_UDP : - udp_spec = item->spec; - udp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_UDP ; -if (udp_spec && udp_mask) { -/* Check UDP mask and update input set*/ -if (udp_mask->hdr.dgram_len || - udp_mask->hdr.dgram_cksum) { -rte_flow_error_set (error,EINVAL , + udp_spec = item->spec; + udp_mask = item->mask; + +if (!(udp_spec && udp_mask)) +break ; + +/* Check UDP mask and update input set*/ +if (udp_mask->hdr.dgram_len || + udp_mask->hdr.dgram_cksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid UDP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (udp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_UDP_SRC_PORT : -ICE_INSET_UDP_SRC_PORT ; -if (udp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_UDP_DST_PORT : -ICE_INSET_UDP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - udp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - udp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.src_port = - udp_spec->hdr.src_port; - filter->input.ip.v6.dst_port = - udp_spec->hdr.dst_port; - } +if (udp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_UDP_SRC_PORT ; +if (udp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_UDP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { +assert (p_v4); + p_v4->dst_port = udp_spec->hdr.dst_port; + p_v4->src_port = udp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { +assert (p_v6); + p_v6->src_port = udp_spec->hdr.src_port; + p_v6->dst_port = udp_spec->hdr.dst_port; }break ;case RTE_FLOW_ITEM_TYPE_SCTP : - sctp_spec = item->spec; - sctp_mask = item->mask; -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV4_SCTP ; -else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) flow_type =ICE_FLTR_PTYPE_NONF_IPV6_SCTP ; -if (sctp_spec && sctp_mask) { -/* Check SCTP mask and update input set */ -if (sctp_mask->hdr.cksum) { -rte_flow_error_set (error,EINVAL , + sctp_spec = item->spec; + sctp_mask = item->mask; + +if (!(sctp_spec && sctp_mask)) +break ; + +/* Check SCTP mask and update input set */ +if (sctp_mask->hdr.cksum) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid UDP mask" ); -return -rte_errno; - } +return -rte_errno; + } -if (sctp_mask->hdr.src_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_SCTP_SRC_PORT : -ICE_INSET_SCTP_SRC_PORT ; -if (sctp_mask->hdr.dst_port ==UINT16_MAX ) - input_set |= tunnel_type ? -ICE_INSET_TUN_SCTP_DST_PORT : -ICE_INSET_SCTP_DST_PORT ; - -/* Get filter info */ -if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { - filter->input.ip.v4.dst_port = - sctp_spec->hdr.dst_port; - filter->input.ip.v4.src_port = - sctp_spec->hdr.src_port; - }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { - filter->input.ip.v6.dst_port = - sctp_spec->hdr.dst_port; - filter->input.ip.v6.src_port = - sctp_spec->hdr.src_port; - } +if (sctp_mask->hdr.src_port ==UINT16_MAX ) + *input_set |=ICE_INSET_SCTP_SRC_PORT ; +if (sctp_mask->hdr.dst_port ==UINT16_MAX ) + *input_set |=ICE_INSET_SCTP_DST_PORT ; + +/* Get filter info */ +if (l3 ==RTE_FLOW_ITEM_TYPE_IPV4 ) { +assert (p_v4); + p_v4->dst_port = sctp_spec->hdr.dst_port; + p_v4->src_port = sctp_spec->hdr.src_port; + }else if (l3 ==RTE_FLOW_ITEM_TYPE_IPV6 ) { +assert (p_v6); + p_v6->dst_port = sctp_spec->hdr.dst_port; + p_v6->src_port = sctp_spec->hdr.src_port; }break ;case RTE_FLOW_ITEM_TYPE_VOID :
@@ -1910,6 +1905,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, l3 =RTE_FLOW_ITEM_TYPE_END ; vxlan_spec = item->spec; vxlan_mask = item->mask; + is_outer = false;if (vxlan_spec || vxlan_mask) { rte_flow_error_set(error, EINVAL,
@@ -1919,50 +1915,50 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,return -rte_errno; } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_VXLAN ;break ;case RTE_FLOW_ITEM_TYPE_GTPU : l3 =RTE_FLOW_ITEM_TYPE_END ; + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; gtp_spec = item->spec; gtp_mask = item->mask; -if (gtp_spec && gtp_mask) { -if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len) { -rte_flow_error_set (error,EINVAL , +if (!(gtp_spec && gtp_mask)) +break ; + +if (gtp_mask->v_pt_rsv_flags || + gtp_mask->msg_type || + gtp_mask->msg_len) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Invalid GTP mask" ); -return -rte_errno; - } - -if (gtp_mask->teid ==UINT32_MAX ) - input_set |=ICE_INSET_GTPU_TEID ; - - filter->input.gtpu_data.teid = gtp_spec->teid; +return -rte_errno; } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU ; +if (gtp_mask->teid ==UINT32_MAX ) + input_set_o |=ICE_INSET_GTPU_TEID ; + + filter->input.gtpu_data.teid = gtp_spec->teid;break ;case RTE_FLOW_ITEM_TYPE_GTP_PSC : + tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; gtp_psc_spec = item->spec; gtp_psc_mask = item->mask; -if (gtp_psc_spec && gtp_psc_mask) { -if (gtp_psc_mask->qfi ==UINT8_MAX ) - input_set |=ICE_INSET_GTPU_QFI ; +if (!(gtp_psc_spec && gtp_psc_mask)) +break ; - filter->input.gtpu_data.qfi = - gtp_psc_spec->qfi; - } - tunnel_type =ICE_FDIR_TUNNEL_TYPE_GTPU_EH ; +if (gtp_psc_mask->qfi ==UINT8_MAX ) + input_set_o |=ICE_INSET_GTPU_QFI ; + + filter->input.gtpu_data.qfi = + gtp_psc_spec->qfi;break ;default :rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item, -"Invalid pattern item." ); +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid pattern item." );return -rte_errno; } }
@@ -1982,7 +1978,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; - filter->input_set_o = input_set; + filter->input_set_o = input_set_o; + filter->input_set_i = input_set_i;return 0 ; }
Signature · 1 line
2.25.1
PATCH v3 4/6 net/ice: refactor input set conf
In reply to Zhirun YanFor tunnel or non-tunnel packet, the input set is in outer_input_set and use seg_tun[0]. seg_tun[1] is only used for tunnel inner fields. This patch make align with input_set inner/outer with seg_tun[] and simplify it.
--- drivers/net/ice/ice_fdir_filter.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/net/ice/ice_fdir_filter.c +4 -8
@@ -1013,7 +1013,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,return -ENOMEM ; } -/* use seg_tun[1] to record tunnel inner part or non-tunnel */ +/* use seg_tun[1] to record tunnel inner part */ for (k =0 ; k <=ICE_FD_HW_SEG_TUN ; k++) { seg = &seg_tun[k]; input_set = (k ==ICE_FD_HW_SEG_TUN ) ? inner_input_set : outer_input_set;
@@ -1036,13 +1036,9 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow, } is_tunnel =ice_fdir_is_tunnel_profile (ttype); -if (!is_tunnel) { - ret =ice_fdir_hw_tbl_conf (pf, pf->main_vsi, pf->fdir.fdir_vsi, - seg_tun +1 , flow, false); - }else { - ret =ice_fdir_hw_tbl_conf (pf, pf->main_vsi, pf->fdir.fdir_vsi, - seg_tun, flow, true); - } + + ret =ice_fdir_hw_tbl_conf (pf, pf->main_vsi, pf->fdir.fdir_vsi, + seg_tun, flow, is_tunnel);if (!ret) {return ret;
Signature · 1 line
2.25.1
PATCH v3 5/6 net/ice: add outer input set mask to distinguish outer fields
In reply to Zhirun YanDistinguish input_set_mask to inner and outer part. Use input_set_mask_o for tunnel outer or non-tunnel input set. input_set_mask_i is used for tunnel inner fields only. Adjust indentation of ice_pattern_match_item list in switch, ACL, RSS and FDIR for easy review. For switch, ACL and RSS, only use input_set_mask_o and set the input_set_mask_i all none.
--- drivers/net/ice/ice_acl_filter.c | 10 +- drivers/net/ice/ice_fdir_filter.c | 72 ++++--- drivers/net/ice/ice_generic_flow.c | 6 +- drivers/net/ice/ice_generic_flow.h | 3 +- drivers/net/ice/ice_hash.c | 214 ++++++++++---------- drivers/net/ice/ice_switch_filter.c | 296 ++++++++++------------------ 6 files changed, 249 insertions(+), 352 deletions(-)
drivers/net/ice/ice_acl_filter.c +5 -5
@@ -50,10 +50,10 @@ struct acl_rule {static struct ice_pattern_match_item ice_acl_pattern[] = { - {pattern_eth_ipv4,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE }, - {pattern_eth_ipv4_udp,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_tcp,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE }, - {pattern_eth_ipv4_sctp,ICE_ACL_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE }, + {pattern_eth_ipv4,ICE_ACL_INSET_ETH_IPV4 ,ICE_INSET_NONE ,ICE_INSET_NONE }, + {pattern_eth_ipv4_udp,ICE_ACL_INSET_ETH_IPV4_UDP ,ICE_INSET_NONE ,ICE_INSET_NONE }, + {pattern_eth_ipv4_tcp,ICE_ACL_INSET_ETH_IPV4_TCP ,ICE_INSET_NONE ,ICE_INSET_NONE }, + {pattern_eth_ipv4_sctp,ICE_ACL_INSET_ETH_IPV4_SCTP ,ICE_INSET_NONE ,ICE_INSET_NONE }, }; static int
@@ -923,7 +923,7 @@ ice_acl_parse(struct ice_adapter *ad,if (ret) goto error; input_set = filter->input_set; -if (!input_set || input_set & ~item->input_set_mask) { +if (!input_set || input_set & ~item->input_set_mask_o) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
drivers/net/ice/ice_fdir_filter.c +35 -37
98 lines not on this page · raw message
drivers/net/ice/ice_generic_flow.c +4 -2
@@ -2216,8 +2216,10 @@ ice_search_pattern_match_item(struct ice_adapter *ad,for (i =0 ; i < array_len; i++) {if (ice_match_pattern (array[i].pattern_list, items)) { - pattern_match_item->input_set_mask = - array[i].input_set_mask; + pattern_match_item->input_set_mask_o = + array[i].input_set_mask_o; + pattern_match_item->input_set_mask_i = + array[i].input_set_mask_i; pattern_match_item->pattern_list = array[i].pattern_list; pattern_match_item->meta = array[i].meta;
drivers/net/ice/ice_generic_flow.h +2 -1
@@ -473,8 +473,9 @@ enum ice_flow_classification_stage {/* pattern structure */ struct ice_pattern_match_item {enum rte_flow_item_type *pattern_list; +uint64_t input_set_mask_o;/* used for tunnel outer or non tunnel fields */ /* pattern_list must end with RTE_FLOW_ITEM_TYPE_END */ -uint64_t input_set_mask; +uint64_t input_set_mask_i;/* only used for tunnel inner fields */ void *meta; };
drivers/net/ice/ice_hash.c +104 -110
273 lines not on this page · raw message
drivers/net/ice/ice_switch_filter.c +99 -197
312 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 6/6 net/ice: clean GTPU flow_type for FDIR
In reply to Zhirun YanCurrently, FDIR only support GTPU outer fields in PF. Clean the redundant GTPU inner info in flow type definition and align with shared code.
--- drivers/net/ice/ice_fdir_filter.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/net/ice/ice_fdir_filter.c +8 -11
@@ -954,26 +954,23 @@ ice_fdir_input_set_hdrs(enum ice_fltr_ptype flow, struct ice_flow_seg_info *seg)ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER );break ; -case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP : -case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP : -case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP : -case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER : +case ICE_FLTR_PTYPE_NONF_IPV4_GTPU :ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_GTPU_IP |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER );break ; -case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER : +case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH :ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_GTPU_EH |ICE_FLOW_SEG_HDR_GTPU_IP |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER );break ; -case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER : +case ICE_FLTR_PTYPE_NONF_IPV6_GTPU :ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_GTPU_IP |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER );break ; -case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER : +case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH : ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV6 |
@@ -1958,16 +1955,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,if (tunnel_type ==ICE_FDIR_TUNNEL_TYPE_GTPU && flow_type ==ICE_FLTR_PTYPE_NONF_IPV4_UDP ) - flow_type =ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER ; + flow_type =ICE_FLTR_PTYPE_NONF_IPV4_GTPU ;else if (tunnel_type ==ICE_FDIR_TUNNEL_TYPE_GTPU_EH && flow_type ==ICE_FLTR_PTYPE_NONF_IPV4_UDP ) - flow_type =ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER ; + flow_type =ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH ;else if (tunnel_type ==ICE_FDIR_TUNNEL_TYPE_GTPU && flow_type ==ICE_FLTR_PTYPE_NONF_IPV6_UDP ) - flow_type =ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER ; + flow_type =ICE_FLTR_PTYPE_NONF_IPV6_GTPU ;else if (tunnel_type ==ICE_FDIR_TUNNEL_TYPE_GTPU_EH && flow_type ==ICE_FLTR_PTYPE_NONF_IPV6_UDP ) - flow_type =ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER ; + flow_type =ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH ; filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type;
Signature · 1 line
2.25.1
Quoted 56 lines
-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Tuesday, March 2, 2021 10:54 AM
To: [email protected]; Zhang, Qi Z <[email protected]>; Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Guo, Junfeng <[email protected]>
Cc: Su, Simei <[email protected]>; Xu, Ting <[email protected]>; Zhang, Yuying <[email protected]>; Ding, Xuan <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v3 0/6] Refactor FDIR pattern parserV3:
Clear the variable name ofinput_set_oandinput_set_i. Useinput_set_ofor tunnerl outer or non-tunnel fields, letice_pattern_match_item3rd columns all none in ACL, RSS, switch. Add new patch to use seg_tun[1] to record tunnel inner part. Add new patch to clean GTPU inner flow type for PF.V2:
Meld patch 4,5 into 3.
Update ACL input set.
Clear PPPoE GTPU input set in RSS.
Put p_v4/6 assignment earlier to reduce redundant code in FDIR.This patch set refactor FDIR pattern parser.
Redefine input set. Ignore the redundant inner/outer info.
Align the parser action with hardware, usinginput_set_ffor outer,input_set_lfor inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.Zhirun Yan (6):
net/ice: clean input set macro definition
net/ice: refactor structure field
net/ice: refactor flow pattern parser
net/ice: refactor input set conf
net/ice: add outer input set mask to distinguish outer fields net/ice: clean GTPUflow_typefor FDIRdrivers/net/ice/ice_acl_filter.c | 10 +- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ice/ice_fdir_filter.c | 590 ++++++++++++++-------------- drivers/net/ice/ice_generic_flow.c | 6 +- drivers/net/ice/ice_generic_flow.h | 237 +++++------ drivers/net/ice/ice_hash.c | 214 +++++----- drivers/net/ice/ice_switch_filter.c | 296 +++++--------- 7 files changed, 605 insertions(+), 752 deletions(-)
Quoted 2 lines
--
2.25.1
Applied to dpdk-next-net-intel.
Thanks
Qi