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},
-};
-
-static struct ice_pattern_match_item ice_fdir_pattern_comms[] = {
+static struct ice_pattern_match_item ice_fdir_pattern_list[] = {
{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_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE},
};
-static struct ice_flow_parser ice_fdir_parser_os;
-static struct ice_flow_parser ice_fdir_parser_comms;
+static struct ice_flow_parser ice_fdir_parser;
static int
ice_fdir_is_tunnel_profile(enum ice_fdir_tunnel_type tunnel_type);
static int
ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
- uint64_t input_set, enum ice_fdir_tunnel_type ttype)
+ uint64_t inner_input_set, uint64_t outer_input_set,
+ enum ice_fdir_tunnel_type ttype)
{
struct ice_flow_seg_info *seg;
struct ice_flow_seg_info *seg_tun = NULL;
enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX];
+ uint64_t input_set;
bool is_tunnel;
- int i, ret;
+ int k, i, ret = 0;
- if (!input_set)
+ if (!(inner_input_set | outer_input_set))
return -EINVAL;
- seg = (struct ice_flow_seg_info *)
- ice_malloc(hw, sizeof(*seg));
- if (!seg) {
+ seg_tun = (struct ice_flow_seg_info *)
+ ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
+ if (!seg_tun) {
PMD_DRV_LOG(ERR, "No memory can be allocated");
return -ENOMEM;
}
- for (i = 0; i < ICE_FLOW_FIELD_IDX_MAX; i++)
- field[i] = ICE_FLOW_FIELD_IDX_MAX;
+ /* use seg_tun[1] to record tunnel inner part or non-tunnel */
+ 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;
+ if (input_set == 0)
+ continue;
+
+ for (i = 0; i < ICE_FLOW_FIELD_IDX_MAX; i++)
+ field[i] = ICE_FLOW_FIELD_IDX_MAX;
- ice_fdir_input_set_parse(input_set, field);
+ ice_fdir_input_set_parse(input_set, field);
- ice_fdir_input_set_hdrs(flow, seg);
+ ice_fdir_input_set_hdrs(flow, seg);
- for (i = 0; field[i] != ICE_FLOW_FIELD_IDX_MAX; i++) {
- ice_flow_set_fld(seg, field[i],
- ICE_FLOW_FLD_OFF_INVAL,
- ICE_FLOW_FLD_OFF_INVAL,
- ICE_FLOW_FLD_OFF_INVAL, false);
+ for (i = 0; field[i] != ICE_FLOW_FIELD_IDX_MAX; i++) {
+ ice_flow_set_fld(seg, field[i],
+ ICE_FLOW_FLD_OFF_INVAL,
+ ICE_FLOW_FLD_OFF_INVAL,
+ ICE_FLOW_FLD_OFF_INVAL, false);
+ }
}
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, flow, false);
+ seg_tun + 1, flow, false);
} else {
- seg_tun = (struct ice_flow_seg_info *)
- ice_malloc(hw, sizeof(*seg) * ICE_FD_HW_SEG_MAX);
- if (!seg_tun) {
- PMD_DRV_LOG(ERR, "No memory can be allocated");
- rte_free(seg);
- return -ENOMEM;
- }
- rte_memcpy(&seg_tun[1], seg, sizeof(*seg));
ret = ice_fdir_hw_tbl_conf(pf, pf->main_vsi, pf->fdir.fdir_vsi,
seg_tun, flow, true);
}
if (!ret) {
return ret;
} else if (ret < 0) {
- rte_free(seg);
- if (is_tunnel)
- rte_free(seg_tun);
+ rte_free(seg_tun);
return (ret == -EEXIST) ? 0 : ret;
} else {
return ret;
if (ret)
return ret;
- if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- parser = &ice_fdir_parser_comms;
- else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
- parser = &ice_fdir_parser_os;
- else
- return -EINVAL;
+ parser = &ice_fdir_parser;
return ice_register_parser(parser, ad);
}
static void
ice_fdir_uninit(struct ice_adapter *ad)
{
- struct ice_pf *pf = &ad->pf;
struct ice_flow_parser *parser;
+ struct ice_pf *pf = &ad->pf;
if (ad->hw.dcf_enabled)
return;
- if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- parser = &ice_fdir_parser_comms;
- else
- parser = &ice_fdir_parser_os;
+ parser = &ice_fdir_parser;
ice_unregister_parser(parser, 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->tunnel_type);
+ filter->input_set, filter->outer_input_set,
+ filter->tunnel_type);
if (ret) {
rte_flow_error_set(error, -ret,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
goto free_counter;
}
+ if (filter->mark_flag == 1)
+ ice_fdir_rx_parsing_enable(ad, 1);
+
rte_memcpy(entry, filter, sizeof(*entry));
ret = ice_fdir_entry_insert(pf, entry, &key);
if (ret) {
}
ice_fdir_cnt_update(pf, filter->input.flow_type, is_tun, false);
+
+ if (filter->mark_flag == 1)
+ ice_fdir_rx_parsing_enable(ad, 0);
+
flow->rule = NULL;
rte_free(filter);
break;
case RTE_FLOW_ACTION_TYPE_MARK:
mark_num++;
-
+ filter->mark_flag = 1;
mark_spec = actions->conf;
filter->input.fltr_id = mark_spec->id;
filter->input.fdid_prio = ICE_FXD_FLTR_QW1_FDID_PRI_ONE;
int ret;
memset(filter, 0, sizeof(*filter));
- item = ice_search_pattern_match_item(pattern, array, array_len, error);
+ item = ice_search_pattern_match_item(ad, pattern, array, array_len,
+ error);
if (!item)
return -rte_errno;
ret = ice_fdir_parse_pattern(ad, pattern, error, filter);
if (ret)
goto error;
- input_set = filter->input_set;
+ input_set = filter->input_set | filter->outer_input_set;
if (!input_set || input_set & ~item->input_set_mask) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
return ret;
}
-static struct ice_flow_parser ice_fdir_parser_os = {
- .engine = &ice_fdir_engine,
- .array = ice_fdir_pattern_os,
- .array_len = RTE_DIM(ice_fdir_pattern_os),
- .parse_pattern_action = ice_fdir_parse,
- .stage = ICE_FLOW_STAGE_DISTRIBUTOR,
-};
-
-static struct ice_flow_parser ice_fdir_parser_comms = {
+static struct ice_flow_parser ice_fdir_parser = {
.engine = &ice_fdir_engine,
- .array = ice_fdir_pattern_comms,
- .array_len = RTE_DIM(ice_fdir_pattern_comms),
+ .array = ice_fdir_pattern_list,
+ .array_len = RTE_DIM(ice_fdir_pattern_list),
.parse_pattern_action = ice_fdir_parse,
.stage = ICE_FLOW_STAGE_DISTRIBUTOR,
};