From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Qiu, Michael" Subject: Re: [PATCH 2/2] i40e: enable internal switch of pf Date: Thu, 29 Jan 2015 06:06:15 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CCFC41@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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: "Wu, Jingjing" , "dev-VfR2kkLFssw@public.gmane.org" Return-path: Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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-VfR2kkLFssw@public.gmane.org=0A= >> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf= =0A= >>=0A= >> On 1/29/2015 9:42 AM, Jingjing Wu wrote:=0A= >>> This patch enables PF's internal switch by setting ALLOWLOOPBACK flag= =0A= >>> when VEB is created. With this patch, traffic from PF can be switched= =0A= >>> 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 *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 overrid= e this=0A= >> filled by "=3D".=0A= >>=0A= >> Thanks,=0A= >> Michael=0A= > You can look at the following lines. What we called is i40e_aq_update_vsi= _params.=0A= > So we need only set the flag we want to update.=0A= =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=0A= ctxt 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 has s= ome issue.=0A= =0A= If I'm wrong, please ignore.=0A= =0A= =0A= Thanks,=0A= Michael=0A= =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=