From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E2E65559A for ; Fri, 26 Aug 2016 13:19:56 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 26 Aug 2016 04:19:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,580,1464678000"; d="scan'208";a="1031638990" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 26 Aug 2016 04:19:55 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u7QBJsqo030300 for ; Fri, 26 Aug 2016 12:19:54 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u7QBJsdl008384 for ; Fri, 26 Aug 2016 12:19:54 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u7QBJsTM008380 for dev@dpdk.org; Fri, 26 Aug 2016 12:19:54 +0100 X-Authentication-Warning: sivswdev02.ir.intel.com: fyigit set sender to ferruh.yigit@intel.com using -f From: Ferruh Yigit To: dev@dpdk.org Date: Fri, 26 Aug 2016 12:17:41 +0100 Message-Id: <1472210279-8286-5-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1472210279-8286-1-git-send-email-ferruh.yigit@intel.com> References: <1472210279-8286-1-git-send-email-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH 04/22] net/pcap: add checks for max queue number 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: Fri, 26 Aug 2016 11:19:57 -0000 Number of queues defined by devargs, a check added to be sure this number is not bigger than configured queue length. Signed-off-by: Ferruh Yigit --- drivers/net/pcap/rte_eth_pcap.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 3493897..8b1d366 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1012,12 +1012,21 @@ rte_pmd_pcap_devinit(const char *name, const char *params) * We check whether we want to open a RX stream from a real NIC or a * pcap file */ - if ((pcaps.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_RX_PCAP_ARG))) { + pcaps.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_RX_PCAP_ARG); + + if (pcaps.num_of_queue) { + if (pcaps.num_of_queue > RTE_PMD_PCAP_MAX_QUEUES) + pcaps.num_of_queue = RTE_PMD_PCAP_MAX_QUEUES; + ret = rte_kvargs_process(kvlist, ETH_PCAP_RX_PCAP_ARG, &open_rx_pcap, &pcaps); } else { pcaps.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_RX_IFACE_ARG); + + if (pcaps.num_of_queue > RTE_PMD_PCAP_MAX_QUEUES) + pcaps.num_of_queue = RTE_PMD_PCAP_MAX_QUEUES; + ret = rte_kvargs_process(kvlist, ETH_PCAP_RX_IFACE_ARG, &open_rx_iface, &pcaps); } @@ -1029,14 +1038,22 @@ rte_pmd_pcap_devinit(const char *name, const char *params) * We check whether we want to open a TX stream to a real NIC or a * pcap file */ - if ((dumpers.num_of_queue = rte_kvargs_count(kvlist, - ETH_PCAP_TX_PCAP_ARG))) { + dumpers.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_TX_PCAP_ARG); + + if (dumpers.num_of_queue) { + if (dumpers.num_of_queue > RTE_PMD_PCAP_MAX_QUEUES) + dumpers.num_of_queue = RTE_PMD_PCAP_MAX_QUEUES; + ret = rte_kvargs_process(kvlist, ETH_PCAP_TX_PCAP_ARG, &open_tx_pcap, &dumpers); using_dumpers = 1; } else { dumpers.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_TX_IFACE_ARG); + + if (dumpers.num_of_queue > RTE_PMD_PCAP_MAX_QUEUES) + dumpers.num_of_queue = RTE_PMD_PCAP_MAX_QUEUES; + ret = rte_kvargs_process(kvlist, ETH_PCAP_TX_IFACE_ARG, &open_tx_iface, &dumpers); } -- 2.7.4