From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D08071B2E0 for ; Mon, 6 Nov 2017 23:58:00 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2017 14:57:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,354,1505804400"; d="scan'208";a="918264208" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.241.225.127]) ([10.241.225.127]) by FMSMGA003.fm.intel.com with ESMTP; 06 Nov 2017 14:57:59 -0800 To: Ilya Matveychikov , dev@dpdk.org References: From: Ferruh Yigit Message-ID: <4c209d9c-3109-8f75-c866-ef6bddd5dae8@intel.com> Date: Mon, 6 Nov 2017 14:57:59 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] net/pcap: remove single interface constraint (v2) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 22:58:01 -0000 On 11/5/2017 2:15 AM, Ilya Matveychikov wrote: > Hello folks, > > This patch removes single interface constraint from the libpcap-based PMD. > The problem it solves is to allow PCAP device consists of more than single > device: > > # testpmd --vdev net_pcap0,iface=vethA,iface=vethB,iface=vethC and so.. > > I found the issue when performed RSS emulation based on PCAP PMD. For my > task I had to create multi-queue PCAP device based on a number of veth > devices which in turn was combined in bonding device. Hi Ilya, Overall patch looks good. But patch does two things, 1- remove "single_iface" variable and replace it with "internals->tx_queue[0].pcap == internals->rx_queue[0].pcap" checks. perhaps variable name is misleading but it is to say Rx and Tx are not different, but single interface, which is still valid. 2- Add multi-queue support. For this case, replace hardcoded queue 0 to variable length. Would you mind keeping "single_iface" as it is but add multi-queue support? Also, multi-queue support for other types seems broken, if you have time can you please send a patch to fix them as well, see below [1] for detail. Thanks, ferruh > > Signed-off-by: Ilya V. Matveychikov <...> > @@ -737,9 +744,14 @@ open_rx_tx_iface(const char *key, const char *value, void *extra_args) > if (open_single_iface(iface, &pcap) < 0) > return -1; > > - tx->queue[0].pcap = pcap; > - tx->queue[0].name = iface; > - tx->queue[0].type = key; > + for (i = 0; i < tx->num_of_queue; i++) { > + if (tx->queue[i].pcap == NULL) { [1]: This check is missing for open_rx_iface, open_tx_iface, open_rx_pcap and open_tx_pcap. It is possible to implement as: for (i = 0; i < rx->num_of_queue; i++) { if (rx->queue[i].name) continue; break; } > + tx->queue[i].pcap = pcap; > + tx->queue[i].name = iface; > + tx->queue[i].type = key; > + break; > + } > + } > > return 0; > } <...> > @@ -953,19 +960,21 @@ pmd_pcap_probe(struct rte_vdev_device *dev) > * If iface argument is passed we open the NICs and use them for > * reading / writing > */ > - if (rte_kvargs_count(kvlist, ETH_PCAP_IFACE_ARG) == 1) { > + if (rte_kvargs_count(kvlist, ETH_PCAP_IFACE_ARG)) { > + int i, queues = rte_kvargs_count(kvlist, ETH_PCAP_IFACE_ARG); Can prevent duplicate call of rte_kvargs_count() by moving queues above if. <...>