From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 312652B8F for ; Wed, 7 Dec 2016 18:36:41 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 07 Dec 2016 09:36:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,310,1477983600"; d="scan'208";a="200106792" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga004.fm.intel.com with ESMTP; 07 Dec 2016 09:36:37 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.159]) by IRSMSX101.ger.corp.intel.com ([163.33.3.153]) with mapi id 14.03.0248.002; Wed, 7 Dec 2016 17:36:36 +0000 From: "Iremonger, Bernard" To: "Yigit, Ferruh" , "Lu, Wenzhuo" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function Thread-Index: AQHSUDqVNz8J9R1jykuLiFR+7Ms6TqD8i0uAgAAsAuA= Date: Wed, 7 Dec 2016 17:36:35 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C224D058F7@IRSMSX108.ger.corp.intel.com> References: <1480637533-37425-1-git-send-email-wenzhuo.lu@intel.com> <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com> <1481081535-37448-17-git-send-email-wenzhuo.lu@intel.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDBmOWI0ZWMtZmM5OC00YzNiLTljMzktMTFlZjYzZjE5MmQ2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNi4yLjExLjAiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOTI0b2k4aHZ4ZmdyMFwvSnZLMUNqM3JRWEtBVjR3cFo0eGxsK3FuU1Jtc2c9In0= x-ctpclassification: CTP_PUBLIC x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function 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, 07 Dec 2016 17:36:41 -0000 Hi Ferruh, > -----Original Message----- > From: Yigit, Ferruh > Sent: Wednesday, December 7, 2016 2:26 PM > To: Lu, Wenzhuo ; dev@dpdk.org > Cc: Iremonger, Bernard > Subject: Re: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert > function >=20 > On 12/7/2016 3:31 AM, Wenzhuo Lu wrote: > > Support inserting VF VLAN id from PF. > > User can call the API on PF to insert a VLAN id to a specific VF. >=20 > Same comment with prev patch, does it make sense to insert " from PF" to > patch title? Consistency in the patch titles makes sense. "set VF VLAN filter from PF" might be better.=20 =20 > > > > Signed-off-by: Bernard Iremonger > > --- > > drivers/net/i40e/i40e_ethdev.c | 53 > +++++++++++++++++++++++++++++++ > > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++ > > drivers/net/i40e/rte_pmd_i40e_version.map | 1 + > > 3 files changed, 73 insertions(+) > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > b/drivers/net/i40e/i40e_ethdev.c index 253209b..c571d8b 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -10361,3 +10361,56 @@ static void i40e_set_default_mac_addr(struct > rte_eth_dev *dev, > > else > > return -EINVAL; > > } > > + > > +int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id, > > + uint16_t vlan_id) > > +{ > > + struct rte_eth_dev *dev; > > + struct rte_eth_dev_info dev_info; > > + struct i40e_pf *pf; > > + struct i40e_pf_vf *vf; > > + struct i40e_hw *hw; > > + struct i40e_vsi *vsi; > > + struct i40e_vsi_context ctxt; > > + int ret; > > + > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > > + > > + dev =3D &rte_eth_devices[port]; > > + rte_eth_dev_info_get(port, &dev_info); > > + > > + pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > > + hw =3D I40E_PF_TO_HW(pf); > > + > > + /** > > + * return -ENODEV if SRIOV not enabled, VF number not configured > > + * or no queue assigned. > > + */ > > + if (!hw->func_caps.sr_iov_1_1 || pf->vf_num =3D=3D 0 || > > + pf->vf_nb_qps =3D=3D 0) > > + return -ENODEV; > > + > > + if (vf_id > pf->vf_num) if (vf_id >=3D pf->vf_num) =20 would be better. =20 > This check was [1] in prev patches: > [1] > if (vf_id > pf->vf_num - 1 || !pf->vfs) if (vf_id >=3D pf->vf_num || !pf->vfs) would be better. >=20 > > + return -EINVAL; > > + > > + if (vlan_id > 4095) >=20 > Can there be any define in base driver for this? Or ETH_VLAN_ID_MAX > perhaps? ETHER_MAX_VLAN_ID in rte_ether.h should be used . =20 > > + return -EINVAL; > > + > > + vf =3D &pf->vfs[vf_id]; > > + vsi =3D vf->vsi; > > + > > + vsi->info.valid_sections =3D > cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID); > > + vsi->info.port_vlan_flags |=3D I40E_AQ_VSI_PVLAN_INSERT_PVID; > > + vsi->info.pvid =3D vlan_id; > > + >=20 > ---> > > + memset(&ctxt, 0, sizeof(ctxt)); > > + (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); > > + ctxt.seid =3D vsi->seid; > > + > > + hw =3D I40E_VSI_TO_HW(vsi); > > + ret =3D i40e_aq_update_vsi_params(hw, &ctxt, NULL); > > + if (ret !=3D I40E_SUCCESS) > > + PMD_DRV_LOG(ERR, "Failed to update VSI params"); > <----- >=20 > If Wenzhuo prefers to extract this part into a function, it can be re-use= d here > too. >=20 > <...>