From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 27 May 2016 08:25:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,374,1459839600"; d="scan'208";a="709870410" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by FMSMGA003.fm.intel.com with ESMTP; 27 May 2016 08:25:31 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.51]) by IRSMSX152.ger.corp.intel.com ([169.254.6.247]) with mapi id 14.03.0248.002; Fri, 27 May 2016 16:25:30 +0100 From: "Ananyev, Konstantin" To: "Pattan, Reshma" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support Thread-Index: AQHRtTzJlCFb+xkZBk+bNKGIAEzkqZ/MwIAQgAATqQCAABjEEA== 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> In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F01044D7E@IRSMSX109.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 15:25:33 -0000 > -----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