From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 4AC7B685E for ; Tue, 14 Jun 2016 07:57:40 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 13 Jun 2016 22:57:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,470,1459839600"; d="scan'208";a="827580877" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 13 Jun 2016 22:57:39 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u5E5vb5Y007921; Tue, 14 Jun 2016 13:57:37 +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 u5E5vYwT009466; Tue, 14 Jun 2016 13:57:36 +0800 Received: (from zhetao@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u5E5vYjP009462; Tue, 14 Jun 2016 13:57:34 +0800 From: Zhe Tao To: dev@dpdk.org Cc: zhe.tao@intel.com, jingjing.wu@intel.com Date: Tue, 14 Jun 2016 13:57:14 +0800 Message-Id: <1465883834-9409-4-git-send-email-zhe.tao@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1465883834-9409-1-git-send-email-zhe.tao@intel.com> References: <1465804960-2846-1-git-send-email-zhe.tao@intel.com> <1465883834-9409-1-git-send-email-zhe.tao@intel.com> Subject: [dpdk-dev] [PATCH v11 3/3] i40e: add floating VEB extension support 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: Tue, 14 Jun 2016 05:57:40 -0000 To enable this feature, the user should pass a devargs parameter to the EAL like "-w 84:00.0,enable_floatingVEB=1", and the application will make sure the PMD will use the floating VEB feature for all the VFs created by this PF device. Also you can specifiy which VF need to connect to this floating veb using "floating_bitmap", every bit corresponding to one VF (e.g. bitn for VFn). Like "-w 84:00.0,enable_floatingVEB=1,floating_bitmap=1", means only the VF0 connect to the floating VEB, VF1 connect to the legacy VEB. The current implementation only support one floating VEB and one legacy VEB. VF can connect to floating VEB or legacy VEB according to the configuration. Signed-off-by: Zhe Tao --- doc/guides/nics/i40e.rst | 8 ++++++ drivers/net/i40e/i40e_ethdev.c | 56 ++++++++++++++++++++++++++++++++++++++++-- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_pf.c | 3 ++- 4 files changed, 65 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst index aae78ca..a34d91a 100644 --- a/doc/guides/nics/i40e.rst +++ b/doc/guides/nics/i40e.rst @@ -372,6 +372,14 @@ FVL can support floating VEB feature. To enable this feature, the user should pass a devargs parameter to the EAL like "-w 84:00.0,enable_floatingVEB=1", and the application will make sure the PMD will use the floating VEB feature for all the VFs created by this PF device. +Also you can specify which VF need to connect to this floating veb using +"floating_bitmap", every bit corresponding to one VF (e.g. bitn for VFn). +Like "-w 84:00.0,enable_floatingVEB=1,floating_bitmap=1", means only the VF0 +connect to the floating VEB, VF1 connect to the legacy VEB. + +The current implementation only support one floating VEB and one legacy +VEB. VF can connect to floating VEB or legacy VEB according to the +configuration. The floating VEB means the VEB doesn't has some uplink connection to the outside world, so all the switching belong to this VEB cannot go to outside, the diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 025d498..17aaa08 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -750,6 +750,52 @@ i40e_add_tx_flow_control_drop_filter(struct i40e_pf *pf) " frames from VSIs."); } +static int i40e_check_fbitmap_handler(__rte_unused const char *key, + const char *value, + void *opaque) +{ + errno = 0; + *(uint16_t *)opaque = strtoul(value, NULL, 0); + if (errno) + return -1; + return 0; +} + +static uint16_t i40e_check_fbitmap(struct rte_devargs *devargs, + uint16_t floating) +{ + struct rte_kvargs *kvlist; + const char *floating_bitmap = "floating_bitmap"; + /* default value for vf floating bitmap is -1 */ + uint16_t vf_fbitmap = (uint16_t)-1; + uint16_t new_vf_fbitmap; + + if (floating == false) + return 0; + + if (devargs == NULL) + return vf_fbitmap; + + kvlist = rte_kvargs_parse(devargs->args, NULL); + if (kvlist == NULL) + return vf_fbitmap; + + if (!rte_kvargs_count(kvlist, floating_bitmap)) { + rte_kvargs_free(kvlist); + return vf_fbitmap; + } + /* Floating is enabled when there's key-value: enable_floatingVEB=1 */ + if (rte_kvargs_process(kvlist, floating_bitmap, + i40e_check_fbitmap_handler, + &new_vf_fbitmap) < 0) { + rte_kvargs_free(kvlist); + return vf_fbitmap; + } + rte_kvargs_free(kvlist); + + return new_vf_fbitmap; +} + static int i40e_check_floating_handler(__rte_unused const char *key, const char *value, __rte_unused void *opaque) @@ -884,8 +930,11 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) /* Need the special FW version support floating VEB */ if (hw->aq.fw_maj_ver >= FLOATING_FW_MAJ) { pf->floating = i40e_check_floating(pci_dev->devargs); + pf->vf_fbitmap = i40e_check_fbitmap(pci_dev->devargs, + pf->floating); } else { pf->floating = false; + pf->vf_fbitmap = 0; } /* Clear PXE mode */ i40e_clear_pxe_mode(hw); @@ -3855,6 +3904,7 @@ i40e_vsi_release(struct i40e_vsi *vsi) struct i40e_vsi_list *vsi_list; int ret; struct i40e_mac_filter *f; + uint16_t user_param = vsi->user_param; if (!vsi) return I40E_SUCCESS; @@ -3886,7 +3936,8 @@ i40e_vsi_release(struct i40e_vsi *vsi) rte_free(f); if (vsi->type != I40E_VSI_MAIN && - ((vsi->type != I40E_VSI_SRIOV) || !pf->floating)) { + ((vsi->type != I40E_VSI_SRIOV) || + !(pf->vf_fbitmap && 1 << user_param))) { /* Remove vsi from parent's sibling list */ if (vsi->parent_vsi == NULL || vsi->parent_vsi->veb == NULL) { PMD_DRV_LOG(ERR, "VSI's parent VSI is NULL"); @@ -3901,7 +3952,8 @@ i40e_vsi_release(struct i40e_vsi *vsi) PMD_DRV_LOG(ERR, "Failed to delete element"); } - if ((vsi->type == I40E_VSI_SRIOV) && pf->floating) { + if ((vsi->type == I40E_VSI_SRIOV) && + (pf->vf_fbitmap && 1 << user_param)) { /* Remove vsi from parent's sibling list */ if (vsi->parent_vsi == NULL || vsi->parent_vsi->floating_veb == NULL) { diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index deef0ce..39c3664 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -458,6 +458,7 @@ struct i40e_pf { 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 */ + uint16_t vf_fbitmap; /* The floating enable flag for the specific VF */ }; enum pending_msg { diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 9adfad2..312e1f8 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -224,7 +224,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) vf->reset_cnt++; I40E_WRITE_FLUSH(hw); - if (pf->floating == true) { + if (pf->floating == true && + (pf->vf_fbitmap & 1 << vf_id)) { vf->vsi = i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV, NULL, vf->vf_idx); } else { -- 2.1.4