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 2C3DDA0C41 for ; Sun, 7 Nov 2021 16:30:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4439D4114A; Sun, 7 Nov 2021 16:30:33 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2083.outbound.protection.outlook.com [40.107.92.83]) by mails.dpdk.org (Postfix) with ESMTP id 905BA41141; Sun, 7 Nov 2021 16:30:31 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N2myB/1gqcjeDQNia8/v9Hn11t/sJzSSqWx9D8eXmp0oXnFI7tWkawierIlXSL5YXz88Zs5Hq2Fc9o/nOM1prgftFhaz0YsMtWcOnHLDUbvh3SItvhBrGcFdbn1J3x6ezKA40UWyTl1xpkm+fQupDGFfg8JcrJLdOVOVgX1zdCuV9fFxJxwxQkcrpe5zCN8EJgXAVDryXyuA0gCKU+6Enl8B17ga++PATBa6V1mWOC8KTG1fsI9BrarO0BSZV/XLwTOfHQdV6SQ8Ejnr9TZ/YmuEDdhM74k38k8karSn7wwNSKjydLu2cdwyahgQM2H2ekqsLbNEfvLajszrq9P6Hw== 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=H917ZJilJzxnMRdpcpN6ddkwYFZmlGwSZwn+q8GYr+8Og46xOP58H873fLnifGcVQGr4vadPBAwDe6KGGKzT3DEipH9sO0i8qNmyTqF63JcvOKn8UY/D7JhgQ1i/X21R0a7XLPPtSeh8FSbYRlgvRLotJQ8/E3rxoRtwKjlhX0xtW4sVDJhkSgQ6/lIX5SUH7zOvSHY4kOWrwUsgQ/GK0Qog2k/XKV04h+xfz3lobfdnRrHJhJe4/xG+qRarnJ5j+m5kW8zVdXjllLVWz2l1nM6zkDBfT5nC+e/+xr9PArErmS+aKYkvI717UWzwscv9WpsJAkh6fieWglhDaRLPtQ== 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=B+y98NDAyKhk+dNWVrDN+ZyIgF3i6G0sEKoj12C/PWIGSiNH67vTU7SN+aPgPp91sdeaCacA6qSDxVbdqNKiY03ae110R1+mWf/HpHJqLQybBiP3VBcyyh6UCFQa57wVFI80MMpSViOWiOQ5N/8FGXdWgAios3zlq+vkkPwnQAZvt6mmCUbqD8bkO541kIGEzWOLM1RhrSx/3yjfWU3kHHKxrnNLJCKGnuyIgwayNCyhDpKEIF5yehVG7ptcWhj3IxacplHU2TLqJsG+qAwTLXa06OBg8YcMl48kXvrXqCJrY6cWq/+5tz/h2MQqueGK4Xl1hHlsHVjqL+PKurabTg== Received: from MWHPR18CA0043.namprd18.prod.outlook.com (2603:10b6:320:31::29) by DM6PR12MB4355.namprd12.prod.outlook.com (2603:10b6:5:2a3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Sun, 7 Nov 2021 15:30:30 +0000 Received: from CO1NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:320:31:cafe::41) by MWHPR18CA0043.outlook.office365.com (2603:10b6:320:31::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Sun, 7 Nov 2021 15:30:30 +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 CO1NAM11FT010.mail.protection.outlook.com (10.13.175.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Sun, 7 Nov 2021 15:30:29 +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; Sun, 7 Nov 2021 15:30:27 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , Michael Baum , Date: Sun, 7 Nov 2021 17:29:19 +0200 Message-ID: <20211107152919.2158802-6-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211107152919.2158802-1-matan@nvidia.com> References: <20211107152919.2158802-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37a8e184-aa25-444e-bd0d-08d9a20387f7 X-MS-TrafficTypeDiagnostic: DM6PR12MB4355: 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: zGIy9zCMjYEFLQx3DwCHraBqDI7EUmDMUYmgCZi5tEUZi2FfauK6yrnTY5rCKzSudqW5B0NT+D6Zs9e2DiQEOgO3FjualqaBJG8Ncs9zjI6IjNcPg4pAsHhD3fWOULaVg/p+bebX9JjyoiyBz3ATstEc/lpMDgSycO/qYA+lLKuhanjHXkOeoGyQ3dRaS5Ko6PpbZ80CDH8G//lELii7m/S6vvTv7Jka5/CmhBjo6oeNFe6ayJZHIYcD/CcPps/PGsNaKMxu9VNuP9AXmpajapWIvaYMcjgrB2EzM6O8y43vZiBVZI5sfUm4gcjYQ8ujOWnCYf4CZgXnSWYx5i5/dKfrt8OK8S1p4JjJnE7JTPC0FqVvqUnRrZV6FjKFZPE0l4XlSALlk1mXzA5UXQRN4S1j9ETKDTai6wHGVYaTnDarvqHlJkwyPUxzoiEiotoYMbqzYQbwSxesDwrpdpHFfgVfuJqhaSChHoGLmyj0nRjSEHSp+x2M/5Z4QqmZ1H6ykyIKs9OxqoxrMZHTwYBYWfV26dzAUJPUEWjEcpOI54Bm2kHeY/2J+eIPUcdcrmSzM3s3U2kKyX6SCIPsZ099u4cBYbmTgsFpMCAV1fX7ypUaah+FhyEqk2xMck80ZhdJfYeXLmiH0OqCsXx0ajf/j8JtopEWVapygPrvFd4k6MzreKoVCHQIKFV/alRQU91WQedr0mpqt9HQcvVa/vAkMQ== 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)(46966006)(36840700001)(37006003)(6636002)(26005)(8936002)(55016002)(356005)(186003)(7636003)(316002)(54906003)(82310400003)(4326008)(2906002)(508600001)(70586007)(70206006)(47076005)(1076003)(7696005)(5660300002)(6666004)(426003)(86362001)(6286002)(6862004)(16526019)(83380400001)(8676002)(2616005)(36756003)(36860700001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2021 15:30:29.8248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37a8e184-aa25-444e-bd0d-08d9a20387f7 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: CO1NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4355 Subject: [dpdk-stable] [PATCH 5/5] net/mlx5: workaround counter memory region creation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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