From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2AD67B66B for ; Tue, 17 Feb 2015 17:34:12 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 17 Feb 2015 08:30:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,595,1418112000"; d="scan'208";a="653319791" Received: from unknown (HELO Sent) ([10.217.248.233]) by orsmga001.jf.intel.com with SMTP; 17 Feb 2015 08:34:06 -0800 Received: by Sent (sSMTP sendmail emulation); Tue, 17 Feb 2015 17:28:34 +0100 From: Pawel Wodkowski To: dev@dpdk.org Date: Tue, 17 Feb 2015 17:19:46 +0100 Message-Id: <1424189986-26219-3-git-send-email-pawelx.wodkowski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424189986-26219-1-git-send-email-pawelx.wodkowski@intel.com> References: <1424187473-25853-1-git-send-email-pawelx.wodkowski@intel.com> <1424189986-26219-1-git-send-email-pawelx.wodkowski@intel.com> Subject: [dpdk-dev] [PATCH v3 2/2] tespmd: fix DCB in SRIOV mode 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, 17 Feb 2015 16:34:13 -0000 This patch incorporate fixes to support DCB in SRIOV mode for testpmd. Signed-off-by: Pawel Wodkowski --- app/test-pmd/cmdline.c | 4 ++-- app/test-pmd/testpmd.c | 39 +++++++++++++++++++++++++++++---------- app/test-pmd/testpmd.h | 10 ---------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 4beb404..eb9877e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1942,9 +1942,9 @@ cmd_config_dcb_parsed(void *parsed_result, /* DCB in VT mode */ if (!strncmp(res->vt_en, "on",2)) - dcb_conf.dcb_mode = DCB_VT_ENABLED; + dcb_conf.vt_en = 1; else - dcb_conf.dcb_mode = DCB_ENABLED; + dcb_conf.vt_en = 0; if (!strncmp(res->pfc_en, "on",2)) { dcb_conf.pfc_en = 1; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 773b8af..9b12c25 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1743,7 +1743,8 @@ const uint16_t vlan_tags[] = { }; static int -get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf) +get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf, + uint16_t sriov) { uint8_t i; @@ -1751,7 +1752,7 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf) * Builds up the correct configuration for dcb+vt based on the vlan tags array * given above, and the number of traffic classes available for use. */ - if (dcb_conf->dcb_mode == DCB_VT_ENABLED) { + if (dcb_conf->vt_en == 1) { struct rte_eth_vmdq_dcb_conf vmdq_rx_conf; struct rte_eth_vmdq_dcb_tx_conf vmdq_tx_conf; @@ -1768,9 +1769,17 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf) vmdq_rx_conf.pool_map[i].vlan_id = vlan_tags[ i ]; vmdq_rx_conf.pool_map[i].pools = 1 << (i % vmdq_rx_conf.nb_queue_pools); } - for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) { - vmdq_rx_conf.dcb_queue[i] = i; - vmdq_tx_conf.dcb_queue[i] = i; + + if (sriov == 0) { + for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) { + vmdq_rx_conf.dcb_queue[i] = i; + vmdq_tx_conf.dcb_queue[i] = i; + } + } else { + for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) { + vmdq_rx_conf.dcb_queue[i] = i % dcb_conf->num_tcs; + vmdq_tx_conf.dcb_queue[i] = i % dcb_conf->num_tcs; + } } /*set DCB mode of RX and TX of multiple queues*/ @@ -1828,22 +1837,32 @@ init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf) uint16_t nb_vlan; uint16_t i; - /* rxq and txq configuration in dcb mode */ - nb_rxq = 128; - nb_txq = 128; rx_free_thresh = 64; + rte_port = &ports[pid]; memset(&port_conf,0,sizeof(struct rte_eth_conf)); /* Enter DCB configuration status */ dcb_config = 1; nb_vlan = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]); /*set configuration of DCB in vt mode and DCB in non-vt mode*/ - retval = get_eth_dcb_conf(&port_conf, dcb_conf); + retval = get_eth_dcb_conf(&port_conf, dcb_conf, rte_port->dev_info.max_vfs); + + /* rxq and txq configuration in dcb mode */ + nb_rxq = rte_port->dev_info.max_rx_queues; + nb_txq = rte_port->dev_info.max_tx_queues; + + if (rte_port->dev_info.max_vfs) { + if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) + nb_rxq /= port_conf.rx_adv_conf.vmdq_dcb_conf.nb_queue_pools; + + if (port_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB) + nb_txq /= port_conf.tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools; + } + if (retval < 0) return retval; - rte_port = &ports[pid]; memcpy(&rte_port->dev_conf, &port_conf,sizeof(struct rte_eth_conf)); rte_port->rx_conf.rx_thresh = rx_thresh; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 8f5e6c7..695e893 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -227,20 +227,10 @@ struct fwd_config { portid_t nb_fwd_ports; /**< Nb. of ports involved. */ }; -/** - * DCB mode enable - */ -enum dcb_mode_enable -{ - DCB_VT_ENABLED, - DCB_ENABLED -}; - /* * DCB general config info */ struct dcb_config { - enum dcb_mode_enable dcb_mode; uint8_t vt_en; enum rte_eth_nb_tcs num_tcs; uint8_t pfc_en; -- 1.9.1