From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700063.outbound.protection.outlook.com [40.107.70.63]) by dpdk.org (Postfix) with ESMTP id DB9011B546; Sat, 1 Dec 2018 15:39:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a/QrougRRsa56zf6/YgxvLpEoHvLmMhL0fsAItGZpyA=; b=idYC9pL1Fh8Bl+8yPcfzAAeetbzxKX66Ej/eH4SJZNLI9kE8PytFodizXsRMk3JViRcEKoe1YuVmTX/CGjopWP0n2z2Xhad3UkMcsyf6/I1sF8VbMaHks5Iq86u/JER5/daj6TFbed6u2eQM8lsN3eXS3+K8iS1BAIyYy1QeGXw= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB5685.namprd07.prod.outlook.com (20.178.0.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 1 Dec 2018 14:39:17 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::9d3a:7709:b7e5:8ccf]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::9d3a:7709:b7e5:8ccf%2]) with mapi id 15.20.1382.020; Sat, 1 Dec 2018 14:39:17 +0000 From: Jerin Jacob To: Nikhil Rao CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] eventdev: fix eth Tx adapter queue count checks Thread-Index: AQHUh9RpJFvBD8hdt0aoRFatw5o7m6Vp95GA 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> In-Reply-To: <1543489908-60688-1-git-send-email-nikhil.rao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [122.178.219.219] x-clientproxiedby: BM1PR01CA0073.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::13) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB5685; 6:RrdnovWNyFIjpIHUZRJNSdDZwewxAKhAgxgUKjVJrhEm1wewHdBoCV5Gbin+dy/ylOIUKHRruY/crur42fd07lsndTU9njXmG+DMtghWks5VwtdWc64FyZL/tjTcRASWBoM7XlkO8lZ+1mgJr1kmEBTca4r1MV0x9JVbNplE3gmCSLfhECbop5FWbH+NpmqNBLEjT1X2u9WWuU360kTAReXIJwm9bSH10LFFhPJfzZohaEygeCJUtyH6y4yq+DLYb9AyYms8IKJomAWViBkqFAg84eSNnCNWWbJwMwJ05ONkjGAzd6LRYbthGhwPYs3mfIfXUqdS9uYZ5XePGGXVwNMtBzCO3YjyiDJKtrcejoHHojaA0V3KAtdjULNFsMOurOSPdm7m9YfRAePP8gxYaL6nEj9o1miCK9po65auPhi6FC+qRNjDD19q4WD9mVfDOeRFhfJxcxvI4KnCYMOI2A==; 5:goOFvMvin3sd+PwOHKSsDRfZRoWUxmlBIfeEWEE30FI2rv73GRbmMjkk2zHadfcYEP1tETftC9/kduXUeb1zeBoz0tsRPVcUgtMhnKUqYlmwveLiDW330Bqp4XFXf6YoL3A/VnxbtvxZQvYi30p2A9MfZCVkyutXMJMfXvYU3TI=; 7:b0XNp2mfnNb0codHXhveSL6j4ru6/I+BHofcdvVkqqTtFDvaYYBKlKZlJzPU1dcjDwuylMvz5ijwAmEgWvOBHFNtyrDM7G+kXfsP5J2dMWFVTgFd3CFrcW570a1MrpYZF3R11o2iDUbfwRDOltI9RA== x-ms-office365-filtering-correlation-id: b00880bd-67d3-472f-0010-08d6579ac556 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB5685; x-ms-traffictypediagnostic: BYAPR07MB5685: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231454)(999002)(944501477)(52105112)(93006095)(10201501046)(3002001)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:BYAPR07MB5685; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB5685; x-forefront-prvs: 087396016C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(7916004)(366004)(396003)(39850400004)(136003)(346002)(376002)(199004)(189003)(13464003)(8676002)(1076002)(8936002)(76176011)(6116002)(3846002)(33656002)(81166006)(81156014)(33716001)(4326008)(54906003)(316002)(6246003)(5660300001)(6506007)(66066001)(53936002)(386003)(9686003)(6512007)(6436002)(99286004)(6486002)(52116002)(33896004)(229853002)(102836004)(106356001)(2906002)(7736002)(186003)(26005)(305945005)(42882007)(105586002)(256004)(72206003)(476003)(6916009)(478600001)(71200400001)(97736004)(68736007)(71190400001)(11346002)(14454004)(486006)(25786009)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB5685; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Z5dJH09RQxgiio+cRQ9V8gO4WwACCuYSjoeOSmNMNiRTtoMFj5sWv+Rhhv4zJTk+sLcu8Lhwej1sieNhphjJe/2WJ66bqTuBcwTDg6n14GdidPgQdqt7HPAaX3rz6Xlq9nAAlcC6bbiMYiaLbcFR0RFq+lASB/skXWDxaFNkQmG1zXfXSW2gO7QmLb4JEUjMe9CEYyNgHdJkxvxRkOeWJ3FRejtQfBzrIni6ydHY+bBPAMJNG2r0SX4lE0E4eq3LHe77sPyTzb4VTq3JtBP9ni3PTfSlwQO7FCSWyAkmYnS9YimAtkDat8BVRrLXv4YMDoEo2LjBNWDferLGqbBV0rICrQygLWHxO1lNXVyj5x0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <67FE2B9B4342AE45A90838FE8D5B1FF3@namprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: b00880bd-67d3-472f-0010-08d6579ac556 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2018 14:39:16.9956 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB5685 Subject: Re: [dpdk-stable] [PATCH] eventdev: fix eth Tx adapter queue count checks X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2018 14:39:23 -0000 -----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