From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0042.outbound.protection.outlook.com [104.47.1.42]) by dpdk.org (Postfix) with ESMTP id E46AF100F for ; Tue, 29 Aug 2017 08:26:42 +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=x3HmWb4afM0ZBvfENEOprDkOSI6q6di0tpgIVe2PbaE=; b=PQSRhOhOGhwn/JmcG9dI40RNj0SXVlFWYVxbvdrUXGXgobJPYu2S2Lr6EQWoeCXbFdtOLj2vJD9GsjSJCZc+JUM1Rv1lDMg+gHuybG+Qg0VHygwxD30IeylasgGh87dbrQll+9JBB56k2pAZpktUJmepEts8ZSQ4ElEh42VthOg= Received: from VI1PR05MB3149.eurprd05.prod.outlook.com (10.170.237.142) by VI1PR05MB1279.eurprd05.prod.outlook.com (10.162.122.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Tue, 29 Aug 2017 06:26:40 +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.1385.014; Tue, 29 Aug 2017 06:26:40 +0000 From: Shahaf Shuler To: "Ananyev, Konstantin" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [RFC PATCH 4/4] ethdev: add helpers to move to the new offloads API Thread-Index: AQHTD2u4RV3tbOCxDUKE02RjhLsQ9qKR99qAgAAKqKCAB+3wgIABCbUw Date: Tue, 29 Aug 2017 06:26:40 +0000 Message-ID: References: <1e9c5ead0fbd92a3e7fb4c76397cb3dc369eca89.1502096064.git.shahafs@mellanox.com> <2601191342CEEE43887BDE71AB977258489B5073@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB9772584F23D376@IRSMSX103.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB9772584F23D376@IRSMSX103.ger.corp.intel.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.107] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB1279; 6:mn7e41obb2jJTHHLnp/AL+Ig2+JaAgZXjM68D6GGy3bcxQF7sTfvuyC2KE6f8OEi99qbJELodRLmdVPiBIFFkkM7J9ChM0XgUUXE3UFvIZMgSaL0XPMN/k0ynmwmbDri8k5fM1b7kQWFPXEVYi7YTjY+C5JBciyqwK1aROh26CNc41MT1D9lhjHn43+2YCr032BjE2hp9SvAsLMsD9mNelV2x1+HPI8M75vNemJUaD5ST7C9Wu+snvnSc33rVS9PUzrRqUxApVH6Q8+w7rq5uZBLNQqzl6Z7rUA1dczW4xM8Xsy6vzgHoUbGyJJ3Fq5YzroGHYDYSBZWveon8QeFmw==; 5:trqCL4Df2H15PDXFCw0TqvLgDjuYla4yI6Xx6AAdRI9v0hpYipud2ibM827tPXiDy0WrhF+DWbpYwWW9H1kfC3j4vj1Pc0HPun18fe5aHCPc6ypVmpN9jhLZd0Z+AokcksUsZQSdFml0gVxeZxQbRw==; 24:lZ/IqcfFTa98VWRJXTpSLpt99mUzDf/JMMLoRH4BEYqEloSAePbbHtO2kVeYHyoPQfDlfSyoGZE44c0470LbxiPUI7IpTPkR/9kDkPZC5h8=; 7:XK77bchcWWd0JoNyLfvR/zKminEgAi+HEqZo0/do12mbPczutS1OJLPmjYA8V+Xx48w6XUyphzgBtxVSMaPPzdnDnjvnFglLzaHHkPejsVIVD4fsWvzPElY5lDhBCpHUj6aLVSPg/ufqlTbiv6zLgwBrLzFfnKMnDJ49Y8rJMJFdpPO3AItK3El3Eufa0YvoeKTs/nO/YFx+gkOwUzaOaeKjlf2QuLPO0H4IQ6AdGVQ= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 92f235ff-cb1e-4602-a718-08d4eea6e8e4 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)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:VI1PR05MB1279; x-ms-traffictypediagnostic: VI1PR05MB1279: x-exchange-antispam-report-test: UriScan:(278428928389397)(17755550239193); 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)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR05MB1279; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR05MB1279; x-forefront-prvs: 0414DF926F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(199003)(189002)(377454003)(478600001)(9686003)(3660700001)(99286003)(53936002)(55016002)(305945005)(3280700002)(33656002)(86362001)(3846002)(102836003)(6116002)(2906002)(68736007)(105586002)(2501003)(97736004)(6246003)(106356001)(189998001)(5250100002)(14454004)(81166006)(81156014)(8936002)(7736002)(2900100001)(50986999)(76176999)(54356999)(66066001)(6506006)(229853002)(93886005)(25786009)(74316002)(7696004)(2950100002)(5660300001)(6436002)(101416001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB1279; 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: 29 Aug 2017 06:26:40.3488 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1279 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: Tue, 29 Aug 2017 06:26:43 -0000 Monday, August 28, 2017 5:12 PM, Ananyev, Konstantin: > > Wednesday, August 23, 2017 3:29 PM, Ananyev, Konstantin: > > > > > > 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 offl= oad > API however the underlying PMD still uses the old one. >=20 > Ok, but as I remember, right now the initialization order is pretty stric= t: > rx_queue_setup() has to be always called after dev_configure(). Is this restriction backed up in the API definition?=20 >>From what I saw in dev_configure API documentation: "=20 This function must be invoked first before any other function in the Ethern= et API. This function can also be re-invoked when a device is in the stoppe= d state. " It does not dictate one is forbidden to do (while port is stopped): dev_configure rx_queue_setup(queue 1) dev _configure (for the same configuration) rx_queue_setup(queue 2) didn't saw any words on in it also in rx_queue_setup API. maybe API doc sho= uld be updated. You are correct though that all examples and apps on dpdk tree behaves in t= he way you described. > One of the reasons for that: rx_queue_setup() might change fileds inside > dev->data->dev_private. > Second call for dev_configure() will void these changes and some of rxq > config information will be lost. > So I think we should avoid calling dev_configure() inside rx_queue_setup(= ). In continue to above comment, is this reason is because of a wrong implemen= tation of the callbacks by the PMDs or actual limitation from ethdev? >=20 > My preference still would be to force all PMDs to move to the new version= of > rx_queue_setup() first. > I think it would be much more error prone then supporting two flavors of > PMD config > and will allow us to catch errors early - in case this new scheme doesn't= work > by some PMD for any reason. I Fully agree with you. If we can force all PMDs to move the new API it wil= l be the best. No need in risky re-configuration in the middle of the queue setup.=20 But how can we force all to do such transition? I saw there is a discussion= on this RFC on the techboard - maybe it can be decided there. As I said before, I think I will be very hard to migrate all PMDs to the ne= w API by myself. It is not a simple function prototype change or some identical swap I need = to do on each PMD. Each device has its own characteristics and restriction on the offloads it = can provide. Some offloads can be enabled only on specific places in the device initiali= zation. Some offloads are only per port. To do such transition properly I must fully understand the underlying devic= e of each PMD. I can commit on transition for the devices I familiar with: Mlx4 and mlx5.= =20 >=20 > Also it seems that you forgot to: > struct rte_eth_rxmode rxmode =3D dev->data->dev_conf.rxmode; Thanks, discovered it right after I sent the RFC. Already fixed.=20 >=20 > Konstantin >=20 >=20 > > > > > > > > > + if (ret < 0) { > > > > + RTE_PMD_DEBUG_TRACE( > > > > + "unable to re-configure port %d " > > > > + "in order to apply rxq offloads " > > > > + "configuration\n", port_id); > > > > + } > > > > + } > > > > + } > > > > + > > > > ret =3D (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, > > > nb_rx_desc, > > > > socket_id, rx_conf, mp); > > > > > > BTW, I don't see changes in any PMD for new offload flags? > > > Is it because it is just a n RFC and full patch would contain such ch= anges? > > > > Yes this is because this is an RFC. > > > > The full patch I intend will move all examples and testpmd to the new > offloads API. > > In addition it will include the mlx5 PMD support for the new offloads A= PI. > > > > As I said on previous mail, I believe that the work to move the > > different PMDs to the new API should be done by their developers or > maintainers. > > > > > > > > > > > > if (!ret) { > > > > @@ -1094,6 +1182,51 @@ rte_eth_rx_queue_setup(uint8_t port_id, > > > uint16_t rx_queue_id, > > > > return ret; > > > > } > > > > > > > > +/** > > > > + * A copy function from txq_flags to rte_eth_txq_conf offloads > > > > +API, > > > > + * to enable PMDs to support only one of the APIs. > > > > + */ > > > > +static void > > > > +rte_eth_copy_txq_flags(struct rte_eth_txq_conf *txq_conf) { > > > > + uint32_t txq_flags =3D txq_conf->txq_flags > > > > + uint64_t *offloads =3D &txq_conf->offloads; > > > > + > > > > + if (!(txq_flags & ETH_TXQ_FLAGS_NOMULTSEGS)) > > > > + *offloads |=3D DEV_TX_OFFLOAD_MULTI_SEGS; > > > > + if (!(txq_flags & ETH_TXQ_FLAGS_NOVLANOFFL)) > > > > + *offloads |=3D DEV_TX_OFFLOAD_VLAN_INSERT; > > > > + if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMSCTP)) > > > > + *offloads |=3D DEV_TX_OFFLOAD_SCTP_CKSUM; > > > > + if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMUDP)) > > > > + *offloads |=3D DEV_TX_OFFLOAD_UDP_CKSUM; > > > > + if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMTCP)) > > > > + *offloads |=3D DEV_TX_OFFLOAD_TCP_CKSUM; } > > > > + > > > > +/** > > > > + * A copy function between rte_eth_txq_conf offloads API to > > > > +txq_flags > > > > + * offloads API, to enable application to be agnostic to the PMD > > > > +supported > > > > + * API. > > > > + */ > > > > +static void > > > > +rte_eth_copy_txq_offloads(struct rte_eth_txq_conf *txq_conf) { > > > > + uint32_t *txq_flags =3D &txq_conf->txq_flags > > > > + uint64_t offloads =3D txq_conf->offloads; > > > > + > > > > + if (!(offloads & DEV_TX_OFFLOAD_MULTI_SEGS)) > > > > + *txq_flags |=3D ETH_TXQ_FLAGS_NOMULTSEGS; > > > > + if (!(offloads & DEV_TX_OFFLOAD_VLAN_INSERT)) > > > > + *txq_flags |=3D ETH_TXQ_FLAGS_NOVLANOFFL; > > > > + if (!(offloads & DEV_TX_OFFLOAD_SCTP_CKSUM)) > > > > + *txq_flags |=3D ETH_TXQ_FLAGS_NOXSUMSCTP; > > > > + if (!(offloads & DEV_TX_OFFLOAD_UDP_CKSUM)) > > > > + *txq_flags |=3D ETH_TXQ_FLAGS_NOXSUMUDP; > > > > + if (!(offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) > > > > + *txq_flags |=3D ETH_TXQ_FLAGS_NOXSUMTCP; } > > > > + > > > > int > > > > rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, > > > > uint16_t nb_tx_desc, unsigned int socket_id, @@ -1145,6 > > > > +1278,13 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t > > > tx_queue_id, > > > > if (tx_conf =3D=3D NULL) > > > > tx_conf =3D &dev_info.default_txconf; > > > > > > > > + if ((dev->data->dev_flags & RTE_ETH_DEV_TXQ_OFFLOAD) && > > > > + (!(tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE))) > > > > + rte_eth_copy_txq_flags(tx_conf); > > > > + else if (!(dev->data->dev_flags & RTE_ETH_DEV_TXQ_OFFLOAD) && > > > > + (tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE)) > > > > + rte_eth_copy_txq_offloads(tx_conf); > > > > + > > > > > > As I said in my previous mail - I think better to always convrert > > > from old txq_flags to new TX offload flags and make each PMD to > > > understand new offload values only. > > > Konstantin > > > > > > > return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, > > > nb_tx_desc, > > > > socket_id, tx_conf); > > > > } > > > > -- > > > > 2.12.0