From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00075.outbound.protection.outlook.com [40.107.0.75]) by dpdk.org (Postfix) with ESMTP id 1134E1CA2B for ; Sun, 13 May 2018 07:37:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=n8f/LR9mBNHVYm/aVDlJFrOlo8RogjAQPf8iJH5TOQ0=; b=NSBrgxG1ZJvSdStZCRi8zwFmIG+j00Ou6Fhgj6gbT/2xAv65xMBOWbNBk2s26EILJ9HoYGqcFYFgMrAqcEtGNZw4+1GoVJ+HPdtUhL2oRdbSXFW+haZpVEpBo3YgmVNlLxaoDCX9uFDqLRSHIxhVz/viFq6ZF4VDWRhVHPg+ZM4= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4810.eurprd05.prod.outlook.com (20.176.235.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.755.16; Sun, 13 May 2018 05:37:30 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8%13]) with mapi id 15.20.0755.018; Sun, 13 May 2018 05:37:30 +0000 From: Shahaf Shuler To: Andrew Rybchenko , "dev@dpdk.org" CC: Ferruh Yigit , Thomas Monjalon , Wei Dai Thread-Topic: [PATCH 2/3] ethdev: fail if Tx queue offload is not supported at all Thread-Index: AQHT6UTItetfYlAbVEOxu5q3cEN/u6QtJOfQ Date: Sun, 13 May 2018 05:37:30 +0000 Message-ID: References: <1526055955-14027-1-git-send-email-arybchenko@solarflare.com> <1526055955-14027-3-git-send-email-arybchenko@solarflare.com> In-Reply-To: <1526055955-14027-3-git-send-email-arybchenko@solarflare.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4810; 7:yPvC2FDppiEGvtCKfGOuVH4yYgDVATHHSmhLyi8aAYmtHsKFK9BT/J+w1TpHwwIXlI4QG+ZbXn/E5fI+kKlouf8UDbzn/ICxSoQmvDgHgnBhdtXWT1KjoVaITPgkbWXHqXGKKWjqU+IbY7pXAbkXNjWzeAyb4qPEUjNKfPsxFCvURkJVKj+haFusOpCTP2K2tp3kY8Al7dkqta94eJxANF69OVSMBl/tGam2ZQVi4lE76efn/mkp3cQCTcraRqp6 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4810; x-ms-traffictypediagnostic: DB7PR05MB4810: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DB7PR05MB4810; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4810; x-forefront-prvs: 0671F32598 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(39380400002)(366004)(39860400002)(13464003)(189003)(199004)(6246003)(2906002)(106356001)(25786009)(5660300001)(11346002)(446003)(8676002)(53936002)(229853002)(54906003)(478600001)(110136005)(305945005)(316002)(7736002)(33656002)(3660700001)(3846002)(4326008)(68736007)(74316002)(14454004)(8936002)(105586002)(7696005)(6436002)(81156014)(81166006)(6116002)(3280700002)(97736004)(55016002)(99286004)(102836004)(86362001)(53546011)(5250100002)(66066001)(9686003)(6506007)(76176011)(186003)(476003)(486006)(59450400001)(2900100001)(26005)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4810; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: //Ld/RKp1/6BzLiN91N+8EEWr/yMor4rbttyIiRF8n12iLMHHj4vKKTOfvJc7S/ubQaQJGx2A6b0T2nWlnRH1qX/AFnGqQaU6WZuwWblCl7Y0v6N5Sjq+ePvpCZCAt1Ixc+IOohqmFv/AuGwchhBc0ds6vmp77sgXFUPQempV0DqZjcyYbWzpmfpYwxpUO6t spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9962a553-f58d-4acc-c93d-08d5b8939e9d X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9962a553-f58d-4acc-c93d-08d5b8939e9d X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2018 05:37:30.2231 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4810 Subject: Re: [dpdk-dev] [PATCH 2/3] ethdev: fail if Tx queue offload is not supported at all 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: Sun, 13 May 2018 05:37:33 -0000 --Shahaf > -----Original Message----- > From: Andrew Rybchenko > Sent: Friday, May 11, 2018 7:26 PM > To: dev@dpdk.org > Cc: Ferruh Yigit ; Thomas Monjalon > ; Shahaf Shuler ; Wei Dai > > Subject: [PATCH 2/3] ethdev: fail if Tx queue offload is not supported at= all >=20 > Do not allow to request unsupported Tx offload since all checks are remov= ed > from PMDs because of consistency check in ethdev. > Otherwise application may rely on offload which is not actually supported > and send traffic with, for example, wrong checksums, truncated packets or > packets with garbage. >=20 > Fixes: d04dd6d4ed67 ("ethdev: new Rx/Tx offloads API") >=20 > Signed-off-by: Andrew Rybchenko > --- > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index dd36e6270..60577efcf 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1744,6 +1744,16 @@ rte_eth_tx_queue_setup(uint16_t port_id, > uint16_t tx_queue_id, > local_conf.offloads, > dev_info.tx_queue_offload_capa, > __func__); > + /* > + * Applications which are not converted yet to the new > + * Tx offload API may request device level offloads on > + * queue level (and nothing is requested on device level). > + * However, if the offload is not supported at all Tx > + * queue setup must fail. > + */ > + if ((local_conf.offloads & dev_info.tx_offload_capa) !=3D > + local_conf.offloads) > + return -EINVAL; Not converted application doesn't have a clue what are per-queue offloads, = and this is the error they will get when the Tx queue configuration will fa= il. How about using ETH_TXQ_FLAGS_IGNORE flag, which explicitly says "applicati= on converted to the new Tx offloads API". and have 2 different checks: 1. for converted application the already exist check[1] with the related er= ror. 2. for not converted application your check with a related error.=20 [1] if ((local_conf.offloads & dev_info.tx_queue_offload_capa) !=3D local_conf.offloads) { =20 > } >=20 > return eth_err(port_id, (*dev->dev_ops->tx_queue_setup)(dev, > -- > 2.17.0