From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 90C702C5D for ; Tue, 22 Mar 2016 09:09:15 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 22 Mar 2016 01:08:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,376,1455004800"; d="scan'208";a="929210780" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 22 Mar 2016 01:08:48 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u2M88k6K001021; Tue, 22 Mar 2016 16:08:46 +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 u2M88g14001844; Tue, 22 Mar 2016 16:08:44 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u2M88gN9001840; Tue, 22 Mar 2016 16:08:42 +0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Tue, 22 Mar 2016 16:08:41 +0800 Message-Id: <1458634121-1808-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] ixgbe: add TX queue number check 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, 22 Mar 2016 08:09:16 -0000 Ixgbe supports at most 128 TX queues. But in none VT nor DCB mode the queues 64 ~ 127 should not be used. Ixgbe doesn't do any check about that. If a queue larger than 64 is used, the TX packets will be dropped silently. It's hard to debug. This check is added to forbid using queue number larger than 64 during device configuration, so the user can know the problem as early as possible. Signed-off-by: Wenzhuo Lu Reported-by: Antonio Fischetti --- drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++++++- drivers/net/ixgbe/ixgbe_ethdev.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 5371720..dd6d00e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1862,7 +1862,7 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev) { struct rte_eth_conf *dev_conf = &dev->data->dev_conf; uint16_t nb_rx_q = dev->data->nb_rx_queues; - uint16_t nb_tx_q = dev->data->nb_rx_queues; + uint16_t nb_tx_q = dev->data->nb_tx_queues; if (RTE_ETH_DEV_SRIOV(dev).active != 0) { /* check multi-queue mode */ @@ -2002,6 +2002,15 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev) return -EINVAL; } } + + if (dev_conf->txmode.mq_mode == ETH_MQ_TX_NONE) { + if (nb_tx_q > IXGBE_NONE_VT_DCB_MAX_TXQ_NB) { + PMD_INIT_LOG(ERR, + "None VT nor DCB, nb_tx_q > %d.", + IXGBE_NONE_VT_DCB_MAX_TXQ_NB); + return -EINVAL; + } + } } return 0; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 5c3aa16..50ee73f 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -61,6 +61,7 @@ #define IXGBE_MAX_RX_QUEUE_NUM 128 #define IXGBE_VMDQ_DCB_NB_QUEUES IXGBE_MAX_RX_QUEUE_NUM #define IXGBE_DCB_NB_QUEUES IXGBE_MAX_RX_QUEUE_NUM +#define IXGBE_NONE_VT_DCB_MAX_TXQ_NB 64 #ifndef NBBY #define NBBY 8 /* number of bits in a byte */ -- 1.9.3