From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v2 2/2] net/pcap: duplicate code consolidation Date: Wed, 20 Jun 2018 19:14:48 +0100 Message-ID: <6bce6701-d15e-2a77-746a-eb5624234d47@intel.com> References: <1529419046-95906-1-git-send-email-ido@cgstowernetworks.com> <1529419046-95906-2-git-send-email-ido@cgstowernetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" To: Ido Goshen Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 55DF11B3A6 for ; Wed, 20 Jun 2018 20:14:50 +0200 (CEST) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 6/20/2018 7:06 PM, Ido Goshen wrote: > 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) OK. Sounds reasonable. > > -----Original Message----- > From: Ferruh Yigit > Sent: Wednesday, June 20, 2018 8:41 PM > To: Ido Goshen > 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 > > <...> > >> /* >> + * 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? >