From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0079.outbound.protection.outlook.com [104.47.1.79]) by dpdk.org (Postfix) with ESMTP id 4879ACFFE for ; Thu, 10 May 2018 16:22:07 +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=x7IsIRbFuyojO/T9FYjQPi1x8Y6AVwqy5JmkD7s6wgY=; b=w0BENyvGXrq8ivVHygBm5rYixKPWuNbcf0piH2lYW5L+L8MLMerMay1rXn/8BLz2yjYXQnUh1a3xOsp8Rq/lLTx+93OA4P8fQamNmt23GjuOrhpoew8RxOmdzCC+4Tetu3XfM64/pVO3LIhxbU0yMxHlEvs+kSlsOev1o29uR8w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0501MB2313.eurprd05.prod.outlook.com (2603:10a6:3:27::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.19; Thu, 10 May 2018 14:22:04 +0000 From: Ophir Munk To: dev@dpdk.org, Adrien Mazarguil Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler Date: Thu, 10 May 2018 14:21:47 +0000 Message-Id: <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> References: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0902CA0019.eurprd09.prod.outlook.com (2603:10a6:800:d7::29) To HE1PR0501MB2313.eurprd05.prod.outlook.com (2603:10a6:3:27::18) 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:HE1PR0501MB2313; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2313; 3:X2hTDL7tvam7q/nwrnpKHAgXBn1IwphnC5Jo2UCTZZqmkXtQV2j3yT6oYddcv5BUwrCEXmtJkEMm24Z/hgeazbaN3kiTKB+D7jaRBqCHj3LVjth9hYOnuTI+EywYLaheCJck5+JrWbubZ0+WHhrceIj9e2g3hJIIAxeoNMjmCx6j77ZsT/r8AmOzvJIsKHd6BBYzBvqw5apQG/Fl0iKHGbOjkxXaVcBpnvj7fHccMnUeyKQbnAcVAKTM195CWsIS; 25:szDUTYv+b9MxSheb0+jZiTkTB+PlkaUD7juAsgURtWRdR/689FswIwiOONCC4m6ixZUXLcsokZhAMzUNFzbzQs84m+4mjRNw7l94nxKoMsj/OYgG9sCUNXxsR5xVHounTGQj9BRgDf2g4wUBi6Ot0q6q4rlOWsAZY20XDUTGjKdEYeVLmScmHA84mUUTgDg3/r//cnXwfXSlqlsgXvfaDna4k3Kk2usu0X628GxanRsjcTCgVzOzEvfnNN07YNSxWav8BM3sJaHuRwUqxRKMXiXXqArbL5bERM7Q46+B20IpaKeQrdbDiq3VZWpUwZMQZO31GedpXEnLRrUgBLeE7A==; 31:+UblKtaugeM4AkDw/Ww095NFdOqe73W1sWMWCzwdZX9mHbnF7GPtLESmumc8fR8uGNrTAA8Ips0OzpgS2NV+xebxbuX8OEYPuQONhOHwzuMkA8l7PjbTqEnINxIZGFVPa8BDX76PVCq+uSjNX9Bj40sBT+hgUub3uxleZnajrvpCN3PxzTDaB2yiFz/AMBgX9q5lv+YIK0sJFGCH8/r+fx79Zn9kAu/IKqZ9EX4Jg0I= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2313: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2313; 20:wJv8MNL7OJQp24LE50l3lLXayduLB6i74kpTpYNesWjj7Uk0VXXKGT+sho7If2Y15sbhZeoMq9SQHpFK4jT7Cm0hEHh3zadVoaUxRMd658p1c66CeiqVHQQr28Upcf8IckRfbTVMlDkIzrQS+mTLKQ0qMBbQCilPa8vIPiNp4uHR/YbG2ObNBNaIjmFVFnXHTLzGoVB4bhLixNdAIjaiSIhOy/FXO3SMvSJW2vZDnLU5gOS0tQr/VGKpmpAQJDHonlW4Q3a8aO+drl1BKrbUlDv8MCexJ5Fhj6wU5U2nLFIbcZ4yKpVJ6iIgUMIMiyJyYvNoj0XZ6Ird72gNORGoeQdGngRopcnrzqqwfcsTl37yIo3lhriuKzqpVGFLCRV5AmeaqSHhUk7ZJl+c7axACpOKWPF4uBWeq0G96K8Bnr0byID5/f58DvHL4bMPzeSDZ4TiOr1YyG4XOyXnKhLPPwbDemOLPUqGEldg+IK7J2u5krLrqex1aJOZxY6PnmTC; 4:00K5WebeCpOdME2BTVWbqVPM/QhFEgoWAPkBcMAA2+aAaeyZua6LhqUWme2HV2viwroMZAs0EGAP4vQ9tm9JIAqm42pcJ7n2F7HdZC87pbxh5p4+NYjmlhL95oJE12ABf3lHeCvE8ViREAdNiQ78s6uLi9mFaOZFwdqXguNht5zzXq1a+kdnA0MuW69ZyeCFGuEkuBlzqsd/bWgaydbVj8rkSCp2qEKsz6l2L9ElTSyN5XW1bCk1DHsBfGW6ejHD64Kj83wnIi+7iW/iCZ6lNQ== 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:HE1PR0501MB2313; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2313; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(376002)(346002)(39380400002)(189003)(199004)(305945005)(956004)(11346002)(8936002)(21086003)(76176011)(7736002)(8676002)(69596002)(68736007)(2616005)(33026002)(81166006)(6666003)(54906003)(446003)(50226002)(4720700003)(51416003)(52116002)(53936002)(7696005)(6916009)(50466002)(48376002)(386003)(107886003)(59450400001)(4326008)(478600001)(47776003)(16526019)(6116002)(55016002)(316002)(66066001)(86362001)(5660300001)(105586002)(3846002)(26005)(476003)(186003)(106356001)(25786009)(97736004)(486006)(2906002)(36756003)(16586007)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2313; 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; HE1PR0501MB2313; 23:NuxSbVzj5PKQYNLpaby1OIYp9nRJiYvVMRip4Vm?= =?us-ascii?Q?r27Drlnk63O5mmoa5z1iXOc2t75e7FQzc3/WGo4qzAMyR82SY4Bi0xS40ks4?= =?us-ascii?Q?WY+qbYhx3XRsfUi1rWZcLxjEaOovCj6EkckyKDXPM9AeOdQaxfQl+6E73Fh0?= =?us-ascii?Q?v8ljVfw9lw6v6CFyoiaA6eRp1aIWEjysl9knwIhAMtXCnfU1pkgl456YRlbH?= =?us-ascii?Q?mRCSBbPWOZCehdIwA/lDkmyb9SVOmUrFbbEV58fDxbsPhE9noNjNjHRiLCIU?= =?us-ascii?Q?9bFN94/OVZglkfSdW6BC0vbwOxMW2yfJfmCk1O0Q5jdoUoTtYTstGMqDH2or?= =?us-ascii?Q?MrmqoGihtiGIEqmxkxhbAZeQxdzFXfLayrdVizkyordZm0nElwGfzXz5lsPT?= =?us-ascii?Q?YrjY7WINMIVzxri93VRnNxwCxUmOEsRztEOUazNptPoMhktv7L4L7O/shWzQ?= =?us-ascii?Q?TgCRsKF8VHBVPmvhwdN9fi8ExmXGwxXgjBPky4GUkHbde422ZRexkiSujwSc?= =?us-ascii?Q?3JiLFeho2/isXbi/vGThOdMXHJqoeeVQZeIjEW1CiVEVInJ9V/wX69dlbGyh?= =?us-ascii?Q?ZvP+gvtvnQlYwj4PWI4n1aDKA6oS8LbGBoi0oKNlLORz2VofcwfqTJG1DID1?= =?us-ascii?Q?uHpSVicCHQ+FIeGVcajUtBnIXOcb0509/wbvM7vEa+kPJo5a+AxDZe/PV0ok?= =?us-ascii?Q?/XShqUex3ecUkzJphFyW2Gwtx2z+u1B7wW2+Y6Q0hY29gzTXvF4fAQC1YZMO?= =?us-ascii?Q?0GulLgoAacuiO4Ws4/xBrWYf3Twk4+BhAGXtiCMY0YMNTf/ZJgY4f4e/Usj5?= =?us-ascii?Q?gXlGYL3Y8Yx9Ro2tU1uklk5o4nnZGNahzbfKGQBMXU1Bn9vpz1XPbdmjLg58?= =?us-ascii?Q?fua2k99xBB0EKFxQn3KexevZ77NAz9cMuPcEGrrIrJ5IZ6si1y3pbGP50znI?= =?us-ascii?Q?4H1oi6EX0gApSeI6UraMug9/2OFd24Ru7s5JYpjCYRvzNpCS+vjx9lLNu4Vk?= =?us-ascii?Q?jckJch4BKVtRR+7I/jJUomDouzF1p+F0OT93NAAtmlJVzo4JayYwcQ2RMwLw?= =?us-ascii?Q?9etQQp5Lw1hapL2+uKUXZhmM82ASme87LnWGLFc3M2OI4WEmHRXZDSeKC1WP?= =?us-ascii?Q?PTWXxLHVNimQornrIU00kec7gGcMEYBIrAU0brZuZUDusbcdLVJQ945ejaXk?= =?us-ascii?Q?wUPvbTQTy462HxyucIpO4AskQTufktSuORoy4ugh8LDJmp7hZo4XrxOBhYED?= =?us-ascii?Q?eWEmqMDvY2J8b2OJ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jh5qbvwCVz3y2tkKWu0YLwD4Jpo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2313; 7:jsD6Y4Ovn2j2GjDYOSG0shxCiFas81V/B7onUZDWcpTV7u96MeBdXpDVW3cf/EPEFWFhjn9hOvfTs+UJZlfYUHUf4fj0AdW98cFdxdoay8qRgnbgVZZnjPE7HUOwmiYBYkJKg1dC1J2Pu+/GjG3UiAYmj7ftB3RMrt70UCpIIt8+tBO/qXEh6jDlooadZHro3h+buPjQbmGZy4u6EWsU3upqhQiywMFTkKMgAFenoMsTKDG8Avgu4eQHVVr1Duqp X-MS-Office365-Filtering-Correlation-Id: d0d95877-73fa-493f-ab88-08d5b6816853 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 14:22:04.7643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0d95877-73fa-493f-ab88-08d5b6816853 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2313 Subject: [dpdk-dev] [PATCH v3 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 14:22:07 -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: Update based on reviews (split into 2 commits) v3: More updates based on reviews 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 397a150..baad299 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -134,6 +134,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}; + + 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, + }; + 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