[dpdk-dev] [PATCH v2 2/2] net/pcap: duplicate code consolidation
Ferruh Yigit
ferruh.yigit at intel.com
Wed Jun 20 19:41:00 CEST 2018
On 6/19/2018 3:37 PM, ido goshen wrote:
> Signed-off-by: ido goshen <ido at 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?
More information about the dev
mailing list