From patchwork Sun May 13 13:30:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahaf Shuler X-Patchwork-Id: 39929 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 41C6C1CE31; Sun, 13 May 2018 15:30:28 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0049.outbound.protection.outlook.com [104.47.0.49]) by dpdk.org (Postfix) with ESMTP id 358871CE28 for ; Sun, 13 May 2018 15:30:27 +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=ZMwkxMzSvD9xBJEkiWcaLqTorygFkhCMV+i6Ssiq+hQ=; b=omUDnCXMBpJGz1qqwV85/oYFm6Z/EFPNRmOMa1Kss/OoE0s4TOUe6YqtpTqbb/koiu8AJjbbKobUs7v6d7Gdjbt0SoixJbYBIJKQdO1SRoULxX7Fd3sNvRPVWPN2P43imqd6quMF5P8PLXizNuH/u8Bb7TUL1OgKxnAktiYDBIs= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB5017.eurprd05.prod.outlook.com (20.176.236.161) 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 13:30:25 +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 13:30:25 +0000 From: Shahaf Shuler To: Shahaf Shuler , 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/u6QtJOfQgACFEyA= Date: Sun, 13 May 2018 13:30:25 +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: 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; DB7PR05MB5017; 7:/UKzr8G0d7izo49rT8EkRmmmVVBTA7DiaNVIN4fF+tPLMTnxrdONgnYPKf5C4l8nS5nvmzqdyVJ7c8hwP/cJTwoMaxtDeFZ5FM1vVet5Jr4IscdNVj8tqO/eRjKoh4Jboj10z5z7j7aj06+8nVazvzIahO7qD3Lj91Fm54shxR1ESkmNQGMkzt9u2B4j+9+aAMjTO+vyNAp1pv84BiGBVS33rJJBHUbrYohm5xbgIoja4luDHKowzlNT8hiALEcq x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB5017; x-ms-traffictypediagnostic: DB7PR05MB5017: 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)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DB7PR05MB5017; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB5017; x-forefront-prvs: 0671F32598 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(376002)(39860400002)(39380400002)(13464003)(189003)(199004)(316002)(105586002)(97736004)(7736002)(305945005)(106356001)(3660700001)(14454004)(9686003)(3280700002)(54906003)(53936002)(6246003)(55016002)(33656002)(2906002)(8936002)(74316002)(5660300001)(4326008)(2940100002)(66066001)(8676002)(81156014)(81166006)(110136005)(7696005)(476003)(53546011)(2900100001)(11346002)(446003)(99286004)(478600001)(59450400001)(76176011)(486006)(102836004)(6506007)(68736007)(86362001)(6436002)(229853002)(25786009)(3846002)(26005)(2501003)(5250100002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5017; 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: WGAgHZhkZa6s5E2Z0BSif40ySFw53YNc+FBAn+9sTZ7Fegh3509sNGbhq8kzbFLrdX9h+dW3WZZ3D51YZeOMj5Zn9IexuC9wIMcG5fXWUocz06yAo+fmEHoRiiLq1ENxtz5tllifzFfm/PB0T6jWGr7OWCN5Obbuq/kXRwjDMHTYqarl43dsMrAT84Yh1DOn spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6992b000-b46a-4ee1-cffb-08d5b8d5af66 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6992b000-b46a-4ee1-cffb-08d5b8d5af66 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2018 13:30:25.2776 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5017 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Sunday, May 13, 2018 8:38 AM, Shahaf Shuler: > Subject: Re: [dpdk-dev] [PATCH 2/3] ethdev: fail if Tx queue offload is not > supported at all > > -----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 > > > > Do not allow to request unsupported Tx offload since all checks are > > removed 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. > > > > Fixes: d04dd6d4ed67 ("ethdev: new Rx/Tx offloads API") > > > > Signed-off-by: Andrew Rybchenko > > --- > > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/lib/librte_ethdev/rte_ethdev.c > > b/lib/librte_ethdev/rte_ethdev.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) != > > + 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 fail. > > How about using ETH_TXQ_FLAGS_IGNORE flag, which explicitly says > "application converted to the new Tx offloads API". and have 2 different > checks: > 1. for converted application the already exist check[1] with the related error. > 2. for not converted application your check with a related error. > > As a suggestion maybe the below diff can be squashed into this one: diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index b3dac067c5..4763718b9c 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1727,25 +1727,29 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, */ local_conf.offloads &= ~dev->data->dev_conf.txmode.offloads; - /* - * New added offloadings for this queue are those not enabled in - * rte_eth_dev_configure( ) and they must be per-queue type. - * A pure per-port offloading can't be enabled on a queue while - * disabled on another queue. A pure per-port offloading can't - * be enabled for any queue as new added one if it hasn't been - * enabled in rte_eth_dev_configure( ). - */ - if ((local_conf.offloads & dev_info.tx_queue_offload_capa) != - local_conf.offloads) { - ethdev_log(ERR, "Ethdev port_id=%d tx_queue_id=%d, new " - "added offloads 0x%" PRIx64 " must be " - "within pre-queue offload capabilities 0x%" - PRIx64 " in %s( )\n", - port_id, - tx_queue_id, - local_conf.offloads, - dev_info.tx_queue_offload_capa, - __func__); + if (tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE) { + /* + * New added offloadings for this queue are those not enabled in + * rte_eth_dev_configure( ) and they must be per-queue type. + * A pure per-port offloading can't be enabled on a queue while + * disabled on another queue. A pure per-port offloading can't + * be enabled for any queue as new added one if it hasn't been + * enabled in rte_eth_dev_configure( ). + */ + if ((local_conf.offloads & dev_info.tx_queue_offload_capa) != + local_conf.offloads) { + ethdev_log(ERR, "Ethdev port_id=%d tx_queue_id=%d, new " + "added offloads 0x%" PRIx64 " must be " + "within pre-queue offload capabilities " + " 0x%" PRIx64 " in %s( )\n", + port_id, + tx_queue_id, + local_conf.offloads, + dev_info.tx_queue_offload_capa, + __func__); + return -EINVAL; + } + } else { /* * Applications which are not converted yet to the new * Tx offload API may request device level offloads on @@ -1754,8 +1758,18 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, * queue setup must fail.