Message ID | 1422495715-6450-3-git-send-email-jingjing.wu@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 4EA455A95; Thu, 29 Jan 2015 02:42:17 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D3DF11F5 for <dev@dpdk.org>; Thu, 29 Jan 2015 02:42:11 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 28 Jan 2015 17:35:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,484,1418112000"; d="scan'208";a="519388451" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 28 Jan 2015 17:34:57 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t0T1g6sW009736; Thu, 29 Jan 2015 09:42:06 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t0T1g2xt006499; Thu, 29 Jan 2015 09:42:04 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0T1g2qe006495; Thu, 29 Jan 2015 09:42:02 +0800 From: Jingjing Wu <jingjing.wu@intel.com> To: dev@dpdk.org Date: Thu, 29 Jan 2015 09:41:55 +0800 Message-Id: <1422495715-6450-3-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1422495715-6450-1-git-send-email-jingjing.wu@intel.com> References: <1422495715-6450-1-git-send-email-jingjing.wu@intel.com> Subject: [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 <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Jingjing Wu
Jan. 29, 2015, 1:41 a.m. UTC
This patch enables PF's internal switch by setting ALLOWLOOPBACK
flag when VEB is created. With this patch, traffic from PF can be
switched on the VEB.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
Comments
On 1/29/2015 9:42 AM, Jingjing Wu wrote: > This patch enables PF's internal switch by setting ALLOWLOOPBACK > flag when VEB is created. With this patch, traffic from PF can be > switched on the VEB. > > Signed-off-by: Jingjing Wu <jingjing.wu@intel.com> > --- > lib/librte_pmd_i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c > index fe758c2..94fd36c 100644 > --- a/lib/librte_pmd_i40e/i40e_ethdev.c > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c > @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi *vsi) > return 0; > } > > +/* > + * i40e_enable_pf_lb > + * @pf: pointer to the pf structure > + * > + * allow loopback on pf > + */ > +static inline void > +i40e_enable_pf_lb(struct i40e_pf *pf) > +{ > + struct i40e_hw *hw = I40E_PF_TO_HW(pf); > + struct i40e_vsi_context ctxt; > + int ret; > + > + memset(&ctxt, 0, sizeof(ctxt)); > + ctxt.seid = pf->main_vsi_seid; > + ctxt.pf_num = hw->pf_id; > + ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); > + if (ret) { > + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d, aq_err %d", > + ret, hw->aq.asq_last_status); > + return; > + } > + ctxt.flags = I40E_AQ_VSI_TYPE_PF; > + ctxt.info.valid_sections = > + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); Here does it need to be "|=" ? As ctxt.infowill be filled in i40e_aq_get_vsi_params(), I don't know if it has other issue for override this filled by "=". Thanks, Michael > + ctxt.info.switch_id |= > + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); > + > + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); > + if (ret) > + PMD_DRV_LOG(ERR, "update vsi switch failed, aq_err=%d\n", > + hw->aq.asq_last_status); > +} > + > /* Setup a VSI */ > struct i40e_vsi * > i40e_vsi_setup(struct i40e_pf *pf, > @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf, > PMD_DRV_LOG(ERR, "VEB setup failed"); > return NULL; > } > + /* set ALLOWLOOPBACk on pf, when veb is created */ > + i40e_enable_pf_lb(pf); > } > > vsi = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0);
Hi, Michael > -----Original Message----- > From: Qiu, Michael > Sent: Thursday, January 29, 2015 9:56 AM > To: Wu, Jingjing; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf > > On 1/29/2015 9:42 AM, Jingjing Wu wrote: > > This patch enables PF's internal switch by setting ALLOWLOOPBACK flag > > when VEB is created. With this patch, traffic from PF can be switched > > on the VEB. > > > > Signed-off-by: Jingjing Wu <jingjing.wu@intel.com> > > --- > > lib/librte_pmd_i40e/i40e_ethdev.c | 36 > > ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 36 insertions(+) > > > > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c > > b/lib/librte_pmd_i40e/i40e_ethdev.c > > index fe758c2..94fd36c 100644 > > --- a/lib/librte_pmd_i40e/i40e_ethdev.c > > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c > > @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi *vsi) > > return 0; > > } > > > > +/* > > + * i40e_enable_pf_lb > > + * @pf: pointer to the pf structure > > + * > > + * allow loopback on pf > > + */ > > +static inline void > > +i40e_enable_pf_lb(struct i40e_pf *pf) { > > + struct i40e_hw *hw = I40E_PF_TO_HW(pf); > > + struct i40e_vsi_context ctxt; > > + int ret; > > + > > + memset(&ctxt, 0, sizeof(ctxt)); > > + ctxt.seid = pf->main_vsi_seid; > > + ctxt.pf_num = hw->pf_id; > > + ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); > > + if (ret) { > > + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d, > aq_err %d", > > + ret, hw->aq.asq_last_status); > > + return; > > + } > > + ctxt.flags = I40E_AQ_VSI_TYPE_PF; > > + ctxt.info.valid_sections = > > + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); > > Here does it need to be "|=" ? As ctxt.infowill be filled in > i40e_aq_get_vsi_params(), I don't know if it has other issue for override this > filled by "=". > > Thanks, > Michael You can look at the following lines. What we called is i40e_aq_update_vsi_params. So we need only set the flag we want to update. Thanks Jingjing > > + ctxt.info.switch_id |= > > + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); > > + > > + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); > > + if (ret) > > + PMD_DRV_LOG(ERR, "update vsi switch failed, > aq_err=%d\n", > > + hw->aq.asq_last_status); > > +} > > + > > /* Setup a VSI */ > > struct i40e_vsi * > > i40e_vsi_setup(struct i40e_pf *pf, > > @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf, > > PMD_DRV_LOG(ERR, "VEB setup failed"); > > return NULL; > > } > > + /* set ALLOWLOOPBACk on pf, when veb is created */ > > + i40e_enable_pf_lb(pf); > > } > > > > vsi = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0);
On 1/29/2015 12:57 PM, Wu, Jingjing wrote: > Hi, Michael > >> -----Original Message----- >> From: Qiu, Michael >> Sent: Thursday, January 29, 2015 9:56 AM >> To: Wu, Jingjing; dev@dpdk.org >> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf >> >> On 1/29/2015 9:42 AM, Jingjing Wu wrote: >>> This patch enables PF's internal switch by setting ALLOWLOOPBACK flag >>> when VEB is created. With this patch, traffic from PF can be switched >>> on the VEB. >>> >>> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com> >>> --- >>> lib/librte_pmd_i40e/i40e_ethdev.c | 36 >>> ++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 36 insertions(+) >>> >>> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c >>> b/lib/librte_pmd_i40e/i40e_ethdev.c >>> index fe758c2..94fd36c 100644 >>> --- a/lib/librte_pmd_i40e/i40e_ethdev.c >>> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c >>> @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi *vsi) >>> return 0; >>> } >>> >>> +/* >>> + * i40e_enable_pf_lb >>> + * @pf: pointer to the pf structure >>> + * >>> + * allow loopback on pf >>> + */ >>> +static inline void >>> +i40e_enable_pf_lb(struct i40e_pf *pf) { >>> + struct i40e_hw *hw = I40E_PF_TO_HW(pf); >>> + struct i40e_vsi_context ctxt; >>> + int ret; >>> + >>> + memset(&ctxt, 0, sizeof(ctxt)); >>> + ctxt.seid = pf->main_vsi_seid; >>> + ctxt.pf_num = hw->pf_id; >>> + ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); >>> + if (ret) { >>> + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d, >> aq_err %d", >>> + ret, hw->aq.asq_last_status); >>> + return; >>> + } >>> + ctxt.flags = I40E_AQ_VSI_TYPE_PF; >>> + ctxt.info.valid_sections = >>> + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); >> Here does it need to be "|=" ? As ctxt.infowill be filled in >> i40e_aq_get_vsi_params(), I don't know if it has other issue for override this >> filled by "=". >> >> Thanks, >> Michael > You can look at the following lines. What we called is i40e_aq_update_vsi_params. > So we need only set the flag we want to update. Sorry, I make a mistake, what I mean is: 1. ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); here will fill the the field ctxt.info of struct i40e_vsi_context ctxt right? So ctxt.info is get from other place. 2. Then: + ctxt.info.valid_sections = + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); Has been override by assignment a value, so I just confuse whether it has some issue. If I'm wrong, please ignore. Thanks, Michael > Thanks > Jingjing > >>> + ctxt.info.switch_id |= >>> + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); >>> + >>> + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); >>> + if (ret) >>> + PMD_DRV_LOG(ERR, "update vsi switch failed, >> aq_err=%d\n", >>> + hw->aq.asq_last_status); >>> +} >>> + >>> /* Setup a VSI */ >>> struct i40e_vsi * >>> i40e_vsi_setup(struct i40e_pf *pf, >>> @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf, >>> PMD_DRV_LOG(ERR, "VEB setup failed"); >>> return NULL; >>> } >>> + /* set ALLOWLOOPBACk on pf, when veb is created */ >>> + i40e_enable_pf_lb(pf); >>> } >>> >>> vsi = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0); >
Hi, Michael > -----Original Message----- > From: Qiu, Michael > Sent: Thursday, January 29, 2015 2:06 PM > To: Wu, Jingjing; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf > > On 1/29/2015 12:57 PM, Wu, Jingjing wrote: > > Hi, Michael > > > >> -----Original Message----- > >> From: Qiu, Michael > >> Sent: Thursday, January 29, 2015 9:56 AM > >> To: Wu, Jingjing; dev@dpdk.org > >> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of > >> pf > >> > >> On 1/29/2015 9:42 AM, Jingjing Wu wrote: > >>> This patch enables PF's internal switch by setting ALLOWLOOPBACK > >>> flag when VEB is created. With this patch, traffic from PF can be > >>> switched on the VEB. > >>> > >>> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com> > >>> --- > >>> lib/librte_pmd_i40e/i40e_ethdev.c | 36 > >>> ++++++++++++++++++++++++++++++++++++ > >>> 1 file changed, 36 insertions(+) > >>> > >>> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c > >>> b/lib/librte_pmd_i40e/i40e_ethdev.c > >>> index fe758c2..94fd36c 100644 > >>> --- a/lib/librte_pmd_i40e/i40e_ethdev.c > >>> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c > >>> @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi > *vsi) > >>> return 0; > >>> } > >>> > >>> +/* > >>> + * i40e_enable_pf_lb > >>> + * @pf: pointer to the pf structure > >>> + * > >>> + * allow loopback on pf > >>> + */ > >>> +static inline void > >>> +i40e_enable_pf_lb(struct i40e_pf *pf) { > >>> + struct i40e_hw *hw = I40E_PF_TO_HW(pf); > >>> + struct i40e_vsi_context ctxt; > >>> + int ret; > >>> + > >>> + memset(&ctxt, 0, sizeof(ctxt)); > >>> + ctxt.seid = pf->main_vsi_seid; > >>> + ctxt.pf_num = hw->pf_id; > >>> + ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); > >>> + if (ret) { > >>> + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d, > >> aq_err %d", > >>> + ret, hw->aq.asq_last_status); > >>> + return; > >>> + } > >>> + ctxt.flags = I40E_AQ_VSI_TYPE_PF; > >>> + ctxt.info.valid_sections = > >>> + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); > >> Here does it need to be "|=" ? As ctxt.infowill be filled in > >> i40e_aq_get_vsi_params(), I don't know if it has other issue for > >> override this filled by "=". > >> > >> Thanks, > >> Michael > > You can look at the following lines. What we called is > i40e_aq_update_vsi_params. > > So we need only set the flag we want to update. > > Sorry, I make a mistake, what I mean is: > > 1. ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); > here will fill the the field ctxt.info of struct i40e_vsi_context ctxt right? > So ctxt.info is get from other place. > > 2. Then: > > + ctxt.info.valid_sections = > + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); > > Has been override by assignment a value, so I just confuse whether it has > some issue. > > If I'm wrong, please ignore. > > > Thanks, > Michael > I get your idea now. Some elements in ctxt is meaningless and not set when getting, and others are meaningful when updating. The valid_sections is only meaningful when setting. If one flag in valid_section is set, it means the hw need to process corresponding section. > > Thanks > > Jingjing > > > >>> + ctxt.info.switch_id |= > >>> + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); > >>> + > >>> + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); > >>> + if (ret) > >>> + PMD_DRV_LOG(ERR, "update vsi switch failed, > >> aq_err=%d\n", > >>> + hw->aq.asq_last_status); > >>> +} > >>> + > >>> /* Setup a VSI */ > >>> struct i40e_vsi * > >>> i40e_vsi_setup(struct i40e_pf *pf, > >>> @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf, > >>> PMD_DRV_LOG(ERR, "VEB setup failed"); > >>> return NULL; > >>> } > >>> + /* set ALLOWLOOPBACk on pf, when veb is created */ > >>> + i40e_enable_pf_lb(pf); > >>> } > >>> > >>> vsi = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0); > >
On 1/29/2015 2:27 PM, Wu, Jingjing wrote: > Hi, Michael > >> -----Original Message----- >> From: Qiu, Michael >> Sent: Thursday, January 29, 2015 2:06 PM >> To: Wu, Jingjing; dev@dpdk.org >> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of pf >> >> On 1/29/2015 12:57 PM, Wu, Jingjing wrote: >>> Hi, Michael >>> >>>> -----Original Message----- >>>> From: Qiu, Michael >>>> Sent: Thursday, January 29, 2015 9:56 AM >>>> To: Wu, Jingjing; dev@dpdk.org >>>> Subject: Re: [dpdk-dev] [PATCH 2/2] i40e: enable internal switch of >>>> pf >>>> >>>> On 1/29/2015 9:42 AM, Jingjing Wu wrote: >>>>> This patch enables PF's internal switch by setting ALLOWLOOPBACK >>>>> flag when VEB is created. With this patch, traffic from PF can be >>>>> switched on the VEB. >>>>> >>>>> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com> >>>>> --- >>>>> lib/librte_pmd_i40e/i40e_ethdev.c | 36 >>>>> ++++++++++++++++++++++++++++++++++++ >>>>> 1 file changed, 36 insertions(+) >>>>> >>>>> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c >>>>> b/lib/librte_pmd_i40e/i40e_ethdev.c >>>>> index fe758c2..94fd36c 100644 >>>>> --- a/lib/librte_pmd_i40e/i40e_ethdev.c >>>>> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c >>>>> @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi >> *vsi) >>>>> return 0; >>>>> } >>>>> >>>>> +/* >>>>> + * i40e_enable_pf_lb >>>>> + * @pf: pointer to the pf structure >>>>> + * >>>>> + * allow loopback on pf >>>>> + */ >>>>> +static inline void >>>>> +i40e_enable_pf_lb(struct i40e_pf *pf) { >>>>> + struct i40e_hw *hw = I40E_PF_TO_HW(pf); >>>>> + struct i40e_vsi_context ctxt; >>>>> + int ret; >>>>> + >>>>> + memset(&ctxt, 0, sizeof(ctxt)); >>>>> + ctxt.seid = pf->main_vsi_seid; >>>>> + ctxt.pf_num = hw->pf_id; >>>>> + ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); >>>>> + if (ret) { >>>>> + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d, >>>> aq_err %d", >>>>> + ret, hw->aq.asq_last_status); >>>>> + return; >>>>> + } >>>>> + ctxt.flags = I40E_AQ_VSI_TYPE_PF; >>>>> + ctxt.info.valid_sections = >>>>> + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); >>>> Here does it need to be "|=" ? As ctxt.infowill be filled in >>>> i40e_aq_get_vsi_params(), I don't know if it has other issue for >>>> override this filled by "=". >>>> >>>> Thanks, >>>> Michael >>> You can look at the following lines. What we called is >> i40e_aq_update_vsi_params. >>> So we need only set the flag we want to update. >> Sorry, I make a mistake, what I mean is: >> >> 1. ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); >> here will fill the the field ctxt.info of struct i40e_vsi_context ctxt right? >> So ctxt.info is get from other place. >> >> 2. Then: >> >> + ctxt.info.valid_sections = >> + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); >> >> Has been override by assignment a value, so I just confuse whether it has >> some issue. >> >> If I'm wrong, please ignore. >> >> >> Thanks, >> Michael >> > I get your idea now. Some elements in ctxt is meaningless and not set when getting, and others are meaningful when > updating. The valid_sections is only meaningful when setting. If one flag in valid_section is set, it means the > hw need to process corresponding section. OK, as it meaningless, I agree with you. Thanks, Michael >>> Thanks >>> Jingjing >>> >>>>> + ctxt.info.switch_id |= >>>>> + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); >>>>> + >>>>> + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); >>>>> + if (ret) >>>>> + PMD_DRV_LOG(ERR, "update vsi switch failed, >>>> aq_err=%d\n", >>>>> + hw->aq.asq_last_status); >>>>> +} >>>>> + >>>>> /* Setup a VSI */ >>>>> struct i40e_vsi * >>>>> i40e_vsi_setup(struct i40e_pf *pf, >>>>> @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf, >>>>> PMD_DRV_LOG(ERR, "VEB setup failed"); >>>>> return NULL; >>>>> } >>>>> + /* set ALLOWLOOPBACk on pf, when veb is created */ >>>>> + i40e_enable_pf_lb(pf); >>>>> } >>>>> >>>>> vsi = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0); >
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index fe758c2..94fd36c 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -2854,6 +2854,40 @@ i40e_vsi_dump_bw_config(struct i40e_vsi *vsi) return 0; } +/* + * i40e_enable_pf_lb + * @pf: pointer to the pf structure + * + * allow loopback on pf + */ +static inline void +i40e_enable_pf_lb(struct i40e_pf *pf) +{ + struct i40e_hw *hw = I40E_PF_TO_HW(pf); + struct i40e_vsi_context ctxt; + int ret; + + memset(&ctxt, 0, sizeof(ctxt)); + ctxt.seid = pf->main_vsi_seid; + ctxt.pf_num = hw->pf_id; + ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); + if (ret) { + PMD_DRV_LOG(ERR, "couldn't get pf vsi config, err %d, aq_err %d", + ret, hw->aq.asq_last_status); + return; + } + ctxt.flags = I40E_AQ_VSI_TYPE_PF; + ctxt.info.valid_sections = + rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); + ctxt.info.switch_id |= + rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); + + ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); + if (ret) + PMD_DRV_LOG(ERR, "update vsi switch failed, aq_err=%d\n", + hw->aq.asq_last_status); +} + /* Setup a VSI */ struct i40e_vsi * i40e_vsi_setup(struct i40e_pf *pf, @@ -2889,6 +2923,8 @@ i40e_vsi_setup(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "VEB setup failed"); return NULL; } + /* set ALLOWLOOPBACk on pf, when veb is created */ + i40e_enable_pf_lb(pf); } vsi = rte_zmalloc("i40e_vsi", sizeof(struct i40e_vsi), 0);