From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0052.outbound.protection.outlook.com [104.47.1.52]) by dpdk.org (Postfix) with ESMTP id A03691CF71 for ; Sun, 13 May 2018 17:36:21 +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=VjD1AZZlpELVhnjrHD9MLoM3rDfpoMPGtD3ebvumrOQ=; b=sPJ+jZr1PAVpTSPqy4prS0w5sC3BXaBOBNL5atCpQ9+Yx5NJ9FmIBDq3EvgDb7flzr4cQb1g1jZrrFZ/DwvS4rJXMpWAA5EGTT8aPk7wi3xHxk3WEjRVYBRdFxX6NhtYvtI/vIdapiqo7jEK6TKFaaC5FzxaEHAzaKrXzOhiqKs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR0501MB2310.eurprd05.prod.outlook.com (2603:10a6:4:4c::21) 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 15:36:18 +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:36:08 +0000 Message-Id: <1526225768-31179-2-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526225768-31179-1-git-send-email-ophirmu@mellanox.com> References: <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> <1526225768-31179-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0802CA0001.eurprd08.prod.outlook.com (2603:10a6:800:aa::11) To DB6PR0501MB2310.eurprd05.prod.outlook.com (2603:10a6:4:4c::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:DB6PR0501MB2310; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2310; 3:g3b7sqtdRjNuiVMAQi3TgW0dXfLWHYaWqxe7lxiBETXur156tfM3dD5m15zXTvAjHoK/9MF1RNL8CxV7eaixHF+jkuOxnCJJXJnTlPS1T248wfcDqfx3ILCfuH5CtIxlW5S0xhL/YOAkLpUPeujxAWMCHX7uCzqNw3mqNl3vOyEQJXnEi8VCVL3UpyowpARdyF1ngmM1Rwr3ZdpB8aCwMzm0Mh24MBBJUV6Vc9o9QjmJWbRcnUmyXtbwUxiOvi3X; 25:MRyXfXfilx4bf4NXu/sO5RSY/kYYcJCatmyjALF7eUxBYfvx4C/nBLvzmDxyccbEkU+MEpafpb4K3MfPFroNtuqvSfQLZj56lLlX7h7bJhli+z4zUVvt35ATNfgzDgz4nnV9TOsYn6PS9lslz5rp9agT2LFLgiIIDwbHksVTR7sgEPSHXgLRry20ka309lzwTDCr5T2QsdLeb92eNZCIJV9z+LU7J8d0eJcTaSizSB5nMCvznGIqqZ0agtjm8jb0fGODA822ZyB3mXrrZtnKAvLtb/5+43zExs97U4svXviKjrnXBCKROtb9tPShmDoTbkBSP1Ujhhqc1dgHLtVHrQ==; 31:63DbBxLCSQ3eF82+SQaJ+7AL0QyDN4Dg1Ecl0w+kIIyhEcYpc6pX5ssM3gMb1k8raoAoGAHKKNAwWuU0I8X0Q8QAst7T10Ca835bYYMyUid4a4xdhaFlBx1rjTBqmQLqCJHD4lQ4Y7Zt+Il31OzkVKK1ZsEGabuHcJCq4j1Y1f0icvOf6iJBU6wTCQjuOOWwQosQoeLx8ESsN/vsjooJmeF7vszW21N3ja6tbGPd0Js= X-MS-TrafficTypeDiagnostic: DB6PR0501MB2310: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2310; 20:px1O4WzI6/5ZhxSyhY4iIYESwxw5Fxk8iFdpE0vDVlL4Uni544/GwEsUCN0oNG9AnV4ITKYQqoVJkNsKBjXiUhXIEcf/ASQZBhhAfTYc+s7bsNMGr1r9trTkgSIM4oLsiQHufmv/VD6njd5+JxUxGuNJYZJrdZsaf5aHrvConRhlCS8towkMKsYvE2zcKpLB7zbBQZdczmNgY752LQ3tEXLFmgWVNrtUNNYNLV3RSG4glsqXuv7hJjf7WhBoTnUAonPWBsHC+r5+4Sw9VMzTU9FweyXfClx2wSzamzpVdH5MgyneDSAd2Zvxnt4QFWb/goZ8uLW+l++146ySIlwY8kF5YC5pFVLM3kg89shqL0Wlgy8pncDHowAQAElX5bCV+BWSZAZx14TaCfLCZUqLMG9X0OFCLI23L3FXTtQCoCpstaGp94YCBuadadEnvXgRuHs8BX5AG2PY/2EJh1eddMtbmLXuT02ieco+0rOc8FKNAhoWAQ8l4jJWE0h5XzBq; 4:jzE9YTY2L+F5f0GfcVp7UiXV7WcWaWB+RGjvm6HPvIJj9P1SQ/eem2TDU18btTAsbgWRapSiF4TmPujjvYGdi7Pi+QKdpIzx3ZRKs5QVrQACekOYRTSM1izXZPBxHA7/Udxbov/JRCKs3FtS5GU0tr33vUBzJFKqCYphdPBUfJ6UFDRw5QYPBnp0i582ZnxTcw8OdXY9r9292Gr9931AgQW7BcETW9Vu7xaTN6cLMn2YKfK97GcYrRMFOswpLzDZrP9bvwpZ1DQDzssHOnridQ== 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)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB6PR0501MB2310; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2310; X-Forefront-PRVS: 0671F32598 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(346002)(366004)(39860400002)(39380400002)(189003)(199004)(97736004)(5660300001)(68736007)(16526019)(53936002)(48376002)(186003)(2906002)(305945005)(486006)(11346002)(66066001)(54906003)(86362001)(4326008)(21086003)(33026002)(446003)(47776003)(7736002)(476003)(386003)(4720700003)(8936002)(36756003)(478600001)(69596002)(956004)(2616005)(106356001)(51416003)(7696005)(105586002)(50226002)(81156014)(3846002)(76176011)(107886003)(50466002)(8676002)(55016002)(52116002)(26005)(316002)(16586007)(6666003)(81166006)(6916009)(25786009)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2310; 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; DB6PR0501MB2310; 23:Yqu0wETQR7cEVi78fdYm6qFiEByJ4TE1eGR926+?= =?us-ascii?Q?Ejfq9Vz91WbaZW6PcMZrRzUprqqyUnRO5l5WNl8CwqgYJUMo7WCr8qMUAEFu?= =?us-ascii?Q?K3lGgUezia+eIKgoAflVxR5KbQWjdvcfgP01GNExf8PCTXoP7uuEGEkaaTWP?= =?us-ascii?Q?n8VZH/irOEXSa6LrGMDy/h3pzvdimqLlDcypYANRJiLKb+JfZ5t+mznlEiEo?= =?us-ascii?Q?sfqkkZFDTF9f23wb0O3cCt4dO7HlDKHbYIZ1QXrcT8OVmM/mbVZwKHf7Bxss?= =?us-ascii?Q?ZH/8CFH/foeOdS3j0UvYI2/3VFQnurrhaC5uT4lUMO0VYwrrRHfUiiY/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mgzO68ETsTqTf7Nupe78KFCZYs5txyF7aokAK8Q8vWNMAm77MTdMisBc5wvX9UaC6Qyn/+MoraaywBjNYP0jpl5v6+4Jy+mGRo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2310; 7:gl2NRGwkczK1QI6S4xYkgRbiV9CFTKQAF8aP2+n9o0rBlM9PpffQbA5tCFzahQWXuIkbFso55pA3ZULzSv2+eX0hamAyZU4ZSM3GbFwp9Aj2HzTjfrj8oo7TwEXE04dHLeWzg9ANzvJuJSj9f2/EMUk0j8/oC62dZoVzDPSJK/aCknUUUhbBMk7rQT4egWxCJkW0DSDmCps2B7HakzhtPfTfxLhLMmHMFjiYQdDSmwV9Du/KCs7gIbt5yUmlIKpe X-MS-Office365-Filtering-Correlation-Id: 0b329fee-4e51-40ca-827a-08d5b8e74670 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2018 15:36:18.9809 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b329fee-4e51-40ca-827a-08d5b8e74670 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2310 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:36:22 -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