From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0056.outbound.protection.outlook.com [104.47.2.56]) by dpdk.org (Postfix) with ESMTP id 758661D0AE for ; Sun, 13 May 2018 18:50:33 +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=HRwMUGx+b+9/9gM9kMUOQ4A1CcdD7pv3JcwMVB/gXKg=; b=kfhmOWgJUq2KGuiQhPlLxAZl1ERC7Ue2KwMU/Io5GIeoisfAcLrzThdAkb2V8jGqqfnxu4iEdiYEL0eQ01ZqXJ9+Fkca8gDRoRaOXxDLESjB5YabKyOyOVRuxx3kSjkeL4XDXgQQ+TZiAUsuZIGwAsXMpc4sv6t8muAMv1cDmvo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR0501MB2312.eurprd05.prod.outlook.com (2603:10a6:4:4c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Sun, 13 May 2018 16:50:31 +0000 From: Ophir Munk To: dev@dpdk.org, Adrien Mazarguil Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler Date: Sun, 13 May 2018 16:50:17 +0000 Message-Id: <1526230217-21180-2-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526230217-21180-1-git-send-email-ophirmu@mellanox.com> References: <1526225995-31378-1-git-send-email-ophirmu@mellanox.com> <1526230217-21180-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1P193CA0010.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::20) To DB6PR0501MB2312.eurprd05.prod.outlook.com (2603:10a6:4:4c::23) 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:DB6PR0501MB2312; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2312; 3:x2vjL4G23TrgXKwWP0TiasiJqo5cxAAIv8okIJr6l6c0bEZxz9+2XiK32srRSvBGSsKLycHDMtJKdUrGYXBysqgXkWsJRk9mS8Wg/0kUP2aHJg8LKvQKmG6AktNxbO1k7QRo8DKhq7GofpXDq0bcrAau9bEd4X92Y/RozvPJ+8XgkZrGtOW2kPdg7hMDuJgNDgCsRtZrWoM+rUH1i1epQjyFCyc70is+K68ugIhZuaUeBP5BMGA+sgGTd2QoSzFE; 25:lHLh2vSVNhOuHkTGF3mbfXzjXzQr/mNP0zJABcHP4JG69HWZj/sFoEp2RCHLpjh1koajsXUOOjaTkG0VXN/8iEbqJ87TqpYo3ygFOj0r/8Bps6VTaz2ZpaXpSCCBRiJ03cyEVHKWOda4WZATmXV6z5DuFjQ2W13k73V89t9rjAFgnCCv/ZmyUaNz77M9UNxbtNqqAiMjA36SwJ7GTRyoq5TpZ4MvcyAt9l2xRRkXAWhohsyJM/4mz0Qjhzt3M4w/4Yd1R4pg7uvndBTO2hPulquVax31ucF9URSWfYTTdYNnX3ubTmjyrHeh95Zu8xYW0RkyOwJwhUsj7ufWUGPn+g==; 31:iFxFLo6MI5D3JbGgfAeUI7BNPdRXn246zJbLLtboIhAtAFwm+MmM6zHrQxbTv1wZ2IhIpWEwGAGqukJylwUE7Cw4pODh2IcC/zx63+gDnw3pAKygKV+x2XRYB/6uV2HGKZIJdXch0trwxyYEBN1fMU9ERVBU/8iHucx/vZN7HzlXgYtWLuhEvLdamafaFp0qILl+5QjFhBcdC0dCvlZ0wbNELWhlfWR6EBYvJecR3wc= X-MS-TrafficTypeDiagnostic: DB6PR0501MB2312: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2312; 20:2oHPB6t29ccic6Nj0UtpXhIQ15G2uMVFuKkFXWCcqwhELvZnhF+Taqw7llOq76zvAoCZbsaPa2wZozvmBrmrQvW1eZdTVoGj4XTAmzAgr69FO3jyMYkpFC6aq6Z+hL3/DhZTEHJrorrPRLXipuifs6/Ji7DSkV9YFHfPYJ1AL4BRfZFFsasZEPId0XqGHlwOTzZAzIbT3rvdMNECAN3Z+iUJiK8yKtnTweemoEz7HZn5MaXEAo9UK6clvowrPnPGXbtv9KvujbHCT9634A8yEwi8tq8kNMQpmt+VpvEdzWF+mnUrKgDLfgsTEBmHDHCakZbacDsp8nKifePmmD3pJD1nVbs8OfdYS5c7AQ71x7oMV00jX7EVFGc6aC+1m/gJRUVILl3o6nvVpehsSE2PBUnJwE1gwuEoRCeF62kh/u7lGPaL7bA0JWANGwzK+oP5eioZjQAVKNDulDvs7t89Sk5qTkAXGb4e1lZgA2h09X9pcozgvxLyxkq01yVKwKhM; 4:8CbOp8ge9UM1eFz4af2KPiCdKykTxaS6d6K0i95O2Jipx61SkiD/lN46WwnHWao/qakPSKWzj/VJXwskTjqfuqMXIlr9Pe3IpwmZC2Yt6xPdTmNyeiQsCAIVV81Gd171yNWkcbiR47e0aGhxMi/hFx7P55AeCohICEKNbtViXgpSw3D9dpaoEyT7m4t5sMdYicfy1R2q+UIMBgg6h4Ut9Qv1lFny+vsuvmFfeyq2A1qdUmrvz9oXC27SS3GZJe1Zrp/x9moQAqLzQZTkqAuubA== 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)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DB6PR0501MB2312; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2312; X-Forefront-PRVS: 0671F32598 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(39380400002)(366004)(376002)(189003)(199004)(16586007)(81156014)(81166006)(305945005)(52116002)(33026002)(8676002)(4326008)(7736002)(69596002)(7696005)(68736007)(53936002)(54906003)(6916009)(4720700003)(6666003)(105586002)(51416003)(50226002)(76176011)(316002)(55016002)(106356001)(5660300001)(386003)(8936002)(48376002)(86362001)(66066001)(97736004)(16526019)(36756003)(21086003)(2616005)(50466002)(186003)(478600001)(6116002)(486006)(107886003)(25786009)(956004)(476003)(2906002)(446003)(26005)(11346002)(3846002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2312; 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; DB6PR0501MB2312; 23:M1WlHvPCCEyddEif/pbhSHk7l27O1Nj01zCV9pp?= =?us-ascii?Q?+SAvpAHoJlIJPV9lgcQChyzpMMg8Cc00UZOCKIYyWFjzJKdC1ORmq3748jz5?= =?us-ascii?Q?0cpxNNfvN+hLvwK2L4bci7Plb0LXI5OYRp4NmURtOEviAsFpGFr53ob0k5I2?= =?us-ascii?Q?AwxQBDGuMdlkpcKfsv1+g94KHw4wug5IiNsypAQmLECdwEzcSvt05OfwbMVy?= =?us-ascii?Q?M9PpTbHA2O4uAwL6hNbzoz+k+boovZKCd6Yg2GnXGtm7U4LklomU+Uqyqa+V?= =?us-ascii?Q?h4hoGtgs5Y4bs0El1CMiGcANPaCIa2SC8y/Y/zIR880UKjf0FCIEczjNHmaa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2kI/6giDsXcHsNsDIZqFb?= =?us-ascii?Q?lXmhPi+znZynQXzQ2sjpLzl5QRhaT/m6eIZ2YePmgOt15gL+U0ZtEfxpcY4u?= =?us-ascii?Q?w5A=3D=3D?= X-Microsoft-Antispam-Message-Info: w+Xi8k6kuK16eMr2jxtE06PG46U9dey+FgSasUBhPTtTPPQmlENItNEdUcvKnR629a2EGrYotWWWwMAC4BIUGfyUTiKYF3NvQZ8nihfrkAE9mLjHD/IvRyx43RoXrBRW+p0vp7tSs4f7jPlUqWqXdFD0KEMd7eqondyKSIfeTpWjLpGvo58AspFicOa2J24O X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2312; 6:B+kAVoXGF9fYrTS8MsDpmdw7m2z3x5L5Ri9wjoJ1r3tyIoCxG/EuXnzR8qBC9XOLqGSWIKsVmZBWZEl5442lh4VcxETI7FrA6mIbYDqpn+U31E8hUC4KaHraAGj879vKDcpM8s9eqJCJoPSh5l8tXhEJ+XM1V5SLuO8jQVB7ZRYj//tpOYCJALtTXlOPl7Jn2AMNQGYkdKSGyuRfSOuegifgy6XXOYXvOJxE0cBKxycWRcVOQeWqSZkC0Gi8USMYUGPfCpsL3zTUuiRHCGpfCFB1ufBuQiqPmLXxn97H/puFBK5NJLCsz4u55QQkJ194ozvmgObx0UM/4aJ+/bpNMDpq8lHXeLT8FQRDXSsIXEs8sAxf34aObwFTioRWlasMaSwLVisPoS67n8jJAozFBP3uey2a5JiVktBdocMpckNvjdkpIUe7KC5jWyrTBGIn9bnQcnEDB0x/ddAnPddpCw==; 5:k9xsoEixzjCa4iyMpC6r9RnWKrCfdQqIPuOezcJZ6fWJWomP9bxnpyUvCyYGfpLSQ7J+qg1cisLoBjNvM0BWysOuG+z0R4heu/sv03ryFHpjomiXXeG5LO3J3A/BA3gcgtynnIByq7un69AhGhSV+dMdVaA084VroFhdfLCUQCk=; 24:q8WutbDrBnk9d3sywDcLKECeu4oj2VGDNKVJTOBN53kuFwUEYjijgzmiETJ4nhcK4FWOd+tI8exOwcnpG/IMR90kOwRdsaHV1xkcAptizJ0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2312; 7:VHHV3tz8MTs/eGoWtsAFpSsLHbLFH6z6seovLJyYWaA3TJHDFVgdLDbw7gCcxj6eNIu2JdgJ4QDyh/qLUojMkuzmnw+yT2ZqWWZ3TFHAkfqUVg4ZGolRSUWh6H0A6q9tkqPm5QzCRlYhwOE2oQFTchdanuC/UNSdBbap8TvfgKTlAxFa3DLSec1sa9geaFPpmxK1G5w0seyP1HDi85WTBvFuf3xirEHQF9DWiVp5qnQRB0IG0tKRTFcf6FM0ibsS X-MS-Office365-Filtering-Correlation-Id: ab5510a9-2079-44c6-7425-08d5b8f1a41f X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2018 16:50:31.1853 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab5510a9-2079-44c6-7425-08d5b8f1a41f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2312 Subject: [dpdk-dev] [PATCH v5 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 16:50:33 -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 | 2 ++ drivers/net/mlx4/mlx4_flow.c | 79 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/mlx4/mlx4_flow.h | 1 + 3 files changed, 82 insertions(+) diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 9a76670..0a9c2e2 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -587,6 +587,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_rss_types(priv->hw_rss_sup); } /** diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index f117e2e..8d90e06 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -42,6 +42,40 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" +/** IBV supported RSS hash functions combinations */ +#define MLX4_IPV4_HF ( \ + IBV_RX_HASH_SRC_IPV4 | \ + IBV_RX_HASH_DST_IPV4) +#define MLX4_IPV6_HF ( \ + IBV_RX_HASH_SRC_IPV6 | \ + IBV_RX_HASH_DST_IPV6) +#define MLX4_TCP_HF ( \ + IBV_RX_HASH_SRC_PORT_TCP | \ + IBV_RX_HASH_DST_PORT_TCP) +#define MLX4_UDP_HF (IBV_RX_HASH_SRC_PORT_UDP | \ + IBV_RX_HASH_DST_PORT_UDP) + +/** Supported RSS hash functions combinations */ +#define ETH_RSS_IPV4_HF ( \ + ETH_RSS_IPV4 | \ + ETH_RSS_FRAG_IPV4 | \ + ETH_RSS_NONFRAG_IPV4_OTHER) +#define ETH_RSS_IPV6_HF ( \ + ETH_RSS_IPV6 | \ + ETH_RSS_FRAG_IPV6 | \ + ETH_RSS_NONFRAG_IPV6_OTHER | \ + ETH_RSS_IPV6_EX) +#define ETH_RSS_IPV4_TCP_HF ( \ + ETH_RSS_NONFRAG_IPV4_TCP) +#define ETH_RSS_IPV6_TCP_HF ( \ + ETH_RSS_NONFRAG_IPV6_TCP | \ + ETH_RSS_IPV6_TCP_EX) +#define ETH_RSS_IPV4_UDP_HF ( \ + ETH_RSS_NONFRAG_IPV4_UDP) +#define ETH_RSS_IPV6_UDP_HF ( \ + ETH_RSS_NONFRAG_IPV6_UDP | \ + ETH_RSS_IPV6_UDP_EX) + /** Static initializer for a list of subsequent item types. */ #define NEXT_ITEM(...) \ (const enum rte_flow_item_type []){ \ @@ -139,6 +173,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] = MLX4_IPV4_HF, + [IPV6] = MLX4_IPV6_HF, + [IPV4_TCP] = MLX4_IPV4_HF | MLX4_TCP_HF, + [IPV6_TCP] = MLX4_IPV6_HF | MLX4_TCP_HF, + [IPV4_UDP] = MLX4_IPV4_HF | MLX4_UDP_HF, + [IPV6_UDP] = MLX4_IPV6_HF | MLX4_UDP_HF, + }; + static const uint64_t out[RTE_DIM(in)] = { + [IPV4] = ETH_RSS_IPV4_HF, + [IPV6] = ETH_RSS_IPV6_HF, + [IPV4_TCP] = ETH_RSS_IPV4_HF | ETH_RSS_IPV4_TCP_HF, + [IPV6_TCP] = ETH_RSS_IPV6_HF | ETH_RSS_IPV6_TCP_HF, + [IPV4_UDP] = ETH_RSS_IPV4_HF | ETH_RSS_IPV4_UDP_HF, + [IPV6_UDP] = ETH_RSS_IPV6_HF | ETH_RSS_IPV6_UDP_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..d1f1611 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_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