From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 56963271 for ; Wed, 28 Jun 2017 08:57:54 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 27 Jun 2017 23:57:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,274,1496127600"; d="scan'208";a="986041848" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 27 Jun 2017 23:57:53 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Jun 2017 23:57:52 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Jun 2017 23:57:47 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.197]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Wed, 28 Jun 2017 14:57:46 +0800 From: "Xing, Beilei" To: "Chilikin, Andrey" , "dev@dpdk.org" CC: "Wu, Jingjing" Thread-Topic: [PATCH v3 1/2] net/i40e: extended list of operations for ddp processing Thread-Index: AQHS70pIH+6LgYAfT0u4q7bJk1UnQKI51PaQ Date: Wed, 28 Jun 2017 06:57:45 +0000 Message-ID: <94479800C636CB44BD422CB454846E0131FD8F09@SHSMSX101.ccr.corp.intel.com> References: <1495901077-11845-1-git-send-email-andrey.chilikin@intel.com> <1498570513-8592-2-git-send-email-andrey.chilikin@intel.com> In-Reply-To: <1498570513-8592-2-git-send-email-andrey.chilikin@intel.com> 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 v3 1/2] net/i40e: extended list of operations for ddp 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: Wed, 28 Jun 2017 06:57:55 -0000 Hi Andrey, > -----Original Message----- > From: Chilikin, Andrey > Sent: Tuesday, June 27, 2017 9:35 PM > To: dev@dpdk.org > Cc: Xing, Beilei ; Wu, Jingjing > ; Chilikin, Andrey > Subject: [PATCH v3 1/2] net/i40e: extended list of operations for ddp > processing >=20 > This patch adds ability to remove already loaded profile or write profile > without registering it >=20 > Signed-off-by: Andrey Chilikin > --- > drivers/net/i40e/rte_pmd_i40e.c | 87 > +++++++++++++++++++++++++++++------------ > drivers/net/i40e/rte_pmd_i40e.h | 6 ++- > 2 files changed, 66 insertions(+), 27 deletions(-) >=20 > diff --git a/drivers/net/i40e/rte_pmd_i40e.c > b/drivers/net/i40e/rte_pmd_i40e.c index 45cdcfaa3..ca2515d96 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.c > +++ b/drivers/net/i40e/rte_pmd_i40e.c > @@ -1554,11 +1554,7 @@ i40e_check_profile_info(uint8_t port, uint8_t > *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_ddp_version)) && > - !memcmp(&pinfo->name, &p->name, > - I40E_DDP_NAME_SIZE)) { > + if (pinfo->track_id =3D=3D p->track_id) { > PMD_DRV_LOG(INFO, "Profile exists."); > rte_free(buff); > return 1; > @@ -1584,6 +1580,13 @@ rte_pmd_i40e_process_ddp_package(uint8_t > port, uint8_t *buff, > int is_exist; > enum i40e_status_code status =3D I40E_SUCCESS; >=20 > + if (op !=3D RTE_PMD_I40E_PKG_OP_WR_ADD && > + op !=3D RTE_PMD_I40E_PKG_OP_WR_ONLY && > + op !=3D RTE_PMD_I40E_PKG_OP_WR_DEL) { > + PMD_DRV_LOG(ERR, "Operation not supported."); > + return -ENOTSUP; > + } > + > RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); >=20 > dev =3D &rte_eth_devices[port]; > @@ -1620,6 +1623,10 @@ rte_pmd_i40e_process_ddp_package(uint8_t > port, uint8_t *buff, > return -EINVAL; > } > track_id =3D ((struct i40e_metadata_segment *)metadata_seg_hdr)- > >track_id; > + if (track_id =3D=3D I40E_DDP_TRACKID_INVALID) { > + PMD_DRV_LOG(ERR, "Invalid track_id"); > + return -EINVAL; > + } >=20 > /* Find profile segment */ > profile_seg_hdr =3D > i40e_find_segment_in_package(SEGMENT_TYPE_I40E, > @@ -1639,40 +1646,68 @@ rte_pmd_i40e_process_ddp_package(uint8_t > port, uint8_t *buff, > return -EINVAL; > } >=20 > + /* Check if the profile already loaded */ > + 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, > + op =3D=3D RTE_PMD_I40E_PKG_OP_WR_ADD); > + is_exist =3D i40e_check_profile_info(port, profile_info_sec); > + if (is_exist < 0) { > + PMD_DRV_LOG(ERR, "Failed to check profile."); > + rte_free(profile_info_sec); > + return -EINVAL; > + } > + > if (op =3D=3D RTE_PMD_I40E_PKG_OP_WR_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 > 0) { > + if (is_exist) { > PMD_DRV_LOG(ERR, "Profile already exists."); > rte_free(profile_info_sec); > - return 1; > - } else if (is_exist < 0) { > - PMD_DRV_LOG(ERR, "Failed to check profile."); > + return -EEXIST; > + } > + } else if (op =3D=3D RTE_PMD_I40E_PKG_OP_WR_DEL) { > + if (!is_exist) { > + PMD_DRV_LOG(ERR, "Profile does not exist."); > rte_free(profile_info_sec); > - return -EINVAL; > + return -EACCES; > } > + } >=20 > - /* Write profile to HW */ > + if (op =3D=3D RTE_PMD_I40E_PKG_OP_WR_DEL) { > + status =3D i40e_rollback_profile( > + hw, > + (struct i40e_profile_segment *)profile_seg_hdr, > + track_id); > + if (status) { > + PMD_DRV_LOG(ERR, "Failed to write profile for > delete."); > + rte_free(profile_info_sec); > + return status; > + } > + } > + else { Should be } else { here according to the coding style. > status =3D i40e_write_profile( > - hw, > - (struct i40e_profile_segment > *)profile_seg_hdr, > - track_id); > + hw, > + (struct i40e_profile_segment *)profile_seg_hdr, > + track_id); > if (status) { > - PMD_DRV_LOG(ERR, "Failed to write profile."); > + if (op =3D=3D RTE_PMD_I40E_PKG_OP_WR_ADD) > + PMD_DRV_LOG(ERR, "Failed to write profile > for add."); > + else > + PMD_DRV_LOG(ERR, "Failed to write > profile."); > rte_free(profile_info_sec); > return status; > } > + } >=20 > - /* Add profile info to info list */ > + if (track_id && (op !=3D RTE_PMD_I40E_PKG_OP_WR_ONLY)) { > + /* Modify loaded profiles 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, "Operation not supported."); > + if (status) { > + if (op =3D=3D RTE_PMD_I40E_PKG_OP_WR_ADD) > + PMD_DRV_LOG(ERR, "Failed to add profile to > info list."); > + else > + PMD_DRV_LOG(ERR, "Failed to delete profile > from info list."); > + } > } >=20 > rte_free(profile_info_sec); > diff --git a/drivers/net/i40e/rte_pmd_i40e.h > b/drivers/net/i40e/rte_pmd_i40e.h index 4a867ad6f..356fa89d7 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.h > +++ b/drivers/net/i40e/rte_pmd_i40e.h > @@ -71,6 +71,8 @@ struct rte_pmd_i40e_mb_event_param { enum > rte_pmd_i40e_package_op { > RTE_PMD_I40E_PKG_OP_UNDEFINED =3D 0, > RTE_PMD_I40E_PKG_OP_WR_ADD, /**< load package and add to > info list */ > + RTE_PMD_I40E_PKG_OP_WR_DEL, /**< load package and delete > from info list */ > + RTE_PMD_I40E_PKG_OP_WR_ONLY, /**< load package without > modifying info > +list */ The only difference between RTE_PMD_I40E_PKG_OP_WR_ADD and RTE_PMD_I40E_PKG= _OP_WR_ONLY is if need to change info list, right? Is there any difference = between the profiles added? Do we need another CLI in testpmd to indicate h= ow/when we need to use RTE_PMD_I40E_PKG_OP_WR_ONLY? Beilei > RTE_PMD_I40E_PKG_OP_MAX =3D 32 > }; >=20 > @@ -517,7 +519,9 @@ int rte_pmd_i40e_set_tc_strict_prio(uint8_t port, > uint8_t tc_map); > * - (0) if successful. > * - (-ENODEV) if *port* invalid. > * - (-EINVAL) if bad parameter. > - * - (1) if profile exists. > + * - (-EEXIST) if profile exists. > + * - (-EACCES) if profile does not exist. > + * - (-ENOTSUP) if operation not supported. > */ > int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff, > uint32_t size, > -- > 2.13.0