From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0BFBC5A5C for ; Fri, 27 May 2016 16:54:47 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 27 May 2016 07:54:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,374,1459839600"; d="scan'208";a="990032731" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by fmsmga002.fm.intel.com with ESMTP; 27 May 2016 07:54:44 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.193]) by IRSMSX154.ger.corp.intel.com ([169.254.12.28]) with mapi id 14.03.0248.002; Fri, 27 May 2016 15:54:43 +0100 From: "Pattan, Reshma" To: "Ananyev, Konstantin" , "dev@dpdk.org" CC: "Pattan, Reshma" Thread-Topic: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support Thread-Index: AQHRuB0rl7xRZQvngkqqk9oqlli5EJ/M18hA Date: Fri, 27 May 2016 14:54:42 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F01044D7E@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> In-Reply-To: <2601191342CEEE43887BDE71AB97725836B67FBC@irsmsx105.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjk0YzU1MjUtYzQwZS00ZTQyLWJmNDQtZThjNDgzYTg3ZDk1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik9MeWNQRjFMd1JaXC9VSkl2N1FORUtqZURrdXY2ckNDcWxxQzNjdFBmWFdnPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] 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 14:54:48 -0000 > -----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 >=20 > 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]; >=20 > In case you have dir =3D=3D (RTE_PDUMP_FLAG_RX | RTE_PDUMP_FLAG_TX) you'l= l > 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 th= em > 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 m= e, 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_P= DUMP_FLAG_TX). > > + > > + 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); >=20 >=20 > Why we can't force client to have device name in predefined format? > Then you woudn't need that name conversion here. You mean I should do the conversion pdump_get_dombdf() in client and then = pass that value to server? >=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); >=20 > 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 c= an get rid > of some duplicated code here. If client is secondary process then the same port id on primary and second= ary processes might be mapping to different devices right?=20 If so I cannot do port id to device name conversion in client. Thanks, Reshma