From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0063.outbound.protection.outlook.com [104.47.1.63]) by dpdk.org (Postfix) with ESMTP id 6C465AAEA for ; Wed, 9 May 2018 11:38:56 +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=HdvQhwTXmgab39L7Y6BJIrqwOiKIHzvCiyshC2yuHb4=; b=Gw9VcGMjBkasJyiPa65wcZGafKe7F0KpdyBMoj8U1MS1SbGWQsgOp271p/JfQazWW7Ry8LFVKYo8RUpU2EBmdUJhOxzsuC24D8F5miJmq9gjnVEepX7AKptVlKgrluKM9Y/qgeG3aJ2FgLLaQH/JkSeTaFB3IWjRP+LY+5FgcZA= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4235.eurprd05.prod.outlook.com (52.134.108.16) 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 09:38:55 +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 09:38:55 +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: AQHT5uNO0GbiNqO25EGZ1lJ9KAAOU6QnI9Gw Date: Wed, 9 May 2018 09:38:54 +0000 Message-ID: References: <1525794195-25082-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1525794195-25082-1-git-send-email-ophirmu@mellanox.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: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4235; 7:QRfX3Sg0M70ycW4+wZafkb92LkdjkPhIsQIXQfY5fjI+O80G7s+1Uqua6a25YP19lC6VUD8JRSfx9FL3llGb3YXMCXZiM/T0/XSPZxL0VD4pWaHwrV3V6sF1+VlYC3/CPk1RKpZPN/3IbZTVV3xRoP7CZTsaktR3GinPy5fe3eiRG1AESdoGfFv5pb3TRWrS2UuAvdKXZLGTDtVOL3fjF6B0UN/01nf/M94fnxTQfRUec7+wP0tDzKAGNUoY96d2 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:DB7PR05MB4235; x-ms-traffictypediagnostic: DB7PR05MB4235: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:DB7PR05MB4235; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4235; x-forefront-prvs: 0667289FF8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(39380400002)(376002)(39860400002)(346002)(189003)(199004)(476003)(6436002)(33656002)(26005)(229853002)(6246003)(6506007)(81156014)(5250100002)(2906002)(25786009)(446003)(102836004)(478600001)(305945005)(11346002)(55016002)(2501003)(8676002)(8936002)(81166006)(14454004)(3660700001)(3280700002)(7736002)(9686003)(66066001)(74316002)(86362001)(107886003)(68736007)(97736004)(2900100001)(4326008)(3846002)(316002)(53936002)(99286004)(486006)(110136005)(6116002)(5660300001)(105586002)(7696005)(106356001)(76176011)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4235; 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: 2ZsiFsVLVKhJDO1xvGVnUrHGRNLFnglkU88+3C9fB6aOH4vQuKlT23sdlSQ39EexXVuWlBaK4s/br3t1KytKLec9b10Wb6oNMTHdKGBCEEldFBiqpDGl54gaNk2ePg9lOfWQjCXzr4U7ZOwf6EXm3NSLJTyAaPGo9lXoVT8X1HT2cUcnTudMP/atxNvjQCIO 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: 1111a99c-c41e-49b3-94af-08d5b590ae8c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1111a99c-c41e-49b3-94af-08d5b590ae8c X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 09:38:54.9441 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4235 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 09:38:56 -0000 Hi Ophir, Tuesday, May 8, 2018 6:43 PM, Ophir Munk: > Subject: [PATCH v1] net/mlx4: report on supported RSS hash functions >=20 > 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 ve= rified. >=20 > [1] commit 8863a1fbfc66 ("ethdev: add supported hash function check") >=20 > Signed-off-by: Ophir Munk > --- > drivers/net/mlx4/mlx4_ethdev.c | 51 > ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) >=20 > 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) } >=20 > /** > + * 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 conta= ining the ibv_hash and the equivalent dpdk_hash, instead of recreating it f= or each call?=20 There is a similar concept on mlx5_flow.c: /* Initialization data for hash RX queues. */ =20 const struct hash_rxq_init hash_rxq_init[] =3D { =20 [HASH_RXQ_TCPV4] =3D { =20 .hash_fields =3D (IBV_RX_HASH_SRC_IPV4 | =20 IBV_RX_HASH_DST_IPV4 | =20 IBV_RX_HASH_SRC_PORT_TCP |=20 IBV_RX_HASH_DST_PORT_TCP),=20 .dpdk_rss_hf =3D ETH_RSS_NONFRAG_IPV4_TCP, =20 .flow_priority =3D 0, =20 .ip_version =3D MLX5_IPV4, =20 }, =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); > } >=20 > /** > -- > 2.7.4