X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fice%2Fice_fdir_filter.c;h=afc956e0a28778261ce2b966e2764b763c4b806a;hb=78156d38e112b33032eedfada65b0df8b047bc31;hp=a1d602a0d2ab2cadcb90762988712528996bf1df;hpb=70feafc1a3f229b397133c05531f37e28b15b2c9;p=dpdk.git diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index a1d602a0d2..afc956e0a2 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -100,11 +100,11 @@ #define ICE_FDIR_INSET_IPV4_NATT_ESP (\ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \ - ICE_INSET_ESP_SPI) + ICE_INSET_NAT_T_ESP_SPI) #define ICE_FDIR_INSET_IPV6_NATT_ESP (\ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \ - ICE_INSET_ESP_SPI) + ICE_INSET_NAT_T_ESP_SPI) static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_ethertype, ICE_FDIR_INSET_ETH, ICE_INSET_NONE, ICE_INSET_NONE}, @@ -806,6 +806,28 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf, (pf, cflct_ptype, is_tunnel)) goto err; break; + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_UDP: + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_TCP: + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_SCTP: + cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_OTHER; + if (!ice_fdir_prof_resolve_conflict + (pf, cflct_ptype, is_tunnel)) + goto err; + break; + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_OTHER: + cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_UDP; + if (!ice_fdir_prof_resolve_conflict + (pf, cflct_ptype, is_tunnel)) + goto err; + cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_TCP; + if (!ice_fdir_prof_resolve_conflict + (pf, cflct_ptype, is_tunnel)) + goto err; + cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_SCTP; + if (!ice_fdir_prof_resolve_conflict + (pf, cflct_ptype, is_tunnel)) + goto err; + break; default: break; } @@ -929,6 +951,8 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field) {ICE_INSET_GTPU_TEID, ICE_FLOW_FIELD_IDX_GTPU_IP_TEID}, {ICE_INSET_GTPU_QFI, ICE_FLOW_FIELD_IDX_GTPU_EH_QFI}, {ICE_INSET_VXLAN_VNI, ICE_FLOW_FIELD_IDX_VXLAN_VNI}, + {ICE_INSET_ESP_SPI, ICE_FLOW_FIELD_IDX_ESP_SPI}, + {ICE_INSET_NAT_T_ESP_SPI, ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI}, }; for (i = 0, j = 0; i < RTE_DIM(ice_inset_map); i++) { @@ -988,11 +1012,12 @@ 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_FRAG); break; - case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN: - ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_UDP | - ICE_FLOW_SEG_HDR_IPV4 | - ICE_FLOW_SEG_HDR_VXLAN | - ICE_FLOW_SEG_HDR_IPV_OTHER); + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_UDP: + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_TCP: + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_SCTP: + break; + case ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_OTHER: + ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV_OTHER); break; case ICE_FLTR_PTYPE_NONF_IPV4_GTPU: ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP | @@ -1656,7 +1681,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, const struct rte_flow_item_ipv4 *ipv4_spec, *ipv4_last, *ipv4_mask; const struct rte_flow_item_ipv6 *ipv6_spec, *ipv6_mask; const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_spec, - *ipv6_frag_last, *ipv6_frag_mask; + *ipv6_frag_mask; const struct rte_flow_item_tcp *tcp_spec, *tcp_mask; const struct rte_flow_item_udp *udp_spec, *udp_mask; const struct rte_flow_item_sctp *sctp_spec, *sctp_mask; @@ -1806,21 +1831,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, p_v4->proto = ipv4_spec->hdr.next_proto_id; p_v4->tos = ipv4_spec->hdr.type_of_service; - /* only support any packet id for fragment IPv4 - * any packet_id: - * spec is 0, last is 0xffff, mask is 0xffff - * fragment Ipv4: - * spec is 0x2000, mask is 0xffff + /* fragment Ipv4: + * spec is 0x2000, mask is 0x2000 */ - if (ipv4_last && ipv4_spec->hdr.packet_id == 0 && - ipv4_last->hdr.packet_id == UINT16_MAX && - ipv4_mask->hdr.packet_id == UINT16_MAX && - ipv4_spec->hdr.fragment_offset == + if (ipv4_spec->hdr.fragment_offset == rte_cpu_to_be_16(RTE_IPV4_HDR_MF_FLAG) && - ipv4_mask->hdr.fragment_offset == UINT16_MAX) { + ipv4_mask->hdr.fragment_offset == + rte_cpu_to_be_16(RTE_IPV4_HDR_MF_FLAG)) { /* all IPv4 fragment packet has the same - * ethertype, if the spec is for all valid - * packet id, set ethertype into input set. + * ethertype, if the spec and mask is valid, + * set ethertype into input set. */ flow_type = ICE_FLTR_PTYPE_FRAG_IPV4; *input_set |= ICE_INSET_ETHERTYPE; @@ -1881,27 +1901,21 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, l3 = RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT; flow_type = ICE_FLTR_PTYPE_FRAG_IPV6; ipv6_frag_spec = item->spec; - ipv6_frag_last = item->last; ipv6_frag_mask = item->mask; if (!(ipv6_frag_spec && ipv6_frag_mask)) break; - /* only support any packet id for fragment IPv6 - * any packet_id: - * spec is 0, last is 0xffffffff, mask is 0xffffffff - * fragment Ipv6: - * spec is 0x1, mask is 0xffff + /* fragment Ipv6: + * spec is 0x1, mask is 0x1 */ - if (ipv6_frag_last && ipv6_frag_spec->hdr.id == 0 && - ipv6_frag_last->hdr.id == UINT32_MAX && - ipv6_frag_mask->hdr.id == UINT32_MAX && - ipv6_frag_spec->hdr.frag_data == + if (ipv6_frag_spec->hdr.frag_data == rte_cpu_to_be_16(1) && - ipv6_frag_mask->hdr.frag_data == UINT16_MAX) { + ipv6_frag_mask->hdr.frag_data == + rte_cpu_to_be_16(1)) { /* all IPv6 fragment packet has the same - * ethertype, if the spec is for all valid - * packet id, set ethertype into input set. + * ethertype, if the spec and mask is valid, + * set ethertype into input set. */ *input_set |= ICE_INSET_ETHERTYPE; input_set_o |= ICE_INSET_ETHERTYPE; @@ -2090,11 +2104,11 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, if (!(gtp_psc_spec && gtp_psc_mask)) break; - if (gtp_psc_mask->qfi == UINT8_MAX) + if (gtp_psc_mask->hdr.qfi == 0x3F) input_set_o |= ICE_INSET_GTPU_QFI; filter->input.gtpu_data.qfi = - gtp_psc_spec->qfi; + gtp_psc_spec->hdr.qfi; break; case RTE_FLOW_ITEM_TYPE_ESP: if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 && @@ -2116,8 +2130,12 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, if (!(esp_spec && esp_mask)) break; - if (esp_mask->hdr.spi == UINT32_MAX) - *input_set |= ICE_INSET_ESP_SPI; + if (esp_mask->hdr.spi == UINT32_MAX) { + if (l4 == RTE_FLOW_ITEM_TYPE_UDP) + *input_set |= ICE_INSET_NAT_T_ESP_SPI; + else + *input_set |= ICE_INSET_ESP_SPI; + } if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) filter->input.ip.v4.sec_parm_idx = @@ -2147,8 +2165,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, 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; - else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN) - flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN; + else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN && + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP) + flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_UDP; + else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN && + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP) + flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_TCP; + else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN && + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP) + flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_SCTP; + else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN && + flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) + flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP_VXLAN_IPV4_OTHER; filter->tunnel_type = tunnel_type; filter->input.flow_type = flow_type; @@ -2164,7 +2192,7 @@ ice_fdir_parse(struct ice_adapter *ad, uint32_t array_len, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], - uint32_t priority __rte_unused, + uint32_t priority, void **meta, struct rte_flow_error *error) { @@ -2177,6 +2205,10 @@ ice_fdir_parse(struct ice_adapter *ad, memset(filter, 0, sizeof(*filter)); item = ice_search_pattern_match_item(ad, pattern, array, array_len, error); + + if (!ad->devargs.pipe_mode_support && priority >= 1) + return -rte_errno; + if (!item) return -rte_errno;