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 DD02CA00C2; Fri, 14 Oct 2022 13:49:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0774642DB9; Fri, 14 Oct 2022 13:49:28 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) by mails.dpdk.org (Postfix) with ESMTP id E29F642DA3 for ; Fri, 14 Oct 2022 13:49:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S/Ha9ayBCnYre6bYxAuhRpMq6daB5Fm/MhVOHGWH9Aq58/pC3oaIZDRo+PeU/JE4DTs4uY6gV64R1RUUsz9aY0iztwb2rXoIoXG5a73O2jGSJ2UsSpRRQljzkf7q0fvcOa8UU8SlxvauMPJvLivUt62yJwVSBLJmopefXSxEw+x2Ye3/jzoiXnHPDGSnsrU60hHGOrNUIwou0hGHJtGIzuk5XMhPGsT87zSxOawpeiFBfvKD1SDkuDiX2RPuFgTXQXdcj+RKsMzHRRyAP3IElbuUZD/Naz1s37239xwtJVtJVILhuji6xxprlypUbVBaa61r62Zd88Rz4+8TB40sYQ== 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=P6YPqGsmLvUPm8AbOHwD51VmCPEC60NjyRHq+Fzx7o8=; b=gkl0lFsO/mHl3bGZjI76IlqJa/84IoXIKkkVYWyap1aXFdlsX/bk9RfDwBS68cbvI03H+bW8mdYUdyMidLk3r1S1UR5uz7byJK04V55uY++lQRzDHvzVCeGdzmrPUPd7/G5zoVizlaQyfqYlXEOav3N/DUSboB0s7OJ3dD7Q1lYz/c7a/M4++9ZbyaO+aTOISL6sZQhBXn9HmQsjLnbucgsBMotmWZc8cZe1HDanPfqfRX6ZsxWmfbo1JsAYWCJG9GTPlq3xoofmIvuRAtffQR30SpmgOoFfiE6eL2EgYghmfTHP/kHW7InfyqnwmO33BPtkczTBQ33EmmryZFTb2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=P6YPqGsmLvUPm8AbOHwD51VmCPEC60NjyRHq+Fzx7o8=; b=KRHa1HSCIMgOig7KOJii+wS6ieTMnnYCK8bOMSg0JfYLNb6AorMEVeSi3AvQdi/yTudqXMO/MjXkQf+lcv5/ByH4x52A70lb5oIc8IGmBWZEdiV4a9V9SghtLVbNVBw22akG+ikCaMwQkLA/9bjdtlZ1vuYmAXKmtGJAOKbUmXj3KMJazfP8zBTZBWcoJ0PMGg78pzdNP0DKMDlm6xc5xBzMEtAc00NYTPr9jWB4fut03/A7d1K15u4Enz/nEQos5OIf1E7bZ41vDGp15mxgIIYKag60JjJLR1q2lvCc0vdBjw6xX7S3/5SrG9712o7I3Lt23i5bx6WbK/ZcN3/Ikg== Received: from MW4P221CA0012.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::17) by BY5PR12MB4114.namprd12.prod.outlook.com (2603:10b6:a03:20c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 11:49:22 +0000 Received: from CO1NAM11FT111.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8b:cafe::c9) by MW4P221CA0012.outlook.office365.com (2603:10b6:303:8b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Fri, 14 Oct 2022 11:49:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT111.mail.protection.outlook.com (10.13.174.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20 via Frontend Transport; Fri, 14 Oct 2022 11:49:22 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 14 Oct 2022 04:49:13 -0700 Received: from nvidia.com (10.126.230.35) 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.29; Fri, 14 Oct 2022 04:49:10 -0700 From: Alex Vesker To: , , , , Matan Azrad CC: , , Bing Zhao Subject: [v3 05/18] common/mlx5: query set capability of registers Date: Fri, 14 Oct 2022 14:48:20 +0300 Message-ID: <20221014114833.13389-6-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20221014114833.13389-1-valex@nvidia.com> References: <20220922190345.394-1-valex@nvidia.com> <20221014114833.13389-1-valex@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT111:EE_|BY5PR12MB4114:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b395b78-5e2a-44c7-12de-08daadda22d4 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: fegZjhHf1g4iUlNblnxlU8/jWWczZws7hfa/QPR+Vkyb/k5WLHdjEdP61TkhgM4IXliwaZxz1ZDSs92mkciP6M+ktT0bL0FwlKRq55FS581GpoBMMT2sjZpA1mg8QIp/yNrDkR/WyQ2phr/xLCjmLryzuvEzuD6Ud3DSZiqClQPhfm7OQIV57VA0sFDFACz32iseYVdxU3jjBfxh2vi8ZvgXry+yd7n+OX9v+Vp/s5Q+CLDnvJIaLqvWsev3Ua5LqsRkLKsf9Gk77AUIpJ9xDg9MLxKqCSNL/6IjcE1Fh4iUxJoLiyPV9YdIbekyf855kSN9Yx7sPFPEYv+BmhaBYAOjfa9nhEyBPRp9xurAfPlVRd73nPZMPPRBJSq4QT/TWUk1fRkNLDTDmyRITexf1upJNT8yht4j2hwnucX/Bqz9ZZkkP9UiJeni8djuRzTF4ADefdgFQGnDl0VZtqStgi6mveKLC49IdsVIk+MA8XWsprNRU+0S4M2r1iKyxkIgmyxdyQEoia1eQU9x9tRyFRJxxy71iABEwTTegX8jwobrn8GBNmgx4Rkcxd6Y1kG02vaqV47asbV3p7AadMGG5mf8qpJP2SamlV5l+9SpODwzLfmf30mzNk+SvZ+OwJYZlw56/G6NQI2bKLfxH6LypLYyT0cEZKvJYSpaR1qM8M68ycRsGT3QDxuDiz/hLNWgbP3yktETtOi8DBZZ2ABx9cFkMAT9aoJTKErM+KpAyi4zsUqHvPvJbbuAGzSHBixP6DzMMTqCMk8CDzM2+Ed2YA== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(6666004)(2616005)(26005)(6286002)(36860700001)(55016003)(107886003)(83380400001)(40480700001)(426003)(47076005)(186003)(1076003)(2906002)(5660300002)(7696005)(16526019)(336012)(40460700003)(478600001)(82310400005)(110136005)(54906003)(6636002)(316002)(41300700001)(8936002)(70206006)(70586007)(4326008)(8676002)(86362001)(36756003)(7636003)(356005)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 11:49:22.4052 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b395b78-5e2a-44c7-12de-08daadda22d4 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT111.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4114 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 From: Bing Zhao In the flow table capabilities, new fields are added to query the capability to set, add, copy to a REG_C_x. The set capability are queried and saved for the future usage. Signed-off-by: Bing Zhao --- drivers/common/mlx5/mlx5_devx_cmds.c | 30 +++++++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/mlx5_prm.h | 45 +++++++++++++++++++++++++--- 3 files changed, 73 insertions(+), 4 deletions(-) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 76f0b6724f..9c185366d0 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -1064,6 +1064,24 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->modify_outer_ip_ecn = MLX5_GET (flow_table_nic_cap, hcattr, ft_header_modify_nic_receive.outer_ip_ecn); + attr->set_reg_c = 0xff; + if (attr->nic_flow_table) { +#define GET_RX_REG_X_BITS \ + MLX5_GET(flow_table_nic_cap, hcattr, \ + ft_header_modify_nic_receive.metadata_reg_c_x) +#define GET_TX_REG_X_BITS \ + MLX5_GET(flow_table_nic_cap, hcattr, \ + ft_header_modify_nic_transmit.metadata_reg_c_x) + + uint32_t tx_reg, rx_reg; + + tx_reg = GET_TX_REG_X_BITS; + rx_reg = GET_RX_REG_X_BITS; + attr->set_reg_c &= (rx_reg & tx_reg); + +#undef GET_RX_REG_X_BITS +#undef GET_TX_REG_X_BITS + } attr->pkt_integrity_match = mlx5_devx_query_pkt_integrity_match(hcattr); attr->inner_ipv4_ihl = MLX5_GET (flow_table_nic_cap, hcattr, @@ -1163,6 +1181,18 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->esw_mgr_vport_id = MLX5_GET(esw_cap, hcattr, esw_manager_vport_number); } + if (attr->eswitch_manager) { + uint32_t esw_reg; + + hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc, + MLX5_GET_HCA_CAP_OP_MOD_ESW_FLOW_TABLE | + MLX5_HCA_CAP_OPMOD_GET_CUR); + if (!hcattr) + return rc; + esw_reg = MLX5_GET(flow_table_esw_cap, hcattr, + ft_header_modify_esw_fdb.metadata_reg_c_x); + attr->set_reg_c &= esw_reg; + } return 0; error: rc = (rc > 0) ? -rc : rc; diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index cceaf3411d..a10aa3331b 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -263,6 +263,8 @@ struct mlx5_hca_attr { uint32_t crypto_wrapped_import_method:1; uint16_t esw_mgr_vport_id; /* E-Switch Mgr vport ID . */ uint16_t max_wqe_sz_sq; + uint32_t set_reg_c:8; + uint32_t nic_flow_table:1; uint32_t modify_outer_ip_ecn:1; }; diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 9c1c93f916..ca4763f53d 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1295,6 +1295,7 @@ enum { MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP = 0xc << 1, MLX5_GET_HCA_CAP_OP_MOD_ROCE = 0x4 << 1, MLX5_GET_HCA_CAP_OP_MOD_NIC_FLOW_TABLE = 0x7 << 1, + MLX5_GET_HCA_CAP_OP_MOD_ESW_FLOW_TABLE = 0x8 << 1, MLX5_SET_HCA_CAP_OP_MOD_ESW = 0x9 << 1, MLX5_GET_HCA_CAP_OP_MOD_VDPA_EMULATION = 0x13 << 1, MLX5_GET_HCA_CAP_OP_MOD_CRYPTO = 0x1A << 1, @@ -1892,6 +1893,7 @@ struct mlx5_ifc_roce_caps_bits { }; struct mlx5_ifc_ft_fields_support_bits { + /* set_action_field_support */ u8 outer_dmac[0x1]; u8 outer_smac[0x1]; u8 outer_ether_type[0x1]; @@ -1919,7 +1921,7 @@ struct mlx5_ifc_ft_fields_support_bits { u8 outer_gre_key[0x1]; u8 outer_vxlan_vni[0x1]; u8 reserved_at_1a[0x5]; - u8 source_eswitch_port[0x1]; + u8 source_eswitch_port[0x1]; /* end of DW0 */ u8 inner_dmac[0x1]; u8 inner_smac[0x1]; u8 inner_ether_type[0x1]; @@ -1943,8 +1945,33 @@ struct mlx5_ifc_ft_fields_support_bits { u8 inner_tcp_sport[0x1]; u8 inner_tcp_dport[0x1]; u8 inner_tcp_flags[0x1]; - u8 reserved_at_37[0x9]; - u8 reserved_at_40[0x40]; + u8 reserved_at_37[0x9]; /* end of DW1 */ + u8 reserved_at_40[0x20]; /* end of DW2 */ + u8 reserved_at_60[0x18]; + union { + struct { + u8 metadata_reg_c_7[0x1]; + u8 metadata_reg_c_6[0x1]; + u8 metadata_reg_c_5[0x1]; + u8 metadata_reg_c_4[0x1]; + u8 metadata_reg_c_3[0x1]; + u8 metadata_reg_c_2[0x1]; + u8 metadata_reg_c_1[0x1]; + u8 metadata_reg_c_0[0x1]; + }; + u8 metadata_reg_c_x[0x8]; + }; /* end of DW3 */ + /* set_action_field_support_2 */ + u8 reserved_at_80[0x80]; + /* add_action_field_support */ + u8 reserved_at_100[0x80]; + /* add_action_field_support_2 */ + u8 reserved_at_180[0x80]; + /* copy_action_field_support */ + u8 reserved_at_200[0x80]; + /* copy_action_field_support_2 */ + u8 reserved_at_280[0x80]; + u8 reserved_at_300[0x100]; }; /* @@ -1989,9 +2016,18 @@ struct mlx5_ifc_flow_table_nic_cap_bits { u8 reserved_at_e00[0x200]; struct mlx5_ifc_ft_fields_support_bits ft_header_modify_nic_receive; - u8 reserved_at_1080[0x380]; struct mlx5_ifc_ft_fields_support_2_bits ft_field_support_2_nic_receive; + u8 reserved_at_1480[0x780]; + struct mlx5_ifc_ft_fields_support_bits + ft_header_modify_nic_transmit; + u8 reserved_at_2000[0x6000]; +}; + +struct mlx5_ifc_flow_table_esw_cap_bits { + u8 reserved_at_0[0x800]; + struct mlx5_ifc_ft_fields_support_bits ft_header_modify_esw_fdb; + u8 reserved_at_C00[0x7400]; }; /* @@ -2046,6 +2082,7 @@ union mlx5_ifc_hca_cap_union_bits { struct mlx5_ifc_qos_cap_bits qos_cap; struct mlx5_ifc_virtio_emulation_cap_bits vdpa_caps; struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap; + struct mlx5_ifc_flow_table_esw_cap_bits flow_table_esw_cap; struct mlx5_ifc_esw_cap_bits esw_cap; struct mlx5_ifc_roce_caps_bits roce_caps; u8 reserved_at_0[0x8000]; -- 2.18.1