From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20059.outbound.protection.outlook.com [40.107.2.59]) by dpdk.org (Postfix) with ESMTP id 5A50B1B8DB for ; Thu, 10 May 2018 07:20:08 +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=KSjFPj3nNZiaK5da478a8okCeMJCL2jl514UvdduXCo=; b=wdKTm4vY1xaIXlBc6g83As1MzuZXXwetkjK2wThB+ER2L+1XNfSboWa87YLBJPoxercqw+rG9e5fXSJ4ZUCO7q252A5U2cL2aDJTrBkCVpYX0A2U1mYrNsDie5ZFSLpRFQDATM75bVtm8jwrw+u2zHxnXJJBT8PznTakNoD9jfQ= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4412.eurprd05.prod.outlook.com (52.134.109.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.18; Thu, 10 May 2018 05:20:06 +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.021; Thu, 10 May 2018 05:20:06 +0000 From: Shahaf Shuler To: Ophir Munk , "dev@dpdk.org" , "Adrien Mazarguil" CC: Thomas Monjalon , Olga Shern Thread-Topic: [PATCH v2 1/2] net/mlx4: advertise supported RSS hash functions Thread-Index: AQHT5+ThZ4QftxruR065VYSkSwd18KQobBoA Date: Thu, 10 May 2018 05:20:06 +0000 Message-ID: References: <1525794195-25082-1-git-send-email-ophirmu@mellanox.com> <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4412; 7:AX1ocVlJvAKKV+L2iI9eNYCGoyB8MUU2AHKgxRLzV9Xq4IA+MAVUXKkR7y7FAynSnPJoLDANwwWJd2TRweBWw964cJE3gYJx5dXHoQk+ceHUPWSNcs7THlmJP7dFhNy4I6lJa+5xGVh3VTOTfboXgT8bFsQrFYizuvSEC3Uiz9tmBUiMoMPm8RlPHAABFOkt416fHhNYAkXOl9wwGab61L68/eIxf8IcfaJ8VMPBf9d22FVHUw3b6+z7qLO0DWTf 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:DB7PR05MB4412; x-ms-traffictypediagnostic: DB7PR05MB4412: 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)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DB7PR05MB4412; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4412; x-forefront-prvs: 066898046A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(366004)(39860400002)(396003)(189003)(199004)(6436002)(8676002)(74316002)(86362001)(5660300001)(3846002)(14454004)(7736002)(107886003)(3280700002)(3660700001)(105586002)(2906002)(229853002)(106356001)(478600001)(6116002)(6246003)(99286004)(2900100001)(81156014)(2501003)(8936002)(6346003)(5250100002)(316002)(25786009)(446003)(66066001)(33656002)(305945005)(11346002)(81166006)(97736004)(7696005)(476003)(68736007)(486006)(110136005)(6506007)(53936002)(26005)(4326008)(102836004)(76176011)(55016002)(9686003)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4412; 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-microsoft-antispam-message-info: JtBHmBw5xLN9KHIEJdEzHWXHJnS28RvaFpppwdYh8AzCeqHAwPo9JJftBh/+GO/UW8bojLhVfCD/Cbb1G3nMKQfjT5aE7A4PyG8Y3pRJyr05eC45k0Q2bt081P/dIbvl2esMqnBaQdTnpeLM2qWx6RNzJA5tLIZTaR3PEfLNjjnEgxWW5wvZwaD3e7LxuV1M 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: 6b613533-3c7a-48ad-457b-08d5b635b101 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b613533-3c7a-48ad-457b-08d5b635b101 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2018 05:20:06.0715 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4412 Subject: Re: [dpdk-dev] [PATCH v2 1/2] net/mlx4: advertise 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: Thu, 10 May 2018 05:20:08 -0000 Hi Ophir,=20 Thursday, May 10, 2018 1:27 AM, Ophir Munk: > Subject: [PATCH v2 1/2] net/mlx4: advertise supported RSS hash functions >=20 > Advertise 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 > --- > v1: > Initial release > v2: > Split into 2 commits following reviews >=20 > drivers/net/mlx4/mlx4_ethdev.c | 3 +++ > drivers/net/mlx4/mlx4_flow.c | 49 > ++++++++++++++++++++++++++++++++++++++++++ > drivers/net/mlx4/mlx4_flow.h | 1 + > 3 files changed, 53 insertions(+) >=20 > diff --git a/drivers/net/mlx4/mlx4_ethdev.c > b/drivers/net/mlx4/mlx4_ethdev.c index 9a76670..8fbb781 100644 > --- a/drivers/net/mlx4/mlx4_ethdev.c > +++ b/drivers/net/mlx4/mlx4_ethdev.c > @@ -544,6 +544,7 @@ mlx4_mac_addr_set(struct rte_eth_dev *dev, struct > ether_addr *mac_addr) > return mlx4_mac_addr_add(dev, mac_addr, 0, 0); } >=20 > + Remove this extra line.=20 > /** > * DPDK callback to get information about the device. > * > @@ -587,6 +588,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( I think better to ident mlx4_ibv_to_dpdk_rss_types to the line below along = with hw_rss_sup=20 > + priv->hw_rss_sup); > } >=20 > /** > diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c > index 397a150..41dac16 100644 > --- a/drivers/net/mlx4/mlx4_flow.c > +++ b/drivers/net/mlx4/mlx4_flow.c > @@ -134,6 +134,55 @@ mlx4_conv_rss_types(struct priv *priv, uint64_t > types) } >=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 Missing period > + * > + * @return > + * A valid dpdk RSS hash fields supported by mlx4 (may return 0) DPDK RSS hash fields supported by mlx4. is enough.=20 > + */ > +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), > + }; > + 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]) There is an issue with this logic. Sorry for not noticing in the previous v= ersion.=20 Let's say the caps report support for only UDP, no IP. On the logic above i= t will report both=20 ETH_RSS_NONFRAG_IPV4_UDP ETH_RSS_NONFRAG_IPV6_UDP It looks like for the L4 to be valid RSS hash it needs the l3 to be valid.= =20 > + conv |=3D out[i]; > + return conv; > +} > + > +/** > * Merge Ethernet pattern item into flow rule handle. > * > * Additional mlx4-specific constraints on supported fields: > diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h > index 2c8dff3..ec990df 100644 > --- a/drivers/net/mlx4/mlx4_flow.h > +++ b/drivers/net/mlx4/mlx4_flow.h > @@ -49,6 +49,7 @@ struct rte_flow { > /* mlx4_flow.c */ >=20 > uint64_t mlx4_conv_rss_types(struct priv *priv, uint64_t rss_hf); > +uint64_t mlx4_ibv_to_dpdk_rss_types(uint64_t ibv_rss_types); > int mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error); vo= id > mlx4_flow_clean(struct priv *priv); int mlx4_filter_ctrl(struct rte_eth_= dev > *dev, > -- > 2.7.4