DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ido Goshen <Ido@cgstowernetworks.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/pcap: support pcap files and ifaces mix
Date: Tue, 26 Jun 2018 10:05:09 +0100	[thread overview]
Message-ID: <305b6010-833f-ec59-1799-655d9522dd9a@intel.com> (raw)
In-Reply-To: <AM5PR0901MB142793CD694E80E332D21CF0D6750@AM5PR0901MB1427.eurprd09.prod.outlook.com>

On 6/22/2018 8:15 AM, Ido Goshen wrote:
> 
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Thursday, June 21, 2018 3:51 PM
>> To: Ido Goshen <Ido@cgstowernetworks.com>
>> Cc: dev@dpdk.org
>> Subject: Re: [PATCH v2 3/3] net/pcap: support pcap files and ifaces mix
>>
>> On 6/21/2018 1:24 PM, ido goshen wrote:
>>> Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
>>>
>>> Signed-off-by: ido goshen <ido@cgstowernetworks.com>
>>
>> <...>
>>
>>> +static uint16_t
>>> +eth_pcap_tx_mux(void *queue, struct rte_mbuf **bufs, uint16_t
>>> +nb_pkts) {
>>> +	struct pcap_tx_queue *tx_queue = queue;
>>> +	if (tx_queue->dumper)
>>> +		return eth_pcap_tx_dumper(queue, bufs, nb_pkts);
>>> +	else
>>> +		return eth_pcap_tx(queue, bufs, nb_pkts); }
>>> +
>>>  /*
>>>   * pcap_open_live wrapper function
>>>   */
>>> @@ -773,6 +783,31 @@ struct pmd_devargs {
>>>  	return open_iface(key, value, extra_args);  }
>>>
>>> +static int
>>> +open_pcap_rx_mux(const char *key, const char *value, void
>>> +*extra_args) {
>>> +	struct pmd_devargs *pcaps = extra_args;
>>
>> Do we need this assignment? Why not pass extra_args directly?
> 
> [idog] Correct, it can be passed directly
> other option is to leave the assignment here and pass strong type to the internal open_rx_pcap/iface 
> instead of passing it as void*
> Any preference?
> 
>>
>>> +
>>> +	if (strcmp(key, ETH_PCAP_RX_PCAP_ARG) == 0)
>>> +		return open_rx_pcap(key, value, pcaps);
>>> +	if (strcmp(key, ETH_PCAP_RX_IFACE_ARG) == 0)
>>> +		return open_rx_iface(key, value, pcaps);
>>> +	return 0;
>>> +}
>>> +
>>> +static int
>>> +open_pcap_tx_mux(const char *key, const char *value, void
>>> +*extra_args) {
>>> +	struct pmd_devargs *dumpers = extra_args;
>>
>> Do we need this assignment? Why not pass extra_args directly?
>>
>>> +
>>> +	if (strcmp(key, ETH_PCAP_TX_PCAP_ARG) == 0)
>>> +		return open_tx_pcap(key, value, dumpers);
>>> +	if (strcmp(key, ETH_PCAP_TX_IFACE_ARG) == 0)
>>> +		return open_tx_iface(key, value, dumpers);
>>> +	return 0;
>>> +}
>>> +
>>> +
>>>  static struct rte_vdev_driver pmd_pcap_drv;
>>>
>>>  static int
>>> @@ -873,8 +908,7 @@ struct pmd_devargs {  eth_from_pcaps(struct
>>> rte_vdev_device *vdev,
>>>  		struct pmd_devargs *rx_queues, const unsigned int
>> nb_rx_queues,
>>>  		struct pmd_devargs *tx_queues, const unsigned int
>> nb_tx_queues,
>>> -		struct rte_kvargs *kvlist, int single_iface,
>>> -		unsigned int using_dumpers)
>>> +		struct rte_kvargs *kvlist, int single_iface)
>>>  {
>>>  	struct pmd_internals *internals = NULL;
>>>  	struct rte_eth_dev *eth_dev = NULL;
>>> @@ -891,10 +925,7 @@ struct pmd_devargs {
>>>
>>>  	eth_dev->rx_pkt_burst = eth_pcap_rx;
>>>
>>> -	if (using_dumpers)
>>> -		eth_dev->tx_pkt_burst = eth_pcap_tx_dumper;
>>> -	else
>>> -		eth_dev->tx_pkt_burst = eth_pcap_tx;
>>> +	eth_dev->tx_pkt_burst = eth_pcap_tx_mux;
>>
>> We shouldn't introduce an extra check in data path. Instead of checking "if
>> (tx_queue->dumper)" for _each_ packet, we should check it here once and
>> assign proper burst function.
> 
> [idog] I don't see how it can be avoided 
> rte_eth_dev has only single tx_pkt_burst
> but now we suggest to support 2 different queue types in a single device
> each type requires different end functionality pcap_dump or pcap_sendpkt
> btw - it's only once per burst 

Right, we can't avoid.

This change is removing a limitation in the PMD but with a side effect, I missed
side effect part.
I am for rejecting the patch until this feature explicitly requested for a
practical usecase, to be sure we are not introducing the side effect a feature
that is not really needed.

Thanks for your effort.

      reply	other threads:[~2018-06-26  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 12:24 ido goshen
2018-06-21 12:51 ` Ferruh Yigit
2018-06-22  7:15   ` Ido Goshen
2018-06-26  9:05     ` Ferruh Yigit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=305b6010-833f-ec59-1799-655d9522dd9a@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=Ido@cgstowernetworks.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).