[dpdk-dev] net/pcap: remove single interface constraint (v2)

Ferruh Yigit ferruh.yigit at intel.com
Mon Nov 6 23:57:59 CET 2017


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 <matvejchikov at gmail.com>

<...>

> @@ -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;

  <this part is same old code>

  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.

<...>



More information about the dev mailing list