From: Jingjing Wu Date: Fri, 21 Nov 2014 00:46:39 +0000 (+0800) Subject: i40e: transition between flow type and pctype X-Git-Tag: spdx-start~10112 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a72c1d58ded274582248389515506b6e76b46414;p=dpdk.git i40e: transition between flow type and pctype - macros to validate flow_type and pctype - functions for transition between flow_type and pctype: - i40e_flowtype_to_pctype - i40e_pctype_to_flowtype Signed-off-by: Jingjing Wu Acked-by: Konstantin Ananyev --- diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 7dd070881b..2200aede0a 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -5136,3 +5136,49 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev, return ret; } + +enum i40e_filter_pctype +i40e_flowtype_to_pctype(enum rte_eth_flow_type flow_type) +{ + static const enum i40e_filter_pctype pctype_table[] = { + [RTE_ETH_FLOW_TYPE_UDPV4] = I40E_FILTER_PCTYPE_NONF_IPV4_UDP, + [RTE_ETH_FLOW_TYPE_TCPV4] = I40E_FILTER_PCTYPE_NONF_IPV4_TCP, + [RTE_ETH_FLOW_TYPE_SCTPV4] = I40E_FILTER_PCTYPE_NONF_IPV4_SCTP, + [RTE_ETH_FLOW_TYPE_IPV4_OTHER] = + I40E_FILTER_PCTYPE_NONF_IPV4_OTHER, + [RTE_ETH_FLOW_TYPE_FRAG_IPV4] = + I40E_FILTER_PCTYPE_FRAG_IPV4, + [RTE_ETH_FLOW_TYPE_UDPV6] = I40E_FILTER_PCTYPE_NONF_IPV6_UDP, + [RTE_ETH_FLOW_TYPE_TCPV6] = I40E_FILTER_PCTYPE_NONF_IPV6_TCP, + [RTE_ETH_FLOW_TYPE_SCTPV6] = I40E_FILTER_PCTYPE_NONF_IPV6_SCTP, + [RTE_ETH_FLOW_TYPE_IPV6_OTHER] = + I40E_FILTER_PCTYPE_NONF_IPV6_OTHER, + [RTE_ETH_FLOW_TYPE_FRAG_IPV6] = + I40E_FILTER_PCTYPE_FRAG_IPV6, + }; + + return pctype_table[flow_type]; +} + +enum rte_eth_flow_type +i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) +{ + static const enum rte_eth_flow_type flowtype_table[] = { + [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = RTE_ETH_FLOW_TYPE_UDPV4, + [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = RTE_ETH_FLOW_TYPE_TCPV4, + [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] = RTE_ETH_FLOW_TYPE_SCTPV4, + [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + RTE_ETH_FLOW_TYPE_IPV4_OTHER, + [I40E_FILTER_PCTYPE_FRAG_IPV4] = + RTE_ETH_FLOW_TYPE_FRAG_IPV4, + [I40E_FILTER_PCTYPE_NONF_IPV6_UDP] = RTE_ETH_FLOW_TYPE_UDPV6, + [I40E_FILTER_PCTYPE_NONF_IPV6_TCP] = RTE_ETH_FLOW_TYPE_TCPV6, + [I40E_FILTER_PCTYPE_NONF_IPV6_SCTP] = RTE_ETH_FLOW_TYPE_SCTPV6, + [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = + RTE_ETH_FLOW_TYPE_IPV6_OTHER, + [I40E_FILTER_PCTYPE_FRAG_IPV6] = + RTE_ETH_FLOW_TYPE_FRAG_IPV6, + }; + + return flowtype_table[pctype]; +} diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h b/lib/librte_pmd_i40e/i40e_ethdev.h index 9e4e6d6e2f..716e1dc26c 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.h +++ b/lib/librte_pmd_i40e/i40e_ethdev.h @@ -461,6 +461,10 @@ const struct rte_memzone *i40e_memzone_reserve(const char *name, int socket_id); int i40e_fdir_configure(struct rte_eth_dev *dev); void i40e_fdir_teardown(struct i40e_pf *pf); +enum i40e_filter_pctype i40e_flowtype_to_pctype( + enum rte_eth_flow_type flow_type); +enum rte_eth_flow_type i40e_pctype_to_flowtype( + enum i40e_filter_pctype pctype); /* I40E_DEV_PRIVATE_TO */ #define I40E_DEV_PRIVATE_TO_PF(adapter) \ @@ -523,4 +527,28 @@ i40e_init_adminq_parameter(struct i40e_hw *hw) hw->aq.asq_buf_size = I40E_AQ_BUF_SZ; } +#define I40E_VALID_FLOW_TYPE(flow_type) \ + ((flow_type) == RTE_ETH_FLOW_TYPE_UDPV4 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_TCPV4 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_SCTPV4 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_IPV4_OTHER || \ + (flow_type) == RTE_ETH_FLOW_TYPE_FRAG_IPV4 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_UDPV6 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_TCPV6 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_SCTPV6 || \ + (flow_type) == RTE_ETH_FLOW_TYPE_IPV6_OTHER || \ + (flow_type) == RTE_ETH_FLOW_TYPE_FRAG_IPV6) + +#define I40E_VALID_PCTYPE(pctype) \ + ((pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_UDP || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_TCP || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || \ + (pctype) == I40E_FILTER_PCTYPE_FRAG_IPV4 || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || \ + (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || \ + (pctype) == I40E_FILTER_PCTYPE_FRAG_IPV6) + #endif /* _I40E_ETHDEV_H_ */