From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0060.outbound.protection.outlook.com [104.47.2.60]) by dpdk.org (Postfix) with ESMTP id 82ECC1C722 for ; Mon, 14 May 2018 12:07:49 +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=EngYZll50xhRffUqndig6W/iBzzY6lRsNRVWSc5SUyk=; b=pkYql2HtDlYYdcwlvelP74EV2hDeeCvbhUnhbbtiMUrVIGP4g0YImfkYYIl0kfA7l7P0OKGhzzA/MU9RCQx2q4/xZDhl4VXOIetLcrbtJ7AS5Aim1O2FfKFWjaOxvt9tk64t7XJeVSNxefe9ToOc4Z4J6J2YwCY6FVd2PlNxqTE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0501MB2317.eurprd05.prod.outlook.com (2603:10a6:800:2c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Mon, 14 May 2018 10:07:47 +0000 From: Ophir Munk To: dev@dpdk.org, Adrien Mazarguil Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler Date: Mon, 14 May 2018 10:07:32 +0000 Message-Id: <1526292452-30482-2-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526292452-30482-1-git-send-email-ophirmu@mellanox.com> References: <1526230217-21180-1-git-send-email-ophirmu@mellanox.com> <1526292452-30482-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR10CA0111.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::40) To VI1PR0501MB2317.eurprd05.prod.outlook.com (2603:10a6:800:2c::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2317; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2317; 3:kRhKG+Riya6nrtIlhi8j2TnR6snaC9VThWFOy71SGp2805lzOFzhkKt4swYhh5hwitwCdm3AmzjrrxggeXiqROa4TVxQ5gcptJ9pi1UhYZtM2ErjAHmeVSJZr0t5TJMupdid1W8mEu1tjYz5SNwnAA0GF5C52lVmvww0pmNULrDgux9xJR5YZagT0UGAG95vjo8zg00W7OP4lbrkh4wWgkT0+3/2Tn1U5c/8SPwbW7D/uxzsOBnPE0e8y0EUmj65; 25:FzaqJuJUxU1QX+6e9XAe2wKk+a7EgTkxeP+gEv/f+M3DaAufdJD/UqHPLeSyk8pcN5iuojJ5m8lM1NfHZ5ctWutfiM0YGESjMdBG3aYNv2TF/53tPl3ps1JY+PTsuvaDvaNwkBhLDsKzaHbZfu4SB+yIfHluKc78EqhP31BSW7eAmSRJratkoguD7YbMqEocinX+7FE+JlXySDBqPm2N8cnQNFimxfK9ryfFmINIhGML7bHRI2Rq3T3rooR+9ZWvu1nL1lwhRdQuFXMk5kln4gpwRq2UJjjDU73L8ECG6Ksoi/OsLc1f2ieeFFIkqiG4JvjXtJi8lb5SojfDG3sdHg==; 31:D4B1OzVxJd0qv2wULgv2TuZ2FloZZf0nWBbC401r3dMeB2cRTxUOAZz6EytuNjXj66JbCvjC87n+QTBnsus+Ld+cEDcepZ+hfnSf13aT2UcGayf3VZHGdLvmLiyDzTAiQubzFcq9DuHxCzFnXIsaDoKbeBiUYixBk1ojYliyxZfu482gHheBkhlBgRAuqP0fqfy4oW+WM4zYY8/RVnBiD9NBjI31xdNbGHK3njNF6wI= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2317: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2317; 20:brz2zeuvN5XJulyDaJ5Bcozen1Yw+zJMLT4ToSBuVPF4YS+m+wJZZVjzjtj7trGMwO07cyWHvBQIyIPvxnhgQz5ApZ0nsuuASPjx0wygy+F5h/4wiMBJ/pZ/hlG+AiUu2e0+BW2or2SF6f5ye8p9LuBudyX5SnDwc6Bbz9ZpSgouyjF2maKqMd4Ffex/kjCa5ayhyiu+HxJrAuM3iogIbpGjPvjyT1mYgG9A2LMTe1NeEZ2wiKW0Prjhijuu0QsOEdIeYlxYCng2JJmwJp76Emu+xzSM3HKQWsnBcoUhzUHz6hOPB7D1EVPdbhsCHIdP0OfH6vd09hy5dVanq39HQMxvPSeLLjY6XzBVTYnYYIIXLruCKYqtD6y6NB2OcQcq6RZucnYlMWDxPiFeEadm/1HGNia6+80X3w7u4sc04Q/+ZY5m8SWg8iEW4QTZ+r4JAdw2sgD5y0izoxrj/EybwOeqnH7Oo9uy8ySXfeJvAN52njUdGFb7hfnwnlZ42ghF; 4:FbmOKE6dOw1GbFs8ryhu+mBm0W1R5AVU5HX6Kf76uOfyU2ERhmeZ2eQ4NKb/+UyOVZGJ9zJ/lbE8LOMIzmsB1KmlND9Ee7x240pHrGn99Up6GkDzJmOszbh2R/JF3rG06jQeAD2P3cmWywoEiP32N2siK423I67bathL22eLB5zj4kJXo1flmfrPVznyHkW1uDKPanENOUOdK5H2B5476c/y/MlCgi8w07jVllMpO//h3wWV0jMOgQ96/WIVqCU00i2U5UPUiGTJWkOjAmkDXA== 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)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:VI1PR0501MB2317; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2317; X-Forefront-PRVS: 067270ECAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(346002)(376002)(366004)(199004)(189003)(486006)(36756003)(4720700003)(6916009)(6666003)(5660300001)(21086003)(11346002)(476003)(54906003)(386003)(16586007)(68736007)(16526019)(2616005)(446003)(956004)(186003)(6116002)(3846002)(55016002)(2906002)(66066001)(7736002)(53936002)(47776003)(26005)(105586002)(305945005)(107886003)(50466002)(33026002)(86362001)(52116002)(106356001)(69596002)(8936002)(50226002)(478600001)(81156014)(25786009)(81166006)(97736004)(316002)(76176011)(51416003)(7696005)(8676002)(4326008)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2317; 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; VI1PR0501MB2317; 23:RMkdCs5xplFq14MSW31wsLaSdw+mAf2nnZPNF6J?= =?us-ascii?Q?ULric9JuaCKEqgP0cNBaOpDilewwoRhZAp66HVkqCt3ZapM9UMcZOuFLUK+j?= =?us-ascii?Q?Q9D7225YFIwAys/7LBHpoIO/8XbPOn3TMz5+xnsDoznfk5//FXAOa9GP6eV0?= =?us-ascii?Q?fFs3zkKAtBbgn8k2z6BpwcMiBZZKl31oeKkAIDb3KR28DmvVgUGCoPis5yrD?= =?us-ascii?Q?ROQ84HAzWZd9GB9mZ1sh6i0wRnVXS4iN6cfrHZHwyUgwoSPtE1KeLHMKnaeE?= =?us-ascii?Q?UIb+xQV994JMp2SU5c+zmIoJzddX6aTdVGgJT4312Q99FkNNSUz+xCnrIf7W?= =?us-ascii?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+nf+skgmQxlQ5nrflHEc1Q/n8y9FDmS8ASInwLCxAbUcIPPd8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2317; 7:UrbhAZicGOsE62fP6U2sV43icsU4EJHN0bn/C+s6HHcj77f0u0+2xvAZh9+/SjaQk8k24s8ffJsLk2hueFANivf5iokD6n3/fAQHZZyaUqPDmhxgFJf7GkjvzGxDA+yMSoOT9/NEiqUHP0g2IkbJq4gFFnwwRWgE0IIsimL9mpPr+uHQVNcBSeLAhdX9z1KD+2QbgWcyWBentW1/D+BNbw5YNhbA+EqtG/kaKL9j9TQe7hhMyeQnvQgkhssvQRci X-MS-Office365-Filtering-Correlation-Id: e85afa84-0484-497e-40ae-08d5b9828bb7 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2018 10:07:47.4972 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e85afa84-0484-497e-40ae-08d5b9828bb7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2317 Subject: [dpdk-dev] [PATCH v6 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: Mon, 14 May 2018 10:07:49 -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 | 80 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/mlx4/mlx4_flow.h | 1 + 3 files changed, 83 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..3085829 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -42,6 +42,41 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" +/** IBV supported RSS hash functions combinations */ +#define MLX4_IBV_IPV4_HF ( \ + IBV_RX_HASH_SRC_IPV4 | \ + IBV_RX_HASH_DST_IPV4) +#define MLX4_IBV_IPV6_HF ( \ + IBV_RX_HASH_SRC_IPV6 | \ + IBV_RX_HASH_DST_IPV6) +#define MLX4_IBV_TCP_HF ( \ + IBV_RX_HASH_SRC_PORT_TCP | \ + IBV_RX_HASH_DST_PORT_TCP) +#define MLX4_IBV_UDP_HF ( \ + IBV_RX_HASH_SRC_PORT_UDP | \ + IBV_RX_HASH_DST_PORT_UDP) + +/** Supported RSS hash functions combinations */ +#define MLX4_RSS_IPV4_HF ( \ + ETH_RSS_IPV4 | \ + ETH_RSS_FRAG_IPV4 | \ + ETH_RSS_NONFRAG_IPV4_OTHER) +#define MLX4_RSS_IPV6_HF ( \ + ETH_RSS_IPV6 | \ + ETH_RSS_FRAG_IPV6 | \ + ETH_RSS_NONFRAG_IPV6_OTHER | \ + ETH_RSS_IPV6_EX) +#define MLX4_RSS_IPV4_TCP_HF ( \ + ETH_RSS_NONFRAG_IPV4_TCP) +#define MLX4_RSS_IPV6_TCP_HF ( \ + ETH_RSS_NONFRAG_IPV6_TCP | \ + ETH_RSS_IPV6_TCP_EX) +#define MLX4_RSS_IPV4_UDP_HF ( \ + ETH_RSS_NONFRAG_IPV4_UDP) +#define MLX4_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 +174,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_IBV_IPV4_HF, + [IPV6] = MLX4_IBV_IPV6_HF, + [IPV4_TCP] = MLX4_IBV_IPV4_HF | MLX4_IBV_TCP_HF, + [IPV6_TCP] = MLX4_IBV_IPV6_HF | MLX4_IBV_TCP_HF, + [IPV4_UDP] = MLX4_IBV_IPV4_HF | MLX4_IBV_UDP_HF, + [IPV6_UDP] = MLX4_IBV_IPV6_HF | MLX4_IBV_UDP_HF, + }; + static const uint64_t out[RTE_DIM(in)] = { + [IPV4] = MLX4_RSS_IPV4_HF, + [IPV6] = MLX4_RSS_IPV6_HF, + [IPV4_TCP] = MLX4_RSS_IPV4_HF | MLX4_RSS_IPV4_TCP_HF, + [IPV6_TCP] = MLX4_RSS_IPV6_HF | MLX4_RSS_IPV6_TCP_HF, + [IPV4_UDP] = MLX4_RSS_IPV4_HF | MLX4_RSS_IPV4_UDP_HF, + [IPV6_UDP] = MLX4_RSS_IPV6_HF | MLX4_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