[dpdk-dev] [PATCH v3 2/8] net/i40e: update ptype and pctype info

Wu, Jingjing jingjing.wu at intel.com
Sat Sep 23 04:58:27 CEST 2017


> +		if (!memcmp(name, "GTPC", sizeof("GTPC") - 1))
> +			new_pctype =
> +				i40e_find_personalized_pctype(pf,
> +						      I40E_PERSONALIZED_GTPC);
> +		else if (!memcmp(name, "GTPU_IPV4",
> +				 sizeof("GTPU_IPV4") - 1))
Memcmp -> strcmp?

[......]


> 
> +enum i40e_new_proto {
> +	I40E_PERSONALIZED_GTPC = 0,
> +	I40E_PERSONALIZED_GTPU_IPV4,
> +	I40E_PERSONALIZED_GTPU_IPV6,
> +	I40E_PERSONALIZED_GTPU,
> +	I40E_PERSONALIZED_MAX,
> +};
> +
> +#define I40E_FILTER_PCTYPE_INVALID     0
> +struct i40e_personalized_pctype {
> +	uint8_t index;    /* Indicate which personalized pctype */


The index is I40E_PERSONALIZED_XXX right? Why not define it like
enum i40e_new_proto index? Or you can just use #define to define
personalized pctype instead of enum.
> +	uint8_t pctype;   /* New pctype value */
> +	bool valid;   /* Check if it's valid */
> +};
> +
>  /*
>   * Structure to store private data specific for PF instance.
>   */
> @@ -786,6 +801,11 @@ struct i40e_pf {
>  	bool mpls_replace_flag;  /* 1 - MPLS filter replace is done */
>  	bool qinq_replace_flag;  /* QINQ filter replace is done */
>  	struct i40e_tm_conf tm_conf;
> +
> +	/* Dynamic Device Personalization */
> +	bool gtp_support; /* 1 - support GTP-C and GTP-U */
> +	/* customer personalized pctype */
> +	struct i40e_personalized_pctype new_pctype[I40E_PERSONALIZED_MAX];
>  };
> 
>  enum pending_msg {
> @@ -1003,6 +1023,10 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr,
> uint32_t val);
>  int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
>  void i40e_tm_conf_init(struct rte_eth_dev *dev);
>  void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
> +struct i40e_personalized_pctype*
> +i40e_find_personalized_pctype(struct i40e_pf *pf, uint8_t index);
> +void i40e_update_personalized_info(struct rte_eth_dev *dev, uint8_t *pkg,
> +				   uint32_t pkg_size);
> 
>  #define I40E_DEV_TO_PCI(eth_dev) \
>  	RTE_DEV_TO_PCI((eth_dev)->device)
> diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
> index 9f9c808..d1313f6 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.c
> +++ b/drivers/net/i40e/rte_pmd_i40e.c
> @@ -1608,6 +1608,8 @@ rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t
> *buff,
>  		return -EINVAL;
>  	}
> 
> +	i40e_update_personalized_info(dev, buff, size);
> +
>  	/* Find metadata segment */
>  	metadata_seg_hdr = i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
>  							pkg_hdr);
> @@ -2090,7 +2092,9 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
>  	    tnl != RTE_PTYPE_TUNNEL_VXLAN &&
>  	    tnl != RTE_PTYPE_TUNNEL_NVGRE &&
>  	    tnl != RTE_PTYPE_TUNNEL_GENEVE &&
> -	    tnl != RTE_PTYPE_TUNNEL_GRENAT)
> +	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
> +	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
> +	    tnl != RTE_PTYPE_TUNNEL_GTPU)
>  		return -1;
> 
>  	if (il2 &&
> --
> 2.5.5



More information about the dev mailing list