From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0046.outbound.protection.outlook.com [104.47.0.46]) by dpdk.org (Postfix) with ESMTP id C398C7CFF for ; Thu, 10 May 2018 00:27:14 +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=uGi/6QYlNWMtfEPvfW+ERMV5zQI63Sa6gKYqmbYNlSo=; b=D05yxxEe5Ij0L+kHRE7LSySXTDjZ0Ho3iTFBZZbBosjYDiOenKaU0bMzyfkzVdfyH2dcDYfKegwNVR/1TSBkc5bkB1986dhImvt0cvt+VKgSL9VUqKNrR4OvNvJvPnk/Y73t4bsx8RBRBu0YxiX5PpEf4VVbKNiSgzwghVnlXW8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0501MB2320.eurprd05.prod.outlook.com (2603:10a6:800:2c::21) 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:27:12 +0000 From: Ophir Munk To: dev@dpdk.org, Adrien Mazarguil Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler Date: Wed, 9 May 2018 22:27:00 +0000 Message-Id: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525794195-25082-1-git-send-email-ophirmu@mellanox.com> References: <1525794195-25082-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1P194CA0028.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::17) To VI1PR0501MB2320.eurprd05.prod.outlook.com (2603:10a6:800:2c::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2320; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2320; 3:kdHqL5mTU3j3B3bHgP+S5tLgoBnciQky8shkLpK2iQNhDQLH0u+rGdTAFCXOslSw0Ux6amzKJYF3UmWduAJBbOv9evA9Uup2j2vBzRalgjzcE+n66lIUH5Craid0aRh3Hh/zRDzNNCKoUT3O5dR4Ss4KATlzLzibFTtNSioXLCEGKx14iwk48AXS4Ij4kgvyQ499aOLBDCQ7GYhPKS4K4Pf3su/IZrv3CMPP9EW1tB9l3GGS86D4uEh1yiR1imcD; 25:lJ4R7kLuR+0mvWWoL0r6cnkwkqs7JuIFLSu+KWj4NJ6Bz0JXy8998SU5zatxY9TgZwIqnrcgnuzIRc8SMvEeYHiC2N6WAb5RHK/XGRqhd5z/uL9/TRhU/Vyk2nar95p+a9TgwOvsDW1D0rbduJdsfIAg6tZfKmxguX59srD2dUP6ZXn7dL53icpqXFCODQlwhkTbeLJYtZ0PNLwBfWDrdluGcJbMZBJtqSbFs0coDd7Buvsl/c4Ky8Y5ubLp4A3ykPvEoa8AynxXjZeiPlpc1Hvf1+0UkdolZyOQEj+kLO3JYr7+uVG6fkeys0tuLL/u83U6N+446PyxNP/JNPjE1Q==; 31:Z2POw3AL1li/s3LKEz/U+SUxnVI8En36mBCbH2Y7YI7uYgJUmEmm/lDTmZt3KGFrfl4UtCSgtXTJ6COrz+nEcBQK7/rG2jwartngKq8rZMw95x7oolNDw2+7/6Locqhkt+bl23Z6aVi07hoqNMRqnSmavNaycXDJBxC4aYmheZ+mGlIdpQqXPymoPsMw+ajWzlx3yzRZcLqWh81hzwllo2eol/LoItdUIge27iOHp+g= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2320: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2320; 20:g9Hd1GsWpOk7PQi0VYMwC2Bv4/ovZtG5qDHUg04G7SKe15qGztjcNbqElccPoiHJe+XVBrtOt/JqvHfWN5RanaeZg6ux/ysKavMu1Vj3ND2m1QIXctxxXY+HZswg3Juv0XbMAVbAbT2HPAWdvdMpc5DsnX3N73swg4mSH6WZ8bNf9k6YXhE46vYxk1ZnONJwi5IqS3NBN/+46kdcJvqx50U+0RpoVEo2VzzAolF4kM0tdTjYZmTXFQlG70nnQEFAV1y/owMVdDzwo1DHp8tYTczVILqWBCUv7euimHBNa3X/uoeca6bBV55wJ4s7Z/LOFsD0P/2gsWz8cGgwh0IINOLrWC++OkM3/gDpr/AM/SYHD50XAU+oSqjpuLe58PkS/z403V1ix201WfxDyRhl6HnNkSQGlwCkYmqqO+YW+aS5okJJ05/vFR3I2o+wv9SscFXgRjkTQQ1SR9TqT208OUQxu85eGXXOH/JCRXhulSfngQ8u87vQbgDQklo/AQ9K; 4:6wXMlGSZ5W+Yjir5xxvzX1vy7VpRx4T1as+0Xnenn+5ERiADoSGYFANB95XbTB49SnlBwQrm79tR69p0YuGyjnb1wDor3fkDsTJtUwcSsb2qjVphZ9FAvd66DdBQAi5WtG8GLIDRzWkGfRRyxzhYglry1CaXrTdHPBU64WyC5pVpFQQl1QOTzTjemrnvg98tHNeQxcwn838WW/7LbcRff0FbL0FSGYN57zti7JC+Y8VfxfhxQ2IZsxUVWL7NmiMDeu+FUR10X0WWYCT/yf20rA== 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)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR0501MB2320; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2320; X-Forefront-PRVS: 0667289FF8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(366004)(39860400002)(396003)(199004)(189003)(51416003)(25786009)(21086003)(47776003)(69596002)(76176011)(97736004)(52116002)(7696005)(956004)(105586002)(26005)(66066001)(2616005)(106356001)(486006)(386003)(16526019)(6116002)(55016002)(446003)(4326008)(186003)(476003)(107886003)(11346002)(68736007)(86362001)(53936002)(3846002)(81156014)(81166006)(8676002)(36756003)(16586007)(316002)(50226002)(478600001)(2906002)(50466002)(54906003)(8936002)(48376002)(4720700003)(305945005)(33026002)(5660300001)(6916009)(6666003)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2320; H:mellanox.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-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2320; 23:vXSJLr/CGe7R8mZcTGknRfosHXSTxbRAxQwhIl4?= =?us-ascii?Q?YuGjmuewpHxLBgm/yfCYNjwy0qMEm2KrGMOjcmERl+L3Vndo7LGvzXOFijbS?= =?us-ascii?Q?NSCmWrxq7Cr8nQsNobDE6mMCkOqmK2BBCwxrzKAgWrbgsbWIu8wwAQ+yTLJO?= =?us-ascii?Q?fXzUMQO4WR60RnUetbFWTry9W9CrHfHoACJk0EaH8f7nyNzNCREKDQmNGHc/?= =?us-ascii?Q?qkew/pMVLK+7o7kJuiUyqTe7WDfO7qiYG5QjOdbHyXANMfSs62/sczQt9sd+?= =?us-ascii?Q?ZAtHtKFcVEMmmC0DpSnBLW/Gd/qLIBHErTfcURVY1M6R9TvEpqGZfE6QLkrv?= =?us-ascii?Q?3Ziv4GncYd1tHsjSh1HTdIvC79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h/p5tVXBCMrKtH6dTDSvy/LGirp17h+XAd6U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2320; 7:HvknQvIBH6vKE5gG8bmFiIKZbyA4v/rccxoXzSCgVQTsRQQe4P40nxJUSvhe8icqbKTSQlfZlNr/FXTJpex2KwL2rHKhuJNEKbdTSA0lnF7/9zl0+vDUpJ7PJqfZXHGv3mbd2nFPXpjF001gMT2c6g3fF4Ey8D2ypEj987kBvkH+OVaXDGDfE2nCeEZ4IeqV5RC3ADbei7b4RgN9wlyRWfSC1+xwMoWJLywCMYuXBniSSA4+JweyIce4caE/Q1uY X-MS-Office365-Filtering-Correlation-Id: 76bac24f-4a6e-4b3b-383d-08d5b5fc0321 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2018 22:27:12.3094 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76bac24f-4a6e-4b3b-383d-08d5b5fc0321 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2320 Subject: [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: Wed, 09 May 2018 22:27:15 -0000 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 verified. [1] commit 8863a1fbfc66 ("ethdev: add supported hash function check") Signed-off-by: Ophir Munk --- v1: Initial release v2: Split into 2 commits following reviews 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(+) 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); } + /** * 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 = mlx4_ibv_to_dpdk_rss_types( + priv->hw_rss_sup); } /** 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) } /** + * 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) + */ +uint64_t +mlx4_ibv_to_dpdk_rss_types(uint64_t types) +{ + enum { IPV4, IPV6, TCP, UDP, }; + const uint64_t in[] = { + [IPV4] = IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4, + [IPV6] = IBV_RX_HASH_SRC_IPV6 | IBV_RX_HASH_DST_IPV6, + [TCP] = IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP, + [UDP] = IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP, + }; + const uint64_t out[RTE_DIM(in)] = { + [IPV4] = (ETH_RSS_IPV4 | + ETH_RSS_FRAG_IPV4 | + ETH_RSS_NONFRAG_IPV4_OTHER), + [IPV6] = (ETH_RSS_IPV6 | + ETH_RSS_FRAG_IPV6 | + ETH_RSS_NONFRAG_IPV6_OTHER | + ETH_RSS_IPV6_EX), + [TCP] = (ETH_RSS_NONFRAG_IPV4_TCP | + ETH_RSS_NONFRAG_IPV6_TCP | + ETH_RSS_IPV6_TCP_EX), + [UDP] = (ETH_RSS_NONFRAG_IPV4_UDP | + ETH_RSS_NONFRAG_IPV6_UDP | + ETH_RSS_IPV6_UDP_EX), + }; + uint64_t conv = 0; + unsigned int i; + + for (i = 0; i != RTE_DIM(in); ++i) + if ((types & in[i]) == in[i]) + conv |= 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 */ 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); void mlx4_flow_clean(struct priv *priv); int mlx4_filter_ctrl(struct rte_eth_dev *dev, -- 2.7.4