From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0052.outbound.protection.outlook.com [104.47.2.52]) by dpdk.org (Postfix) with ESMTP id CA2D41CF71 for ; Sun, 13 May 2018 17:40:10 +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=gaOX4XYF21yJygjZPV/OvQgMOcKlHajrRjVFOIGNYbo=; b=OUNyLTfwgDQ5d5Lb9JmovblBf1MMv6+FQ6fKE75MWADMcoQMe91ASC7pUM6Usniqfvy/0R6Zh7HJotxPUQjrpJ5OyHWZ7o23fxWZyPRGSzEu1czMlEQA1qNQSYE7JFOtNnPXEh36XEVDCaKI4qCvBycuGBrB4ePV82cZvxXPv4I= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR0501MB2308.eurprd05.prod.outlook.com (2603:10a6:200:53::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.755.16; Sun, 13 May 2018 15:40:08 +0000 From: Ophir Munk To: dev@dpdk.org, Adrien Mazarguil Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler Date: Sun, 13 May 2018 15:39:55 +0000 Message-Id: <1526225995-31378-2-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526225995-31378-1-git-send-email-ophirmu@mellanox.com> References: <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> <1526225995-31378-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0802CA0011.eurprd08.prod.outlook.com (2603:10a6:800:aa::21) To AM4PR0501MB2308.eurprd05.prod.outlook.com (2603:10a6:200:53::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM4PR0501MB2308; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0501MB2308; 3:II83eSjqCedUqqMgbWWlJOtZQBK07QdJmTZ/knqS6SKTjcpII0NnlvrFrRDjk1aw5+ilQSEa0sP8Xc7iBceyQQUHUANolZxWaGabG42Ba1NNglblYio0vg/kGMNv0UHt33MN28Tm4dm3W5wEA+/x6QWNagcVKiY1f28Yk62eZGPfyChMuAAxdxJ/Aepv8+ft3rk6DwwAswUAV6jvXKdwCFpRyW0HqZGkT2rcCPz86pceFiBkTYsgSrBLgDDIW+m9; 25:I4DbEet+il/R0XNynBJ4vwDXn3Qmn3tUVY42SeZZ+zU5kCeUg9P493NF2+C41tOHwBrU+XU28RBEY7QAjknTjt+M+AwIWosEjX+YGGb3ltWKWpbwz/X+Fl98oyUVmYUJcPV5qrncJeGghG8wnIhi6UX3AqQxIZyw4Kjb0QcSSBWQblosVir38/PzKDcDGOYMkFhBYv7mmCqqmHwpkIwPF5oMA0OOVvm5xz5Tz2cpecJ1I7Ch3DVY1FP3UMlcvIBl0xI0y2zoRieZS/2EPpPYtnBtLEo/Bj+3nxRgBX4Hfjo81QlX86miDtmpU+ce7gpW+tA6LqDoF2H3rz/q2l9Pfg==; 31:9FqF+52JYgth/SvR0jmQ9Qk+IHQc/67BkriE4E5TkW8b3diqNqKSUZrRoqbREWMLnVWxeaXaBZEkdVqTrjRaOwlLp5PEbUtvUpH9oqqDxUMZZwZN2M2tGiCIuI9sB2tyVmXCpXbK03g84oD0U0aTygKRdLuTDJf/vvWM4xlXIM34b87yuCWJgogEf0nuXSB10BcHrhNPYD8fPcjzlrJB+81que0VSEN8gYNU1lZH8Fg= X-MS-TrafficTypeDiagnostic: AM4PR0501MB2308: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR0501MB2308; 20:9i+fjpy4OYW/yCLx/TsOXOmObCsuid17qrYsssS2D7flHeOYrmK0aiD2XPGiiJ7j5TdGc7K9jWvrVSt1uQtz2TGAmOnNBtpSnsl1ZCd4DpzUiAQJnZX1hn4OQetlVbD7F2rS1uncaUw7f5Hv5JTH8jG9ul0O8U7Wf6Sc32r1oCfaFzD6usEpHEMAkweAa0+bpP/Mk7lX5gb9WOouQShLLfwzJS+L/0VSgglr1c5VfksflbZbcmGkrsGK+dy8Ghv1L3+OKj97MMuksIcc+bHSTPFX4BmnGUAg+jjvQ7xLdU6+gRfc0W0vTQtpEl0iUL9XnQWgegA4VhEKHILRh3Km9IGhSSBJWI/3rgxY1V8FuT9qleoLBj1if3CQBI+FGftG/RfOX4UDBqA7yMELVlkEpCIPJCV6TKODt2Ajbs3THPkADeXVFlnDWcGfmiOVBtcm9HFU/qy9XWN9R4dPhBbscPGcg2BaZ3NLHC1a/9i77vC2Ios2ckFb9OnRq7cWmTKh; 4:g+Kr93A8E2x5uOAymSB07PRT3biUfpmH4CRS+BenrIFaBr93f0ptDAmlPK5pkAjKXFhS1VsmXyBd+ITn1gUmWmWgIkuhQyjXRLHQOgPCPOab3GpDsLAWJLDj/2CX0X8gxFQQmRPOuoOvZ3LHMzBw8XZG3NLmv9eJEI2XuHtzpFWARWXhDGSQqBZh/5uIr69KqTYTpYKMgdaZG3tmBz2HlKuuCxF6fkv36DISYbsYb/++Z6+Y+6jbnCaO80Gqgos6wu4fS4Y6+oM1NohUZ4yOsA== 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)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:AM4PR0501MB2308; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0501MB2308; X-Forefront-PRVS: 0671F32598 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(39380400002)(346002)(396003)(366004)(189003)(199004)(68736007)(386003)(47776003)(81156014)(81166006)(2906002)(305945005)(51416003)(8676002)(7696005)(52116002)(7736002)(21086003)(97736004)(50226002)(8936002)(76176011)(66066001)(106356001)(105586002)(69596002)(16586007)(5660300001)(53936002)(316002)(486006)(55016002)(26005)(86362001)(2616005)(956004)(4326008)(476003)(36756003)(446003)(11346002)(48376002)(4720700003)(6666003)(33026002)(478600001)(3846002)(186003)(6916009)(107886003)(50466002)(54906003)(6116002)(16526019)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0501MB2308; H:mellanox.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-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR0501MB2308; 23:rA3fhGAfHP7L5bB0tZ6tNFGDQASTYIorbuZr3a5?= =?us-ascii?Q?2wkXK+URMAiwT6iErhu7kNz33Xmh5UDDZ0ppbMmy+jVMkPN293yhkzJbqOo8?= =?us-ascii?Q?5/pZsptIK9zEaN0w+m0dcEzfTMg5bTluGQ/iVZM+fhYTgjag1Wjc7vmAgXDi?= =?us-ascii?Q?igerizxCE8mh3CH040pbOYwx0qWaAEZBvEomDG7RAPEt8WaAv6KEvTOPhshd?= =?us-ascii?Q?CLPLlep41kGltuQVMirRC5a79+w4A/1YQYFbPze1gJRlmfEVX9p2iJG/ygYm?= =?us-ascii?Q?aEksjy33ZEXRQDozA2/YdTh1ePmn6cr9DkLvtSqgj7CWFbRI5FcZwNBiHROj?=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Ud3PwUVmgtz6yWj?= =?us-ascii?Q?6ac0lrjpgem+MY3rO/UXQhfa6qBq9i6jZWgBXug3XXhfSWK7W948ThmMhcgk?= =?us-ascii?Q?Tpg=3D=3D?= X-Microsoft-Antispam-Message-Info: MWPVnehSQhRz6ACYspVdsHENjOYnDWjnTTKAgL2BDpbHnxmfHHswrqkEvJkjLG9arz6N9qEGgUwgmFz3hqHYsLxxxi/6hbUX5c4wirE1g75ZPrAeN0sDP3yO/2bTPMU1otadf8QPeburLwfS93uzyUG6f18kbRwGJByrXxMg5NKV2kyXavXFctT1abuTB6he X-Microsoft-Exchange-Diagnostics: 1; AM4PR0501MB2308; 6:PeUZ6Lp9MYhvwZUBr0AT6M/pg7CpmL1cz7FedKCleOEYfYGvZnL1i9muX+x2CjkR8jVE0gJQqBueeYCS8S9LM9qBzhjvFbFp2SV0N3TqmaThMhT+QDj+QjZIWJQ8QFZ2Y8Mv1TGgjDhzTKkkQP9Fdtg+14s3qwtMK/tb1HoFJ3uU6LNWHuL4RvvIkUphudFGhQbVgga2+aoBJ5qAg70yz8AOhiecT0pOnC9OH/lskJDAvzOWVRCBQrQbFg5B5RXC3Zt4FIshStGMKE/iT2GufJpzd4y3UnKLLFbqySs7qcRC0mUpaRskmttJS4Hp1yY/tjc8OcfXnEQKf811myMAj8n07S/H7WSVN+cD7OZcl1x17mfoH/hmKWg5KjyBIAUgjxTeZYlbsysOemomnRVoU37CP3vKo85oBbFH8PJNOw8jezUvxUads/pcB2fv3ljj7ATXNn5+TbzEupuRQymh/A==; 5:ahyj1kIFChjP6IMoebgaOa5pU963zlL1g3jXL9fEYZbx/VPT5baziI8+fYeKxxijCuwvEf9SbccCLIgQQCeuetrNWWM+snyos+b55MjA8betYuTiNSFCEunTVT1+iPjXdziCFh6DltKxFjqvZSodbGMPjip4fDvXP8JJLUzPgYk=; 24:Xui1jXNAOd4654ORbqKSekDqQ9qbFgU6JfZ+V/2CwvAQcZchRA44MAaiQTBXbvGLQMPvOBwQ5nWAJzdqugYMM7GdmMCiHs7tm5HETlrzIRk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR0501MB2308; 7:XsC6h0PoiFVfxyKuHyTLYyU/GRba2w6xyY0/AhOGhO3Rlc3xsT4kJAB5RSmUls83t3LCVSE/C/fmzdrdGBj1jSvkI1BczYXHL1WoyIWUYCpqf26EKG7Ly/hOwRaSXXW7VvpfXeQs2l0WtZvCslCRR5Zj0JM1nZ10DZBCOcRonDeM47o5nhAX6KrrkxjezxUV1JNNrKJp4ZNDH4iMVaak4uEjTMtdwedoXOEH4dgNjpZgMiyKCaRfGoBgfb06kDCT X-MS-Office365-Filtering-Correlation-Id: ab601f89-6ffa-4989-dae6-08d5b8e7cf5d X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2018 15:40:08.8245 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab601f89-6ffa-4989-dae6-08d5b8e7cf5d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0501MB2308 Subject: [dpdk-dev] [PATCH v4 2/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: Sun, 13 May 2018 15:40:11 -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 --- drivers/net/mlx4/mlx4_ethdev.c | 12 ++++++----- drivers/net/mlx4/mlx4_flow.c | 45 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/mlx4/mlx4_flow.h | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 9a76670..ef559a3 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -582,11 +582,13 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->if_index = if_nametoindex(ifname); info->hash_key_size = MLX4_RSS_HASH_KEY_SIZE; info->speed_capa = - ETH_LINK_SPEED_1G | - ETH_LINK_SPEED_10G | - ETH_LINK_SPEED_20G | - ETH_LINK_SPEED_40G | - ETH_LINK_SPEED_56G; + ETH_LINK_SPEED_1G | + ETH_LINK_SPEED_10G | + ETH_LINK_SPEED_20G | + ETH_LINK_SPEED_40G | + ETH_LINK_SPEED_56G; + info->flow_type_rss_offloads = + mlx4_ibv_to_rss_types(priv->hw_rss_sup); } /** diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index f117e2e..b234623 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -139,6 +139,51 @@ 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 + * DPDK RSS hash fields supported by mlx4. + */ +uint64_t +mlx4_ibv_to_rss_types(uint64_t types) +{ + enum { IPV4, IPV6, IPV4_TCP, IPV6_TCP, IPV4_UDP, IPV6_UDP}; + + static const uint64_t in[] = { + [IPV4] = IPV4_IBV_HF, + [IPV6] = IPV6_IBV_HF, + [IPV4_TCP] = IPV4_IBV_HF | TCP_IBV_HF, + [IPV6_TCP] = IPV6_IBV_HF | TCP_IBV_HF, + [IPV4_UDP] = IPV4_IBV_HF | UDP_IBV_HF, + [IPV6_UDP] = IPV6_IBV_HF | UDP_IBV_HF, + }; + static const uint64_t out[RTE_DIM(in)] = { + [IPV4] = IPV4_RSS_HF, + [IPV6] = IPV6_RSS_HF, + [IPV4_TCP] = IPV4_RSS_HF | IPV4_TCP_RSS_HF, + [IPV6_TCP] = IPV6_RSS_HF | IPV6_TCP_RSS_HF, + [IPV4_UDP] = IPV4_RSS_HF | IPV4_UDP_RSS_HF, + [IPV6_UDP] = IPV6_RSS_HF | IPV6_UDP_RSS_HF, + }; + 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..e47982c 100644 --- a/drivers/net/mlx4/mlx4_flow.h +++ b/drivers/net/mlx4/mlx4_flow.h @@ -30,6 +30,40 @@ /** Meta pattern item used to distinguish internal rules. */ #define MLX4_FLOW_ITEM_TYPE_INTERNAL ((enum rte_flow_item_type)-1) +/** IBV supported RSS hash functions combinations */ +#define IPV4_IBV_HF ( \ + IBV_RX_HASH_SRC_IPV4 | \ + IBV_RX_HASH_DST_IPV4) +#define IPV6_IBV_HF ( \ + IBV_RX_HASH_SRC_IPV6 | \ + IBV_RX_HASH_DST_IPV6) +#define TCP_IBV_HF ( \ + IBV_RX_HASH_SRC_PORT_TCP | \ + IBV_RX_HASH_DST_PORT_TCP) +#define UDP_IBV_HF (IBV_RX_HASH_SRC_PORT_UDP | \ + IBV_RX_HASH_DST_PORT_UDP) + +/** Supported RSS hash functions combinations */ +#define IPV4_RSS_HF ( \ + ETH_RSS_IPV4 | \ + ETH_RSS_FRAG_IPV4 | \ + ETH_RSS_NONFRAG_IPV4_OTHER) +#define IPV6_RSS_HF ( \ + ETH_RSS_IPV6 | \ + ETH_RSS_FRAG_IPV6 | \ + ETH_RSS_NONFRAG_IPV6_OTHER | \ + ETH_RSS_IPV6_EX) +#define IPV4_TCP_RSS_HF ( \ + ETH_RSS_NONFRAG_IPV4_TCP) +#define IPV6_TCP_RSS_HF ( \ + ETH_RSS_NONFRAG_IPV6_TCP | \ + ETH_RSS_IPV6_TCP_EX) +#define IPV4_UDP_RSS_HF ( \ + ETH_RSS_NONFRAG_IPV4_UDP) +#define IPV6_UDP_RSS_HF ( \ + ETH_RSS_NONFRAG_IPV6_UDP | \ + ETH_RSS_IPV6_UDP_EX) + /** PMD-specific (mlx4) definition of a flow rule handle. */ struct rte_flow { LIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */ @@ -49,6 +83,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_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