From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH] eventdev: fix eth Tx adapter queue count checks Date: Sat, 1 Dec 2018 14:39:16 +0000 Message-ID: <20181201143906.GA26004@jerin> References: <1543489908-60688-1-git-send-email-nikhil.rao@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "stable@dpdk.org" To: Nikhil Rao Return-path: In-Reply-To: <1543489908-60688-1-git-send-email-nikhil.rao@intel.com> Content-Language: en-US Content-ID: <67FE2B9B4342AE45A90838FE8D5B1FF3@namprd07.prod.outlook.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----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 >=20 >=20 > rte_event_eth_tx_adapter_queue_add() - add a check > that returns an error if the ethdev the zero Tx queues > configured. >=20 > 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. >=20 > 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(-) >=20 > 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) >=20 > +#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_queu= es) { \ The queue should be bracket i.e ((queue) !=3D 1) to avoid any side effect > + 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; >=20 > tqi =3D txa_service_queue(txa, port_id, tx_queue_id); > if (tqi =3D=3D NULL || !tqi->added) > @@ -999,11 +1027,7 @@ static int txa_service_queue_del(uint8_t id, > TXA_CHECK_OR_ERR_RET(id); >=20 > eth_dev =3D &rte_eth_devices[eth_dev_id]; > - if (queue !=3D -1 && (uint16_t)queue >=3D eth_dev->data->nb_tx_qu= eues) { > - RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, > - (uint16_t)queue); > - return -EINVAL; > - } > + TXA_CHECK_TXQ(eth_dev, queue); >=20 > 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); >=20 > eth_dev =3D &rte_eth_devices[eth_dev_id]; > - if (queue !=3D -1 && (uint16_t)queue >=3D eth_dev->data->nb_tx_qu= eues) { > - RTE_EDEV_LOG_ERR("Invalid tx queue_id %" PRIu16, > - (uint16_t)queue); > - return -EINVAL; > - } Shouldn't we need TXA_CHECK_TXQ here? If we need only one place, Do we need macro? >=20 > caps =3D 0; >=20 > -- > 1.8.3.1 >=20