From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ananyev, Konstantin" Subject: Re: [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support Date: Fri, 27 May 2016 15:25:30 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B68132@irsmsx105.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: "Pattan, Reshma" , "dev@dpdk.org" Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 2275E2BB3 for ; Fri, 27 May 2016 17:25:32 +0200 (CEST) In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F01044D7E@IRSMSX109.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: 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 >=20 >=20 >=20 > > -----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 librar= y for > > packet capturing support > > > > Hi Reshma, >=20 > > > +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_RX = | > > 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 mentioned above. > > >=20 > Yes, I never invoke the function with dir =3D=3D(RTE_PDUMP_FLAG_RX | RTE= _PDUMP_FLAG_TX). Ok, then at least probably comment it somehow. Though I still think 2 different variables (and might be functions) would b= e better. >=20 > > > + > > > + dir =3D p->dir; > > > + operation =3D p->op; > > > + if (operation =3D=3D ENABLE) { > > > + if (p->data.en_v1.is_pci_or_name =3D=3D true) { > > > + /* check if device is pci address or name */ > > > + if (pdump_get_dombdf(p->data.en_v1.device, domBDF) > > =3D=3D 0) > > > + ret =3D rte_eth_dev_get_port_by_name(domBDF, > > &port); > > > + else > > > + ret =3D rte_eth_dev_get_port_by_name(p- > > >data.en_v1.device, > > > + > > &port); > > > > > > Why we can't force client to have device name in predefined format? > > Then you woudn't need that name conversion here. >=20 > You mean I should do the conversion pdump_get_dombdf() in client and the= n pass that value to server? Yes. >=20 > > > > > + if (ret < 0) { > > > + RTE_LOG(ERR, PDUMP, > > > + "failed to get potid for device > > id=3D%s\n", > > > + p->data.en_v1.device); > > > + return -EINVAL; > > > + } > > > + } else /* if device is port id */ > > > + port =3D atoi(p->data.en_v1.device); > > > > Hmm, again why not make server to accept requests only by device id? > > Then it would be client responsibility to do port to device id, and you= can get rid > > of some duplicated code here. >=20 > If client is secondary process then the same port id on primary and seco= ndary processes might be mapping to different devices right? Yes. > If so I cannot do port id to device name conversion in client. Ok, but the client can do either port_enable/disable by client port id, or (if that device is not mapped on the client) by device_id. Konstantin >=20 > Thanks, > Reshma