From: Bruce Richardson <bruce.richardson@intel.com>
To: Beilei Xing <beilei.xing@intel.com>
Cc: jingjing.wu@intel.com, helin.zhang@intel.com, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] ppp implemantation
Date: Fri, 3 Mar 2017 09:39:26 +0000 [thread overview]
Message-ID: <20170303093926.GB188460@bricha3-MOBL3.ger.corp.intel.com> (raw)
In-Reply-To: <1488525977-15321-3-git-send-email-beilei.xing@intel.com>
Given that this patch is not about point-to-point protocol, i.e. the
best-known expansion of "PPP", I think you need to clarify the acronym
in the commit message, at minimum, if not also in the commit title.
/Bruce
On Fri, Mar 03, 2017 at 03:26:07PM +0800, Beilei Xing wrote:
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
> app/test-pmd/cmdline.c | 57 ++++++++
> app/test-pmd/config.c | 62 +++++++++
> app/test-pmd/testpmd.h | 3 +
> drivers/net/i40e/base/i40e_adminq_cmd.h | 32 +++++
> drivers/net/i40e/base/i40e_common.c | 236 +++++++++++++++++++++++++++++++-
> drivers/net/i40e/base/i40e_prototype.h | 17 +++
> drivers/net/i40e/base/i40e_type.h | 79 +++++++++++
> drivers/net/i40e/i40e_ethdev.c | 68 +++++++++
> drivers/net/i40e/rte_pmd_i40e.h | 1 +
> 9 files changed, 554 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 43fc636..0d62a07 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -12395,6 +12395,62 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = {
> },
> };
>
> +/* Write Pipeline Personalization Profile */
> +struct cmd_write_ppp_result {
> + cmdline_fixed_string_t write;
> + cmdline_fixed_string_t ppp;
> + uint8_t port_id;
> + char filename[];
> +};
> +
> +cmdline_parse_token_string_t cmd_write_ppp_write =
> + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write");
> +cmdline_parse_token_string_t cmd_write_ppp_ppp =
> + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp");
> +cmdline_parse_token_num_t cmd_write_ppp_port_id =
> + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8);
> +cmdline_parse_token_string_t cmd_write_ppp_filename =
> + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL);
> +
> +static void
> +cmd_write_ppp_parsed(
> + void *parsed_result,
> + __attribute__((unused)) struct cmdline *cl,
> + __attribute__((unused)) void *data)
> +{
> + struct cmd_write_ppp_result *res = parsed_result;
> + uint8_t *buff;
> + int ret = -ENOTSUP;
> +
> + if (res->port_id > nb_ports) {
> + printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
> + return;
> + }
> +
> + buff = open_package_file(res->filename);
> + if (!buff)
> + return;
> +
> + ret = i40e_process_package(res->port_id, buff);
> + if (ret < 0)
> + printf("Failed to write profile.\n");
> +
> + close_package_file(buff);
> +}
> +
> +cmdline_parse_inst_t cmd_write_ppp = {
> + .f = cmd_write_ppp_parsed,
> + .data = NULL,
> + .help_str = "write ppp <port_id> <profile_name>",
> + .tokens = {
> + (void *)&cmd_write_ppp_write,
> + (void *)&cmd_write_ppp_ppp,
> + (void *)&cmd_write_ppp_port_id,
> + (void *)&cmd_write_ppp_filename,
> + NULL,
> + },
> +};
> +
> /* ******************************************************************************** */
>
> /* list of instructions */
> @@ -12570,6 +12626,7 @@ cmdline_parse_ctx_t main_ctx[] = {
> (cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
> (cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
> (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,
> + (cmdline_parse_inst_t *)&cmd_write_ppp,
> NULL,
> };
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 80491fc..aa26da1 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -3245,3 +3245,65 @@ port_dcb_info_display(uint8_t port_id)
> printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].nb_queue);
> printf("\n");
> }
> +
> +uint8_t *
> +open_package_file(const char *file_path)
> +{
> + FILE *fh = fopen(file_path, "rb");
> + uint32_t pkg_size;
> + uint8_t *buf = NULL;
> + int ret = 0;
> +
> + if (fh == NULL) {
> + printf("%s: Failed to open %s\n", __func__, file_path);
> + return buf;
> + }
> +
> + ret = fseek(fh, 0, SEEK_END);
> + if (ret < 0) {
> + fclose(fh);
> + printf("%s: File operations failed\n", __func__);
> + return buf;
> + }
> +
> + pkg_size = ftell(fh);
> +
> + buf = (uint8_t *)malloc(pkg_size);
> + if (!buf) {
> + fclose(fh);
> + printf("%s: Failed to malloc memory\n", __func__);
> + return buf;
> + }
> +
> + ret = fseek(fh, 0, SEEK_SET);
> + if (ret < 0) {
> + fclose(fh);
> + printf("%s: File operations failed\n", __func__);
> + close_package_file(buf);
> + return NULL;
> + }
> + fread(buf, 1, pkg_size, fh);
> +
> + for(uint32_t i = 0; i < pkg_size; i++) {
> + if (!(i % 16))
> + printf(" ");
> + printf(" 0x%02X,", buf[i]);
> + if (!((i + 1) % 16))
> + printf("\n");
> + }
> +
> + fclose(fh);
> +
> + return buf;
> +}
> +
> +int
> +close_package_file(uint8_t *buf)
> +{
> + if (buf) {
> + free((void *)buf);
> + return 0;
> + }
> +
> + return -1;
> +}
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 8cf2860..2a7f683 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);
> void mcast_addr_remove(uint8_t port_id, struct ether_addr *mc_addr);
> void port_dcb_info_display(uint8_t port_id);
>
> +uint8_t *open_package_file(const char *file_path);
> +int close_package_file(uint8_t *buf);
> +
> enum print_warning {
> ENABLED_WARN = 0,
> DISABLED_WARN
> diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
> index 67cef7c..bb1e978 100644
> --- a/drivers/net/i40e/base/i40e_adminq_cmd.h
> +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
> @@ -198,6 +198,10 @@ enum i40e_admin_queue_opc {
> i40e_aqc_opc_add_mirror_rule = 0x0260,
> i40e_aqc_opc_delete_mirror_rule = 0x0261,
>
> + /* Support Pipeline Personalization Profile */
> + i40e_aqc_opc_write_personalization_profile = 0x0270,
> + i40e_aqc_opc_get_personalization_profile_list = 0x0271,
> +
> /* DCB commands */
> i40e_aqc_opc_dcb_ignore_pfc = 0x0301,
> i40e_aqc_opc_dcb_updated = 0x0302,
> @@ -1441,6 +1445,34 @@ struct i40e_aqc_add_delete_mirror_rule_completion {
>
> I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule_completion);
>
> +/* Pipeline Personalization Profile */
> +struct i40e_aqc_write_ppp {
> + u8 reserved[4];
> + __le32 profile_track_id;
> + __le32 addr_high;
> + __le32 addr_low;
> +};
> +
> +I40E_CHECK_CMD_LENGTH(i40e_aqc_write_ppp);
> +
> +struct i40e_aqc_write_ppp_resp {
> + __le32 error_offset;
> + __le32 error_info;
> + __le32 addr_high;
> + __le32 addr_low;
> +};
> +
> +struct i40e_aqc_get_ppp_list {
> + u8 flags;
> + #define I40E_AQC_WR_PPP_GET_CONF 0x1
> + #define I40E_AQC_WR_PPP_GET_RDPU_CONF 0x2
> + u8 reserved[7];
> + __le32 addr_high;
> + __le32 addr_low;
> +};
> +
> +I40E_CHECK_CMD_LENGTH(i40e_aqc_get_ppp_list);
> +
> /* DCB 0x03xx*/
>
> /* PFC Ignore (direct 0x0301)
> diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
> index b8d8165..98653d5 100644
> --- a/drivers/net/i40e/base/i40e_common.c
> +++ b/drivers/net/i40e/base/i40e_common.c
> @@ -6997,4 +6997,238 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,
> status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
>
> return status;
> -}
> \ No newline at end of file
> +}
> +
> +/**
> + * i40e_aq_write_ppp - Write pipeline personalization profile (ppp)
> + * @hw: pointer to the hw struct
> + * @buff: command buffer (size in bytes = buff_size)
> + * @buff_size: buffer size in bytes
> + * @track_id: package tracking id
> + * @error_offset: returns error offset
> + * @error_info: returns error information
> + * @cmd_details: pointer to command details structure or NULL
> + **/
> +enum
> +i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff,
> + u16 buff_size, u32 track_id,
> + u32 *error_offset, u32 *error_info,
> + struct i40e_asq_cmd_details *cmd_details)
> +{
> + struct i40e_aq_desc desc;
> + struct i40e_aqc_write_ppp *cmd =
> + (struct i40e_aqc_write_ppp *)&desc.params.raw;
> + struct i40e_aqc_write_ppp_resp *resp;
> + enum i40e_status_code status;
> +
> + i40e_fill_default_direct_cmd_desc(&desc,
> + i40e_aqc_opc_write_personalization_profile);
> +
> + desc.flags |= CPU_TO_LE16(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD);
> + if (buff_size > I40E_AQ_LARGE_BUF)
> + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
> +
> + desc.datalen = CPU_TO_LE16(buff_size);
> +
> + cmd->profile_track_id = CPU_TO_LE32(track_id);
> +
> + status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
> + if (!status) {
> + resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw;
> + if (error_offset)
> + *error_offset = LE32_TO_CPU(resp->error_offset);
> + if (error_info)
> + *error_info = LE32_TO_CPU(resp->error_info);
> + }
> +
> + return status;
> +}
> +
> +/**
> + * i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp)
> + * @hw: pointer to the hw struct
> + * @buff: command buffer (size in bytes = buff_size)
> + * @buff_size: buffer size in bytes
> + * @cmd_details: pointer to command details structure or NULL
> + **/
> +enum
> +i40e_status_code i40e_aq_get_ppp_list(struct i40e_hw *hw, void *buff,
> + u16 buff_size, u8 flags,
> + struct i40e_asq_cmd_details *cmd_details)
> +{
> + struct i40e_aq_desc desc;
> + struct i40e_aqc_get_ppp_list *cmd =
> + (struct i40e_aqc_get_ppp_list *)&desc.params.raw;
> + enum i40e_status_code status;
> +
> + i40e_fill_default_direct_cmd_desc(&desc,
> + i40e_aqc_opc_get_personalization_profile_list);
> +
> + if (buff_size > I40E_AQ_LARGE_BUF)
> + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);
> + desc.datalen = CPU_TO_LE16(buff_size);
> +
> + cmd->flags = flags;
> +
> + status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
> +
> + return status;
> +}
> +
> +/**
> + * i40e_find_segment_in_package
> + * @segment_type: the segment type to search for (i.e., SEGMENT_TYPE_I40E)
> + * @pkg_hdr: pointer to the package header to be searched
> + *
> + * This function searches a package file for a particular segment type. On
> + * success it returns a pointer to the segment header, otherwise it will
> + * return NULL.
> + */
> +struct i40e_generic_seg_header *
> +i40e_find_segment_in_package(u32 segment_type,
> + struct i40e_package_header *pkg_hdr)
> +{
> + struct i40e_generic_seg_header *segment;
> + u32 i;
> +
> + PMD_DRV_LOG(INFO, "i40e_find_segment_in_package");
> + PMD_DRV_LOG(INFO, "Package version: %d.%d.%d.%d",
> + pkg_hdr->version.major,
> + pkg_hdr->version.minor,
> + pkg_hdr->version.update,
> + pkg_hdr->version.draft);
> +
> + /* Search all package segments for the requested segment type */
> + for (i = 0; i < pkg_hdr->segment_count; i++) {
> + segment =
> + (struct i40e_generic_seg_header *)((u8 *)pkg_hdr +
> + pkg_hdr->segment_offset[i]);
> +
> + if (segment->type == segment_type)
> + return segment;
> + }
> +
> + return NULL;
> +}
> +
> +/**
> + * i40e_write_profile
> + * @hw: pointer to the hardware structure
> + * @profile: pointer to the profile segment of the package to be downloaded
> + * @track_id: package tracking id
> + *
> + * Handles the download of a complete package.
> + */
> +enum i40e_status_code
> +i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,
> + u32 track_id)
> +{
> + enum i40e_status_code status = I40E_SUCCESS;
> + struct i40e_section_table *sec_tbl;
> + struct i40e_profile_section_header *sec = NULL;
> + u32 dev_cnt;
> + u32 vendor_dev_id;
> + u32 *nvm;
> + u32 section_size = 0;
> + u32 offset = 0, info = 0;
> + u32 i;
> +
> + PMD_DRV_LOG(INFO, "i40e_write_profile");
> + PMD_DRV_LOG(INFO, "Segment version: %d.%d.%d.%d",
> + profile->header.version.major,
> + profile->header.version.minor,
> + profile->header.version.update,
> + profile->header.version.draft);
> + PMD_DRV_LOG(INFO, "Seg: type 0x%X, size %d, name %s",
> + LE32_TO_CPU(profile->header.type),
> + LE32_TO_CPU(profile->header.size),
> + profile->header.name);
> +
> + if (!track_id) {
> + PMD_DRV_LOG(ERR, "Track_id can't be 0.");
> + return I40E_NOT_SUPPORTED;
> + }
> +
> + dev_cnt = profile->device_table_count;
> +
> + for (i = 0; i < dev_cnt; i++) {
> + vendor_dev_id = profile->device_table[i].vendor_dev_id;
> + if ((vendor_dev_id >> 16) == I40E_INTEL_VENDOR_ID)
> + if (hw->device_id == (vendor_dev_id & 0xFFFF))
> + break;
> + }
> + if (i == dev_cnt) {
> + PMD_DRV_LOG(ERR, "Device doesn't support PPP");
> + return I40E_ERR_DEVICE_NOT_SUPPORTED;
> + }
> +
> + nvm = (u32 *)&profile->device_table[dev_cnt];
> + sec_tbl = (struct i40e_section_table *)&nvm[nvm[0] + 1];
> +
> + for (i = 0; i < sec_tbl->section_count; i++) {
> + sec = (struct i40e_profile_section_header *)((u8 *)profile +
> + sec_tbl->section_offset[i]);
> +
> + /* Skip 'AQ', 'note' and 'name' sections */
> + if (sec->section.type != SECTION_TYPE_MMIO)
> + continue;
> +
> + section_size = sec->section.size +
> + sizeof(struct i40e_profile_section_header);
> +
> + /* Write profile */
> + status = i40e_aq_write_ppp(hw, (void *)sec, (u16)section_size,
> + track_id, &offset, &info, NULL);
> + if (status) {
> + PMD_DRV_LOG(ERR, "Failed to write profile: "
> + "offset %d, info %d",
> + offset, info);
> + break;
> + }
> + }
> +
> + return status;
> +}
> +
> +/**
> + * i40e_add_pinfo_to_list
> + * @hw: pointer to the hardware structure
> + * @profile: pointer to the profile segment of the package
> + * @profile_info_sec: buffer for information section
> + * @track_id: package tracking id
> + *
> + * Register a profile to the list of loaded profiles.
> + */
> +enum i40e_status_code
> +i40e_add_pinfo_to_list(struct i40e_hw *hw,
> + struct i40e_profile_segment *profile,
> + u8 *profile_info_sec, u32 track_id)
> +{
> + enum i40e_status_code status = I40E_SUCCESS;
> + struct i40e_profile_section_header *sec = NULL;
> + struct i40e_profile_info *pinfo;
> + u32 offset = 0, info = 0;
> +
> + 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;
> + pinfo->version = profile->version;
> + pinfo->op = I40E_PPP_ADD_TRACKID;
> + memcpy(pinfo->name, profile->name, I40E_PPP_NAME_SIZE);
> +
> + 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 to list: "
> + "offset %d, info %d",
> + offset, info);
> +
> + return status;
> +}
> diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
> index 109d3c5..b9b3a46 100644
> --- a/drivers/net/i40e/base/i40e_prototype.h
> +++ b/drivers/net/i40e/base/i40e_prototype.h
> @@ -555,4 +555,21 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,
> u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num);
> enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw,
> u32 time, u32 interval);
> +enum i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff,
> + u16 buff_size, u32 track_id,
> + u32 *error_offset, u32 *error_info,
> + struct i40e_asq_cmd_details *cmd_details);
> +enum i40e_status_code i40e_aq_get_ppp_list(struct i40e_hw *hw, void *buff,
> + u16 buff_size, u8 flags,
> + struct i40e_asq_cmd_details *cmd_details);
> +struct i40e_generic_seg_header *
> +i40e_find_segment_in_package(u32 segment_type,
> + struct i40e_package_header *pkg_header);
> +enum i40e_status_code
> +i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *i40e_seg,
> + u32 track_id);
> +enum i40e_status_code
> +i40e_add_pinfo_to_list(struct i40e_hw *hw,
> + struct i40e_profile_segment *profile,
> + u8 *profile_info_sec, u32 track_id);
> #endif /* _I40E_PROTOTYPE_H_ */
> diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
> index 590d97c..28e5e89 100644
> --- a/drivers/net/i40e/base/i40e_type.h
> +++ b/drivers/net/i40e/base/i40e_type.h
> @@ -1878,4 +1878,83 @@ struct i40e_lldp_variables {
> #define I40E_FLEX_56_MASK (0x1ULL << I40E_FLEX_56_SHIFT)
> #define I40E_FLEX_57_SHIFT 6
> #define I40E_FLEX_57_MASK (0x1ULL << I40E_FLEX_57_SHIFT)
> +
> +/* Version format for PPP */
> +struct i40e_ppp_version {
> + u8 major;
> + u8 minor;
> + u8 update;
> + u8 draft;
> +};
> +
> +#define I40E_PPP_NAME_SIZE 32
> +
> +/* Package header */
> +struct i40e_package_header {
> + struct i40e_ppp_version version;
> + u32 segment_count;
> + u32 segment_offset[1];
> +};
> +
> +/* Generic segment header */
> +struct i40e_generic_seg_header {
> +#define SEGMENT_TYPE_METADATA 0x00000001
> +#define SEGMENT_TYPE_NOTES 0x00000002
> +#define SEGMENT_TYPE_I40E 0x00000011
> +#define SEGMENT_TYPE_X722 0x00000012
> + u32 type;
> + struct i40e_ppp_version version;
> + u32 size;
> + char name[I40E_PPP_NAME_SIZE];
> +};
> +
> +struct i40e_metadata_segment {
> + struct i40e_generic_seg_header header;
> + struct i40e_ppp_version version;
> + u32 track_id;
> + char name[I40E_PPP_NAME_SIZE];
> +};
> +
> +struct i40e_device_id_entry {
> + u32 vendor_dev_id;
> + u32 sub_vendor_dev_id;
> +};
> +
> +struct i40e_profile_segment {
> + struct i40e_generic_seg_header header;
> + struct i40e_ppp_version version;
> + char name[I40E_PPP_NAME_SIZE];
> + u32 device_table_count;
> + struct i40e_device_id_entry device_table[1];
> +};
> +
> +struct i40e_section_table {
> + u32 section_count;
> + u32 section_offset[1];
> +};
> +
> +struct i40e_profile_section_header {
> + u16 tbl_size;
> + u16 data_end;
> + struct {
> +#define SECTION_TYPE_INFO 0x0000010
> +#define SECTION_TYPE_MMIO 0x0000800
> +#define SECTION_TYPE_AQ 0x0000801
> +#define SECTION_TYPE_NOTE 0x8000000
> +#define SECTION_TYPE_NAME 0x8000001
> + u32 type;
> + u32 offset;
> + u32 size;
> + } section;
> +};
> +
> +struct i40e_profile_info {
> + u32 track_id;
> + struct i40e_ppp_version version;
> + u8 op;
> +#define I40E_PPP_ADD_TRACKID 0x01
> +#define I40E_PPP_REMOVE_TRACKID 0x02
> + u8 reserved[7];
> + u8 name[I40E_PPP_NAME_SIZE];
> +};
> #endif /* _I40E_TYPE_H_ */
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 303027b..2016b77 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -39,6 +39,10 @@
> #include <stdarg.h>
> #include <inttypes.h>
> #include <assert.h>
> +#include <sys/stat.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <fcntl.h>
>
> #include <rte_string_fns.h>
> #include <rte_pci.h>
> @@ -11212,3 +11216,67 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,
>
> return 0;
> }
> +
> +/**
> + * i40e_process_package - Load package
> + * @port: port id
> + * @buff: buffer of package
> + **/
> +int
> +i40e_process_package(uint8_t port, uint8_t *buff)
> +{
> + struct rte_eth_dev *dev = &rte_eth_devices[port];
> + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + 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;
> + enum i40e_status_code status;
> +
> + pkg_hdr = (struct i40e_package_header *)buff;
> +
> + if (!pkg_hdr) {
> + PMD_DRV_LOG(ERR, "Failed to fill the package structure");
> + 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;
> + }
> +
> + /* Write profile to HW */
> + status = i40e_write_profile(hw,
> + (struct i40e_profile_segment *)profile_seg_hdr,
> + track_id);
> + if (!status)
> + printf("Write profile successfully.\n");
> +
> + /* Add the profile info to the list of loaded profiles */
> + profile_info_sec = rte_zmalloc("i40e_profile_info",
> + sizeof(struct i40e_profile_section_header) +
> + sizeof(struct i40e_profile_info),
> + 0);
> + status = i40e_add_pinfo_to_list(hw,
> + (struct i40e_profile_segment *)profile_seg_hdr,
> + profile_info_sec, track_id);
> + if (!status)
> + printf("Add profile info successfully.\n");
> +
> + rte_free(profile_info_sec);
> +
> + return status;
> +}
> diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
> index a0ad88c..755a279 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.h
> +++ b/drivers/net/i40e/rte_pmd_i40e.h
> @@ -332,4 +332,5 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,
> int rte_pmd_i40e_reset_vf_stats(uint8_t port,
> uint16_t vf_id);
>
> +int i40e_process_package(uint8_t port, uint8_t *buff);
> #endif /* _PMD_I40E_H_ */
> --
> 2.5.5
>
next prev parent reply other threads:[~2017-03-03 9:39 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 7:26 [dpdk-dev] [PATCH] MPSL enabling Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH 1/2] net/i40e: change tunnel filter function name Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH] ppp implemantation Beilei Xing
2017-03-03 9:39 ` Bruce Richardson [this message]
2017-03-03 9:41 ` Bruce Richardson
2017-03-03 7:26 ` [dpdk-dev] [PATCH 2/2] net/i40e: parse NVGRE filter Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH] PPP prototype Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH] ppp implemantation Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH 0/6] net/i40e: support pipeline personalization profile Beilei Xing
2017-03-03 7:39 ` [dpdk-dev] [PATCH v2 0/5] " Beilei Xing
2017-03-03 7:39 ` [dpdk-dev] [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 ` [dpdk-dev] [PATCH v2 2/5] net/i40e: add ppp processing Beilei Xing
2017-03-08 12:07 ` Ferruh Yigit
2017-03-03 7:39 ` [dpdk-dev] [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 ` [dpdk-dev] [PATCH v2 4/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-03 7:39 ` [dpdk-dev] [PATCH v2 5/5] app/testpmd: add command for getting " Beilei Xing
2017-03-08 11:43 ` [dpdk-dev] [PATCH v2 0/5] net/i40e: support pipeline personalization profile Ferruh Yigit
2017-03-09 3:07 ` Xing, Beilei
2017-03-23 10:02 ` [dpdk-dev] [PATCH v3 0/5] pipeline personalization profile support Beilei Xing
2017-03-23 10:02 ` [dpdk-dev] [PATCH v3 1/5] net/i40e: add pipeline personalization profile processing Beilei Xing
2017-03-23 14:50 ` Iremonger, Bernard
2017-03-24 2:01 ` Xing, Beilei
2017-03-23 10:02 ` [dpdk-dev] [PATCH v3 2/5] app/testpmd: add command for loading a profile Beilei Xing
2017-03-23 10:02 ` [dpdk-dev] [PATCH v3 3/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-23 10:02 ` [dpdk-dev] [PATCH v3 4/5] app/testpmd: add command for getting " Beilei Xing
2017-03-23 10:02 ` [dpdk-dev] [PATCH v3 5/5] doc: add pipeline personalization profile support for i40e Beilei Xing
2017-03-24 10:19 ` [dpdk-dev] [PATCH v4 0/5] pipeline personalization profile support Beilei Xing
2017-03-24 10:19 ` [dpdk-dev] [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 ` [dpdk-dev] [PATCH v4 2/5] app/testpmd: add command for loading a profile Beilei Xing
2017-03-24 10:19 ` [dpdk-dev] [PATCH v4 3/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-24 10:19 ` [dpdk-dev] [PATCH v4 4/5] app/testpmd: add command for getting " Beilei Xing
2017-03-24 10:19 ` [dpdk-dev] [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 ` [dpdk-dev] [PATCH v5 0/5] pipeline personalization profile support Beilei Xing
2017-03-27 6:17 ` [dpdk-dev] [PATCH v5 1/5] net/i40e: add pipeline personalization profile processing Beilei Xing
2017-03-27 6:17 ` [dpdk-dev] [PATCH v5 2/5] app/testpmd: add command for loading a profile Beilei Xing
2017-03-27 6:17 ` [dpdk-dev] [PATCH v5 3/5] net/i40e: add get all loaded profiles Beilei Xing
2017-03-27 6:17 ` [dpdk-dev] [PATCH v5 4/5] app/testpmd: add command for getting " Beilei Xing
2017-03-27 6:17 ` [dpdk-dev] [PATCH v5 5/5] doc: add pipeline personalization profile support for i40e Beilei Xing
2017-03-29 12:26 ` [dpdk-dev] [PATCH v6 0/6] dynamic device profile support Beilei Xing
2017-03-29 12:26 ` [dpdk-dev] [PATCH v6 1/6] net/i40e/base: change ppp to ddp Beilei Xing
2017-03-29 12:26 ` [dpdk-dev] [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 ` [dpdk-dev] [PATCH v6 3/6] app/testpmd: add command for loading a profile Beilei Xing
2017-03-29 12:26 ` [dpdk-dev] [PATCH v6 4/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-29 12:26 ` [dpdk-dev] [PATCH v6 5/6] app/testpmd: add command for getting " Beilei Xing
2017-03-29 12:26 ` [dpdk-dev] [PATCH v6 6/6] doc: add dynamic device profile support for i40e Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 0/6] dynamic device profile support Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 1/6] net/i40e/base: change ppp to ddp Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 2/6] net/i40e: add dynamic device profile processing Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 3/6] app/testpmd: add command for loading a profile Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 4/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 5/6] app/testpmd: add command for getting " Beilei Xing
2017-03-29 14:44 ` [dpdk-dev] [PATCH v7 6/6] doc: add dynamic device profile support for i40e Beilei Xing
2017-03-30 2:51 ` [dpdk-dev] [PATCH v8 0/6] dynamic device personalization support Beilei Xing
2017-03-30 2:51 ` [dpdk-dev] [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 ` [dpdk-dev] [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 ` [dpdk-dev] [PATCH v8 3/6] app/testpmd: add command for loading ddp Beilei Xing
2017-03-30 2:51 ` [dpdk-dev] [PATCH v8 4/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-30 2:51 ` [dpdk-dev] [PATCH v8 5/6] app/testpmd: add command for getting " Beilei Xing
2017-03-30 14:07 ` Ferruh Yigit
2017-03-30 2:51 ` [dpdk-dev] [PATCH v8 6/6] doc: add dynamic device personalization support for i40e Beilei Xing
2017-03-30 6:18 ` [dpdk-dev] [PATCH v8 0/6] dynamic device personalization support Wu, Jingjing
2017-03-30 14:05 ` Ferruh Yigit
2017-03-03 7:52 ` [dpdk-dev] [PATCH 0/6] net/i40e: support pipeline personalization profile Xing, Beilei
2017-03-03 7:26 ` [dpdk-dev] [PATCH 1/6] net/i40e: fix a typo in flow Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH 2/6] net/i40e: support pipeline personalization profile Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH 3/6] net/i40e: add ppp processing Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH 4/6] app/testpmd: add command for writing personalization profile Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [PATCH 5/6] net/i40e: add get all loaded profiles Beilei Xing
2017-03-03 7:26 ` [dpdk-dev] [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=20170303093926.GB188460@bricha3-MOBL3.ger.corp.intel.com \
--to=bruce.richardson@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).