All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Iremonger, Bernard" <bernard.iremonger@intel.com>
To: "Xing, Beilei" <beilei.xing@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>
Cc: "Zhang, Helin" <helin.zhang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v3 1/5] net/i40e: add pipeline personalization	profile processing
Date: Thu, 23 Mar 2017 14:50:27 +0000	[thread overview]
Message-ID: <8CEF83825BEC744B83065625E567D7C224D3850F@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1490263352-61174-2-git-send-email-beilei.xing@intel.com>

Hi Beilei,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Beilei Xing
> Sent: Thursday, March 23, 2017 10:02 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Zhang, Helin <helin.zhang@intel.com>; dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 1/5] net/i40e: add pipeline personalization
> profile processing
> 
> Add support for adding or removing a pipeline personalization profile
> package.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
>  app/test-pmd/cmdline.c                    |   1 +
>  drivers/net/i40e/i40e_ethdev.c            | 200
> ++++++++++++++++++++++++++++++
>  drivers/net/i40e/i40e_ethdev.h            |   5 +
>  drivers/net/i40e/rte_pmd_i40e.h           |  21 ++++
>  drivers/net/i40e/rte_pmd_i40e_version.map |   6 +
>  5 files changed, 233 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 47f935d..6e0625d 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -37,6 +37,7 @@
>  #include <stdio.h>
>  #include <stdint.h>
>  #include <stdarg.h>
> +#include <stdbool.h>
>  #include <string.h>
>  #include <termios.h>
>  #include <unistd.h>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 3702214..7aff9a3 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -11259,3 +11259,203 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,
> 
>  	return 0;
>  }
> +
> +static void
> +i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version
> *version,
> +			       uint32_t track_id, uint8_t *profile_info_sec,
> +			       bool add)
> +{
> +	struct i40e_profile_section_header *sec = NULL;
> +	struct i40e_profile_info *pinfo;
> +
> +	sec = (struct i40e_profile_section_header *)profile_info_sec;
> +	sec->tbl_size = 1;
> +	sec->data_end = sizeof(struct i40e_profile_section_header) +
> +		sizeof(struct i40e_profile_info);
> +	sec->section.type = SECTION_TYPE_INFO;
> +	sec->section.offset = sizeof(struct i40e_profile_section_header);
> +	sec->section.size = sizeof(struct i40e_profile_info);
> +	pinfo = (struct i40e_profile_info *)(profile_info_sec +
> +					     sec->section.offset);
> +	pinfo->track_id = track_id;
> +	memcpy(pinfo->name, name, I40E_PPP_NAME_SIZE);
> +	memcpy(&pinfo->version, version, sizeof(struct i40e_ppp_version));
> +	if (add)
> +		pinfo->op = I40E_PPP_ADD_TRACKID;
> +	else
> +		pinfo->op = I40E_PPP_REMOVE_TRACKID;
> +}
> +
> +static enum i40e_status_code
> +i40e_add_rm_profile_info(struct i40e_hw *hw, uint8_t *profile_info_sec)
> +{
> +	enum i40e_status_code status = I40E_SUCCESS;
> +	struct i40e_profile_section_header *sec;
> +	uint32_t track_id;
> +	uint32_t offset = 0, info = 0;
> +
> +	sec = (struct i40e_profile_section_header *)profile_info_sec;
> +	track_id = ((struct i40e_profile_info *)(profile_info_sec +
> +					 sec->section.offset))->track_id;
> +
> +	status = i40e_aq_write_ppp(hw, (void *)sec, sec->data_end,
> +				   track_id, &offset, &info, NULL);
> +	if (status)
> +		PMD_DRV_LOG(ERR, "Failed to add/remove profile info: "
> +			    "offset %d, info %d",
> +			    offset, info);
> +
> +	return status;
> +}
> +
> +#define I40E_PROFILE_INFO_SIZE 48
> +#define I40E_MAX_PROFILE_NUM 16
> +
> +/* Check if the profile info exists */
> +static int
> +i40e_check_profile_info(uint8_t port, uint8_t *profile_info_sec) {
> +	struct rte_eth_dev *dev = &rte_eth_devices[port];
> +	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +	uint8_t *buff;
> +	struct i40e_profile_list *p_list;
> +	struct i40e_profile_info *pinfo, *p;
> +	int ret;
> +
> +	buff = rte_zmalloc("i40e_pinfo_list",
> +			   (I40E_PROFILE_INFO_SIZE *
> I40E_MAX_PROFILE_NUM + 4),
> +			   0);
> +	if (!buff) {
> +		PMD_DRV_LOG(ERR, "failed to allocate memory");
> +		return -1;
> +	}
> +
> +	ret = i40e_aq_get_ppp_list(hw, (void *)buff,
> +		      (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +
> 4),
> +		      0, NULL);
> +	if (ret) {
> +		PMD_DRV_LOG(ERR, "Failed to get profile info list.");
> +		rte_free(buff);
> +		return -1;
> +	}
> +	p_list = (struct i40e_profile_list *)buff;
> +	pinfo = (struct i40e_profile_info *)(profile_info_sec +
> +			     sizeof(struct i40e_profile_section_header));
> +	for (uint32_t i = 0; i < p_list->p_count; i++) {

There is a compile error in the "for" statement.

dpdk/drivers/net/i40e/i40e_ethdev.c:11561:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < p_list->p_count; i++) {

This is occurring with the following compiler:
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)


> +		p = &p_list->p_info[i];
> +		if ((pinfo->track_id == p->track_id) &&
> +		    !memcmp(&pinfo->version, &p->version,
> +			    sizeof(struct i40e_ppp_version)) &&
> +		    !memcmp(&pinfo->name, &p->name,
> +			    I40E_PPP_NAME_SIZE)) {
> +			PMD_DRV_LOG(INFO, "Profile exists.");
> +			rte_free(buff);
> +			return 1;
> +		}
> +	}
> +
> +	rte_free(buff);
> +	return 0;
> +}
> +
> +int
> +rte_pmd_i40e_process_ppp_package(uint8_t port, uint8_t *buff,
> +				 uint32_t size, bool add)
> +{
> +	struct rte_eth_dev *dev;
> +	struct i40e_hw *hw;
> +	struct i40e_package_header *pkg_hdr;
> +	struct i40e_generic_seg_header *profile_seg_hdr;
> +	struct i40e_generic_seg_header *metadata_seg_hdr;
> +	uint32_t track_id;
> +	uint8_t *profile_info_sec;
> +	int is_exist;
> +	enum i40e_status_code status = I40E_SUCCESS;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
> +
> +	dev = &rte_eth_devices[port];
> +
> +	if (!is_device_supported(dev, &rte_i40e_pmd))
> +		return -ENOTSUP;
> +
> +	hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	if (size < (sizeof(struct i40e_package_header) +
> +		    sizeof(struct i40e_metadata_segment) +
> +		    sizeof(uint32_t) * 2)) {
> +		PMD_DRV_LOG(ERR, "Buff is invalid.");
> +		return -EINVAL;
> +	}
> +
> +	pkg_hdr = (struct i40e_package_header *)buff;
> +
> +	if (!pkg_hdr) {
> +		PMD_DRV_LOG(ERR, "Failed to fill the package structure");
> +		return -EINVAL;
> +	}
> +
> +	if (pkg_hdr->segment_count < 2) {
> +		PMD_DRV_LOG(ERR, "Segment_count should be 2 at
> least.");
> +		return -EINVAL;
> +	}
> +
> +	/* Find metadata segment */
> +	metadata_seg_hdr =
> i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
> +							pkg_hdr);
> +	if (!metadata_seg_hdr) {
> +		PMD_DRV_LOG(ERR, "Failed to find metadata segment
> header");
> +		return -EINVAL;
> +	}
> +	track_id = ((struct i40e_metadata_segment
> +*)metadata_seg_hdr)->track_id;
> +
> +	/* Find profile segment */
> +	profile_seg_hdr =
> i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
> +						       pkg_hdr);
> +	if (!profile_seg_hdr) {
> +		PMD_DRV_LOG(ERR, "Failed to find profile segment
> header");
> +		return -EINVAL;
> +	}
> +
> +	profile_info_sec = rte_zmalloc("i40e_profile_info",
> +			       sizeof(struct i40e_profile_section_header) +
> +			       sizeof(struct i40e_profile_info),
> +			       0);
> +	if (!profile_info_sec) {
> +		PMD_DRV_LOG(ERR, "Failed to allocate memory");
> +		return -EINVAL;
> +	}
> +
> +	if (add) {
> +		i40e_generate_profile_info_sec(
> +		     ((struct i40e_profile_segment *)profile_seg_hdr)->name,
> +		     &((struct i40e_profile_segment *)profile_seg_hdr)-
> >version,
> +		     track_id, profile_info_sec, 1);
> +		is_exist = i40e_check_profile_info(port, profile_info_sec);
> +		if (is_exist) {
> +			PMD_DRV_LOG(ERR, "Profile already exists.");
> +			rte_free(profile_info_sec);
> +			return 1;
> +		}
> +
> +		/* Write profile to HW */
> +		status = i40e_write_profile(hw,
> +				 (struct i40e_profile_segment
> *)profile_seg_hdr,
> +				 track_id);
> +		if (status)
> +			PMD_DRV_LOG(ERR, "Failed to write profile.");
> +	} else {
> +		i40e_generate_profile_info_sec(
> +		     ((struct i40e_profile_segment *)profile_seg_hdr)->name,
> +		     &((struct i40e_profile_segment *)profile_seg_hdr)-
> >version,
> +		     track_id, profile_info_sec, 0);
> +	}
> +
> +	status = i40e_add_rm_profile_info(hw, profile_info_sec);
> +	if (status)
> +		PMD_DRV_LOG(ERR, "Failed to %s profile info.",
> +			    add ? "add" : "remove");
> +
> +	rte_free(profile_info_sec);
> +	return status;
> +}
> diff --git a/drivers/net/i40e/i40e_ethdev.h
> b/drivers/net/i40e/i40e_ethdev.h index aebb097..f0be7a3 100644
> --- a/drivers/net/i40e/i40e_ethdev.h
> +++ b/drivers/net/i40e/i40e_ethdev.h
> @@ -730,6 +730,11 @@ struct i40e_valid_pattern {
>  	parse_filter_t parse_filter;
>  };
> 
> +struct i40e_profile_list {
> +	uint32_t p_count;
> +	struct i40e_profile_info p_info[1];
> +};
> +
>  int i40e_dev_switch_queues(struct i40e_pf *pf, bool on);  int
> i40e_vsi_release(struct i40e_vsi *vsi);  struct i40e_vsi *i40e_vsi_setup(struct
> i40e_pf *pf, diff --git a/drivers/net/i40e/rte_pmd_i40e.h
> b/drivers/net/i40e/rte_pmd_i40e.h index a0ad88c..7861a56 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.h
> +++ b/drivers/net/i40e/rte_pmd_i40e.h
> @@ -332,4 +332,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,  int
> rte_pmd_i40e_reset_vf_stats(uint8_t port,
>  				uint16_t vf_id);
> 
> +/**
> + * Load/Unload a ppp package
> + *
> + * @param port
> + *    The port identifier of the Ethernet device.
> + * @param buff
> + *    buffer of package.
> + * @param size
> + *    size of buffer.
> + * @param add
> + *   - (1) load profile.
> + *   - (0) remove profile.
> + * @return
> + *   - (0) if successful.
> + *   - (-ENODEV) if *port* invalid.
> + *   - (-EINVAL) if bad parameter.
> + *   - (1) if profile exists.
> + */
> +int rte_pmd_i40e_process_ppp_package(uint8_t port, uint8_t *buff,
> +				     uint32_t size, bool add);
> +
>  #endif /* _PMD_I40E_H_ */
> diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map
> b/drivers/net/i40e/rte_pmd_i40e_version.map
> index 7a5d211..01c4a90 100644
> --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> @@ -22,3 +22,9 @@ DPDK_17.02 {
>  	rte_pmd_i40e_set_vf_vlan_tag;
> 
>  } DPDK_2.0;
> +
> +DPDK_17.05 {
> +	global:
> +
> +	rte_pmd_i40e_process_ppp_package;
> +};
> --
> 2.5.5

Regards,

Bernard.

  reply	other threads:[~2017-03-23 14:52 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  7:26 [PATCH] MPSL enabling Beilei Xing
2017-03-03  7:26 ` [PATCH 1/2] net/i40e: change tunnel filter function name Beilei Xing
2017-03-03  7:26 ` [PATCH] ppp implemantation Beilei Xing
2017-03-03  9:39   ` Bruce Richardson
2017-03-03  9:41     ` Bruce Richardson
2017-03-03  7:26 ` [PATCH 2/2] net/i40e: parse NVGRE filter Beilei Xing
2017-03-03  7:26 ` [PATCH] PPP prototype Beilei Xing
2017-03-03  7:26 ` [PATCH] ppp implemantation Beilei Xing
2017-03-03  7:26 ` [PATCH 0/6] net/i40e: support pipeline personalization profile Beilei Xing
2017-03-03  7:39   ` [PATCH v2 0/5] " Beilei Xing
2017-03-03  7:39     ` [PATCH v2 1/5] " Beilei Xing
2017-03-08 12:07       ` Ferruh Yigit
2017-03-09  3:30         ` Xing, Beilei
2017-03-03  7:39     ` [PATCH v2 2/5] net/i40e: add ppp processing Beilei Xing
2017-03-08 12:07       ` Ferruh Yigit
2017-03-03  7:39     ` [PATCH v2 3/5] app/testpmd: add command for writing personalization profile Beilei Xing
2017-03-08 12:10       ` Ferruh Yigit
2017-03-03  7:39     ` [PATCH v2 4/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-03  7:39     ` [PATCH v2 5/5] app/testpmd: add command for getting " Beilei Xing
2017-03-08 11:43     ` [PATCH v2 0/5] net/i40e: support pipeline personalization profile Ferruh Yigit
2017-03-09  3:07       ` Xing, Beilei
2017-03-23 10:02     ` [PATCH v3 0/5] pipeline personalization profile support Beilei Xing
2017-03-23 10:02       ` [PATCH v3 1/5] net/i40e: add pipeline personalization profile processing Beilei Xing
2017-03-23 14:50         ` Iremonger, Bernard [this message]
2017-03-24  2:01           ` Xing, Beilei
2017-03-23 10:02       ` [PATCH v3 2/5] app/testpmd: add command for loading a profile Beilei Xing
2017-03-23 10:02       ` [PATCH v3 3/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-23 10:02       ` [PATCH v3 4/5] app/testpmd: add command for getting " Beilei Xing
2017-03-23 10:02       ` [PATCH v3 5/5] doc: add pipeline personalization profile support for i40e Beilei Xing
2017-03-24 10:19       ` [PATCH v4 0/5] pipeline personalization profile support Beilei Xing
2017-03-24 10:19         ` [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing Beilei Xing
2017-03-24 14:52           ` Chilikin, Andrey
2017-03-25  4:04             ` Xing, Beilei
2017-03-25 21:03               ` Chilikin, Andrey
2017-03-27  2:09                 ` Xing, Beilei
2017-03-24 10:19         ` [PATCH v4 2/5] app/testpmd: add command for loading a profile Beilei Xing
2017-03-24 10:19         ` [PATCH v4 3/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-24 10:19         ` [PATCH v4 4/5] app/testpmd: add command for getting " Beilei Xing
2017-03-24 10:19         ` [PATCH v4 5/5] doc: add pipeline personalization profile support for i40e Beilei Xing
2017-03-24 14:31           ` Mcnamara, John
2017-03-27  6:17         ` [PATCH v5 0/5] pipeline personalization profile support Beilei Xing
2017-03-27  6:17           ` [PATCH v5 1/5] net/i40e: add pipeline personalization profile processing Beilei Xing
2017-03-27  6:17           ` [PATCH v5 2/5] app/testpmd: add command for loading a profile Beilei Xing
2017-03-27  6:17           ` [PATCH v5 3/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-27  6:17           ` [PATCH v5 4/5] app/testpmd: add command for getting " Beilei Xing
2017-03-27  6:17           ` [PATCH v5 5/5] doc: add pipeline personalization profile support for i40e Beilei Xing
2017-03-29 12:26           ` [PATCH v6 0/6] dynamic device profile support Beilei Xing
2017-03-29 12:26             ` [PATCH v6 1/6] net/i40e/base: change ppp to ddp Beilei Xing
2017-03-29 12:26             ` [PATCH v6 2/6] net/i40e: add dynamic device profile processing Beilei Xing
2017-03-29 13:17               ` Wu, Jingjing
2017-03-29 14:25                 ` Xing, Beilei
2017-03-29 12:26             ` [PATCH v6 3/6] app/testpmd: add command for loading a profile Beilei Xing
2017-03-29 12:26             ` [PATCH v6 4/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-29 12:26             ` [PATCH v6 5/6] app/testpmd: add command for getting " Beilei Xing
2017-03-29 12:26             ` [PATCH v6 6/6] doc: add dynamic device profile support for i40e Beilei Xing
2017-03-29 14:44             ` [PATCH v7 0/6] dynamic device profile support Beilei Xing
2017-03-29 14:44               ` [PATCH v7 1/6] net/i40e/base: change ppp to ddp Beilei Xing
2017-03-29 14:44               ` [PATCH v7 2/6] net/i40e: add dynamic device profile processing Beilei Xing
2017-03-29 14:44               ` [PATCH v7 3/6] app/testpmd: add command for loading a profile Beilei Xing
2017-03-29 14:44               ` [PATCH v7 4/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-29 14:44               ` [PATCH v7 5/6] app/testpmd: add command for getting " Beilei Xing
2017-03-29 14:44               ` [PATCH v7 6/6] doc: add dynamic device profile support for i40e Beilei Xing
2017-03-30  2:51               ` [PATCH v8 0/6] dynamic device personalization support Beilei Xing
2017-03-30  2:51                 ` [PATCH v8 1/6] net/i40e/base: change ppp to ddp Beilei Xing
2017-03-30 14:06                   ` Ferruh Yigit
2017-03-30  2:51                 ` [PATCH v8 2/6] net/i40e: add dynamic device personalization processing Beilei Xing
2017-03-30 14:06                   ` Ferruh Yigit
2017-03-30 14:08                   ` Ferruh Yigit
2017-03-30  2:51                 ` [PATCH v8 3/6] app/testpmd: add command for loading ddp Beilei Xing
2017-03-30  2:51                 ` [PATCH v8 4/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-30  2:51                 ` [PATCH v8 5/6] app/testpmd: add command for getting " Beilei Xing
2017-03-30 14:07                   ` Ferruh Yigit
2017-03-30  2:51                 ` [PATCH v8 6/6] doc: add dynamic device personalization support for i40e Beilei Xing
2017-03-30  6:18                 ` [PATCH v8 0/6] dynamic device personalization support Wu, Jingjing
2017-03-30 14:05                   ` Ferruh Yigit
2017-03-03  7:52   ` [PATCH 0/6] net/i40e: support pipeline personalization profile Xing, Beilei
2017-03-03  7:26 ` [PATCH 1/6] net/i40e: fix a typo in flow Beilei Xing
2017-03-03  7:26 ` [PATCH 2/6] net/i40e: support pipeline personalization profile Beilei Xing
2017-03-03  7:26 ` [PATCH 3/6] net/i40e: add ppp processing Beilei Xing
2017-03-03  7:26 ` [PATCH 4/6] app/testpmd: add command for writing personalization profile Beilei Xing
2017-03-03  7:26 ` [PATCH 5/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-03  7:26 ` [PATCH 6/6] app/testpmd: add command for getting " Beilei Xing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8CEF83825BEC744B83065625E567D7C224D3850F@IRSMSX108.ger.corp.intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.