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 ECBC75A7A for ; Mon, 19 Jan 2015 14:22:08 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 19 Jan 2015 05:20:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,427,1418112000"; d="scan'208";a="639315415" Received: from unknown (HELO Sent) ([10.217.248.233]) by orsmga001.jf.intel.com with SMTP; 19 Jan 2015 05:20:28 -0800 Received: by Sent (sSMTP sendmail emulation); Mon, 19 Jan 2015 14:12:27 +0100 From: Pawel Wodkowski To: dev@dpdk.org Date: Mon, 19 Jan 2015 14:02:29 +0100 Message-Id: <1421672551-11652-3-git-send-email-pawelx.wodkowski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421672551-11652-1-git-send-email-pawelx.wodkowski@intel.com> References: <1421077843-8492-1-git-send-email-michalx.k.jastrzebski@intel.com> <1421672551-11652-1-git-send-email-pawelx.wodkowski@intel.com> Subject: [dpdk-dev] [PATCH v2 2/4] ethdev: prevent changing of nb_q_per_pool in rte_eth_dev_check_mq_mode() 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: Mon, 19 Jan 2015 13:22:09 -0000 If SRIOV is used and device configuration does not use MQ the RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool is set to 1 in rte_eth_dev_check_mq_mode(). This is bad becouse of two reasons: 1. Port reconfiguration from non-MQ mode to MQ mode is impossible 2. Confguring RX and TX side in different way is impossible. This patch fix first issue by not changing RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool and second by comparing nb_q_per_pool separately for RX (nb_rx_q_per_pool) and for TX (nb_tx_q_per_pool). Signed-off-by: Pawel Wodkowski --- lib/librte_ether/rte_ethdev.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 62d7f6e..85385f8 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -548,6 +548,9 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, return (-EINVAL); } + uint16_t nb_rx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool; + uint16_t nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool; + switch (dev_conf->rxmode.mq_mode) { case ETH_MQ_RX_VMDQ_DCB: case ETH_MQ_RX_VMDQ_DCB_RSS: @@ -580,8 +583,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */ /* if nothing mq mode configure, use default scheme */ dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_ONLY; - if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1) - RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1; + if (nb_rx_q_per_pool > 1) + nb_rx_q_per_pool = 1; break; } @@ -596,15 +599,16 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */ /* if nothing mq mode configure, use default scheme */ dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY; + if (nb_tx_q_per_pool > 1) + nb_tx_q_per_pool = 1; break; } /* check valid queue number */ - if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) || - (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) { + if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q > nb_tx_q_per_pool) { PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, " - "queue number must less equal to %d\n", - port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool); + "rx/tx queue number must less or equal to %d/%d\n", + port_id, nb_rx_q_per_pool, nb_tx_q_per_pool); return (-EINVAL); } } else { -- 1.7.9.5