From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id AB26DF618 for ; Mon, 27 Mar 2017 04:09:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490580597; x=1522116597; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5WE6AHkU7s/iGWWHDu1h1i9HiL7xVTwVJeiL8ChN6bE=; b=p0CYQqw/uFabIIhkDl2/DhQl9iDRf/z/2yEV+PPTQV4enFEwFbNxruuW 8XLX8lCfYfoYnzKpL5f1oipRXflivg==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2017 19:09:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,229,1486454400"; d="scan'208";a="1147242551" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 26 Mar 2017 19:09:57 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 26 Mar 2017 19:09:57 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 26 Mar 2017 19:09:56 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.224]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.82]) with mapi id 14.03.0248.002; Mon, 27 Mar 2017 10:09:53 +0800 From: "Xing, Beilei" To: "Chilikin, Andrey" , "Wu, Jingjing" CC: "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing Thread-Index: AQHSpIhuHnRFyplCE0Co4TYgoXDBQqGjjVyAgAFb+4CAAJ4MAIACbH/w Date: Mon, 27 Mar 2017 02:09:53 +0000 Message-ID: <94479800C636CB44BD422CB454846E01315BFF21@SHSMSX101.ccr.corp.intel.com> References: <1490263352-61174-1-git-send-email-beilei.xing@intel.com> <1490350768-65006-1-git-send-email-beilei.xing@intel.com> <1490350768-65006-2-git-send-email-beilei.xing@intel.com> <94479800C636CB44BD422CB454846E01315BF7C7@SHSMSX101.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 02:09:59 -0000 Hi Andrey, > -----Original Message----- > From: Chilikin, Andrey > Sent: Sunday, March 26, 2017 5:04 AM > To: Xing, Beilei ; Wu, Jingjing > Cc: Zhang, Helin ; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline > personalization profile processing >=20 > Hi Beilei >=20 > > -----Original Message----- > > From: Xing, Beilei > > Sent: Saturday, March 25, 2017 4:04 AM > > To: Chilikin, Andrey ; Wu, Jingjing > > > > Cc: Zhang, Helin ; dev@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline > > personalization profile processing > > > > Hi Andrey, > > > > > -----Original Message----- > > > From: Chilikin, Andrey > > > Sent: Friday, March 24, 2017 10:53 PM > > > To: Xing, Beilei ; Wu, Jingjing > > > > > > Cc: Zhang, Helin ; dev@dpdk.org > > > Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline > > > personalization profile processing > > > > > > Hi Beilei, > > > > > > > -----Original Message----- > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Beilei Xing > > > > Sent: Friday, March 24, 2017 10:19 AM > > > > To: Wu, Jingjing > > > > Cc: Zhang, Helin ; dev@dpdk.org > > > > Subject: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline > > > > personalization profile processing > > > > > > > > Add support for adding a pipeline personalization profile package. > > > > > > > > Signed-off-by: Beilei Xing > > > > --- > > > > app/test-pmd/cmdline.c | 1 + > > > > drivers/net/i40e/i40e_ethdev.c | 198 > > > > ++++++++++++++++++++++++++++++ > > > > drivers/net/i40e/rte_pmd_i40e.h | 51 ++++++++ > > > > drivers/net/i40e/rte_pmd_i40e_version.map | 6 + > > > > 4 files changed, 256 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 > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > > > b/drivers/net/i40e/i40e_ethdev.c index 3702214..bea593f 100644 > > > > --- a/drivers/net/i40e/i40e_ethdev.c > > > > +++ b/drivers/net/i40e/i40e_ethdev.c > > > > @@ -11259,3 +11259,201 @@ 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 =3D NULL; > > > > + struct i40e_profile_info *pinfo; > > > > + > > > > + sec =3D (struct i40e_profile_section_header *)profile_info_sec; > > > > + sec->tbl_size =3D 1; > > > > + sec->data_end =3D sizeof(struct i40e_profile_section_header) + > > > > + sizeof(struct i40e_profile_info); > > > > + sec->section.type =3D SECTION_TYPE_INFO; > > > > + sec->section.offset =3D sizeof(struct i40e_profile_section_header= ); > > > > + sec->section.size =3D sizeof(struct i40e_profile_info); > > > > + pinfo =3D (struct i40e_profile_info *)(profile_info_sec + > > > > + sec->section.offset); > > > > + pinfo->track_id =3D track_id; > > > > + memcpy(pinfo->name, name, I40E_PPP_NAME_SIZE); > > > > + memcpy(&pinfo->version, version, sizeof(struct i40e_ppp_version))= ; > > > > + if (add) > > > > + pinfo->op =3D I40E_PPP_ADD_TRACKID; > > > > + else > > > > + pinfo->op =3D 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 =3D I40E_SUCCESS; > > > > + struct i40e_profile_section_header *sec; > > > > + uint32_t track_id; > > > > + uint32_t offset =3D 0, info =3D 0; > > > > + > > > > + sec =3D (struct i40e_profile_section_header *)profile_info_sec; > > > > + track_id =3D ((struct i40e_profile_info *)(profile_info_sec + > > > > + sec->section.offset))->track_id; > > > > + > > > > + status =3D 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 =3D &rte_eth_devices[port]; > > > > + struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > > > > >dev_private); > > > > + uint8_t *buff; > > > > + struct rte_pmd_i40e_profile_list *p_list; > > > > + struct rte_pmd_i40e_profile_info *pinfo, *p; > > > > + uint32_t i; > > > > + int ret; > > > > + > > > > + buff =3D rte_zmalloc("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 =3D 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 =3D (struct rte_pmd_i40e_profile_list *)buff; > > > > + pinfo =3D (struct rte_pmd_i40e_profile_info *)(profile_info_sec + > > > > + sizeof(struct i40e_profile_section_header)); > > > > + for (i =3D 0; i < p_list->p_count; i++) { > > > > + p =3D &p_list->p_info[i]; > > > > + if ((pinfo->track_id =3D=3D 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) > > > > > > To make this function future-proof it is better not to use 'bool add' > > > as there are at least three possible processing actions: > > > > > > 1. Process package and add it to the list of applied profiles > > > (applying new > > > personalization) 2. Process package and remove it from the list > > > (restoring original configuration) 3. Process package and to not > > > update the list (update already applied personalization) > > > > Thanks for your comments, I considered your suggestion before, but > > it's a private API for user, I think there's only "add" and "remove" > > for users, user shouldn't want to know if the profile needs to be > > updated in the info list. So I think the first and the third items > > above should be distinguished by driver instead of application. Driver > > can distinguish them when driver parses the package by checking if trac= k_id > is 0. > > What do you think? > > > > In my opinion, the first item means add a profile, the second item > > means remove a profile, the third means add a read-only profile. > > Please correct me if I'm wrong. In fact we only support the first in > > this release, the second and third items above need to be supported aft= er > this release. >=20 > You already have "Action not supported temporarily" message now, so it wi= ll > not break anything but will save users updating their apps ABI in future. > In addition to read-only profiles, option 3 can be used for profiles whic= h call > generic admin commands, and only first call is needed to be registered. I= n > this case TrackId will not be 0 and driver cannot used it directly. > This is very minor change and do not see why not declare parameters > properly from the first release if support for all three options is neede= d > anyway. OK, misunderstood for option 3, I thought there was only different track_id= between option 1 and option 3. Will update in next version, thanks for explanation. > > > > Beilei > > > > > > > > > +{ > > > > + 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 =3D I40E_SUCCESS; > > > > + > > > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > > > > + > > > > + dev =3D &rte_eth_devices[port]; > > > > + > > > > + if (!is_device_supported(dev, &rte_i40e_pmd)) > > > > + return -ENOTSUP; > > > > + > > > > + hw =3D 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 =3D (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 =3D > > > > 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 =3D ((struct i40e_metadata_segment > > > > +*)metadata_seg_hdr)->track_id; > > > > + > > > > + /* Find profile segment */ > > > > + profile_seg_hdr =3D > > > > 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 =3D 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) { > > > > + /* Check if the profile exists */ > > > > + 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 =3D 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 =3D i40e_write_profile(hw, > > > > + (struct i40e_profile_segment > > > > *)profile_seg_hdr, > > > > + track_id); > > > > + if (status) > > > > + PMD_DRV_LOG(ERR, "Failed to write profile."); > > > > + > > > > + /* Add profile info to info list */ > > > > + status =3D i40e_add_rm_profile_info(hw, profile_info_sec); > > > > + if (status) > > > > + PMD_DRV_LOG(ERR, "Failed to add profile info."); > > > > + } else > > > > + PMD_DRV_LOG(ERR, "Action not supported temporarily."); > > > > + > > > > + 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..4f6cdb5 100644 > > > > --- a/drivers/net/i40e/rte_pmd_i40e.h > > > > +++ b/drivers/net/i40e/rte_pmd_i40e.h > > > > @@ -65,6 +65,36 @@ struct rte_pmd_i40e_mb_event_param { > > > > uint16_t msglen; /**< length of the message */ > > > > }; > > > > > > > > +#define RTE_PMD_I40E_PPP_NAME_SIZE 32 > > > > + > > > > +/** > > > > + * Pipeline personalization profile version */ struct > > > > +rte_pmd_i40e_ppp_version { > > > > + uint8_t major; > > > > + uint8_t minor; > > > > + uint8_t update; > > > > + uint8_t draft; > > > > +}; > > > > + > > > > +/** > > > > + * Structure of profile information */ struct > > > > +rte_pmd_i40e_profile_info { > > > > + uint32_t track_id; > > > > + struct rte_pmd_i40e_ppp_version version; > > > > + uint8_t reserved[8]; > > > > > > Instead of uint8_t reserved[8] it should be > > > uint8_t owner; > > > uint8_t reserved[7]; > > > > Actually I define this for getting profile info but not updating > > profile info, so I thought there won't be "owner =3D REMOVE" in info > > list. please correct me if I'm wrong. In base driver, there's "struct > > i40e_profile_info " used for updating profile info. > > All the structures defined in "rte_pmd_i40e.h" are used for getting > > info by application. > > Do you think "owner" member is used for user? If yes, I will update > > it. If no, I think user will be confused by "owner". >=20 > After calling "get profile info list" 'owner' contains PF function which = was > used to execute a profile, not 'operation'. OK, will update it. >=20 > > > > > > > > > + uint8_t name[RTE_PMD_I40E_PPP_NAME_SIZE]; }; > > > > + > > > > +/** > > > > + * Structure of profile information list */ struct > > > > +rte_pmd_i40e_profile_list { > > > > + uint32_t p_count; > > > > + struct rte_pmd_i40e_profile_info p_info[1]; }; > > > > + > > > > /** > > > > * Notify VF when PF link status changes. > > > > * > > > > @@ -332,4 +362,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) write 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, > > > Andrey