DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ido Goshen <Ido@cgstowernetworks.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/pcap: duplicate code consolidation
Date: Wed, 20 Jun 2018 18:06:55 +0000	[thread overview]
Message-ID: <HE1PR0901MB14361345BF89F7E94EC808DED6770@HE1PR0901MB1436.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <b77f7cb2-a73f-030f-c7c4-8cff0f0fb70e@intel.com>

Although there's no functional need for them I considered keeping it for maintainability reasons:
1. Keep the call flow more aligned with pcap (file) that has separated open_rx_pcap()/open_tx_pcap()
2. If in future there'll rise a need for different functionality between rx and tx then it will be a good place to hook it in. 
e.g. if we'll want to force PCAP_D_IN/OUT for rx_iface/tx_iface as you suggested then it can go in those functions 
(I'd like to go back to that direction issue after this fix is done)

-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@intel.com> 
Sent: Wednesday, June 20, 2018 8:41 PM
To: Ido Goshen <Ido@cgstowernetworks.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v2 2/2] net/pcap: duplicate code consolidation

On 6/19/2018 3:37 PM, ido goshen wrote:
> Signed-off-by: ido goshen <ido@cgstowernetworks.com>

<...>

>  /*
> + * Opens a NIC for reading packets from it  */ static inline int 
> +open_rx_iface(const char *key, const char *value, void *extra_args) {
> +	return open_iface(key, value, extra_args); }
> +
> +/*
>   * Opens a NIC for writing packets to it
>   */
>  static int
>  open_tx_iface(const char *key, const char *value, void *extra_args)  
> {
> -	const char *iface = value;
> -	struct pmd_devargs *tx = extra_args;
> -	pcap_t *pcap;
> -
> -	if (tx->num_of_queue >= RTE_PMD_PCAP_MAX_QUEUES)
> -		return -1;
> -	if (open_single_iface(iface, &pcap) < 0)
> -		return -1;
> -	tx->queue[tx->num_of_queue].pcap = pcap;
> -	tx->queue[tx->num_of_queue].name = iface;
> -	tx->queue[tx->num_of_queue].type = key;
> -	tx->num_of_queue++;
> -
> -	return 0;
> +	return open_iface(key, value, extra_args);
>  }
>  
>  static struct rte_vdev_driver pmd_pcap_drv;
> 

Is there a reason to keep open_tx_iface() and open_rx_iface(), they both are wrapper to open_iface().
Why not use open_iface() directly as callback function?

  reply	other threads:[~2018-06-20 18:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 14:37 [dpdk-dev] [PATCH v2 1/2] net/pcap: multiple queues fix ido goshen
2018-06-19 14:37 ` [dpdk-dev] [PATCH v2 2/2] net/pcap: duplicate code consolidation ido goshen
2018-06-20 17:41   ` Ferruh Yigit
2018-06-20 18:06     ` Ido Goshen [this message]
2018-06-20 18:14       ` Ferruh Yigit
2018-06-20 18:22 ` [dpdk-dev] [PATCH v2 1/2] net/pcap: multiple queues fix Ferruh Yigit
2018-06-26 11:06   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

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=HE1PR0901MB14361345BF89F7E94EC808DED6770@HE1PR0901MB1436.eurprd09.prod.outlook.com \
    --to=ido@cgstowernetworks.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).