From patchwork Fri Aug 26 11:17:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 15360 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 629365591; Fri, 26 Aug 2016 13:20:28 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 605285583 for ; Fri, 26 Aug 2016 13:20:26 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 26 Aug 2016 04:20:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,580,1464678000"; d="scan'208";a="1466876" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga005.fm.intel.com with ESMTP; 26 Aug 2016 04:20:14 -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 u7QBKDgQ030437 for ; Fri, 26 Aug 2016 12:20:13 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u7QBKD71008403 for ; Fri, 26 Aug 2016 12:20:13 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u7QBKDVc008397 for dev@dpdk.org; Fri, 26 Aug 2016 12:20:13 +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:42 +0100 Message-Id: <1472210279-8286-6-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 05/22] net/pcap: update function to reuse it 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_eth_from_pcaps and rte_eth_from_pcaps_n_dumpers functions are very close, updated rte_eth_from_pcaps function and reused. No functional update. Signed-off-by: Ferruh Yigit --- drivers/net/pcap/rte_eth_pcap.c | 58 +++++++++-------------------------------- 1 file changed, 13 insertions(+), 45 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 8b1d366..a644928 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -910,43 +910,11 @@ rte_eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues, } static int -rte_eth_from_pcaps_n_dumpers(const char *name, - struct pmd_devargs *rx_queues, - const unsigned nb_rx_queues, - struct pmd_devargs *tx_queues, - const unsigned nb_tx_queues, - const unsigned numa_node, - struct rte_kvargs *kvlist) -{ - struct pmd_internals *internals = NULL; - struct rte_eth_dev *eth_dev = NULL; - int ret; - - ret = rte_eth_from_pcaps_common(name, rx_queues, nb_rx_queues, - tx_queues, nb_tx_queues, numa_node, kvlist, - &internals, ð_dev); - - if (ret < 0) - return ret; - - /* using multiple pcaps/interfaces */ - internals->single_iface = 0; - - eth_dev->rx_pkt_burst = eth_pcap_rx; - eth_dev->tx_pkt_burst = eth_pcap_tx_dumper; - - return 0; -} - -static int -rte_eth_from_pcaps(const char *name, - struct pmd_devargs *rx_queues, - const unsigned nb_rx_queues, - struct pmd_devargs *tx_queues, - const unsigned nb_tx_queues, - const unsigned numa_node, - struct rte_kvargs *kvlist, - int single_iface) +rte_eth_from_pcaps(const char *name, struct pmd_devargs *rx_queues, + const unsigned nb_rx_queues, struct pmd_devargs *tx_queues, + const unsigned nb_tx_queues, const unsigned numa_node, + struct rte_kvargs *kvlist, int single_iface, + unsigned int using_dumpers) { struct pmd_internals *internals = NULL; struct rte_eth_dev *eth_dev = NULL; @@ -963,7 +931,11 @@ rte_eth_from_pcaps(const char *name, internals->single_iface = single_iface; eth_dev->rx_pkt_burst = eth_pcap_rx; - eth_dev->tx_pkt_burst = eth_pcap_tx; + + if (using_dumpers) + eth_dev->tx_pkt_burst = eth_pcap_tx_dumper; + else + eth_dev->tx_pkt_burst = eth_pcap_tx; return 0; } @@ -1004,7 +976,7 @@ rte_pmd_pcap_devinit(const char *name, const char *params) dumpers.queue[0].name = pcaps.queue[0].name; dumpers.queue[0].type = pcaps.queue[0].type; ret = rte_eth_from_pcaps(name, &pcaps, 1, &dumpers, 1, - numa_node, kvlist, 1); + numa_node, kvlist, 1, using_dumpers); goto free_kvlist; } @@ -1061,12 +1033,8 @@ rte_pmd_pcap_devinit(const char *name, const char *params) if (ret < 0) goto free_kvlist; - if (using_dumpers) - ret = rte_eth_from_pcaps_n_dumpers(name, &pcaps, pcaps.num_of_queue, - &dumpers, dumpers.num_of_queue, numa_node, kvlist); - else - ret = rte_eth_from_pcaps(name, &pcaps, pcaps.num_of_queue, &dumpers, - dumpers.num_of_queue, numa_node, kvlist, 0); + ret = rte_eth_from_pcaps(name, &pcaps, pcaps.num_of_queue, &dumpers, + dumpers.num_of_queue, numa_node, kvlist, 0, using_dumpers); free_kvlist: rte_kvargs_free(kvlist);