From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 716197CCF for ; Mon, 4 Sep 2017 19:24:23 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 10:24:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,475,1498546800"; d="scan'208";a="145355673" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga005.jf.intel.com with ESMTP; 04 Sep 2017 10:24:21 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.167]) by IRSMSX106.ger.corp.intel.com ([169.254.8.36]) with mapi id 14.03.0319.002; Mon, 4 Sep 2017 18:24:20 +0100 From: "Iremonger, Bernard" To: "Rybalchenko, Kirill" , "dev@dpdk.org" CC: "Rybalchenko, Kirill" , "Chilikin, Andrey" , "Xing, Beilei" , "Wu, Jingjing" Thread-Topic: [dpdk-dev] [PATCH v2 2/4] net/i40e: add new functions to manipulate with pctype mapping table Thread-Index: AQHTIzN/jHWMOwQ0JE+USe85e9IsS6Kk/jFQ Date: Mon, 4 Sep 2017 17:24:19 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C24E04466F@IRSMSX108.ger.corp.intel.com> References: <1503569908-104074-1-git-send-email-kirill.rybalchenko@intel.com> <1504278166-32769-1-git-send-email-kirill.rybalchenko@intel.com> <1504278166-32769-3-git-send-email-kirill.rybalchenko@intel.com> In-Reply-To: <1504278166-32769-3-git-send-email-kirill.rybalchenko@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDQ0NTliNjAtM2VlYS00ZmMxLWE4OGEtMjg5ZTIzMjNkMzhkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ims4dlQ5ekdSZXh2TkFRUmpZNzJaTE5RdkZGK3N1b3RwS1dPbGo4SE5IeEU9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 2/4] net/i40e: add new functions to manipulate with pctype mapping table 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, 04 Sep 2017 17:24:24 -0000 Hi Kirill, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Kirill Rybalchenko > Sent: Friday, September 1, 2017 4:03 PM > To: dev@dpdk.org > Cc: Rybalchenko, Kirill ; Chilikin, Andrey > ; Xing, Beilei ; Wu, > Jingjing > Subject: [dpdk-dev] [PATCH v2 2/4] net/i40e: add new functions to > manipulate with pctype mapping table >=20 > Add new functions which allow modify, return or reset to default the > contents of flow type to pctype dynamic mapping table. >=20 > Signed-off-by: Kirill Rybalchenko > --- > drivers/net/i40e/rte_pmd_i40e.c | 98 > +++++++++++++++++++++++++++++++++++++++++ > drivers/net/i40e/rte_pmd_i40e.h | 61 +++++++++++++++++++++++++ > 2 files changed, 159 insertions(+) >=20 > diff --git a/drivers/net/i40e/rte_pmd_i40e.c > b/drivers/net/i40e/rte_pmd_i40e.c index d69a472..3f844e6 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.c > +++ b/drivers/net/i40e/rte_pmd_i40e.c > @@ -2161,3 +2161,101 @@ rte_pmd_i40e_add_vf_mac_addr(uint8_t port, > uint16_t vf_id, >=20 > return 0; > } > + > +int rte_pmd_i40e_flow_type_mapping_reset(uint8_t port) { > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + dev =3D &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + i40e_set_default_pctype_table(dev); > + > + return 0; > +} > + > +int rte_pmd_i40e_flow_type_mapping_get( > + uint8_t port, > + struct rte_pmd_i40e_flow_type_mapping > *mapping_items, > + uint16_t size, > + uint16_t *count, > + uint8_t valid_only) > +{ > + struct rte_eth_dev *dev; > + struct i40e_adapter *ad; > + int n =3D 0; > + uint16_t i; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + dev =3D &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + ad =3D I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > + > + for (i =3D 0; i < I40E_FLOW_TYPE_MAX; i++) { > + if (n >=3D size) > + break; > + if (valid_only && ad->pcypes_tbl[i] =3D=3D 0ULL) > + continue; > + mapping_items[n].flow_type =3D i; > + mapping_items[n].pctype =3D ad->pcypes_tbl[i]; > + n++; > + } > + > + *count =3D n; > + return 0; > +} > + > +int > +rte_pmd_i40e_flow_type_mapping_update( > + uint8_t port, > + struct rte_pmd_i40e_flow_type_mapping > *mapping_items, > + uint16_t count, > + uint8_t exclusive) > +{ > + struct rte_eth_dev *dev; > + struct i40e_adapter *ad; > + int i; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + dev =3D &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + if (count > I40E_FLOW_TYPE_MAX) > + return -EINVAL; > + > + for (i =3D 0; i < count; i++) > + if (mapping_items[i].flow_type >=3D I40E_FLOW_TYPE_MAX) > + return -EINVAL; > + > + ad =3D I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > + > + if (exclusive) { > + for (i =3D 0; i < I40E_FLOW_TYPE_MAX; i++) > + ad->pcypes_tbl[i] =3D 0ULL; > + ad->flow_types_msk =3D 0ULL; > + } > + > + for (i =3D 0; i < count; i++) { > + ad->pcypes_tbl[mapping_items[i].flow_type] =3D > mapping_items[i].pctype; > + if (mapping_items[i].pctype) > + ad->flow_types_msk |=3D (1ULL << > mapping_items[i].flow_type); > + else > + ad->flow_types_msk &=3D ~(1ULL << > mapping_items[i].flow_type); > + } > + > + for (i =3D 0, ad->pctypes_msk =3D 0ULL; i < I40E_FLOW_TYPE_MAX; i++) > + ad->pctypes_msk |=3D ad->pcypes_tbl[i]; > + > + return 0; > +} > diff --git a/drivers/net/i40e/rte_pmd_i40e.h > b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..66de588 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.h > +++ b/drivers/net/i40e/rte_pmd_i40e.h > @@ -657,4 +657,65 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t > port, int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, > struct ether_addr *mac_addr); >=20 > + > +struct rte_pmd_i40e_flow_type_mapping { > + uint8_t flow_type; /**< software defined flow type*/ > + uint64_t pctype; /**< hardware defined pctype */ }; > + > +/** > + * Update hardware defined pctype to software defined flow type > + * mapping table. > + * > + * @param port > + * pointer to port identifier of the device. > + * @param mapping_items > + * the base address of the mapping items array. > + * @param count > + * number of mapping items. > + * @param exclusive > + * the flag indicate different ptype mapping update method. > + * -(0) only overwrite referred PTYPE mapping, > + * keep other PTYPEs mapping unchanged. > + * -(!0) overwrite referred PTYPE mapping, > + * set other PTYPEs maps to PTYPE_UNKNOWN. > + */ > +int rte_pmd_i40e_flow_type_mapping_update( > + uint8_t port, > + struct rte_pmd_i40e_flow_type_mapping > *mapping_items, > + uint16_t count, > + uint8_t exclusive); > + > +/** > + * Get software defined flow type to hardware defined pctype > + * mapping items. > + * > + * @param port > + * pointer to port identifier of the device. > + * @param mapping_items > + * the base address of the array to store returned items. > + * @param size > + * the size of the input array. > + * @param count > + * the place to store the number of returned items. > + * @param valid_only > + * -(0) return full mapping table. > + * -(!0) only return mapping items which flow_type !=3D > RTE_ETH_FLOW_UNKNOWN. > + */ > +int rte_pmd_i40e_flow_type_mapping_get( > + uint8_t port, > + struct rte_pmd_i40e_flow_type_mapping > *mapping_items, > + uint16_t size, > + uint16_t *count, > + uint8_t valid_only); > + > +/** > + * Reset hardware defined pctype to software defined flow type > + * mapping table to default. > + * > + * @param port > + * pointer to port identifier of the device > + */ > +int rte_pmd_i40e_flow_type_mapping_reset(uint8_t port); > + > #endif /* _PMD_I40E_H_ */ > -- > 2.5.5 There are 3 checkpatch warnings in rte_pmd_i40e.c file at lines 2250, 2252 = and 2254. Regards, Bernard.