From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0068.outbound.protection.outlook.com [104.47.0.68]) by dpdk.org (Postfix) with ESMTP id 99EAE1B77C for ; Thu, 10 May 2018 00:42:21 +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=CLiwphSfFcwFzWJMvvVWos1rsnkw0B2lSiHlWj8FwOo=; b=Ry3355Ufdim2ga/TbGiI4EnURsCPiKayRdpErC2JoTF/pCvnCrkaR+KWNKC2LYURd+XBgEfGh+5PMq3HBj2oZ5h3Kyk4LRPvVrJanovqT46MxXi6cSOP/WcpVZKHE+AlJkhXnvFDjdKANpJACmqjR8xjTCxZJCqGmmKP7TD0xcE= Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com (10.168.34.19) by HE1PR0501MB2634.eurprd05.prod.outlook.com (10.172.130.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.18; Wed, 9 May 2018 22:42:19 +0000 Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::1071:70d0:eac1:5d97]) by HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::1071:70d0:eac1:5d97%18]) with mapi id 15.20.0735.021; Wed, 9 May 2018 22:42:19 +0000 From: Ophir Munk To: Shahaf Shuler , "dev@dpdk.org" , Adrien Mazarguil CC: Thomas Monjalon , Olga Shern Thread-Topic: [PATCH v1] net/mlx4: report on supported RSS hash functions Thread-Index: AQHT5uNOIKWeHgXiR0+3ApeEKi2E8KQnJVAAgAAZ8fCAAC9OAIAAkYOg Date: Wed, 9 May 2018 22:42:19 +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=ophirmu@mellanox.com; x-originating-ip: [85.250.111.138] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0501MB2634; 7:2sIFdmoi1Wj6G4TN2iNbvARTldPhJ7Q++vgeyOuCkw8RPCrQIXzLPmP8C20tArdszoGAjF5d8nVD1icfc681V9qGF2X+5hCm7fz4cV0xJM+wS6jgv7pleFbARp4d+0f7VSmigu8ACQs8r6uLjsAfX+fv0o6Hre0VSfLGS08fJe0UwTirX4SrBVDO/CENIvVj8Ne2+R9APKgaCDYHSs2a3mTXUPcI/o68rKpwKtdfECdciBs9sA+22jXqm5ORa710 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:HE1PR0501MB2634; x-ms-traffictypediagnostic: HE1PR0501MB2634: 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)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0501MB2634; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2634; x-forefront-prvs: 0667289FF8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39380400002)(39860400002)(366004)(376002)(13464003)(189003)(199004)(54906003)(33656002)(99286004)(110136005)(6506007)(76176011)(8676002)(7696005)(66066001)(97736004)(105586002)(26005)(102836004)(53546011)(106356001)(478600001)(81166006)(93886005)(316002)(81156014)(14454004)(7736002)(4326008)(8936002)(9686003)(25786009)(107886003)(55016002)(486006)(5250100002)(2906002)(3280700002)(68736007)(74316002)(3846002)(6116002)(3660700001)(2501003)(446003)(476003)(305945005)(229853002)(6436002)(5660300001)(86362001)(2900100001)(6246003)(53936002)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2634; H:HE1PR0501MB2314.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: VWXA5ajwLwt5vdLiytzHQ17Cj0JTncrG9uwqkGDib+al18dSMDt/gWtx7pwir6QE95CDcvJ629aa8C6Sz8FR/ht6G908HPcR5TKfZIo+cnxTQSc7GnAuZQrooPmRI9mDAyjtqCupkDvmLk+XgR2Y/sPrwQHLr00greecb2spxNp3d3ecvmJf0vhtqs7l2ND3 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: 6d6b7a6f-ff7c-42a7-14aa-08d5b5fe1f44 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d6b7a6f-ff7c-42a7-14aa-08d5b5fe1f44 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 22:42:19.2263 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2634 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 22:42:21 -0000 Hi, PATCH v2 was sent > -----Original Message----- > From: Shahaf Shuler > Sent: Wednesday, May 09, 2018 5:01 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 >=20 > Wednesday, May 9, 2018 2:54 PM, Ophir Munk: > > Subject: RE: [PATCH v1] net/mlx4: report on supported RSS hash > > functions > > > > Hi Shahaf, > > > > > -----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 be > 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? > > > > The array is recreated because it should have been declared as "static > const" > > 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. > > > > > 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, > > > }, > > > > > > > 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 togeth= er. > > > > I suggest: > > 1. Moving mlx4_ibv_to_dpdk_rss_types() function as is from > > mlx4_ether.c to 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 functi= ons. >=20 > OK. Those can be 2 patches from the same series. >=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; > > > > 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; > > } > > > > > > + 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