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 D56D15A0A for ; Fri, 26 Aug 2016 13:20:50 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 26 Aug 2016 04:20:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,580,1464678000"; d="scan'208";a="1047618876" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 26 Aug 2016 04:20:49 -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 u7QBKmp5030650 for ; Fri, 26 Aug 2016 12:20:48 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u7QBKmY5008787 for ; Fri, 26 Aug 2016 12:20:48 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u7QBKmlw008783 for dev@dpdk.org; Fri, 26 Aug 2016 12:20:48 +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:44 +0100 Message-Id: <1472210279-8286-8-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 07/22] net/pcap: don't carry kvlist argument 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:20:51 -0000 Don't carry kvlist argument into sub function and used it, use kvlist argument in upper level of call stack. Signed-off-by: Ferruh Yigit --- drivers/net/pcap/rte_eth_pcap.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index a56b8d9..0135266 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -789,18 +789,10 @@ open_single_iface(const char *iface, pcap_t **pcap) static int rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues, const unsigned nb_tx_queues, struct pmd_internals **internals, - struct rte_eth_dev **eth_dev, struct rte_kvargs *kvlist) + struct rte_eth_dev **eth_dev) { struct rte_eth_dev_data *data = NULL; unsigned int numa_node = rte_socket_id(); - unsigned k_idx; - struct rte_kvargs_pair *pair = NULL; - - for (k_idx = 0; k_idx < kvlist->count; k_idx++) { - pair = &kvlist->pairs[k_idx]; - if (strstr(pair->key, ETH_PCAP_IFACE_ARG) != NULL) - break; - } RTE_LOG(INFO, PMD, "Creating pcap-backed ethdev on numa socket %u\n", numa_node); @@ -835,11 +827,6 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues, /* NOTE: we'll replace the data element, of originally allocated eth_dev * so the rings are local per-process */ - if (pair == NULL) - (*internals)->if_index = 0; - else - (*internals)->if_index = if_nametoindex(pair->value); - data->dev_private = *internals; data->port_id = (*eth_dev)->data->port_id; snprintf(data->name, sizeof(data->name), "%s", (*eth_dev)->data->name); @@ -873,6 +860,8 @@ rte_eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues, const unsigned nb_tx_queues, struct rte_kvargs *kvlist, struct pmd_internals **internals, struct rte_eth_dev **eth_dev) { + struct rte_kvargs_pair *pair = NULL; + unsigned k_idx; unsigned i; /* do some parameter checking */ @@ -882,7 +871,7 @@ rte_eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues, return -1; if (rte_pmd_init_internals(name, nb_rx_queues, nb_tx_queues, internals, - eth_dev, kvlist) < 0) + eth_dev) < 0) return -1; for (i = 0; i < nb_rx_queues; i++) { @@ -904,6 +893,17 @@ rte_eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues, tx_queues->queue[i].type); } + for (k_idx = 0; k_idx < kvlist->count; k_idx++) { + pair = &kvlist->pairs[k_idx]; + if (strstr(pair->key, ETH_PCAP_IFACE_ARG) != NULL) + break; + } + + if (pair == NULL) + (*internals)->if_index = 0; + else + (*internals)->if_index = if_nametoindex(pair->value); + return 0; } -- 2.7.4