From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Pattan, Reshma" Subject: Re: [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support Date: Tue, 31 May 2016 14:55:07 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F010454A0@IRSMSX109.ger.corp.intel.com> References: <1463503030-10318-1-git-send-email-reshma.pattan@intel.com> <1464039512-2683-1-git-send-email-reshma.pattan@intel.com> <1464039512-2683-6-git-send-email-reshma.pattan@intel.com> <2601191342CEEE43887BDE71AB97725836B67FBC@irsmsx105.ger.corp.intel.com> <3AEA2BF9852C6F48A459DA490692831F01044D7E@IRSMSX109.ger.corp.intel.com> <2601191342CEEE43887BDE71AB97725836B68132@irsmsx105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: "Ananyev, Konstantin" , "dev@dpdk.org" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id F08FD2E81 for ; Tue, 31 May 2016 16:55:28 +0200 (CEST) In-Reply-To: <2601191342CEEE43887BDE71AB97725836B68132@irsmsx105.ger.corp.intel.com> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Ananyev, Konstantin > Sent: Friday, May 27, 2016 4:26 PM > To: Pattan, Reshma ; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new library = for > packet capturing support >=20 >=20 >=20 > > -----Original Message----- > > From: Pattan, Reshma > > Sent: Friday, May 27, 2016 3:55 PM > > To: Ananyev, Konstantin; dev@dpdk.org > > Cc: Pattan, Reshma > > Subject: RE: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new > > library for packet capturing support > > > > > > > > > -----Original Message----- > > > From: Ananyev, Konstantin > > > Sent: Friday, May 27, 2016 2:39 PM > > > To: Pattan, Reshma ; dev@dpdk.org > > > Cc: Pattan, Reshma > > > Subject: RE: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new > > > library for packet capturing support > > > > > > Hi Reshma, > > > > > > +static int > > > > +pdump_regitser_callbacks(uint32_t dir, uint16_t end_q, > > > > + uint8_t port, uint16_t queue, > > > > + struct rte_ring *ring, struct rte_mempool *mp, > > > > + uint16_t operation) > > > > +{ > > > > + > > > > + uint16_t qid; > > > > + struct pdump_rxtx_cbs *cbs =3D NULL; > > > > + > > > > + qid =3D (queue =3D=3D RTE_PDUMP_ALL_QUEUES) ? 0 : queue; > > > > + for (; qid < end_q; qid++) { > > > > + if ((dir & RTE_PDUMP_FLAG_RX) !=3D 0) > > > > + cbs =3D &rx_cbs[port][qid]; > > > > + if ((dir & RTE_PDUMP_FLAG_TX) !=3D 0) > > > > + cbs =3D &tx_cbs[port][qid]; > > > > > > In case you have dir =3D=3D (RTE_PDUMP_FLAG_RX | RTE_PDUMP_FLAG_TX) > > > you'll overwrite your rx_cbs pointer with tx_cbs pointer. > > > I suppose you need 2 local vars: cbs_rx and cbs_tx here. > > > Again probably worth to have 2 helper functions: > > > pdump_regitser_rx_callback() and pdump_regitser_tx_callback() and > > > call them from that one. > > > Or you'll never invoke that function with dir =3D=3D(RTE_PDUMP_FLAG_R= X | > > > RTE_PDUMP_FLAG_TX)? > > > If so, it porbably worth to put it into comments, though if it would > > > be me, I still think it would be good to split it in a way I mentione= d above. > > > > > > > Yes, I never invoke the function with dir =3D=3D(RTE_PDUMP_FLAG_RX | > RTE_PDUMP_FLAG_TX). >=20 > Ok, then at least probably comment it somehow. > Though I still think 2 different variables (and might be functions) would= be > better. >=20 > > Ok, I will add a comment. Thanks, Reshma