[dpdk-dev] [PATCH RFC 5/7] ethdev: unification of flow types

Zhang, Helin helin.zhang at intel.com
Mon Dec 22 03:33:07 CET 2014


Hi Konstantin

> > -
> > -/**
> >   * A structure used to define the input for IPV4 flow
> >   */
> >  struct rte_eth_ipv4_flow {
> > @@ -291,7 +302,7 @@ struct rte_eth_fdir_flow_ext {
> >   * A structure used to define the input for a flow director filter entry
> >   */
> >  struct rte_eth_fdir_input {
> > -	enum rte_eth_flow_type flow_type;      /**< Type of flow */
> > +	uint16_t flow_type;      /**< Type of flow */
> 
> Wonder, why do you need to switch from int to uinsigned short for flow_type?
> Konstantin

Actually there are same things in rte_ethdev.h and rte_eth_ctrl.h, though seems different.
The goal is to unify them, so the original type of MACRO was chosen. Using uint16_t but
not enum is also beneficial for compilation, as rte_eth_ctrl.h is included in rte_ethdev.h.

In rte_ethdev.h, it is,
/* Supported RSS offloads */
/* for 1G & 10G */
#define ETH_RSS_IPV4_SHIFT                    0
#define ETH_RSS_IPV4_TCP_SHIFT                1
#define ETH_RSS_IPV6_SHIFT                    2
#define ETH_RSS_IPV6_EX_SHIFT                 3
#define ETH_RSS_IPV6_TCP_SHIFT                4
#define ETH_RSS_IPV6_TCP_EX_SHIFT             5
#define ETH_RSS_IPV4_UDP_SHIFT                6
#define ETH_RSS_IPV6_UDP_SHIFT                7
#define ETH_RSS_IPV6_UDP_EX_SHIFT             8
/* for 40G only */
#define ETH_RSS_NONF_IPV4_UDP_SHIFT           31
#define ETH_RSS_NONF_IPV4_TCP_SHIFT           33
#define ETH_RSS_NONF_IPV4_SCTP_SHIFT          34
#define ETH_RSS_NONF_IPV4_OTHER_SHIFT         35
#define ETH_RSS_FRAG_IPV4_SHIFT               36
#define ETH_RSS_NONF_IPV6_UDP_SHIFT           41
#define ETH_RSS_NONF_IPV6_TCP_SHIFT           43
#define ETH_RSS_NONF_IPV6_SCTP_SHIFT          44
#define ETH_RSS_NONF_IPV6_OTHER_SHIFT         45
#define ETH_RSS_FRAG_IPV6_SHIFT               46
#define ETH_RSS_FCOE_OX_SHIFT                 48
#define ETH_RSS_FCOE_RX_SHIFT                 49
#define ETH_RSS_FCOE_OTHER_SHIFT              50
#define ETH_RSS_L2_PAYLOAD_SHIFT              63

In rte_eth_ctrl.h, it is,
/**
 * Flow type
 */
enum rte_eth_flow_type {
	RTE_ETH_FLOW_TYPE_NONE = 0,
	RTE_ETH_FLOW_TYPE_UDPV4,
	RTE_ETH_FLOW_TYPE_TCPV4,
	RTE_ETH_FLOW_TYPE_SCTPV4,
	RTE_ETH_FLOW_TYPE_IPV4_OTHER,
	RTE_ETH_FLOW_TYPE_FRAG_IPV4,
	RTE_ETH_FLOW_TYPE_UDPV6,
	RTE_ETH_FLOW_TYPE_TCPV6,
	RTE_ETH_FLOW_TYPE_SCTPV6,
	RTE_ETH_FLOW_TYPE_IPV6_OTHER,
	RTE_ETH_FLOW_TYPE_FRAG_IPV6,
	RTE_ETH_FLOW_TYPE_MAX = 64,
};

Regards,
Helin

> 
> >  	union rte_eth_fdir_flow flow;
> >  	/**< Flow fields to match, dependent on flow_type */
> >  	struct rte_eth_fdir_flow_ext flow_ext; @@ -371,7 +382,7 @@ struct
> > rte_eth_flex_payload_cfg {
> >   * for each flow type
> >   */
> >  struct rte_eth_fdir_flex_mask {
> > -	enum rte_eth_flow_type flow_type;  /**< Flow type */
> > +	uint16_t flow_type;  /**< Flow type */
> >  	uint8_t mask[RTE_ETH_FDIR_MAX_FLEXLEN];
> >  	/**< Mask for the whole flexible payload */  }; @@ -385,7 +396,7 @@
> > struct rte_eth_fdir_flex_conf {
> >  	uint16_t nb_flexmasks; /**< The number of following mask */
> >  	struct rte_eth_flex_payload_cfg flex_set[RTE_ETH_PAYLOAD_MAX];
> >  	/**< Flex payload configuration for each payload type */
> > -	struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_TYPE_MAX];
> > +	struct rte_eth_fdir_flex_mask flex_mask[ETH_FLOW_TYPE_MAX];
> >  	/**< Flex mask configuration for each flow type */  };


More information about the dev mailing list