From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0086.outbound.protection.outlook.com [104.47.2.86]) by dpdk.org (Postfix) with ESMTP id C7DDB1B274 for ; Fri, 19 Oct 2018 17:21:46 +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:X-MS-Exchange-SenderADCheck; bh=Mc4Xsh2pNG3xYcb7y86tJHnB8R6hhuoOOGPsEQLY+kw=; b=sfERNcI+ZoDNxZ6i9fYKamE/XS9JCQlQ7Ha8HPc7rXwKKQHLysXGBcTZrnN6pkqhCrJdKyHJdzRQz3O4F49Km20RYZ7esOdmlXH8Q13Bb0kYKfglVhS8DEAgIwYNrv4lzr7MsW4v35MHkvidKMxECyBl4J/F6ov+Xz/9LWmqwco= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR05MB3268.eurprd05.prod.outlook.com (2603:10a6:205:4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.31; Fri, 19 Oct 2018 15:21:45 +0000 From: Viacheslav Ovsiienko To: shahafs@mellanox.com, yskoh@mellanox.com Cc: dev@dpdk.org, Viacheslav Ovsiienko Date: Fri, 19 Oct 2018 15:21:07 +0000 Message-Id: <1539962470-10950-4-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> References: <1539784438-29242-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: CWXP265CA0079.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:39::19) To AM4PR05MB3268.eurprd05.prod.outlook.com (2603:10a6:205:4::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e6fe352-e753-4ae9-396a-08d635d694d3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3268; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3268; 3:iiSjNnVyz3HEAqVfO0ShJ7xU9C2pGVOptdc5rLTBMcA1XkTBIV/r8rlObMazk1XEVDb3y7VCPmVMPJRxsyhYGjE31CfuzVxDWVmw4Bq1CBqI+2mIiY6lT8GoPB4jO7tpBLpCyNLXMG1ONW1ddY7Ma4yVeLE2ES9F5a4aey2KY9RIGtByulnPzwjbj++i5LquiatKz3zuYFAsibyN6qXh/2lYF09b3+yYAuCtnfZYiSrOUdIb/QA7o+OSss4TRy9T; 25:czwEcdPP1/EskWpd5EBiCl54yRqaAxt91rA7W/gOH5J256ZrGbKdqJ1B9p0PkMOELRda/pfMxWmBoSgVPksoo543j3XL8LcL0ou+5L9CEYo+EAWm2uQHIohBzSt8oC5r7+0KfYlYd8jzbGk1Gg7lcKux0IynMzfPuybJhTUECo9X32jNdNvSt7e7/lxNyi4Jl6qdT+zJhKHWmSImBNtrQ4uWf/MkHRec9Gu7sQKP+WO+nzGMpXmvZlUpOYTI1QfBAoGPHnOC7YSD/cw0EKgoDqYAO4RIY/GBYrlCX+ZT4gz9BkZ3Te050hAM3m2tPc9STmVVsnhK+D/hxf7b3zoyRw==; 31:XBCnilsbz9ZSCpRRS+3rUsLF78LR5DQ/ZxyBVcUUQ+SRM3OOPWEA6NHxk1Frix4Vzb8/f1SzQ3EbJv5ZXPoxuuUeIvSXsCy0fzyFlBHbpDvbPZYhixGl4XMxr2q/z8TBmFYvmIL42UmoC2gnjTCTSgSy69deQoLTheMnpwrQEPXaGX6m1H6Y7nEDirGGngUTvH4s9nJVUV0rq4AyurFEVWR2UQAeZ9PrxIcfoGWaOzw= X-MS-TrafficTypeDiagnostic: AM4PR05MB3268: X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3268; 20:ixfKxGLXUYlQ8uTnnNLyavTs/rlNXjulsmBy4+h1QA5ukuQXO8kwzzT4YbQ5210NhjUuSNr8diNDwI/igaoguea6CG8jNAiycphehNN66kxhRlO0gUgVUfk+1KkhZUJ3ZIJF1s50AvdV98w7dsyMbqViO7FGr7z0WvjpUssBeXApa/ZfuKBcM7oM5Abu3TOxL2wbRBQ9JZ9zk9BwPLaypWNkJqR7+fist86QAo0u9sfvUTcRu0Czoqk8Dp4X07bv0+hHVTBd6LSvCeNe/IEgAfh/Zzc43hhglvW+cfDXJYAf8XwG8tdJ4lg6bWzHPBXGuFWVcU2Wma56AoU+5gKrJrxshR1JL0ghLPzqtJRPIr4cHjtx80DfYTEIMCzPF4DxsYNc3X9RSb6jZBN/e+RfYpDmoIxZvqeFs9JLxuhyX7uu/Q/ZQ2vgJUy6YQ20kK/QSW8fnWokTOu7LUADjFi951bS0xDleP6dpFu0U1owB6vTixsOWFfdwyaipN6i8P7I; 4:UtK/ObCQ21XZx+uMLTtaXFlE0luDhNaDf00rBXhDocw9CIQn0Gka5fUsX7xtH5qqMWgUFWHTvfN8YJB5s3eJF3X/3FkhGs2ni0wlZTKb1j9N+FhpGwi5FlmKCmpoXO6LJXS4CZ3VNnf+5B5KqDHAtG+yA9yaBTljtFCRMm0R5E5Vi6DubszJCCadoZOhkpV7Wgohm3QOrXsU4tHFwSRY5n3UKp1DD6LYdDAdkEQ9AOeSZYR4iFoJfkmrEP71LQ14x5wQOReI0wn+A84ahc/VaA== 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)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3268; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3268; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39850400004)(376002)(366004)(136003)(396003)(199004)(189003)(2906002)(8676002)(50226002)(69596002)(33026002)(6116002)(3846002)(476003)(446003)(4326008)(11346002)(76176011)(7696005)(486006)(51416003)(386003)(186003)(956004)(81156014)(81166006)(8936002)(25786009)(2616005)(36756003)(14444005)(105586002)(86362001)(66066001)(47776003)(97736004)(16526019)(26005)(316002)(16586007)(52116002)(68736007)(50466002)(5660300001)(478600001)(48376002)(8886007)(55016002)(21086003)(4720700003)(6636002)(6666004)(106356001)(107886003)(53936002)(7736002)(85306007)(305945005)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3268; 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; AM4PR05MB3268; 23:8a/0/40R/6IEwV1OEBEMZ6jQvCGnJCbNmWpLM7R5S?= =?us-ascii?Q?TV/k4lXL1KQZ7V9tLHyOYG9ogXEOgDwHWs8dPQp7dJETb4PulthuKC+xOTO6?= =?us-ascii?Q?tsw5mXlT4vG0SZ6PKw2YCAJMwORtqlHo2KHt62KLijSiJQFEsNWUALyXlV17?= =?us-ascii?Q?GYDb2yFFy+bh1xW70vs09jydQWUJ2mkOybGI89IW+ubqj5K7uIBg5dkijmjB?= =?us-ascii?Q?no25AQuN+0DjGJXmJO7n8x4xmhDK8fI5b2L97hLlyQ9Po7xeYe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oAN1nAmPv0+bIYe2H9gNwJVRWveHIbA8ZNlYVP+pRqIIoBzfkgMo/ZZ0eic+Ax0TMTA7vNdi8QevuhfAWUqc7VUxfdPqemwXLKEJUpA==; 5:EK5AIfYGpW072o7aOUqiPx9rB7RHRF3hveE3OxtKr3WWevBLqjYmAwNyMldviKi1xenGmvxAl1cG1phQWjsmJIhksu34cDqprzBBslNACx1mpPxTW8G1pzppfQc9xLWSLaHLxP7FrieH/NXbs6I1aNkQ6ZkTv/GIlvNfPxvGE9A=; 7:kZVBusBxvDJXGvdwTSMbF8XvGebBnHk0ZiVOdbOLxnvlPMJtx0DV6KSVwdyMz2I9HWPZYXUu/QhxceDtad4lwCp+7WaXvVoDyYHzGbEAWQiyNjkTjC8mr1Y04TB5+uF7PmEq+bGZ9j6PwlgDlQe2m8bczuFQ2J03Y4YfCqmN0Jw2/+PAYk5XMUoJOx0S0mdPQEut4UGist5EZ5aLdnsgSM1S0MHrQ1YO2xLqHNbMkJ5x2fXeMaKBRB7Z1N/1GaOF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 15:21:45.0648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e6fe352-e753-4ae9-396a-08d635d694d3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3268 Subject: [dpdk-dev] [PATCH v3 3/6] net/mlx5: flow counters simplifying runtime support check 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: Fri, 19 Oct 2018 15:21:47 -0000 This part of patchset removes the redundant check of counters support in runtime. The flag flow_counter_en is eliminated from the code. The Verbs create counter function just returns an error if no counter support presented in kernel. Some log messages regarding the counter support type and presence are added. mlx5_flow_validate_action_count() is also updated due to flow_counter_en flag removal. Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.c | 15 ++++++++++----- drivers/net/mlx5/mlx5.h | 1 - drivers/net/mlx5/mlx5_flow.c | 16 +++++++++------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index bb19085..8a33639 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1009,12 +1009,17 @@ config.hw_csum = !!(attr.device_cap_flags_ex & IBV_DEVICE_RAW_IP_CSUM); DRV_LOG(DEBUG, "checksum offloading is %ssupported", (config.hw_csum ? "" : "not ")); -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 - config.flow_counter_en = !!attr.max_counter_sets; +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) mlx5_glue->describe_counter_set(ctx, 0, &cs_desc); - DRV_LOG(DEBUG, "counter type = %d, num of cs = %ld, attributes = %d", - cs_desc.counter_type, cs_desc.num_of_cs, - cs_desc.attributes); + DRV_LOG(DEBUG, "Flow counters are supported (4.2), " + "type = %d, num of cs = %ld, attr = %d", + cs_desc.counter_type, + cs_desc.num_of_cs, + cs_desc.attributes); +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + DRV_LOG(DEBUG, "Flow counters are supported (4.5)"); +#else + DRV_LOG(DEBUG, "Flow counters are not supported"); #endif config.ind_table_max_size = attr.rss_caps.max_rwq_indirection_table_size; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index d14239c..74d87c0 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -114,7 +114,6 @@ struct mlx5_dev_config { unsigned int tunnel_en:1; /* Whether tunnel stateless offloads are supported. */ unsigned int mpls_en:1; /* MPLS over GRE/UDP is enabled. */ - unsigned int flow_counter_en:1; /* Whether flow counter is supported. */ unsigned int cqe_comp:1; /* CQE compression is enabled. */ unsigned int tso:1; /* Whether TSO is supported. */ unsigned int tx_vec_en:1; /* Tx vector is enabled. */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index fcabab0..c15722d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -921,22 +921,24 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, * 0 on success, a negative errno value otherwise and rte_ernno is set. */ int -mlx5_flow_validate_action_count(struct rte_eth_dev *dev, +mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_attr *attr, struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; - - if (!priv->config.flow_counter_en) - return rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, NULL, - "flow counters are not supported."); +#if !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) && \ + !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + (void)attr; + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "flow counters are not supported."); +#else if (attr->egress) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL, "count action not supported for " "egress"); return 0; +#endif } /** -- 1.8.3.1