From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 5363C2B97 for ; Wed, 2 Mar 2016 03:31:23 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 01 Mar 2016 18:31:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,526,1449561600"; d="scan'208";a="924806930" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 01 Mar 2016 18:31:22 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 1 Mar 2016 18:31:21 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 1 Mar 2016 18:31:20 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.232]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.18]) with mapi id 14.03.0248.002; Wed, 2 Mar 2016 10:31:19 +0800 From: "Xu, Qian Q" To: "Tao, Zhe" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 2/2 v3] i40e: Add floating VEB support in i40e Thread-Index: AQHRb5ZYpUsLttUGfkC9YcOJYxUUJZ9Fd6IA Date: Wed, 2 Mar 2016 02:31:18 +0000 Message-ID: <82F45D86ADE5454A95A89742C8D1410E031F41BB@shsmsx102.ccr.corp.intel.com> References: <1456218796-15630-1-git-send-email-zhe.tao@intel.com> <1456381901-23080-1-git-send-email-zhe.tao@intel.com> <1456381901-23080-3-git-send-email-zhe.tao@intel.com> In-Reply-To: <1456381901-23080-3-git-send-email-zhe.tao@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 v3] i40e: Add floating VEB support in i40e 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: Wed, 02 Mar 2016 02:31:24 -0000 Suggest to add document for why to have it, the basic usage and the sample = of how to use it.=20 Thanks Qian -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhe Tao Sent: Thursday, February 25, 2016 2:32 PM To: dev@dpdk.org Subject: [dpdk-dev] [PATCH 2/2 v3] i40e: Add floating VEB support in i40e This patch add the support for floating VEB in i40e. All the VFs VSIs can decide whether to connect to the legacy VEB/VEPA or t= he floating VEB. When connect to the floating VEB a new floating VEB is cr= eated. Now all the VFs need to connect to floating VEB or legacy VEB, cann= ot connect to both of them. The PF and VMDQ,FD VSIs still connect to the ol= d legacy VEB/VEPA. All the VEB/VEPA concepts are not specific for FVL, they are defined in the= 802.1Qbg spec. Signed-off-by: Zhe Tao --- doc/guides/rel_notes/release_16_04.rst | 2 + drivers/net/i40e/Makefile | 2 +- drivers/net/i40e/i40e_ethdev.c | 105 +++++++++++++++++++++++++++--= ---- drivers/net/i40e/i40e_ethdev.h | 4 ++ drivers/net/i40e/i40e_pf.c | 11 +++- 5 files changed, 103 insertions(+), 21 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/= release_16_04.rst index 5786f74..446112c 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,8 @@ This section should contain new features added in this re= lease. Sample format: =20 * **Added vhost-user live migration support.** =20 +* **Added floating VEB support for FVL.** + =20 Resolved Issues --------------- diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile index 03= 3ee4a..2e01d45 100644 --- a/drivers/net/i40e/Makefile +++ b/drivers/net/i40e/Makefile @@ -39,7 +39,7 @@ LIB =3D librte_pmd_i40e.a CFLAGS +=3D -O3 CFLAGS +=3D $= (WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF CFLAGS +=3D -DX722_= SUPPORT -DX722_A0_SUPPORT - +CFLAGS +=3D -I$(RTE_SDK)/lib/librte_eal/common EXPORT_MAP :=3D rte_pmd_i40e_version.map =20 LIBABIVER :=3D 1 diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.= c index ef24122..f8554c9 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -744,6 +744,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) pf->adapter =3D I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); pf->adapter->eth_dev =3D dev; pf->dev_data =3D dev->data; + pf->floating =3D internal_config.floating; =20 hw->back =3D I40E_PF_TO_ADAPTER(pf); hw->hw_addr =3D (uint8_t *)(pci_dev->mem_resource[0].addr); @@ -3592,21 +3593,27 @@ i40e_veb_release(struct i40e_veb *veb) struct i40e_vsi *vsi; struct i40e_hw *hw; =20 - if (veb =3D=3D NULL || veb->associate_vsi =3D=3D NULL) + if (veb =3D=3D NULL) return -EINVAL; =20 if (!TAILQ_EMPTY(&veb->head)) { PMD_DRV_LOG(ERR, "VEB still has VSI attached, can't remove"); return -EACCES; } + /* associate_vsi field is NULL for floating VEB */ + if (veb->associate_vsi !=3D NULL) { + vsi =3D veb->associate_vsi; + hw =3D I40E_VSI_TO_HW(vsi); =20 - vsi =3D veb->associate_vsi; - hw =3D I40E_VSI_TO_HW(vsi); + vsi->uplink_seid =3D veb->uplink_seid; + vsi->veb =3D NULL; + } else { + veb->associate_pf->main_vsi->floating_veb =3D NULL; + hw =3D I40E_VSI_TO_HW(veb->associate_pf->main_vsi); + } =20 - vsi->uplink_seid =3D veb->uplink_seid; i40e_aq_delete_element(hw, veb->seid, NULL); rte_free(veb); - vsi->veb =3D NULL; return I40E_SUCCESS; } =20 @@ -3618,9 +3625,9 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *v= si) int ret; struct i40e_hw *hw; =20 - if (NULL =3D=3D pf || vsi =3D=3D NULL) { + if (NULL =3D=3D pf) { PMD_DRV_LOG(ERR, "veb setup failed, " - "associated VSI shouldn't null"); + "associated PF shouldn't null"); return NULL; } hw =3D I40E_PF_TO_HW(pf); @@ -3632,11 +3639,19 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi = *vsi) } =20 veb->associate_vsi =3D vsi; + veb->associate_pf =3D pf; TAILQ_INIT(&veb->head); - veb->uplink_seid =3D vsi->uplink_seid; + veb->uplink_seid =3D vsi ? vsi->uplink_seid : 0; =20 - ret =3D i40e_aq_add_veb(hw, veb->uplink_seid, vsi->seid, - I40E_DEFAULT_TCMAP, false, false, &veb->seid, NULL); + /* create floating veb if vsi is NULL */ + if (vsi !=3D NULL) { + ret =3D i40e_aq_add_veb(hw, veb->uplink_seid, vsi->seid, + I40E_DEFAULT_TCMAP, false, false, + &veb->seid, NULL); + } else { + ret =3D i40e_aq_add_veb(hw, 0, 0, I40E_DEFAULT_TCMAP, + false, false, &veb->seid, NULL); + } =20 if (ret !=3D I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Add veb failed, aq_err: %d", @@ -3688,12 +3703,22 @@ i= 40e_vsi_release(struct i40e_vsi *vsi) i40e_veb_release(vsi->veb); } =20 + if (vsi->floating_veb) { + TAILQ_FOREACH(vsi_list, &vsi->floating_veb->head, list) { + if (i40e_vsi_release(vsi_list->vsi) !=3D I40E_SUCCESS) + return -1; + TAILQ_REMOVE(&vsi->floating_veb->head, vsi_list, list); + } + i40e_veb_release(vsi->floating_veb); + } + /* Remove all macvlan filters of the VSI */ i40e_vsi_remove_all_macvlan_filter(vsi); TAILQ_FOREACH(f, &vsi->mac_list, next) rte_free(f); =20 - if (vsi->type !=3D I40E_VSI_MAIN) { + if (vsi->type !=3D I40E_VSI_MAIN && + ((vsi->type !=3D I40E_VSI_SRIOV) || !pf->floating)) { /* Remove vsi from parent's sibling list */ if (vsi->parent_vsi =3D=3D NULL || vsi->parent_vsi->veb =3D=3D NULL) { PMD_DRV_LOG(ERR, "VSI's parent VSI is NULL"); @@ -3707,6 +3732,23 @@ i4= 0e_vsi_release(struct i40e_vsi *vsi) if (ret !=3D I40E_SUCCESS) PMD_DRV_LOG(ERR, "Failed to delete element"); } + + if ((vsi->type =3D=3D I40E_VSI_SRIOV) && pf->floating) { + /* Remove vsi from parent's sibling list */ + if (vsi->parent_vsi =3D=3D NULL || + vsi->parent_vsi->floating_veb =3D=3D NULL) { + PMD_DRV_LOG(ERR, "VSI's parent VSI is NULL"); + return I40E_ERR_PARAM; + } + TAILQ_REMOVE(&vsi->parent_vsi->floating_veb->head, + &vsi->sib_vsi_list, list); + + /* Remove all switch element of the VSI */ + ret =3D i40e_aq_delete_element(hw, vsi->seid, NULL); + if (ret !=3D I40E_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to delete element"); + } + i40e_res_pool_free(&pf->qp_pool, vsi->base_queue); =20 if (vsi->type !=3D I40E_VSI_SRIOV) @@ -3837,7 +3879,8 @@ i40e_vsi_setup(struct i40e_pf *pf, struct ether_addr broadcast =3D {.addr_bytes =3D {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; =20 - if (type !=3D I40E_VSI_MAIN && uplink_vsi =3D=3D NULL) { + if (type !=3D I40E_VSI_MAIN && type !=3D I40E_VSI_SRIOV && + uplink_vsi =3D=3D NULL) { PMD_DRV_LOG(ERR, "VSI setup failed, " "VSI link shouldn't be NULL"); return NULL; @@ -3849,11 +3892,28 @@ i40e_vsi_setup(struct i40e_pf *pf, return NULL; } =20 - /* If uplink vsi didn't setup VEB, create one first */ - if (type !=3D I40E_VSI_MAIN && uplink_vsi->veb =3D=3D NULL) { + /* two situations + * 1.type is not MAIN and uplink vsi is not NULL + * If uplink vsi didn't setup VEB, create one first under veb field + * 2.type is SRIOV and the uplink is NULL + * If floating VEB is NULL, create one veb under floating veb field + */ + + if (type !=3D I40E_VSI_MAIN && uplink_vsi !=3D NULL && + uplink_vsi->veb =3D=3D NULL) { uplink_vsi->veb =3D i40e_veb_setup(pf, uplink_vsi); =20 - if (NULL =3D=3D uplink_vsi->veb) { + if (uplink_vsi->veb =3D=3D NULL) { + PMD_DRV_LOG(ERR, "VEB setup failed"); + return NULL; + } + } + + if (type =3D=3D I40E_VSI_SRIOV && uplink_vsi =3D=3D NULL && + pf->main_vsi->floating_veb =3D=3D NULL) { + pf->main_vsi->floating_veb =3D i40e_veb_setup(pf, uplink_vsi); + + if (pf->main_vsi->floating_veb =3D=3D NULL) { PMD_DRV_LOG(ERR, "VEB setup failed"); return NULL; } @@ -4022,7 +4082,11 @@ i40e_vsi_setup(struct i40e_pf *pf, * For other VSI, the uplink_seid equals to uplink VSI's * uplink_seid since they share same VEB */ - vsi->uplink_seid =3D uplink_vsi->uplink_seid; + if (uplink_vsi =3D=3D NULL) { + vsi->uplink_seid =3D pf->main_vsi->floating_veb->seid; + } else { + vsi->uplink_seid =3D uplink_vsi->uplink_seid; + } ctxt.pf_num =3D hw->pf_id; ctxt.vf_num =3D hw->func_caps.vf_base_id + user_param; ctxt.uplink_seid =3D vsi->uplink_seid; @@ -4130,8 +4194,13 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->seid =3D ctxt.seid; vsi->vsi_id =3D ctxt.vsi_number; vsi->sib_vsi_list.vsi =3D vsi; - TAILQ_INSERT_TAIL(&uplink_vsi->veb->head, - &vsi->sib_vsi_list, list); + if (vsi->type =3D=3D I40E_VSI_SRIOV && uplink_vsi =3D=3D NULL) { + TAILQ_INSERT_TAIL(&pf->main_vsi->floating_veb->head, + &vsi->sib_vsi_list, list); + } else { + TAILQ_INSERT_TAIL(&uplink_vsi->veb->head, + &vsi->sib_vsi_list, list); + } } =20 /* MAC/VLAN configuration */ diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.= h index 6edd7dd..3bac60a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -36,6 +36,7 @@ =20 #include #include +#include =20 #define I40E_VLAN_TAG_SIZE 4 =20 @@ -203,6 +204,7 @@ struct i40e_tx_queue; struct i40e_veb { struct i40e_vsi_list_head head; struct i40e_vsi *associate_vsi; /* Associate VSI who owns the VEB */ + struct i40e_pf *associate_pf; /* Associate PF who owns the VEB */ uint16_t seid; /* The seid of VEB itself */ uint16_t uplink_seid; /* The uplink seid of this VEB */ uint16_t stats_idx; @@ -254,6 +256,7 @@ struct i40e_vsi { struct i40e_vsi_list sib_vsi_list; /* sibling vsi list */ struct i40e_vsi *parent_vsi; struct i40e_veb *veb; /* Associated veb, could be null */ + struct i40e_veb *floating_veb; /* Associated floating veb */ bool offset_loaded; enum i40e_vsi_type type; /* VSI types */ uint16_t vlan_num; /* Total VLAN number */ @@ -440,6 +443,7 @@ struct i40e_pf { struct i40e_fc_conf fc_conf; /* Flow control conf */ struct i40e_mirror_rule_list mirror_list; uint16_t nb_mirror_rule; /* The number of mirror rules */ + uint16_t floating; /* The flag to use the floating VEB */ }; =20 enum pending_msg { diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index = cbf4e5b..7ce399b 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -124,6 +124,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw= _reset) { uint32_t val, i; struct i40e_hw *hw =3D I40E_PF_TO_HW(vf->pf); + struct i40e_pf *pf =3D vf->pf; uint16_t vf_id, abs_vf_id, vf_msix_num; int ret; struct i40e_virtchnl_queue_select qsel; @@ -223,9 +224,15 @@ i40e_pf_host= _vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) vf->reset_cnt++; I40E_WRITE_FLUSH(hw); =20 + if (pf->floating =3D=3D true) { + vf->vsi =3D i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV, + NULL, vf->vf_idx); + } else { /* Allocate resource again */ - vf->vsi =3D i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV, - vf->pf->main_vsi, vf->vf_idx); + vf->vsi =3D i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV, + vf->pf->main_vsi, vf->vf_idx); + } + if (vf->vsi =3D=3D NULL) { PMD_DRV_LOG(ERR, "Add vsi failed"); return -EFAULT; -- 2.1.4