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 09827427E2; Mon, 20 Mar 2023 15:13:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E973E41141; Mon, 20 Mar 2023 15:13:13 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2059.outbound.protection.outlook.com [40.107.220.59]) by mails.dpdk.org (Postfix) with ESMTP id BB900410EF for ; Mon, 20 Mar 2023 15:13:12 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LYlOcGmAq5S0L3Etei16FvAwn9a1+7d4Wup5VNN/zQ7F58G75FNu/DrUbExND365EbvcWfgK0iAXrTxkWKllO/GmcsdDiZm+zqWkaZzywgL8iQJ2s34Zvmc09aFX85/Z1Xi5NvKdojbmIc5z1bRZP4E6At7hFYZ/GS/DZ019MpytLwoDGQKL6pOTxjLU+9vVx/3ulRF/BEbTvxjo0NkidMRxzot/7eXkUJlZfq3d7nnGSCxzQANN7Rx6784i48XnzLrl06ukrFMI6qdXhbFnjC1pz+5Q2QmFZOjIvVeojuC7/lyiq2ogdT4sbJHmsIrUQJdcjoLmGVScDCmQSenvMQ== 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=fEoDllUt+tCchy/LPPXzvNZD94mr4rQhW7HKgEjXiRo=; b=fyGeFioNDbLepug1/MugHouPIV4plAIIly9+jaqw9/EjhfGd7qpR9J12MoVKyuMaIzKLr2KQgNIRvp719PiXen6nFUCFIeShLoWFY9mGXg77scO0s5mlv+ahTxWmNXwlty8u9DJ6bETDH3T7MSDPpwpiam0ybE14qWHR1XjyfU+2rKfZIIphQfR2FKNBk0FNBzfqcU4HaZlNjvebyNLT6xQNswEl4u4ZHx33DeTnBdJtUhQ59gB18U3ywVGAgpLpmDJdPCjqECY2mdWj3lVETPkTUuvYFlHXiQfsOR0MYYZnYks32t8njjY1wAqr6Qs6anESjv8DSqQaKhVxNUaHgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=fEoDllUt+tCchy/LPPXzvNZD94mr4rQhW7HKgEjXiRo=; b=kn5IBSS1N7sS69JXDPdpOB2L7Zd1L7QbPK6M6dO1nD/pxrMwFfxEw9Y/mQ7y4BXVKj36XUwaarMc3Azd1p0cGyUQFYYrnK34GwrIVu13Zai2w9bidEvlMx27TiCVxcwwaaglDgotFI2RfUuBCuSZi+7UVuBvLrJ0FGVuNNpzIqv0NqNmS/cTLXFAHZ12K2W5rG51hoAv7aTvZsECf4dTsjBHR56i4EiDLJLj+pc4JTqh0CiPU8GxZRGdjiY40NV98kumdz2JEdD5jK/ogOqXPbpq7DFvoL+3/Ma6M5p0fnNNe6pMUo7BIpjAx0CUcfapczL+igjfry57ZxGiYrXhQg== Received: from MW4P221CA0004.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::9) by SN7PR12MB7369.namprd12.prod.outlook.com (2603:10b6:806:298::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 14:13:10 +0000 Received: from CO1NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8b:cafe::16) by MW4P221CA0004.outlook.office365.com (2603:10b6:303:8b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 14:13:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT004.mail.protection.outlook.com (10.13.175.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 14:13:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 07:13:02 -0700 Received: from nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 07:12:59 -0700 From: Hamdan Igbaria To: , , , , Matan Azrad CC: , , Subject: [v1 2/3] net/mlx5/hws: dump FT icm addresses Date: Mon, 20 Mar 2023 16:12:27 +0200 Message-ID: <20230320141229.104748-2-hamdani@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20230320141229.104748-1-hamdani@nvidia.com> References: <20230320141229.104748-1-hamdani@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT004:EE_|SN7PR12MB7369:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d4f6a7b-ea0b-479e-34c4-08db294d3c6a X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xglgsdjND3Ab+mJdsewTO1kftDBDg5Z253JRrYK5CIl77n0exdelkmhihjxa4FSEauHWLeNfqgHRv0SmYgPM+vaEAxmE4DZ3OgHSh/eOG0JlRpP4NWD8rofVaLS7YT7sn9ZSKmq8UZKPC3ZKe5b4XcooR6nJEUH/h1MEb3MglBy8APKEIT8+e9DP0qipz2anvHKZvtDCYcKZ1r2yoSuBWNnbhrmP1gfQcBH0+g2sehqO+J4c5ZJMM6Gkzkjr41uVEZ5gBNuILOXbD6nYjnD0HuXLqlq18+u+SiqhmRRXjLTc02SVhkOR8NMMYI1dpWE/pkCovRLfZfklWjYxAjTa0pm54jBM2ku3QJeyRJjCJliAos1Lj99J/GNrocx9M6lAOd3I3mZUgygzqvwah38tw7PPl5l0ERIDeu11qb3q2vpU5vxcpwkcQaRXtERgbMDen+6ImK7/eNDB0XUEXpffO6JgMfYWLhd62hrhdTi608PTycKjcsqLIAiKHw+9iMgYIrR0qBpZXKjARIvaGnxE3nTIE3Cv2lFjX28t+M+84cfgvgFIICqaTEdxOXo0vd2MASedDxSRBMsjlui/jureMYNfq+/qVWwGyWTPDlgTZrgRSoEZUPICJMF4jXgw6M3NGP58q+rsbLKwb6LxgwnterLcoKfYEMHlrmxG+PEH8hYOhGfuBPKMOPGfp411S7iq/xNEF5vHMkMgBWwxE5YzaYRSlXWpMOCcLo4jiYb5yoHtda6qUe6MgPbej24e4pfP X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199018)(46966006)(40470700004)(36840700001)(83380400001)(5660300002)(8936002)(426003)(2906002)(47076005)(86362001)(7696005)(36756003)(40460700003)(6286002)(26005)(186003)(16526019)(2616005)(1076003)(55016003)(40480700001)(336012)(107886003)(6666004)(8676002)(4326008)(316002)(356005)(41300700001)(7636003)(70586007)(70206006)(82740400003)(478600001)(36860700001)(54906003)(82310400005)(110136005)(6636002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 14:13:10.4933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d4f6a7b-ea0b-479e-34c4-08db294d3c6a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7369 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 Add the support for query FT command. Use the query FT command to dump the ICM addresses of table start anchor and matcher end anchor. Signed-off-by: Hamdan Igbaria Reviewed-by: Alex Vesker --- drivers/common/mlx5/mlx5_prm.h | 50 ++++++++++++++++++++--- drivers/net/mlx5/hws/mlx5dr_cmd.c | 28 +++++++++++++ drivers/net/mlx5/hws/mlx5dr_cmd.h | 9 +++++ drivers/net/mlx5/hws/mlx5dr_debug.c | 62 ++++++++++++++++++++++++++--- drivers/net/mlx5/hws/mlx5dr_debug.h | 6 +++ 5 files changed, 144 insertions(+), 11 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 4b0a56f4e5..6b72039bdd 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1156,6 +1156,7 @@ enum { MLX5_CMD_OP_CREATE_RQT = 0x916, MLX5_CMD_OP_MODIFY_RQT = 0x917, MLX5_CMD_OP_CREATE_FLOW_TABLE = 0x930, + MLX5_CMD_OP_QUERY_FLOW_TABLE = 0x932, MLX5_CMD_OP_CREATE_FLOW_GROUP = 0x933, MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x936, MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c, @@ -4872,11 +4873,17 @@ struct mlx5_ifc_flow_table_context_bits { u8 reserved_at_60[0x60]; - u8 rtc_id_0[0x20]; - - u8 rtc_id_1[0x20]; - - u8 reserved_at_100[0x40]; + union { + struct { + u8 rtc_id_0[0x20]; + u8 rtc_id_1[0x20]; + u8 reserved_at_100[0x40]; + }; + struct { + u8 sw_owner_icm_root_1[0x40]; + u8 sw_owner_icm_root_0[0x40]; + }; + }; }; struct mlx5_ifc_create_flow_table_in_bits { @@ -4909,6 +4916,39 @@ struct mlx5_ifc_create_flow_table_out_bits { u8 icm_address_31_0[0x20]; }; +struct mlx5_ifc_query_flow_table_in_bits { + u8 opcode[0x10]; + u8 uid[0x10]; + + u8 vhca_tunnel_id[0x10]; + u8 op_mod[0x10]; + + u8 other_vport[0x1]; + u8 reserved_at_41[0xf]; + u8 vport_number[0x10]; + + u8 reserved_at_60[0x20]; + + u8 table_type[0x8]; + u8 reserved_at_88[0x18]; + + u8 reserved_at_a0[0x8]; + u8 table_id[0x18]; + + u8 reserved_at_c0[0x140]; +}; + +struct mlx5_ifc_query_flow_table_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x80]; + + struct mlx5_ifc_flow_table_context_bits flow_table_context; +}; + enum mlx5_flow_destination_type { MLX5_FLOW_DESTINATION_TYPE_VPORT = 0x0, }; diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c index a444fb4438..6e7d6eb1ac 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.c +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c @@ -80,6 +80,34 @@ mlx5dr_cmd_flow_table_modify(struct mlx5dr_devx_obj *devx_obj, return ret; } +int +mlx5dr_cmd_flow_table_query(struct mlx5dr_devx_obj *devx_obj, + struct mlx5dr_cmd_ft_query_attr *ft_attr, + uint64_t *icm_addr_0, uint64_t *icm_addr_1) +{ + uint32_t out[MLX5_ST_SZ_DW(query_flow_table_out)] = {0}; + uint32_t in[MLX5_ST_SZ_DW(query_flow_table_in)] = {0}; + void *ft_ctx; + int ret; + + MLX5_SET(query_flow_table_in, in, opcode, MLX5_CMD_OP_QUERY_FLOW_TABLE); + MLX5_SET(query_flow_table_in, in, table_type, ft_attr->type); + MLX5_SET(query_flow_table_in, in, table_id, devx_obj->id); + + ret = mlx5_glue->devx_obj_query(devx_obj->obj, in, sizeof(in), out, sizeof(out)); + if (ret) { + DR_LOG(ERR, "Failed to query FT"); + rte_errno = errno; + return ret; + } + + ft_ctx = MLX5_ADDR_OF(query_flow_table_out, out, flow_table_context); + *icm_addr_0 = MLX5_GET64(flow_table_context, ft_ctx, sw_owner_icm_root_0); + *icm_addr_1 = MLX5_GET64(flow_table_context, ft_ctx, sw_owner_icm_root_1); + + return ret; +} + static struct mlx5dr_devx_obj * mlx5dr_cmd_flow_group_create(struct ibv_context *ctx, struct mlx5dr_cmd_fg_attr *fg_attr) diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h index 3f40c085be..7d03f3d169 100644 --- a/drivers/net/mlx5/hws/mlx5dr_cmd.h +++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h @@ -22,6 +22,10 @@ struct mlx5dr_cmd_ft_modify_attr { uint64_t modify_fs; }; +struct mlx5dr_cmd_ft_query_attr { + uint8_t type; +}; + struct mlx5dr_cmd_fg_attr { uint32_t table_id; uint32_t table_type; @@ -215,6 +219,11 @@ int mlx5dr_cmd_flow_table_modify(struct mlx5dr_devx_obj *devx_obj, struct mlx5dr_cmd_ft_modify_attr *ft_attr); +int +mlx5dr_cmd_flow_table_query(struct mlx5dr_devx_obj *devx_obj, + struct mlx5dr_cmd_ft_query_attr *ft_attr, + uint64_t *icm_addr_0, uint64_t *icm_addr_1); + struct mlx5dr_devx_obj * mlx5dr_cmd_rtc_create(struct ibv_context *ctx, struct mlx5dr_cmd_rtc_create_attr *rtc_attr); diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c index e29122aa98..c49b504317 100644 --- a/drivers/net/mlx5/hws/mlx5dr_debug.c +++ b/drivers/net/mlx5/hws/mlx5dr_debug.c @@ -198,9 +198,12 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher) bool is_shared = mlx5dr_context_shared_gvmi_used(matcher->tbl->ctx); bool is_root = matcher->tbl->level == MLX5DR_ROOT_LEVEL; enum mlx5dr_table_type tbl_type = matcher->tbl->type; + struct mlx5dr_cmd_ft_query_attr ft_attr = {0}; struct mlx5dr_devx_obj *ste_0, *ste_1 = NULL; struct mlx5dr_pool_chunk *ste; struct mlx5dr_pool *ste_pool; + uint64_t icm_addr_0 = 0; + uint64_t icm_addr_1 = 0; int ret; ret = fprintf(f, "%d,0x%" PRIx64 ",0x%" PRIx64 ",%d,%d,0x%" PRIx64, @@ -243,13 +246,25 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher) ste_1 = NULL; } - ret = fprintf(f, ",%d,%d,%d,%d,%d\n", + if (!is_root) { + ft_attr.type = matcher->tbl->fw_ft_type; + ret = mlx5dr_cmd_flow_table_query(matcher->end_ft, + &ft_attr, + &icm_addr_0, + &icm_addr_1); + if (ret) + return ret; + } + + ret = fprintf(f, ",%d,%d,%d,%d,%d,0x%" PRIx64 ",0x%" PRIx64 "\n", matcher->action_ste.rtc_0 ? matcher->action_ste.rtc_0->id : 0, ste_0 ? (int)ste_0->id : -1, matcher->action_ste.rtc_1 ? matcher->action_ste.rtc_1->id : 0, ste_1 ? (int)ste_1->id : -1, is_shared && !is_root ? - matcher->match_ste.aliased_rtc_0->id : 0); + matcher->match_ste.aliased_rtc_0->id : 0, + mlx5dr_debug_icm_to_idx(icm_addr_0), + mlx5dr_debug_icm_to_idx(icm_addr_1)); if (ret < 0) goto out_err; @@ -276,10 +291,15 @@ static int mlx5dr_debug_dump_table(FILE *f, struct mlx5dr_table *tbl) { bool is_shared = mlx5dr_context_shared_gvmi_used(tbl->ctx); bool is_root = tbl->level == MLX5DR_ROOT_LEVEL; + struct mlx5dr_cmd_ft_query_attr ft_attr = {0}; struct mlx5dr_matcher *matcher; + uint64_t local_icm_addr_0 = 0; + uint64_t local_icm_addr_1 = 0; + uint64_t icm_addr_0 = 0; + uint64_t icm_addr_1 = 0; int ret; - ret = fprintf(f, "%d,0x%" PRIx64 ",0x%" PRIx64 ",%d,%d,%d,%d,%d\n", + ret = fprintf(f, "%d,0x%" PRIx64 ",0x%" PRIx64 ",%d,%d,%d,%d,%d", MLX5DR_DEBUG_RES_TYPE_TABLE, (uint64_t)(uintptr_t)tbl, (uint64_t)(uintptr_t)tbl->ctx, @@ -288,11 +308,37 @@ static int mlx5dr_debug_dump_table(FILE *f, struct mlx5dr_table *tbl) is_root ? 0 : tbl->fw_ft_type, tbl->level, is_shared && !is_root ? tbl->local_ft->id : 0); - if (ret < 0) { - rte_errno = EINVAL; - return rte_errno; + if (ret < 0) + goto out_err; + + if (!is_root) { + ft_attr.type = tbl->fw_ft_type; + ret = mlx5dr_cmd_flow_table_query(tbl->ft, + &ft_attr, + &icm_addr_0, + &icm_addr_1); + if (ret) + return ret; + + if (is_shared) { + ft_attr.type = tbl->fw_ft_type; + ret = mlx5dr_cmd_flow_table_query(tbl->local_ft, + &ft_attr, + &local_icm_addr_0, + &local_icm_addr_1); + if (ret) + return ret; + } } + ret = fprintf(f, ",0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 "\n", + mlx5dr_debug_icm_to_idx(icm_addr_0), + mlx5dr_debug_icm_to_idx(icm_addr_1), + mlx5dr_debug_icm_to_idx(local_icm_addr_0), + mlx5dr_debug_icm_to_idx(local_icm_addr_1)); + if (ret < 0) + goto out_err; + LIST_FOREACH(matcher, &tbl->head, next) { ret = mlx5dr_debug_dump_matcher(f, matcher); if (ret) @@ -300,6 +346,10 @@ static int mlx5dr_debug_dump_table(FILE *f, struct mlx5dr_table *tbl) } return 0; + +out_err: + rte_errno = EINVAL; + return rte_errno; } static int diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.h b/drivers/net/mlx5/hws/mlx5dr_debug.h index 0f88e73186..5cffdb10b5 100644 --- a/drivers/net/mlx5/hws/mlx5dr_debug.h +++ b/drivers/net/mlx5/hws/mlx5dr_debug.h @@ -26,6 +26,12 @@ enum mlx5dr_debug_res_type { MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_RANGE_DEFINER = 4206, }; +static inline uint64_t +mlx5dr_debug_icm_to_idx(uint64_t icm_addr) +{ + return (icm_addr >> 6) & 0xffffffff; +} + const char *mlx5dr_debug_action_type_to_str(enum mlx5dr_action_type action_type); #endif /* MLX5DR_DEBUG_H_ */ -- 2.26.3