From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0073.outbound.protection.outlook.com [104.47.1.73]) by dpdk.org (Postfix) with ESMTP id 909A11B652 for ; Wed, 9 May 2018 16:01:06 +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=XGuH61IovLRU7+FTC0URyA+h0S+oDxDk6cLSSlCHet4=; b=up5KjpQ2eweTvIttpi/knhk3gOC2BBlcg85O6KePJN6X28/VP9ZlYQtv0WJtLG+6TXkUKoPuYo83tyS5QBaY7ZhSdnjByWExJ8COAK2SUNQi+fTfyIPaVJKMoiTbtMQ/qh4SkcUa7YXOHSH5cNuBpr5fSJ8+0px9UIfEvSYnsGw= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4122.eurprd05.prod.outlook.com (52.134.107.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Wed, 9 May 2018 14:01:04 +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.0735.018; Wed, 9 May 2018 14:01:04 +0000 From: Shahaf Shuler To: Ophir Munk , "dev@dpdk.org" , "Adrien Mazarguil" CC: Thomas Monjalon , Olga Shern Thread-Topic: [PATCH v1] net/mlx4: report on supported RSS hash functions Thread-Index: AQHT5uNO0GbiNqO25EGZ1lJ9KAAOU6QnI9GwgAAnP4CAACNZ0A== Date: Wed, 9 May 2018 14:01:04 +0000 Message-ID: References: <1525794195-25082-1-git-send-email-ophirmu@mellanox.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: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4122; 7:Aw08O870PALG95EOSXniS/N2hktoQmnW7g8T7czGYOXSR0ol/8Pv/cjDqrEfBD2TaqOEOeAgG8+6PBKEcHCk7o4wUxtI8KMTkSZJqokv/mJ06Xz2at2CUAAuNChXL6h9fYCiy/UXFPBFD7TQM/hNC/cbGTOOuC/wKs3BW2FYzRYnoW2DhxHMWsrp22F5bVZMJpJrjRXuEL314xl7gfWF2UDSJCfWkIH/6irj8f0brX8HHriAd7OoePNFOD3ao1mK x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4122; x-ms-traffictypediagnostic: DB7PR05MB4122: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(17755550239193); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DB7PR05MB4122; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4122; x-forefront-prvs: 0667289FF8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(366004)(346002)(396003)(13464003)(189003)(199004)(305945005)(2906002)(3280700002)(55016002)(9686003)(5660300001)(14454004)(53936002)(6246003)(107886003)(6116002)(3846002)(26005)(316002)(33656002)(110136005)(54906003)(3660700001)(446003)(4326008)(74316002)(68736007)(5250100002)(478600001)(486006)(476003)(2501003)(97736004)(25786009)(2900100001)(99286004)(8676002)(6436002)(81166006)(81156014)(229853002)(7736002)(11346002)(7696005)(6506007)(53546011)(76176011)(102836004)(105586002)(106356001)(66066001)(86362001)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4122; 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: UdFmVz9iUMqTiWOILapHUu/nD4AZ0ogeiP/mE9X8EdqGV16NO1OxiersKn/djNFsOipe5LM1V7hVnE1d1ilXuSVPw9mxdVRPMHdGLz45F6EqHiD/EXPAjkmGs+R6+pw1ZSb7hoAMLEX0MaA7OECVwRmJBgI0NRlfmN/0ucJ76IL6JWLO83gcBWlHiuczGcWt 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: 53bc0201-c5d2-4f3e-aab6-08d5b5b54ddd X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53bc0201-c5d2-4f3e-aab6-08d5b5b54ddd X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 14:01:04.1311 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4122 Subject: Re: [dpdk-dev] [PATCH v1] net/mlx4: report on supported RSS hash functions 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: Wed, 09 May 2018 14:01:06 -0000 Wednesday, May 9, 2018 2:54 PM, Ophir Munk: > Subject: RE: [PATCH v1] net/mlx4: report on supported RSS hash functions >=20 > Hi Shahaf, >=20 > > -----Original Message----- > > From: Shahaf Shuler > > Sent: Wednesday, May 09, 2018 12:39 PM > > To: Ophir Munk ; dev@dpdk.org; Adrien > Mazarguil > > > > Cc: Thomas Monjalon ; Olga Shern > > > > Subject: RE: [PATCH v1] net/mlx4: report on supported RSS hash > > functions > > > > Hi Ophir, > > > > Tuesday, May 8, 2018 6:43 PM, Ophir Munk: > > > Subject: [PATCH v1] net/mlx4: report on supported RSS hash functions > > > > > > Report on mlx4 supported RSS functions as part of dev_infos_get > callback. > > > Previous to this commit RSS support was reported as none. Since the > > > introduction of [1] it is required that all RSS configurations will b= e verified. > > > > > > [1] commit 8863a1fbfc66 ("ethdev: add supported hash function > > > check") > > > > > > Signed-off-by: Ophir Munk > > > --- > > > drivers/net/mlx4/mlx4_ethdev.c | 51 > > > ++++++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 51 insertions(+) > > > > > > diff --git a/drivers/net/mlx4/mlx4_ethdev.c > > > b/drivers/net/mlx4/mlx4_ethdev.c index 9a76670..2a1533c 100644 > > > --- a/drivers/net/mlx4/mlx4_ethdev.c > > > +++ b/drivers/net/mlx4/mlx4_ethdev.c > > > @@ -545,6 +545,55 @@ mlx4_mac_addr_set(struct rte_eth_dev *dev, > > struct > > > ether_addr *mac_addr) } > > > > > > /** > > > + * Convert verbs RSS types to their DPDK equivalents. > > > + * > > > + * This function returns a group of RSS dpdk types given their > > > +equivalent group > > > + * of verbs types. > > > + * For example both source IPv4 and destination IPv4 verbs types > > > +are converted > > > + * into their equivalent RSS group types. If each of these verbs > > > +types existed > > > + * exclusively - no conversion would take place. > > > + * > > > + * @param types > > > + * RSS hash types in verbs format > > > + * > > > + * @return > > > + * A valid dpdk RSS hash fields supported by mlx4 (may return 0) > > > + */ > > > +static uint64_t > > > +mlx4_ibv_to_dpdk_rss_types(uint64_t types) { > > > + enum { IPV4, IPV6, TCP, UDP, }; > > > + const uint64_t in[] =3D { > > > + [IPV4] =3D IBV_RX_HASH_SRC_IPV4 | > > > IBV_RX_HASH_DST_IPV4, > > > + [IPV6] =3D IBV_RX_HASH_SRC_IPV6 | > > > IBV_RX_HASH_DST_IPV6, > > > + [TCP] =3D IBV_RX_HASH_SRC_PORT_TCP | > > > IBV_RX_HASH_DST_PORT_TCP, > > > + [UDP] =3D IBV_RX_HASH_SRC_PORT_UDP | > > > IBV_RX_HASH_DST_PORT_UDP, > > > + }; > > > + const uint64_t out[RTE_DIM(in)] =3D { > > > + [IPV4] =3D (ETH_RSS_IPV4 | > > > + ETH_RSS_FRAG_IPV4 | > > > + ETH_RSS_NONFRAG_IPV4_OTHER), > > > + [IPV6] =3D (ETH_RSS_IPV6 | > > > + ETH_RSS_FRAG_IPV6 | > > > + ETH_RSS_NONFRAG_IPV6_OTHER | > > > + ETH_RSS_IPV6_EX), > > > + [TCP] =3D (ETH_RSS_NONFRAG_IPV4_TCP | > > > + ETH_RSS_NONFRAG_IPV6_TCP | > > > + ETH_RSS_IPV6_TCP_EX), > > > + [UDP] =3D (ETH_RSS_NONFRAG_IPV4_UDP | > > > + ETH_RSS_NONFRAG_IPV6_UDP | > > > + ETH_RSS_IPV6_UDP_EX), > > > + }; > > > > Since above are constants, why not defining a global array of structs > > containing the ibv_hash and the equivalent dpdk_hash, instead of > > recreating it for each call? >=20 > The array is recreated because it should have been declared as "static co= nst" > rather than just "const". I prefer this fix. > Alternatively it could have been defined globally outside of the function= as > suggested which would have avoided recreation as well. > All of those claims are confirmed by inspecting the assembly code of the > above alternatives. >=20 > > There is a similar concept on mlx5_flow.c: > > > > /* Initialization data for hash RX queues. */ const struct > > hash_rxq_init hash_rxq_init[] =3D { > > [HASH_RXQ_TCPV4] =3D { > > .hash_fields =3D (IBV_RX_HASH_SRC_IPV4 | > > IBV_RX_HASH_DST_IPV4 | > > IBV_RX_HASH_SRC_PORT_TCP | > > IBV_RX_HASH_DST_PORT_TCP), > > .dpdk_rss_hf =3D ETH_RSS_NONFRAG_IPV4_TCP, > > .flow_priority =3D 0, > > .ip_version =3D MLX5_IPV4, > > }, > > >=20 > I was inspired from "the reversed" function in mlx4_flow.c which defines > constants inside the function as well, see [1]. > To fix the constants recreation both functions should be handled together= . >=20 > I suggest: > 1. Moving mlx4_ibv_to_dpdk_rss_types() function as is from mlx4_ether.c t= o > mlx4_flow.c so it will be adjacent to mlx4_conv_rss_types() function. > 2. Sending a new patch that avoids constants recreation in the 2 function= s. OK. Those can be 2 patches from the same series.=20 >=20 > [1] > uint64_t > mlx4_conv_rss_types(struct priv *priv, uint64_t types) { > enum { IPV4, IPV6, TCP, UDP, }; > const uint64_t in[] =3D { > [IPV4] =3D (ETH_RSS_IPV4 | > ETH_RSS_FRAG_IPV4 | > ETH_RSS_NONFRAG_IPV4_TCP | > ETH_RSS_NONFRAG_IPV4_UDP | > ETH_RSS_NONFRAG_IPV4_OTHER), > [IPV6] =3D (ETH_RSS_IPV6 | > ETH_RSS_FRAG_IPV6 | > ETH_RSS_NONFRAG_IPV6_TCP | > ETH_RSS_NONFRAG_IPV6_UDP | > ETH_RSS_NONFRAG_IPV6_OTHER | > ETH_RSS_IPV6_EX | > ETH_RSS_IPV6_TCP_EX | > ETH_RSS_IPV6_UDP_EX), > [TCP] =3D (ETH_RSS_NONFRAG_IPV4_TCP | > ETH_RSS_NONFRAG_IPV6_TCP | > ETH_RSS_IPV6_TCP_EX), > [UDP] =3D (ETH_RSS_NONFRAG_IPV4_UDP | > ETH_RSS_NONFRAG_IPV6_UDP | > ETH_RSS_IPV6_UDP_EX), > }; > const uint64_t out[RTE_DIM(in)] =3D { > [IPV4] =3D IBV_RX_HASH_SRC_IPV4 | > IBV_RX_HASH_DST_IPV4, > [IPV6] =3D IBV_RX_HASH_SRC_IPV6 | > IBV_RX_HASH_DST_IPV6, > [TCP] =3D IBV_RX_HASH_SRC_PORT_TCP | > IBV_RX_HASH_DST_PORT_TCP, > [UDP] =3D IBV_RX_HASH_SRC_PORT_UDP | > IBV_RX_HASH_DST_PORT_UDP, > }; > uint64_t seen =3D 0; > uint64_t conv =3D 0; > unsigned int i; >=20 > if (types =3D=3D (uint64_t)-1) > return priv->hw_rss_sup; > for (i =3D 0; i !=3D RTE_DIM(in); ++i) > if (types & in[i]) { > seen |=3D types & in[i]; > conv |=3D out[i]; > } > if ((conv & priv->hw_rss_sup) =3D=3D conv && !(types & ~seen)) > return conv; > rte_errno =3D ENOTSUP; > return (uint64_t)-1; > } >=20 > > > + uint64_t conv =3D 0; > > > + unsigned int i; > > > + > > > + for (i =3D 0; i !=3D RTE_DIM(in); ++i) > > > + if ((types & in[i]) =3D=3D in[i]) > > > + conv |=3D out[i]; > > > + return conv; > > > +} > > > + > > > +/** > > > * DPDK callback to get information about the device. > > > * > > > * @param dev > > > @@ -587,6 +636,8 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, > > struct > > > rte_eth_dev_info *info) > > > ETH_LINK_SPEED_20G | > > > ETH_LINK_SPEED_40G | > > > ETH_LINK_SPEED_56G; > > > + info->flow_type_rss_offloads =3D mlx4_ibv_to_dpdk_rss_types( > > > + priv->hw_rss_sup); > > > } > > > > > > /** > > > -- > > > 2.7.4