From patchwork Thu Sep 22 19:03:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Vesker X-Patchwork-Id: 116668 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1FE9A0543; Thu, 22 Sep 2022 21:05:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9253742B73; Thu, 22 Sep 2022 21:05:10 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) by mails.dpdk.org (Postfix) with ESMTP id 9F77442B73 for ; Thu, 22 Sep 2022 21:05:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gptBYRkaHTDhaqY1mpiASj0VFdJ5Dh0fqPk1/zzAsm24I914xkcQGu9dQHwJFTVts4FvbAe3VxPMS6K3GFw/uBYE9Y4oJnB2lx+0cw/2Bgl7iyxxNnoajmtN1WG56jaLK5E0j5lfLbDHb3E8ei15NNtMWobWVNSUzavZeqPiW9prhPgIGy6fXyi+Ecazky0lw3cnDA6gUfMFDoEnuiG4sdCHpduJ1HXGz8eWCKuBWQ8Cok2S8N6sKw6OAHABDJtwryyiis1ldkCGKygdkEjlCOX2m5WAyF6gzDPMyisJ0IZDNaQ8qMkJl/qXrk6mYqMQPBPmFh7j9WK1dPbpD8KG0w== 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=/kHQmc7VyJ2udgMalqMR5zVLSUltRMUGuWssy8TZDog=; b=R1H2vANjdmtAKLynVUv61cazBbVMgv+sUC5V3tBmyMskSfc46o1vpHXh2sB/utSVcpi3hmWzXwUT4ia71UdrVkL2614ofT0+9mq2xg6hwwQKVs8svRz57i6jLPexs0UL9oPfi9/ujA3FgP2GOO20kG0ekSDw98KhJFopaknInecBV3xLx73TErLagRoqzJlsUTwHj8/QaHcNETtGTxNzT7C1XM/PiV0Deu+iVA0ZYR7hhfG6G/ujOnOS0p9h0bSdhmXXLew/yTyPStYlr6yIFwN+YDMfvHbfknVKJ4P/mI9aONb1M8RJhGJRLohhxHHMZupXl6ipaMjTu6+x0DrDZg== 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=/kHQmc7VyJ2udgMalqMR5zVLSUltRMUGuWssy8TZDog=; b=guXpaztSqexFflPHcbVvhunws0wUPh153F4S8ISU9y7TLchfIl5JZPi04FmRHiZRhcxMRLM46R6txzkmXh3q6+Hv6hop+0fWLAHg2yCsOJXHM6ptdWPbkSJBxqrVR+Nxvcnu319Jbp9Muihzm2RI3JZKtV7XOl7cGSyxRYxeAIaku18m7Rt3eaoM6i2GxC1ici2mIvf+xm7zUkVVRAsWcvZFwYKxqhKrK/HIPWOXGb7woBgiv0vv2+pskiOV4v3N84/ZxSbiJt5HkQ361FDwvWNalKRwCjAMADyZSrB9qJJRECpNniqdMN+uFXhBOIf3+6t7p9nMc8m6w2rAYDvi6g== Received: from MW4PR04CA0365.namprd04.prod.outlook.com (2603:10b6:303:81::10) by DM6PR12MB5021.namprd12.prod.outlook.com (2603:10b6:5:208::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 19:05:07 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::2e) by MW4PR04CA0365.outlook.office365.com (2603:10b6:303:81::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18 via Frontend Transport; Thu, 22 Sep 2022 19:05:07 +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 CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Thu, 22 Sep 2022 19:05:06 +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.26; Thu, 22 Sep 2022 12:04:49 -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; Thu, 22 Sep 2022 12:04:46 -0700 From: Alex Vesker To: , , , , , Matan Azrad CC: , , Bing Zhao Subject: [v1 05/19] common/mlx5: query set capability of registers Date: Thu, 22 Sep 2022 22:03:30 +0300 Message-ID: <20220922190345.394-6-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20220922190345.394-1-valex@nvidia.com> References: <20220922190345.394-1-valex@nvidia.com> MIME-Version: 1.0 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: CO1NAM11FT018:EE_|DM6PR12MB5021:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e95844a-f655-4b1a-6827-08da9ccd5cfc 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: Zkkder5nZNODqPC8jev8Sc+aLiXLhlT9znfFqUlZtSsaR3q8BCbLv1/FAVOyDJnLOVkhBMoidI8kmcX6JdoTRAkZk/NdLlXZP6Vqb9uKH2wvUI8/R4yEdUJ0Nn0qaXYIUPbpJfWSWaSZNHE07ttWhVEJ4m7rFRmUM95O5JM3lClfvsJpJlv3OxQtag4Mx55qp1Pq+MJMn4elSDMdBsEiFbCPQ0D595ThyH2KWQooiv+0ZQ4FRo25CMg0Colb//7nBhMpY4I+F9IMb6UowcveEG5fig9zRueVDz0K6o+nnW98ectMTF/EDxJutugBCS28p+Q8hwziYSsUh5Hz2qNgjg19wdabWsidsky3ldL28AY8ZTl+46sT7o6OAebnlj5tQ6hDYO6nzm6eORAVp4yBNcaGAwWRme61z7MGOYppFUJHnJHldRQ0DT3BbcF2N7nFaRfh4y6yaXp+0eS6ABbcBt4MaKanvR06VUal8GziKLhj/l4FLc5cFS8mWY2xmXnqnW35cMnupGBNLBphEOXJ5jzUA695Yu3Y+9aTCG+ZUJWDfEVFMuIwXi4+7DBU+BY3XI3RVNI+HlWM7XmE0vM+JmxTMpyYDSr3KbrHwVlBKFu3EN7S/U+4UmiABWWc08xzlv6jt7r7M4dV3J8IZyLWp8Kifu1+s7G/1sNtAjLp8PMBB+8QVstrspCl1lYuEx+awRH/jlfIELptGZosSFEABM/J0VHxqvvrgbnIybHcQnVhtwk+Hm3fdRQkPCBa+3wnp7mi2iOVylgVc7SfwwSvtQ== 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:(13230022)(4636009)(136003)(346002)(39860400002)(376002)(396003)(451199015)(40470700004)(36840700001)(46966006)(70586007)(40460700003)(40480700001)(2906002)(82740400003)(70206006)(7696005)(54906003)(26005)(5660300002)(86362001)(36756003)(316002)(55016003)(41300700001)(8936002)(107886003)(110136005)(6666004)(6636002)(6286002)(7636003)(356005)(4326008)(478600001)(82310400005)(2616005)(47076005)(83380400001)(36860700001)(1076003)(8676002)(186003)(426003)(16526019)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 19:05:06.7527 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e95844a-f655-4b1a-6827-08da9ccd5cfc 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5021 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 | 44 +++++++++++++++++++++++++--- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index fb33023138..ac6891145d 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -1058,6 +1058,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, @@ -1157,6 +1175,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 af6053a788..d69dad613e 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -260,6 +260,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 4346279c81..12eb7b3b7f 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1892,6 +1892,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 +1920,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 +1944,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 +2015,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]; }; /* @@ -2041,6 +2076,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];