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;
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);
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);
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;
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,
};
item->type == RTE_FLOW_ITEM_TYPE_END);
}
+struct ice_ptype_match {
+ enum rte_flow_item_type *pattern_list;
+ uint16_t hw_ptype;
+};
+
+static struct ice_ptype_match ice_ptype_map[] = {
+ {pattern_eth_ipv4, ICE_PTYPE_IPV4_PAY},
+ {pattern_eth_ipv4_udp, ICE_PTYPE_IPV4_UDP_PAY},
+ {pattern_eth_ipv4_tcp, ICE_PTYPE_IPV4_TCP_PAY},
+ {pattern_eth_ipv4_sctp, ICE_PTYPE_IPV4_SCTP_PAY},
+ {pattern_eth_ipv4_gtpu, ICE_MAC_IPV4_GTPU},
+ {pattern_eth_ipv4_gtpu_eh, ICE_MAC_IPV4_GTPU},
+ {pattern_eth_ipv4_gtpu_ipv4, ICE_MAC_IPV4_GTPU_IPV4_PAY},
+ {pattern_eth_ipv4_gtpu_ipv4_udp, ICE_MAC_IPV4_GTPU_IPV4_UDP_PAY},
+ {pattern_eth_ipv4_gtpu_ipv4_tcp, ICE_MAC_IPV4_GTPU_IPV4_TCP},
+ {pattern_eth_ipv4_gtpu_ipv6, ICE_MAC_IPV4_GTPU_IPV6_PAY},
+ {pattern_eth_ipv4_gtpu_ipv6_udp, ICE_MAC_IPV4_GTPU_IPV6_UDP_PAY},
+ {pattern_eth_ipv4_gtpu_ipv6_tcp, ICE_MAC_IPV4_GTPU_IPV6_TCP},
+ {pattern_eth_ipv4_gtpu_eh_ipv4, ICE_MAC_IPV4_GTPU_IPV4_PAY},
+ {pattern_eth_ipv4_gtpu_eh_ipv4_udp, ICE_MAC_IPV4_GTPU_IPV4_UDP_PAY},
+ {pattern_eth_ipv4_gtpu_eh_ipv4_tcp, ICE_MAC_IPV4_GTPU_IPV4_TCP},
+ {pattern_eth_ipv4_gtpu_eh_ipv6, ICE_MAC_IPV4_GTPU_IPV6_PAY},
+ {pattern_eth_ipv4_gtpu_eh_ipv6_udp, ICE_MAC_IPV4_GTPU_IPV6_UDP_PAY},
+ {pattern_eth_ipv4_gtpu_eh_ipv6_tcp, ICE_MAC_IPV4_GTPU_IPV6_TCP},
+ {pattern_eth_ipv4_esp, ICE_MAC_IPV4_ESP},
+ {pattern_eth_ipv4_udp_esp, ICE_MAC_IPV4_NAT_T_ESP},
+ {pattern_eth_ipv4_ah, ICE_MAC_IPV4_AH},
+ {pattern_eth_ipv4_l2tp, ICE_MAC_IPV4_L2TPV3},
+ {pattern_eth_ipv4_pfcp, ICE_MAC_IPV4_PFCP_SESSION},
+ {pattern_eth_ipv6, ICE_PTYPE_IPV6_PAY},
+ {pattern_eth_ipv6_udp, ICE_PTYPE_IPV6_UDP_PAY},
+ {pattern_eth_ipv6_tcp, ICE_PTYPE_IPV6_TCP_PAY},
+ {pattern_eth_ipv6_sctp, ICE_PTYPE_IPV6_SCTP_PAY},
+ {pattern_eth_ipv6_gtpu, ICE_MAC_IPV6_GTPU},
+ {pattern_eth_ipv6_gtpu_eh, ICE_MAC_IPV6_GTPU},
+ {pattern_eth_ipv6_gtpu_ipv4, ICE_MAC_IPV6_GTPU_IPV4_PAY},
+ {pattern_eth_ipv6_gtpu_ipv4_udp, ICE_MAC_IPV6_GTPU_IPV4_UDP_PAY},
+ {pattern_eth_ipv6_gtpu_ipv4_tcp, ICE_MAC_IPV6_GTPU_IPV4_TCP},
+ {pattern_eth_ipv6_gtpu_ipv6, ICE_MAC_IPV6_GTPU_IPV6_PAY},
+ {pattern_eth_ipv6_gtpu_ipv6_udp, ICE_MAC_IPV6_GTPU_IPV6_UDP_PAY},
+ {pattern_eth_ipv6_gtpu_ipv6_tcp, ICE_MAC_IPV6_GTPU_IPV6_TCP},
+ {pattern_eth_ipv6_gtpu_eh_ipv4, ICE_MAC_IPV6_GTPU_IPV4_PAY},
+ {pattern_eth_ipv6_gtpu_eh_ipv4_udp, ICE_MAC_IPV6_GTPU_IPV4_UDP_PAY},
+ {pattern_eth_ipv6_gtpu_eh_ipv4_tcp, ICE_MAC_IPV6_GTPU_IPV4_TCP},
+ {pattern_eth_ipv6_gtpu_eh_ipv6, ICE_MAC_IPV6_GTPU_IPV6_PAY},
+ {pattern_eth_ipv6_gtpu_eh_ipv6_udp, ICE_MAC_IPV6_GTPU_IPV6_UDP_PAY},
+ {pattern_eth_ipv6_gtpu_eh_ipv6_tcp, ICE_MAC_IPV6_GTPU_IPV6_TCP},
+ {pattern_eth_ipv6_esp, ICE_MAC_IPV6_ESP},
+ {pattern_eth_ipv6_udp_esp, ICE_MAC_IPV6_NAT_T_ESP},
+ {pattern_eth_ipv6_ah, ICE_MAC_IPV6_AH},
+ {pattern_eth_ipv6_l2tp, ICE_MAC_IPV6_L2TPV3},
+ {pattern_eth_ipv6_pfcp, ICE_MAC_IPV6_PFCP_SESSION},
+ {pattern_ethertype, ICE_PTYPE_MAC_PAY},
+ {pattern_ethertype_vlan, ICE_PTYPE_MAC_PAY},
+ {pattern_eth_arp, ICE_PTYPE_MAC_PAY},
+ {pattern_eth_vlan_ipv4, ICE_PTYPE_IPV4_PAY},
+ {pattern_eth_vlan_ipv4_udp, ICE_PTYPE_IPV4_UDP_PAY},
+ {pattern_eth_vlan_ipv4_tcp, ICE_PTYPE_IPV4_TCP_PAY},
+ {pattern_eth_vlan_ipv4_sctp, ICE_PTYPE_IPV4_SCTP_PAY},
+ {pattern_eth_vlan_ipv6, ICE_PTYPE_IPV6_PAY},
+ {pattern_eth_vlan_ipv6_udp, ICE_PTYPE_IPV6_UDP_PAY},
+ {pattern_eth_vlan_ipv6_tcp, ICE_PTYPE_IPV6_TCP_PAY},
+ {pattern_eth_vlan_ipv6_sctp, ICE_PTYPE_IPV6_SCTP_PAY},
+ {pattern_eth_pppoes, ICE_MAC_PPPOE_PAY},
+ {pattern_eth_vlan_pppoes, ICE_MAC_PPPOE_PAY},
+ {pattern_eth_pppoes_proto, ICE_MAC_PPPOE_PAY},
+ {pattern_eth_vlan_pppoes_proto, ICE_MAC_PPPOE_PAY},
+ {pattern_eth_pppoes_ipv4, ICE_MAC_PPPOE_IPV4_PAY},
+ {pattern_eth_pppoes_ipv4_udp, ICE_MAC_PPPOE_IPV4_UDP_PAY},
+ {pattern_eth_pppoes_ipv4_tcp, ICE_MAC_PPPOE_IPV4_TCP},
+ {pattern_eth_vlan_pppoes_ipv4, ICE_MAC_PPPOE_IPV4_PAY},
+ {pattern_eth_vlan_pppoes_ipv4_tcp, ICE_MAC_PPPOE_IPV4_TCP},
+ {pattern_eth_vlan_pppoes_ipv4_udp, ICE_MAC_PPPOE_IPV4_UDP_PAY},
+ {pattern_eth_pppoes_ipv6, ICE_MAC_PPPOE_IPV6_PAY},
+ {pattern_eth_pppoes_ipv6_udp, ICE_MAC_PPPOE_IPV6_UDP_PAY},
+ {pattern_eth_pppoes_ipv6_tcp, ICE_MAC_PPPOE_IPV6_TCP},
+ {pattern_eth_vlan_pppoes_ipv6, ICE_MAC_PPPOE_IPV6_PAY},
+ {pattern_eth_vlan_pppoes_ipv6_tcp, ICE_MAC_PPPOE_IPV6_TCP},
+ {pattern_eth_vlan_pppoes_ipv6_udp, ICE_MAC_PPPOE_IPV6_UDP_PAY},
+ {pattern_eth_ipv4_udp_vxlan_ipv4, ICE_MAC_IPV4_TUN_IPV4_PAY},
+ {pattern_eth_ipv4_udp_vxlan_ipv4_udp, ICE_MAC_IPV4_TUN_IPV4_UDP_PAY},
+ {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, ICE_MAC_IPV4_TUN_IPV4_TCP},
+ {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, ICE_MAC_IPV4_TUN_IPV4_SCTP},
+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4, ICE_MAC_IPV4_TUN_IPV4_PAY},
+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, ICE_MAC_IPV4_TUN_IPV4_UDP_PAY},
+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, ICE_MAC_IPV4_TUN_IPV4_TCP},
+ {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, ICE_MAC_IPV4_TUN_IPV4_SCTP},
+ {pattern_eth_ipv4_nvgre_eth_ipv4, ICE_MAC_IPV4_TUN_IPV4_PAY},
+ {pattern_eth_ipv4_nvgre_eth_ipv4_udp, ICE_MAC_IPV4_TUN_IPV4_UDP_PAY},
+ {pattern_eth_ipv4_nvgre_eth_ipv4_tcp, ICE_MAC_IPV4_TUN_IPV4_TCP},
+};
+
+static bool
+ice_pattern_is_supported(__rte_unused struct ice_adapter *ad,
+ const struct rte_flow_item *pattern)
+{
+ uint16_t i;
+
+ for (i = 0; i < RTE_DIM(ice_ptype_map); i++) {
+ if (ice_match_pattern(ice_ptype_map[i].pattern_list,
+ pattern)) {
+ return ice_hw_ptype_ena(&ad->hw,
+ ice_ptype_map[i].hw_ptype);
+ }
+ }
+
+ return false;
+}
+
struct ice_pattern_match_item *
-ice_search_pattern_match_item(const struct rte_flow_item pattern[],
- struct ice_pattern_match_item *array,
- uint32_t array_len,
- struct rte_flow_error *error)
+ice_search_pattern_match_item(struct ice_adapter *ad,
+ const struct rte_flow_item pattern[],
+ struct ice_pattern_match_item *array,
+ uint32_t array_len,
+ struct rte_flow_error *error)
{
- uint16_t i = 0;
struct ice_pattern_match_item *pattern_match_item;
/* need free by each filter */
struct rte_flow_item *items; /* used for pattern without VOID items */
uint32_t item_num = 0; /* non-void item number */
+ uint16_t i = 0;
/* Get the non-void item number of pattern */
while ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_END) {
if (!pattern_match_item) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "Failed to allocate memory.");
+ rte_free(items);
return NULL;
}
ice_pattern_skip_void_item(items, pattern);
- for (i = 0; i < array_len; i++)
+ if (!ice_pattern_is_supported(ad, pattern))
+ goto unsupported;
+
+ for (i = 0; i < array_len; i++) {
if (ice_match_pattern(array[i].pattern_list,
- items)) {
+ items)) {
pattern_match_item->input_set_mask =
array[i].input_set_mask;
pattern_match_item->pattern_list =
rte_free(items);
return pattern_match_item;
}
+ }
+
+unsupported:
rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
pattern, "Unsupported pattern");
-
rte_free(items);
rte_free(pattern_match_item);
return NULL;
void ice_unregister_parser(struct ice_flow_parser *parser,
struct ice_adapter *ad);
struct ice_pattern_match_item *
-ice_search_pattern_match_item(const struct rte_flow_item pattern[],
- struct ice_pattern_match_item *array,
- uint32_t array_len,
- struct rte_flow_error *error);
+ice_search_pattern_match_item(struct ice_adapter *ad,
+ const struct rte_flow_item pattern[],
+ struct ice_pattern_match_item *array,
+ uint32_t array_len,
+ struct rte_flow_error *error);
int
ice_flow_redirect(struct ice_adapter *ad,
struct ice_flow_redirect *rd);
* the second member is input set mask,
* the third member is ice_rss_hash_cfg template.
*/
-
-/* Supported pattern for os default package. */
-static struct ice_pattern_match_item ice_hash_pattern_list_os[] = {
- /* IPV4 */
- {pattern_eth_ipv4, ICE_RSS_TYPE_OUTER_IPV4, &ipv4_tmplt},
- {pattern_eth_ipv4_udp, ICE_RSS_TYPE_OUTER_IPV4_UDP, &ipv4_udp_tmplt},
- {pattern_eth_ipv4_tcp, ICE_RSS_TYPE_OUTER_IPV4_TCP, &ipv4_tcp_tmplt},
- {pattern_eth_ipv4_sctp, ICE_RSS_TYPE_OUTER_IPV4_SCTP, &ipv4_sctp_tmplt},
- /* IPV6 */
- {pattern_eth_ipv6, ICE_RSS_TYPE_OUTER_IPV6, &ipv6_tmplt},
- {pattern_eth_ipv6_udp, ICE_RSS_TYPE_OUTER_IPV6_UDP, &ipv6_udp_tmplt},
- {pattern_eth_ipv6_tcp, ICE_RSS_TYPE_OUTER_IPV6_TCP, &ipv6_tcp_tmplt},
- {pattern_eth_ipv6_sctp, ICE_RSS_TYPE_OUTER_IPV6_SCTP, &ipv6_sctp_tmplt},
- /* EMPTY */
- {pattern_empty, ICE_RSS_TYPE_EMPTY, &empty_tmplt},
-};
-
-/* Supported pattern for comms package. */
-static struct ice_pattern_match_item ice_hash_pattern_list_comms[] = {
+static struct ice_pattern_match_item ice_hash_pattern_list[] = {
/* IPV4 */
{pattern_eth_ipv4, ICE_RSS_TYPE_OUTER_IPV4, &ipv4_tmplt},
{pattern_eth_ipv4_udp, ICE_RSS_TYPE_OUTER_IPV4_UDP, &ipv4_udp_tmplt},
};
/* Register parser for os package. */
-static struct ice_flow_parser ice_hash_parser_os = {
- .engine = &ice_hash_engine,
- .array = ice_hash_pattern_list_os,
- .array_len = RTE_DIM(ice_hash_pattern_list_os),
- .parse_pattern_action = ice_hash_parse_pattern_action,
- .stage = ICE_FLOW_STAGE_RSS,
-};
-
-/* Register parser for comms package. */
-static struct ice_flow_parser ice_hash_parser_comms = {
+static struct ice_flow_parser ice_hash_parser = {
.engine = &ice_hash_engine,
- .array = ice_hash_pattern_list_comms,
- .array_len = RTE_DIM(ice_hash_pattern_list_comms),
+ .array = ice_hash_pattern_list,
+ .array_len = RTE_DIM(ice_hash_pattern_list),
.parse_pattern_action = ice_hash_parse_pattern_action,
.stage = ICE_FLOW_STAGE_RSS,
};
if (ad->hw.dcf_enabled)
return 0;
- if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
- parser = &ice_hash_parser_os;
- else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- parser = &ice_hash_parser_comms;
- else
- return -EINVAL;
+ parser = &ice_hash_parser;
return ice_register_parser(parser, ad);
}
}
/* Check rss supported pattern and find matched pattern. */
- pattern_match_item = ice_search_pattern_match_item(pattern,
- array, array_len, error);
+ pattern_match_item = ice_search_pattern_match_item(ad, pattern, array,
+ array_len, error);
if (!pattern_match_item) {
ret = -rte_errno;
goto error;
if (ad->hw.dcf_enabled)
return;
- if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
- ice_unregister_parser(&ice_hash_parser_os, ad);
- else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- ice_unregister_parser(&ice_hash_parser_comms, ad);
+ ice_unregister_parser(&ice_hash_parser, ad);
}
static void
struct ice_adv_rule_info rule_info;
};
-static struct ice_flow_parser ice_switch_dist_parser_os;
-static struct ice_flow_parser ice_switch_dist_parser_comms;
-static struct ice_flow_parser ice_switch_perm_parser_os;
-static struct ice_flow_parser ice_switch_perm_parser_comms;
+static struct ice_flow_parser ice_switch_dist_parser;
+static struct ice_flow_parser ice_switch_perm_parser;
static struct
-ice_pattern_match_item ice_switch_pattern_dist_os[] = {
- {pattern_ethertype,
- ICE_SW_INSET_ETHER, ICE_INSET_NONE},
- {pattern_ethertype_vlan,
- ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
- {pattern_eth_arp,
- ICE_INSET_NONE, ICE_INSET_NONE},
- {pattern_eth_ipv4,
- ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp,
- ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv4_tcp,
- ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
- {pattern_eth_ipv6,
- ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
- {pattern_eth_ipv6_udp,
- ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv6_tcp,
- ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp_vxlan_eth_ipv4,
- ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
- ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
- ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
- {pattern_eth_ipv4_nvgre_eth_ipv4,
- ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
- {pattern_eth_ipv4_nvgre_eth_ipv4_udp,
- ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
- ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
-};
-
-static struct
-ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
+ice_pattern_match_item ice_switch_pattern_dist_list[] = {
{pattern_ethertype,
ICE_SW_INSET_ETHER, ICE_INSET_NONE},
{pattern_ethertype_vlan,
};
static struct
-ice_pattern_match_item ice_switch_pattern_perm_os[] = {
- {pattern_ethertype,
- ICE_SW_INSET_ETHER, ICE_INSET_NONE},
- {pattern_ethertype_vlan,
- ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
- {pattern_eth_arp,
- ICE_INSET_NONE, ICE_INSET_NONE},
- {pattern_eth_ipv4,
- ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp,
- ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv4_tcp,
- ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
- {pattern_eth_ipv6,
- ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
- {pattern_eth_ipv6_udp,
- ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv6_tcp,
- ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp_vxlan_eth_ipv4,
- ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
- ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
- ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
- {pattern_eth_ipv4_nvgre_eth_ipv4,
- ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
- {pattern_eth_ipv4_nvgre_eth_ipv4_udp,
- ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
- {pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
- ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-};
-
-static struct
-ice_pattern_match_item ice_switch_pattern_perm_comms[] = {
+ice_pattern_match_item ice_switch_pattern_perm_list[] = {
{pattern_ethertype,
ICE_SW_INSET_ETHER, ICE_INSET_NONE},
{pattern_ethertype_vlan,
}
pattern_match_item =
- ice_search_pattern_match_item(pattern, array, array_len, error);
+ ice_search_pattern_match_item(ad, pattern, array, array_len,
+ error);
if (!pattern_match_item) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
struct ice_flow_parser *dist_parser;
struct ice_flow_parser *perm_parser;
- if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- dist_parser = &ice_switch_dist_parser_comms;
- else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
- dist_parser = &ice_switch_dist_parser_os;
- else
- return -EINVAL;
-
if (ad->devargs.pipe_mode_support) {
- if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- perm_parser = &ice_switch_perm_parser_comms;
- else
- perm_parser = &ice_switch_perm_parser_os;
-
+ perm_parser = &ice_switch_perm_parser;
ret = ice_register_parser(perm_parser, ad);
} else {
+ dist_parser = &ice_switch_dist_parser;
ret = ice_register_parser(dist_parser, ad);
}
return ret;
struct ice_flow_parser *dist_parser;
struct ice_flow_parser *perm_parser;
- if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- dist_parser = &ice_switch_dist_parser_comms;
- else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
- dist_parser = &ice_switch_dist_parser_os;
- else
- return;
-
if (ad->devargs.pipe_mode_support) {
- if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
- perm_parser = &ice_switch_perm_parser_comms;
- else
- perm_parser = &ice_switch_perm_parser_os;
-
+ perm_parser = &ice_switch_perm_parser;
ice_unregister_parser(perm_parser, ad);
} else {
+ dist_parser = &ice_switch_dist_parser;
ice_unregister_parser(dist_parser, ad);
}
}
};
static struct
-ice_flow_parser ice_switch_dist_parser_os = {
+ice_flow_parser ice_switch_dist_parser = {
.engine = &ice_switch_engine,
- .array = ice_switch_pattern_dist_os,
- .array_len = RTE_DIM(ice_switch_pattern_dist_os),
+ .array = ice_switch_pattern_dist_list,
+ .array_len = RTE_DIM(ice_switch_pattern_dist_list),
.parse_pattern_action = ice_switch_parse_pattern_action,
.stage = ICE_FLOW_STAGE_DISTRIBUTOR,
};
static struct
-ice_flow_parser ice_switch_dist_parser_comms = {
- .engine = &ice_switch_engine,
- .array = ice_switch_pattern_dist_comms,
- .array_len = RTE_DIM(ice_switch_pattern_dist_comms),
- .parse_pattern_action = ice_switch_parse_pattern_action,
- .stage = ICE_FLOW_STAGE_DISTRIBUTOR,
-};
-
-static struct
-ice_flow_parser ice_switch_perm_parser_os = {
- .engine = &ice_switch_engine,
- .array = ice_switch_pattern_perm_os,
- .array_len = RTE_DIM(ice_switch_pattern_perm_os),
- .parse_pattern_action = ice_switch_parse_pattern_action,
- .stage = ICE_FLOW_STAGE_PERMISSION,
-};
-
-static struct
-ice_flow_parser ice_switch_perm_parser_comms = {
+ice_flow_parser ice_switch_perm_parser = {
.engine = &ice_switch_engine,
- .array = ice_switch_pattern_perm_comms,
- .array_len = RTE_DIM(ice_switch_pattern_perm_comms),
+ .array = ice_switch_pattern_perm_list,
+ .array_len = RTE_DIM(ice_switch_pattern_perm_list),
.parse_pattern_action = ice_switch_parse_pattern_action,
.stage = ICE_FLOW_STAGE_PERMISSION,
};