From 2ccabd8cd1f62f337ee9119542beeca9afe43154 Mon Sep 17 00:00:00 2001 From: Jingjing Wu Date: Thu, 29 Jan 2015 09:41:55 +0800 Subject: [PATCH] i40e: enable internal switch of PF 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. Test report: http://www.dpdk.org/ml/archives/dev/2015-February/013237.html Signed-off-by: Jingjing Wu Acked-by: Jijiang Liu Tested-by: Min Cao --- 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 6f24ee5d6d..85e8315f0f 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -2870,6 +2870,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, @@ -2905,6 +2939,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); -- 2.20.1