From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50040.outbound.protection.outlook.com [40.107.5.40]) by dpdk.org (Postfix) with ESMTP id 7066B23D for ; Sat, 3 Nov 2018 16:48:45 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=1yxDVTP9ZQxaU2ItjBLSUo4qZIygnkuLE02f83QXSR0=; b=v/OpKOMTU6jOWR+Z7voaMBR8DXMYwZRTkPV698T5zvhafUJgUW4vpccQd2179PG0Eg+HHql2ZlNAwBAQN62YWXYsv8bxk/Dw+yTQzDRRdq0z1eUSePnai1IHXLyTbAwEFeA7H8C2jvSsgMkdxfUtD3uaLVG3UllGsy5GNgdFtj4= Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com (52.134.8.154) by VI1PR0502MB2959.eurprd05.prod.outlook.com (10.175.21.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Sat, 3 Nov 2018 15:48:43 +0000 Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::84d3:8812:d45c:98e4]) by VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::84d3:8812:d45c:98e4%4]) with mapi id 15.20.1294.028; Sat, 3 Nov 2018 15:48:43 +0000 From: Ophir Munk To: Yongseok Koh , "dev@dpdk.org" CC: Asaf Penso , Shahaf Shuler , Thomas Monjalon , Olga Shern , Ophir Munk Thread-Topic: [PATCH v3] net/mlx5: set RSS key to NULL to indicate default RSS Thread-Index: AQHUc4yybSXrBwb0EEaYfTbPkDcYxw== Date: Sat, 3 Nov 2018 15:48:43 +0000 Message-ID: <1541260115-4368-1-git-send-email-ophirmu@mellanox.com> References: <1541062744-25491-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1541062744-25491-1-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: CWLP123CA0112.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:5f::28) To VI1PR0502MB3743.eurprd05.prod.outlook.com (2603:10a6:803:11::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0502MB2959; 6:rIepARn1scVXSfXD4+Hna0o2lfHgBZOd95Q5m8y4U3NgyNtDNWfCZpEJzuO7f1cTiqAh/kjqPBHYpXZ6F8cocWKJ9gzuCNtjY048qhfEnbVl1QbwRoohAIqMjCziSoVkqBIyKiPX9GLcriXWuZKYG2RUKQzhCEOaGXzTU5X6Qriid62Oq/xZw/SDyDAYe0zXe384GP2E0eeEA0Rw8E29EW1a6jLC8CW5MLgtZJ6IT2M0ImZFrd/NNnRCi+6kRwIctgh81IU2fyhyoiXwzvQvnOk2Sf1ZYX3/T2e5UELQn0CEVjJSqi7qzt92Thw9DajxDQJ7V2N3BbSUIzzBPdubDHQJQDNB2VLkRvJZKRU84anElTeuPzLH+wcG3nmleTrmbdOAgIlEVQ/YEDYetZzd0Bz2wp1cwZwlixN0yYxYp8Tnbty90WpbHKbmiVxQBl/aAvpgSjvljuKpuosEQQPt0Q==; 5:9ibD3UcX/a8kqXOSfNd/zAKVRKR1iN1jqffC8TtFZVU4/wFwJ65p7AW7Cp37Kg4DmLYv2UszaX6wJaSDlSf9dhIv28M1OMkAkriLibK5UnYDkr1I0z8zTkTjhGDvdAFG8YCW1nqBou9gyjFkrnot4MG14AGT8BA/lxpSJqSGZXc=; 7:eYAhUK1Ohk9SBRDs0gUk5yHk21XjrllNj+krJr4InoIEhqvdlPgMya/acyUylAz7CJKfXAKK2n9/BMujlNfwKe5UHLxg2qUCfK0/sDehOrrhpkp4Jt5csOZFukajY4f+z/+NsIlcu1cZZtw5iRbzfw== x-ms-office365-filtering-correlation-id: 81ad2c68-c7eb-4c0d-6955-08d641a3d54e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VI1PR0502MB2959; x-ms-traffictypediagnostic: VI1PR0502MB2959: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:VI1PR0502MB2959; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB2959; x-forefront-prvs: 08457955C4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(53936002)(3846002)(5660300001)(8936002)(486006)(106356001)(71190400001)(71200400001)(86362001)(6436002)(105586002)(6116002)(66066001)(14454004)(81166006)(81156014)(316002)(8676002)(110136005)(54906003)(6486002)(478600001)(68736007)(2906002)(6506007)(386003)(102836004)(76176011)(97736004)(26005)(7736002)(4326008)(256004)(186003)(107886003)(6512007)(25786009)(11346002)(305945005)(36756003)(99286004)(446003)(2900100001)(52116002)(2501003)(476003)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB2959; H:VI1PR0502MB3743.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9fxvLfL0wOwoOEZZt3d3xsPCv2SMmmIlAxwNfK9DTdjitbYxdUlMDTHQl0kP+bwrPMecf6DUwFrIHLvfuiBsxNaxb4wCpvmCOJvH1o9Lvj/UNnVBDl9MjCaamDUoj2N7O28Pp6KE4lVd1lfafzrQtwX93cT4T9QTolD8rfAXrfhHnM8Mzs6m2YrXt0r/qTVuo1WReToZUfTHfZUmosmQuR0L4T0b29fd/QvqGb/yvkvUW6YtoUqTk1C1xXyI63oJeMy1SBlJtgojegIDCRv20nOa7UcAeEIC0cG+RYx3vR+9FeSK40c5mc+t+aMBFaoIwYGR2/TlWD/U/t8+xpUWvlheQKsNrphjORbmU8Nr1Ug= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81ad2c68-c7eb-4c0d-6955-08d641a3d54e X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Nov 2018 15:48:43.6164 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB2959 Subject: [dpdk-dev] [PATCH v3] net/mlx5: set RSS key to NULL to indicate default RSS 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: Sat, 03 Nov 2018 15:48:45 -0000 Applications which add RSS rules must supply an RSS key and length. If an application is only interested in default RSS operation it should not care about the exact RSS key. By setting the key to NULL - the PMD will use the default RSS key. In addition if the application does not care about the RSS type it can set it to 0 and the PMD will use the default type (ETH_RSS_IP). Signed-off-by: Ophir Munk --- v1: Initial release v2, v3: Rebase + following code review doc/guides/nics/mlx5.rst | 1 + drivers/net/mlx5/mlx5_flow.c | 4 ++-- drivers/net/mlx5/mlx5_flow_dv.c | 7 +++++-- drivers/net/mlx5/mlx5_flow_verbs.c | 8 ++++++-- drivers/net/mlx5/mlx5_rxq.c | 18 ++++-------------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 1dc3282..0303152 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -54,6 +54,7 @@ Features - Support for scattered TX and RX frames. - IPv4, IPv6, TCPv4, TCPv6, UDPv4 and UDPv6 RSS on any number of queues. - Several RSS hash keys, one for each flow type. +- Default RSS operation with no hash key specification. - Configurable RETA table. - Support for multiple MAC addresses. - VLAN filtering. diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 107a4f0..677d2c4 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -912,12 +912,12 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev= *dev, int32_t priority, RTE_FLOW_ERROR_TYPE_ACTION_CONF, &rss->level, "tunnel RSS is not supported"); - if (rss->key_len < MLX5_RSS_HASH_KEY_LEN) + if (rss->key && rss->key_len < MLX5_RSS_HASH_KEY_LEN) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, &rss->key_len, "RSS hash key too small"); - if (rss->key_len > MLX5_RSS_HASH_KEY_LEN) + if (rss->key && rss->key_len > MLX5_RSS_HASH_KEY_LEN) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, &rss->key_len, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_d= v.c index c11ecd4..cdf3377 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1758,8 +1758,11 @@ memcpy((*flow->queue), rss->queue, rss->queue_num * sizeof(uint16_t)); flow->rss.queue_num =3D rss->queue_num; - memcpy(flow->key, rss->key, MLX5_RSS_HASH_KEY_LEN); - flow->rss.types =3D rss->types; + /* NULL RSS key indicates default RSS key. */ + rss_key =3D !rss->key ? rss_hash_default_key : rss->key; + memcpy(flow->key, rss_key, MLX5_RSS_HASH_KEY_LEN); + /* RSS type 0 indicates default RSS type ETH_RSS_IP. */ + flow->rss.types =3D !rss->types ? ETH_RSS_IP : rss->types; flow->rss.level =3D rss->level; /* Added to array only in apply since we need the QP */ flow->actions |=3D MLX5_FLOW_ACTION_RSS; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flo= w_verbs.c index 2e506b9..54ac620 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -925,14 +925,18 @@ struct mlx5_flow *dev_flow) { const struct rte_flow_action_rss *rss =3D action->conf; + const uint8_t *rss_key; struct rte_flow *flow =3D dev_flow->flow; =20 if (flow->queue) memcpy((*flow->queue), rss->queue, rss->queue_num * sizeof(uint16_t)); flow->rss.queue_num =3D rss->queue_num; - memcpy(flow->key, rss->key, MLX5_RSS_HASH_KEY_LEN); - flow->rss.types =3D rss->types; + /* NULL RSS key indicates default RSS key. */ + rss_key =3D !rss->key ? rss_hash_default_key : rss->key; + memcpy(flow->key, rss_key, MLX5_RSS_HASH_KEY_LEN); + /* RSS type 0 indicates default RSS type (ETH_RSS_IP). */ + flow->rss.types =3D !rss->types ? ETH_RSS_IP : rss->types; flow->rss.level =3D rss->level; *action_flags |=3D MLX5_FLOW_ACTION_RSS; } diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 6df8997..eef4850 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1794,10 +1794,6 @@ struct mlx5_hrxq * rte_errno =3D ENOMEM; return NULL; } - if (!rss_key_len) { - rss_key_len =3D MLX5_RSS_HASH_KEY_LEN; - rss_key =3D rss_hash_default_key; - } #ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT if (tunnel) { qp_init_attr.comp_mask =3D @@ -1823,11 +1819,8 @@ struct mlx5_hrxq * IBV_QP_INIT_ATTR_RX_HASH, .rx_hash_conf =3D (struct ibv_rx_hash_conf){ .rx_hash_function =3D IBV_RX_HASH_FUNC_TOEPLITZ, - .rx_hash_key_len =3D rss_key_len ? rss_key_len : - MLX5_RSS_HASH_KEY_LEN, - .rx_hash_key =3D rss_key ? - (void *)(uintptr_t)rss_key : - rss_hash_default_key, + .rx_hash_key_len =3D rss_key_len, + .rx_hash_key =3D (void *)(uintptr_t)rss_key, .rx_hash_fields_mask =3D hash_fields, }, .rwq_ind_tbl =3D ind_tbl->ind_table, @@ -1845,11 +1838,8 @@ struct mlx5_hrxq * IBV_QP_INIT_ATTR_RX_HASH, .rx_hash_conf =3D (struct ibv_rx_hash_conf){ .rx_hash_function =3D IBV_RX_HASH_FUNC_TOEPLITZ, - .rx_hash_key_len =3D rss_key_len ? rss_key_len : - MLX5_RSS_HASH_KEY_LEN, - .rx_hash_key =3D rss_key ? - (void *)(uintptr_t)rss_key : - rss_hash_default_key, + .rx_hash_key_len =3D rss_key_len, + .rx_hash_key =3D (void *)(uintptr_t)rss_key, .rx_hash_fields_mask =3D hash_fields, }, .rwq_ind_tbl =3D ind_tbl->ind_table, --=20 1.8.3.1