From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 76F9CA0C4E; Mon, 8 Nov 2021 18:22:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0702441169; Mon, 8 Nov 2021 18:22:02 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2060.outbound.protection.outlook.com [40.107.212.60]) by mails.dpdk.org (Postfix) with ESMTP id E316541152; Mon, 8 Nov 2021 18:21:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BtFtqN8MHbKKD7qrrafk4QhKsWjtW7a1grNJZO2KDT4NkoGbwy+vL1lLDz1C0ayu3+v0pfw6k/TTytZjyu62cp3uEbhuBY5bflbxtbA1NO894m3fa/GzisTG7TF4QIm2MpxWxHf8Sf9OZ6FjnNdcbW9KgTvAvgQpjjGKx+O6H1VY8EKnz86RbWTRS4xlh1ISxcT+NBhzcigadYJFmE60gCXpJ2YgfPur2KKRWP3gFiqj3KHECgdxzOs9aINvUCHOANqLzkShhQthxsZpKP67TJPhKURH8+fdxPuTBuAYZya9sUPNoUq1lzdTdEQT1FHNrJS9JenBy/uH2ju1TtwmKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lVXJ7lAedzYcFM0C13Dm0Ef1HmInUQzhyrCiM1gyGkY=; b=jD57cEsvp6FQlODYkP2w5R3XEGHzsXJE986QyzB+oeCd1cGTxYG4Z/bYtiZV9FA2Wwk/FnejMA/0cobGJl41hWyDwZr09/JBUZIClJFZfLCqedrD9Wof5eOIarQBkBLJtqIcqh3rXXss7oN0v7ZEEA31aKWPvbvqJoPGDviJ+U9Ow7/EtPJ1EUT9/qflnkzHf+xjqzSvA8/8f3HP481WN4pYlDziqRKey7QSgBcGzWrXu0f+Ovu6SPkbZT0KeHadaLCrU5DDiVDeoKantTCGfUei1pUs8uCg9o6JKT2DM0HfxlTiKlNk6euwmIP8mLZFdbfeTf5ia9AA7t9kfhOp6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lVXJ7lAedzYcFM0C13Dm0Ef1HmInUQzhyrCiM1gyGkY=; b=sf6Yhy8cs/Sk6tPp1B+Ef3054GYyig/EatM65k4o49QOtRZDRuX4cyN0/+UQ94cl9PceWw3P+j9/20P2clJvuc4GCqeqGJElbLFZz9RoguIul6LXvNnWMLuLdSez0u/flaN7so6XN917/B3HdXWIgrVBmlU45EMV+bstkz6mgYsJCXrY56zvxyVkQP/l9k5gVVpcjFJQpxDUa75wlBZUl2roGYouu22AoKjUORlsmKoSHqIk6fZczlzKu8Gk4wu5zjVR+7/ZsLqkxUf4lsKAxP/XlSM81Tfq7uQ8WmQBRuxG+1ETlERUfSQq5Tnjq/x2a8JcDjt9U9fSAtV3g8Dy2g== Received: from BN9PR03CA0298.namprd03.prod.outlook.com (2603:10b6:408:f5::33) by DM5PR1201MB0155.namprd12.prod.outlook.com (2603:10b6:4:55::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Mon, 8 Nov 2021 17:21:56 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::d6) by BN9PR03CA0298.outlook.office365.com (2603:10b6:408:f5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 17:21:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 17:21:56 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 8 Nov 2021 17:21:42 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , Michael Baum , Date: Mon, 8 Nov 2021 19:21:13 +0200 Message-ID: <20211108172113.2241853-6-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108172113.2241853-1-matan@nvidia.com> References: <20211107152919.2158802-1-matan@nvidia.com> <20211108172113.2241853-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f06f11cc-3eeb-4f80-8af7-08d9a2dc43d4 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0155: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:246; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vqzi5k7TQl6ZKRf8e2URF8STy6ooZFKMCcraJwqZfTG3k5TRpjn6o96FBVAtHx6p8aNZ2TNKPnGzzn53SMSXGsQsL0qkdYNHN3MurOmHewRoePBtZmMscK/s4t/PpRXYlECAAvLqRn6I/OZPfGDvARamOhvuN9trsdEHXC4jhhAEC9o9hnxxFv3AUunrsPDsJ3PcVGsHmSRi7z7WX0S0wswEYyTBHaq+/DivtEufZdhtG/ZSDKTLrVSmPnTzS+ajhWwca1IYZoD5UWo1h5VbOZCVXHdq5SirEjanFx88AfKUlHe1Pdh/EPcd4AetNeLpS/lnxDBMn/J0IdEGFSzhA2mLZBWia//GoUBymOyVU5QarEaNnDQBJQ+qwbUD+K1FkbMsq3m5H/1l6o6VEV6lxbv9otvK56afkt1XL60nOjqlxqdG4Hrd6LxMF0Xs3qhKPaXWOjwDFlHJSWCC4ZBu522+8Ugw5uCg2wQWZYTApTJ3O205FVnpD9KU3ty+cE1iMjSfjwfo4sIob6gkOfQhMCgpYQQXZ/KlUSMHKP48uj4r4bgGYUuZ3XI9olgmMOOG9lPoGC2ME3vGntUy6EuAwdtVuNKtc4yAscNFLj6aKXIANqHxMg9U7aFSEP5QsDfzTSt+7EiTx+b7SOczkX5eb8emlyIDrcXQK8BArHGNXOB6JU96Ee5UXhABpzAAmufjHv5p2/wdKlzMdRWfquGUfg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(316002)(47076005)(70586007)(36860700001)(1076003)(186003)(16526019)(37006003)(82310400003)(55016002)(54906003)(6666004)(26005)(336012)(70206006)(6862004)(426003)(36756003)(36906005)(2616005)(7696005)(4326008)(6286002)(8676002)(5660300002)(6636002)(83380400001)(508600001)(86362001)(2906002)(8936002)(7636003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 17:21:56.1934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f06f11cc-3eeb-4f80-8af7-08d9a2dc43d4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0155 Subject: [dpdk-dev] [PATCH v2 5/5] net/mlx5: workaround MR creation for flow counter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michael Baum Due to kernel driver / FW issues in direct MKEY creation using the DevX API, this patch replaces the counter MR creation to use wrapped mkey API. Fixes: 5382d28c2110 ("net/mlx5: accelerate DV flow counter transactions") Cc: stable@dpdk.org Signed-off-by: Michael Baum Signed-off-by: Matan Azrad --- drivers/net/mlx5/mlx5.c | 8 +------- drivers/net/mlx5/mlx5.h | 5 +---- drivers/net/mlx5/mlx5_flow.c | 25 ++++++------------------- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 9c8d1cc76f..da21a30390 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -521,7 +521,6 @@ mlx5_flow_aging_init(struct mlx5_dev_ctx_shared *sh) static void mlx5_flow_counters_mng_init(struct mlx5_dev_ctx_shared *sh) { - struct mlx5_hca_attr *attr = &sh->cdev->config.hca_attr; int i; memset(&sh->cmng, 0, sizeof(sh->cmng)); @@ -534,10 +533,6 @@ mlx5_flow_counters_mng_init(struct mlx5_dev_ctx_shared *sh) TAILQ_INIT(&sh->cmng.counters[i]); rte_spinlock_init(&sh->cmng.csl[i]); } - if (sh->devx && !haswell_broadwell_cpu) { - sh->cmng.relaxed_ordering_write = attr->relaxed_ordering_write; - sh->cmng.relaxed_ordering_read = attr->relaxed_ordering_read; - } } /** @@ -552,8 +547,7 @@ mlx5_flow_destroy_counter_stat_mem_mng(struct mlx5_counter_stats_mem_mng *mng) uint8_t *mem = (uint8_t *)(uintptr_t)mng->raws[0].data; LIST_REMOVE(mng, next); - claim_zero(mlx5_devx_cmd_destroy(mng->dm)); - claim_zero(mlx5_os_umem_dereg(mng->umem)); + mlx5_os_wrapped_mkey_destroy(&mng->wm); mlx5_free(mem); } diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 9307a4f95b..05f2618aed 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -462,8 +462,7 @@ struct mlx5_flow_counter_pool { struct mlx5_counter_stats_mem_mng { LIST_ENTRY(mlx5_counter_stats_mem_mng) next; struct mlx5_counter_stats_raw *raws; - struct mlx5_devx_obj *dm; - void *umem; + struct mlx5_pmd_wrapped_mr wm; }; /* Raw memory structure for the counter statistics values of a pool. */ @@ -494,8 +493,6 @@ struct mlx5_flow_counter_mng { uint8_t pending_queries; uint16_t pool_index; uint8_t query_thread_on; - bool relaxed_ordering_read; - bool relaxed_ordering_write; bool counter_fallback; /* Use counter fallback management. */ LIST_HEAD(mem_mngs, mlx5_counter_stats_mem_mng) mem_mngs; LIST_HEAD(stat_raws, mlx5_counter_stats_raw) free_stat_raws; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 2f30a35525..40625688b0 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -7775,7 +7775,6 @@ mlx5_counter_query(struct rte_eth_dev *dev, uint32_t cnt, static int mlx5_flow_create_counter_stat_mem_mng(struct mlx5_dev_ctx_shared *sh) { - struct mlx5_devx_mkey_attr mkey_attr; struct mlx5_counter_stats_mem_mng *mem_mng; volatile struct flow_counter_stats *raw_data; int raws_n = MLX5_CNT_CONTAINER_RESIZE + MLX5_MAX_PENDING_QUERIES; @@ -7785,6 +7784,7 @@ mlx5_flow_create_counter_stat_mem_mng(struct mlx5_dev_ctx_shared *sh) sizeof(struct mlx5_counter_stats_mem_mng); size_t pgsize = rte_mem_page_size(); uint8_t *mem; + int ret; int i; if (pgsize == (size_t)-1) { @@ -7799,23 +7799,10 @@ mlx5_flow_create_counter_stat_mem_mng(struct mlx5_dev_ctx_shared *sh) } mem_mng = (struct mlx5_counter_stats_mem_mng *)(mem + size) - 1; size = sizeof(*raw_data) * MLX5_COUNTERS_PER_POOL * raws_n; - mem_mng->umem = mlx5_os_umem_reg(sh->cdev->ctx, mem, size, - IBV_ACCESS_LOCAL_WRITE); - if (!mem_mng->umem) { - rte_errno = errno; - mlx5_free(mem); - return -rte_errno; - } - memset(&mkey_attr, 0, sizeof(mkey_attr)); - mkey_attr.addr = (uintptr_t)mem; - mkey_attr.size = size; - mkey_attr.umem_id = mlx5_os_get_umem_id(mem_mng->umem); - mkey_attr.pd = sh->cdev->pdn; - mkey_attr.relaxed_ordering_write = sh->cmng.relaxed_ordering_write; - mkey_attr.relaxed_ordering_read = sh->cmng.relaxed_ordering_read; - mem_mng->dm = mlx5_devx_cmd_mkey_create(sh->cdev->ctx, &mkey_attr); - if (!mem_mng->dm) { - mlx5_os_umem_dereg(mem_mng->umem); + ret = mlx5_os_wrapped_mkey_create(sh->cdev->ctx, sh->cdev->pd, + sh->cdev->pdn, mem, size, + &mem_mng->wm); + if (ret) { rte_errno = errno; mlx5_free(mem); return -rte_errno; @@ -7934,7 +7921,7 @@ mlx5_flow_query_alarm(void *arg) ret = mlx5_devx_cmd_flow_counter_query(pool->min_dcs, 0, MLX5_COUNTERS_PER_POOL, NULL, NULL, - pool->raw_hw->mem_mng->dm->id, + pool->raw_hw->mem_mng->wm.lkey, (void *)(uintptr_t) pool->raw_hw->data, sh->devx_comp, -- 2.25.1