From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 42F7718F for ; Thu, 29 Jan 2015 07:53:01 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 28 Jan 2015 22:49:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="446866014" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jan 2015 22:39:02 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 29 Jan 2015 14:52:47 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.253]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.168]) with mapi id 14.03.0195.001; Thu, 29 Jan 2015 14:52:46 +0800 From: "Qiu, Michael" To: "Wu, Jingjing" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf Thread-Index: AQHQO2TkRD7sJiuwj0OtHhu3qh+/Pw== Date: Thu, 29 Jan 2015 06:52:45 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CCFC84@SHSMSX101.ccr.corp.intel.com> References: <1422495715-6450-1-git-send-email-jingjing.wu@intel.com> <1422495715-6450-3-git-send-email-jingjing.wu@intel.com> <533710CFB86FA344BFBF2D6802E60286CCD955@SHSMSX101.ccr.corp.intel.com> <9BB6961774997848B5B42BEC655768F8B86D0D@SHSMSX104.ccr.corp.intel.com> <533710CFB86FA344BFBF2D6802E60286CCFC41@SHSMSX101.ccr.corp.intel.com> <9BB6961774997848B5B42BEC655768F8B86F0A@SHSMSX104.ccr.corp.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 2/2] i40e: enable internal switch of pf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 06:53:01 -0000 On 1/29/2015 2:27 PM, Wu, Jingjing wrote:=0A= > Hi, Michael=0A= >=0A= >> -----Original Message-----=0A= >> From: Qiu, Michael=0A= >> Sent: Thursday, January 29, 2015 2:06 PM=0A= >> To: Wu, Jingjing; dev@dpdk.org=0A= >> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf= =0A= >>=0A= >> On 1/29/2015 12:57 PM, Wu, Jingjing wrote:=0A= >>> Hi, Michael=0A= >>>=0A= >>>> -----Original Message-----=0A= >>>> From: Qiu, Michael=0A= >>>> Sent: Thursday, January 29, 2015 9:56 AM=0A= >>>> To: Wu, Jingjing; dev@dpdk.org=0A= >>>> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of=0A= >>>> pf=0A= >>>>=0A= >>>> On 1/29/2015 9:42 AM, Jingjing Wu wrote:=0A= >>>>> This patch enables PF's internal switch by setting ALLOWLOOPBACK=0A= >>>>> flag when VEB is created. With this patch, traffic from PF can be=0A= >>>>> switched on the VEB.=0A= >>>>>=0A= >>>>> Signed-off-by: Jingjing Wu =0A= >>>>> ---=0A= >>>>> lib/librte_pmd_i40e/i40e_ethdev.c | 36=0A= >>>>> ++++++++++++++++++++++++++++++++++++=0A= >>>>> 1 file changed, 36 insertions(+)=0A= >>>>>=0A= >>>>> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c=0A= >>>>> b/lib/librte_pmd_i40e/i40e_ethdev.c=0A= >>>>> index fe758c2..94fd36c 100644=0A= >>>>> --- a/lib/librte_pmd_i40e/i40e_ethdev.c=0A= >>>>> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c=0A= >>>>> @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi=0A= >> *vsi)=0A= >>>>> return 0;=0A= >>>>> }=0A= >>>>>=0A= >>>>> +/*=0A= >>>>> + * i40e_enable_pf_lb=0A= >>>>> + * @pf: pointer to the pf structure=0A= >>>>> + *=0A= >>>>> + * allow loopback on pf=0A= >>>>> + */=0A= >>>>> +static inline void=0A= >>>>> +i40e_enable_pf_lb(struct i40e_pf *pf) {=0A= >>>>> + struct i40e_hw *hw =3D I40E_PF_TO_HW(pf);=0A= >>>>> + struct i40e_vsi_context ctxt;=0A= >>>>> + int ret;=0A= >>>>> +=0A= >>>>> + memset(&ctxt, 0, sizeof(ctxt));=0A= >>>>> + ctxt.seid =3D pf->main_vsi_seid;=0A= >>>>> + ctxt.pf_num =3D hw->pf_id;=0A= >>>>> + ret =3D i40e_aq_get_vsi_params(hw, &ctxt, NULL);=0A= >>>>> + if (ret) {=0A= >>>>> + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d,=0A= >>>> aq_err %d",=0A= >>>>> + ret, hw->aq.asq_last_status);=0A= >>>>> + return;=0A= >>>>> + }=0A= >>>>> + ctxt.flags =3D I40E_AQ_VSI_TYPE_PF;=0A= >>>>> + ctxt.info.valid_sections =3D=0A= >>>>> + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID);=0A= >>>> Here does it need to be "|=3D" ? As ctxt.infowill be filled in=0A= >>>> i40e_aq_get_vsi_params(), I don't know if it has other issue for=0A= >>>> override this filled by "=3D".=0A= >>>>=0A= >>>> Thanks,=0A= >>>> Michael=0A= >>> You can look at the following lines. What we called is=0A= >> i40e_aq_update_vsi_params.=0A= >>> So we need only set the flag we want to update.=0A= >> Sorry, I make a mistake, what I mean is:=0A= >>=0A= >> 1. ret =3D i40e_aq_get_vsi_params(hw, &ctxt, NULL);=0A= >> here will fill the the field ctxt.info of struct i40e_vsi_context c= txt right?=0A= >> So ctxt.info is get from other place.=0A= >>=0A= >> 2. Then:=0A= >>=0A= >> + ctxt.info.valid_sections =3D=0A= >> + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID);=0A= >>=0A= >> Has been override by assignment a value, so I just confuse whether it ha= s=0A= >> some issue.=0A= >>=0A= >> If I'm wrong, please ignore. =0A= >>=0A= >>=0A= >> Thanks,=0A= >> Michael=0A= >>=0A= > I get your idea now. Some elements in ctxt is meaningless and not set whe= n getting, and others are meaningful when=0A= > updating. The valid_sections is only meaningful when setting. If one flag= in valid_section is set, it means the=0A= > hw need to process corresponding section.=0A= =0A= OK, as it meaningless, I agree with you.=0A= =0A= Thanks,=0A= Michael=0A= >>> Thanks=0A= >>> Jingjing=0A= >>>=0A= >>>>> + ctxt.info.switch_id |=3D=0A= >>>>> + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);=0A= >>>>> +=0A= >>>>> + ret =3D i40e_aq_update_vsi_params(hw, &ctxt, NULL);=0A= >>>>> + if (ret)=0A= >>>>> + PMD_DRV_LOG(ERR, "update vsi switch failed,=0A= >>>> aq_err=3D%d\n",=0A= >>>>> + hw->aq.asq_last_status);=0A= >>>>> +}=0A= >>>>> +=0A= >>>>> /* Setup a VSI */=0A= >>>>> struct i40e_vsi *=0A= >>>>> i40e_vsi_setup(struct i40e_pf *pf,=0A= >>>>> @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf,=0A= >>>>> PMD_DRV_LOG(ERR, "VEB setup failed");=0A= >>>>> return NULL;=0A= >>>>> }=0A= >>>>> + /* set ALLOWLOOPBACk on pf, when veb is created */=0A= >>>>> + i40e_enable_pf_lb(pf);=0A= >>>>> }=0A= >>>>>=0A= >>>>> vsi =3D rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0);=0A= >=0A= =0A=