From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D6F2C1B4B6; Mon, 3 Dec 2018 08:37:40 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2018 23:37:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,309,1539673200"; d="scan'208";a="122372765" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by fmsmga002.fm.intel.com with ESMTP; 02 Dec 2018 23:37:39 -0800 Received: from orsmsx113.amr.corp.intel.com (10.22.240.9) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 2 Dec 2018 23:37:39 -0800 Received: from orsmsx110.amr.corp.intel.com ([169.254.10.166]) by ORSMSX113.amr.corp.intel.com ([169.254.9.125]) with mapi id 14.03.0415.000; Sun, 2 Dec 2018 23:37:38 -0800 From: "Rao, Nikhil" To: Jerin Jacob CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] eventdev: fix eth Tx adapter queue count checks Thread-Index: AQHUh9Ro+65XXbAgSUeIfwjvyA5luKVqfbgAgAIF0IA= Date: Mon, 3 Dec 2018 07:37:38 +0000 Message-ID: <1F668163772FA946975B9466A9DFF729ED3A2360@ORSMSX110.amr.corp.intel.com> References: <1543489908-60688-1-git-send-email-nikhil.rao@intel.com> <20181201143906.GA26004@jerin> In-Reply-To: <20181201143906.GA26004@jerin> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWJmNmExNzUtMTFlOS00ODNlLWI4OGQtNzMwZjRmZDVkY2E5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoia3BNbFhaSEZhXC9kTW5cL1wvdDltaVZ3c2tab25CTlorY3RZclR1Y1NpZlN2TUZRZG0xZThnYllTYzZQTHNOSTE4YSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] eventdev: fix eth Tx adapter queue count checks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 07:37:41 -0000 > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Saturday, December 1, 2018 8:09 PM > To: Rao, Nikhil > Cc: dev@dpdk.org; stable@dpdk.org > Subject: Re: [PATCH] eventdev: fix eth Tx adapter queue count checks >=20 > -----Original Message----- > > Date: Thu, 29 Nov 2018 16:41:48 +0530 > > From: Nikhil Rao > > To: jerin.jacob@caviumnetworks.com > > CC: dev@dpdk.org, Nikhil Rao , stable@dpdk.org > > Subject: [PATCH] eventdev: fix eth Tx adapter queue count checks > > X-Mailer: git-send-email 1.8.3.1 > > > > > > rte_event_eth_tx_adapter_queue_add() - add a check that returns an > > error if the ethdev the zero Tx queues configured. > > > > rte_event_eth_tx_adapter_queue_del() - remove the checks for ethdev > > queue count, instead check for queues added to the adapter which maybe > > different from the current ethdev queue count. > > > > Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation") > > Cc: stable@dpdk.org > > Signed-off-by: Nikhil Rao > > --- > > lib/librte_eventdev/rte_event_eth_tx_adapter.c | 53 > > +++++++++++++++++--------- > > 1 file changed, 36 insertions(+), 17 deletions(-) > > > > diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c > > b/lib/librte_eventdev/rte_event_eth_tx_adapter.c > > index ccf8a75..8431656 100644 > > --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c > > +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c > > @@ -59,6 +59,19 @@ > > return -EINVAL; \ > > } while (0) > > > > +#define TXA_CHECK_TXQ(dev, queue) \ > > +do {\ > > + if ((dev)->data->nb_tx_queues =3D=3D 0) { \ > > + RTE_EDEV_LOG_ERR("No tx queues configured"); \ > > + return -EINVAL; \ > > + } \ > > + if (queue !=3D -1 && (uint16_t)queue >=3D > > +(dev)->data->nb_tx_queues) { \ >=20 > The queue should be bracket i.e ((queue) !=3D 1) to avoid any side effect >=20 Thanks. Will fix. > > + RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, \ > > + (uint16_t)queue); \ > > + return -EINVAL; \ > > + } \ > > +} while (0) > > + > > txa =3D txa_service_id_to_data(id); > > - port_id =3D dev->data->port_id; > > > > tqi =3D txa_service_queue(txa, port_id, tx_queue_id); > > if (tqi =3D=3D NULL || !tqi->added) @@ -999,11 +1027,7 @@ stati= c > > int txa_service_queue_del(uint8_t id, > > TXA_CHECK_OR_ERR_RET(id); > > > > eth_dev =3D &rte_eth_devices[eth_dev_id]; > > - if (queue !=3D -1 && (uint16_t)queue >=3D eth_dev->data->nb_tx_= queues) > { > > - RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, > > - (uint16_t)queue); > > - return -EINVAL; > > - } > > + TXA_CHECK_TXQ(eth_dev, queue); > > > > caps =3D 0; > > if (txa_dev_caps_get(id)) > > @@ -1034,11 +1058,6 @@ static int txa_service_queue_del(uint8_t id, > > TXA_CHECK_OR_ERR_RET(id); > > > > eth_dev =3D &rte_eth_devices[eth_dev_id]; > > - if (queue !=3D -1 && (uint16_t)queue >=3D eth_dev->data->nb_tx_= queues) > { > > - RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, > > - (uint16_t)queue); > > - return -EINVAL; > > - } >=20 > Shouldn't we need TXA_CHECK_TXQ here?=20 This patch updates the common queue delete code to handle queues that have = been added to the adapter (so rte_event_eth_tx_adapter_queue_del() will als= o work after if its called after calling rte_eth_dev_close()) > If we need only one place, Do we > need macro? I won't say we need it, I had it originally in rte_event_eth_tx_adapter_qu= eue_del() as well, I retained it since it eliminated clutter in rte_event_e= th_tx_adapter_queue_add(). Nikhil