From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20071.outbound.protection.outlook.com [40.107.2.71]) by dpdk.org (Postfix) with ESMTP id A82BF7D3A for ; Thu, 24 Aug 2017 09:12:30 +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=XL+Ud7ClKciKzOgbxNYU92xW5SvGnA9wIPAr30EUmkQ=; b=ruQyFcUdni+jIz5wTzyMNC+T84KXU2tCWvAccAW38sFA3O5MoZQ7Px3kscmg54Oy7P6yq5mwURuLSQ1a9haEc7d3GVvEqbKHNX67OxMKpWrtgJBA9Ebo9UC8aY+tCrNMWOAGypk2aJ8ZKqvLuIKS7ztQa/7HyAjtcgSwiQmQ1VE= Received: from VI1PR05MB3149.eurprd05.prod.outlook.com (10.170.237.142) by VI1PR05MB3294.eurprd05.prod.outlook.com (10.170.238.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Thu, 24 Aug 2017 07:12:29 +0000 Received: from VI1PR05MB3149.eurprd05.prod.outlook.com ([fe80::8450:1a86:2dd0:82c2]) by VI1PR05MB3149.eurprd05.prod.outlook.com ([fe80::8450:1a86:2dd0:82c2%13]) with mapi id 15.01.1362.019; Thu, 24 Aug 2017 07:12:28 +0000 From: Shahaf Shuler To: Thomas Monjalon CC: "dev@dpdk.org" , "Ananyev, Konstantin" Thread-Topic: [dpdk-dev] [RFC PATCH 4/4] ethdev: add helpers to move to the new offloads API Thread-Index: AQHTD2u4RV3tbOCxDUKE02RjhLsQ9qKR99qAgAAKqKCAAJbBgIAAlrBw Date: Thu, 24 Aug 2017 07:12:28 +0000 Message-ID: References: <2601191342CEEE43887BDE71AB977258489B5073@irsmsx105.ger.corp.intel.com> <5969739.W1oj9hpjs5@xps> In-Reply-To: <5969739.W1oj9hpjs5@xps> 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: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB3294; 6:VSTP9ZpANNpJVQ+Aa6oBulOUjsVv1NwtqJW5ry5otarQSgTEJgLRoK+5l8JGaGtm8uN22a0InnKqM8ZtqbwbrNiPnhkNkP+3NEjc84K4Nc8lFrxCZ+FDOmv8fYFgRagQChxe8jhUl37YYZSWaGlUqrA17y5ss/UqTtDrOpET42e1Qp4kaCr4giQP6DcBRSULCmv7U8AkihJJIKPvOrh+hckauEbxaAGUNJ39YfpJp26m9GXAsOtvJoQPhQ9WmwvjQs1VG+Rpk95qheOmvMlViimDQNTA4tlHWZymZacN6U8vuGPqig0nehTIe00WWofo1PWe838SbCydNCzBL7ZO6A==; 5:yg0eOrK3XOomxlF6voTfY29+avfU/jDAgguxJjl3F3XIef/xHSWaqYzYVgrQ4pxBKcmhhLa9V5hucr7TVIodn9LTPWnzXsFO0NS0bQtnov3moTM6g4BvCI4v2fLcymglqB/5wbrU33fcUZfyQXuejg==; 24:P6B8JPEDlFXBGlIeDG8BkPmCyCXBLSA82Uag2aRLR+uj9bbNDswV1jDtWebeK8xPid0RGS14vsCZtDzFo2hXvoL/MNfehMW9ge/MatZ9ngQ=; 7:77fAxfLicOVfPML0gkDllDylH2EJ5M3arqIjvhm/zWBHyF7JrxshgsXROBno1CXhirOMJC3n4eNQWkZWWmM2q/MiBD9ghev8307KQhYTQk49aB0yrQ/3ZAdZFd/cmN4hX8DjW+91FTp1DYoAv251m/QMU4GdTHM3eUbZw7EXsR+1YzLiChzzCXGXhKLeUG35eOr4+9vmW924tjvcCqIXQNe90PchBbGN6GSJ+FgJn00= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-office365-filtering-correlation-id: e1983dec-4102-4485-2558-08d4eabf7aeb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603196)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:VI1PR05MB3294; x-ms-traffictypediagnostic: VI1PR05MB3294: x-exchange-antispam-report-test: UriScan:(278428928389397); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123555025)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR05MB3294; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR05MB3294; x-forefront-prvs: 04097B7F7F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(377454003)(6116002)(105586002)(106356001)(54356999)(66066001)(110136004)(6246003)(7696004)(6436002)(4326008)(54906002)(9686003)(50986999)(99286003)(76176999)(55016002)(102836003)(101416001)(53936002)(2906002)(3280700002)(33656002)(3660700001)(6506006)(3846002)(25786009)(97736004)(478600001)(68736007)(189998001)(86362001)(2900100001)(305945005)(229853002)(5250100002)(5660300001)(6916009)(74316002)(14454004)(81156014)(81166006)(8936002)(2950100002)(7736002)(93886005)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3294; H:VI1PR05MB3149.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2017 07:12:28.6091 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3294 Subject: Re: [dpdk-dev] [RFC PATCH 4/4] ethdev: add helpers to move to the new offloads API 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: Thu, 24 Aug 2017 07:12:30 -0000 Thursday, August 24, 2017 1:06 AM, Thomas Monjalon: > 23/08/2017 15:13, Shahaf Shuler: > > Wednesday, August 23, 2017 3:29 PM, Ananyev, Konstantin: > > > From: Shahaf Shuler > > > > In order to enable PMDs to support only one of the APIs, and > > > > applications to avoid branching according to the underlying device > > > > a copy functions to/from the old/new APIs were added. >=20 > Looks a good intent. > I would prefer the word "convert" instead of "copy". >=20 > > > > int > > > > rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > [...] > > > > + } else if ((!(dev->data->dev_flags & RTE_ETH_DEV_RXQ_OFFLOAD)) > && > > > > + (dev->data->dev_conf.rxmode.ignore =3D=3D 1)) { > > > > + int ret; > > > > + struct rte_eth_rxmode rxmode; > > > > + > > > > + rte_eth_copy_rxq_offloads(&rxmode, rx_conf); > > > > + if (memcmp(&rxmode, &dev->data->dev_conf.rxmode, > > > > + sizeof(rxmode))) { > > > > + /* > > > > + * device which work with rxmode offloads API > requires > > > > + * a re-configuration in order to apply the new > offloads > > > > + * configuration. > > > > + */ > > > > + dev->data->dev_conf.rxmode =3D rxmode; > > > > + ret =3D rte_eth_dev_configure(port_id, > > > > + dev->data->nb_rx_queues, > > > > + dev->data->nb_tx_queues, > > > > + &dev->data->dev_conf); > > > > > > Hmm, and why we would need to reconfigure our device in the middle > > > of rx queue setup? > > > > The reason is the old Rx offloads API is configured on device configure= . > > This if section is for applications which already moved to the new > > offload API however the underlying PMD still uses the old one. >=20 > Isn't it risky to re-run configure here? > We could also declare this case as an error. >=20 > I think applications which have migrated to the new API, could use the > convert functions themselves before calling configure to support not > migrated PMDs. > The cons of my solution are: > - discourage apps to migrate before all PMDs have migrated > - expose a temporary function to convert API I propose it anyway because > there is always someone to like bad ideas ;) Yes. I tried to make it as simple as possible for application to move to th= e new API. Defining it as error flow, will enforce the application to check the PMD of= fload mode and branch accordingly. The conversion functions are a good help= ers, yet the code remains complex due to the different cases with the diffe= rent PMDs. Considering the re-configuration is risky, and without other ideas I will n= eed to fall back to the error flow case. Are we OK with that?