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 5CB52A034F for ; Mon, 21 Feb 2022 20:46:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57DBE40E5A; Mon, 21 Feb 2022 20:46:47 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by mails.dpdk.org (Postfix) with ESMTP id 5BF174068C for ; Mon, 21 Feb 2022 20:46:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NfiQ6NbvknG20iHOSMc/5c3BF6HWA1+09UzVAga9Fgg+gyVcgo61NV0akyVSKCVEqt8jepU76zMDqLBz0Bz8Tlh1loAiKYI0Auyqr5FpK8RAOIg3mQoHDobTuDD+KUihuSlmiiyMl41wsy5IPlpd5fk+Q8snMFA1YIquMv0Q6lbJM/pjKYGeVqjXLMF2rpSdIUqo6ltA9z4OmTxV2HEisE0SoyITqBsmqE7YQU69X3XKHcoLJooyIzQaCtqh2X8IRvgS2DQ2rOzuWSy8IJ9U0gc+AQavLM7RvMm7a5tQnIp7oHiwFWtbfDolU6HvdeC404uYd5PKILI3uEeqoSzolw== 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=D7esMI+JVrwrHvKVivaYjgPL9IOIFI1MDo8JOR+nt3c=; b=lF8wiVAQJHEgANRt/VAOArOXK/sp8iS1TIMfYBnBwsuZ5/UuEQ6rwBqjDG1fggbHqXLbWAOCSAfrBhcG7IsUHDqejNyYVPLNxUF6NUVd9Q+pFxNvobQCfZBq3lcuqVCbxWVjMptWyobfRlom91SjS/LAyz//GS+cOMmuz8eY1Wo84kzuqcg0vDIWMXND8BCTV8y0jPwADbVpXvZCNHMg6O7XODd0NNf3nff+UvJT/5TCjRW5Lbnax63bjQGf/AuJ/dBymqzMOFGt51WsAxfummImNiXnZLgDV4HScjqrfGsfz7sjAMkiOm/dF63QjxgMxF38MvgE4Ah9G5+uKieF8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=dpdk.org 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=D7esMI+JVrwrHvKVivaYjgPL9IOIFI1MDo8JOR+nt3c=; b=uQQiMQvt15zP6Eri1gnYZx4INcwz1guuioFdoPYSkWaha2QxS5rjSr150fWgox97WUMJzyyD9x1nMa/t9WUWRUR8dVcb1XtF9Kt3uqfIjBNx7F3XQ2JuzpuAfgT4CsLNrNMz6pSLSjN+QG71bwfnPFzHBx2jhC6SBi6WDZYVTbfkvk1Cwx1iKkbMNfPwIsbO73H2e+Lgmarq0LcRjiy9V5FtIeyFKyBonI1fLxFDsM21x0X3HblAdnAj19xZdvsEa5HSvmuUT659wGWyyGHx6C6AcwpGMuYjMY7NM/DA4PYsBBTrZOP6pgdrY7kNpsAWuawAtQj9yeo8T1QTcCvozA== Received: from BN6PR17CA0013.namprd17.prod.outlook.com (2603:10b6:404:65::23) by BL0PR12MB4852.namprd12.prod.outlook.com (2603:10b6:208:1ce::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Mon, 21 Feb 2022 19:46:44 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:404:65:cafe::fc) by BN6PR17CA0013.outlook.office365.com (2603:10b6:404:65::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 21 Feb 2022 19:46:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4995.15 via Frontend Transport; Mon, 21 Feb 2022 19:46:44 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 21 Feb 2022 19:46:44 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Mon, 21 Feb 2022 11:46:43 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Mon, 21 Feb 2022 11:46:42 -0800 From: Michael Baum To: CC: Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 20.11 1/5] common/mlx5: add minimum WQE size for striding RQ Date: Mon, 21 Feb 2022 21:46:31 +0200 Message-ID: <20220221194635.2458173-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220221194635.2458173-1-michaelba@nvidia.com> References: <20220221194635.2458173-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43374c30-77c1-4803-4a30-08d9f572e3e7 X-MS-TrafficTypeDiagnostic: BL0PR12MB4852:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NXQhhskx4d1OIZF5gOxgp8v/LlG2wYW7QvB1LqbOW1baFhMAYKTOrBSpxwSK8Z7YF5qPvoDimqfg96Y2KYvX0b+G+O33DgeWAeLLgpKvmKSc1nVC/1ZQCJVeBNychutRfEtAWCd3LPJLO/GxQBkiYbciYVwGBGmTMMhR7TW7sxn4j5Ld3G3ssPAR6aieu2Am6Kq8rcK0uyGR2FaU4Jqlt8DCv2uZyd+dQJnGIECohyWY2cMMIMeXpd/u76yBT6aE72oDZVWuEps2N75bP3VvhKppap0mrEN3OZR9zW1amb2XDZAFY67yUb7wHv5cAqPU/pxfZDS3os5LX148t2oNJ/vezIa0T1xKBqsbWkPfwpVHd8s2l7hS2guEvXky7K+u73bvjepaddOppKE728kwyXMQf0a0fshqDEo44KZ84C7PS0L5sAWzVC+fuC6BSI1KBtdBBxsiS3Pvr4lwEyc4Se4bnh2fwwzdZGkKAFPGl3OHTSzWnGdqcsiQ5ldCK6ASDhAfUcP5OTpXPi7jozzwwJ7k5bnL4rM4kGJX2OXv2HFJFVh6QZ8pUeiKGgjJbsqzthEZX8ziiHH+2E4vsZzLwlFADpvCr0tZJe6o6yCjZ/NDt7l+OAkklRNJoHws/C73slnaZQeHOxFpSqGzxEMocse7KakRXxTy4lqE0uJbgl7Yrg97sXefpdtjjR+VmBNlTzHF/cchxr6Xp0SFR3k1Uw== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(7696005)(8936002)(5660300002)(2616005)(6666004)(6916009)(54906003)(316002)(4326008)(86362001)(70206006)(70586007)(508600001)(8676002)(55016003)(82310400004)(6286002)(81166007)(47076005)(186003)(2906002)(36860700001)(336012)(426003)(356005)(26005)(36756003)(40460700003)(1076003)(107886003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2022 19:46:44.6579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43374c30-77c1-4803-4a30-08d9f572e3e7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4852 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 [ upstream commit 10599cf83ebe768fe5ebe3e430c2a3c4250aafca ] Some devices have a WQE size limit for striding RQ. On some newer devices, this limitation is smaller and information on its size is provided by the firmware. This patch adds the attribute query from firmware: the minimum required size of WQE buffer for striding RQ in granularity of Bytes. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_devx_cmds.c | 28 ++++++++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 38 +++++++++++++++++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 450595ee70..97e9b38703 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -653,6 +653,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, uint32_t out[MLX5_ST_SZ_DW(query_hca_cap_out)] = {0}; void *hcattr; int status, syndrome, rc, i; + bool hca_cap_2_sup; MLX5_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP); MLX5_SET(query_hca_cap_in, in, op_mod, @@ -672,6 +673,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, return -1; } hcattr = MLX5_ADDR_OF(query_hca_cap_out, out, capability); + hca_cap_2_sup = MLX5_GET(cmd_hca_cap, hcattr, hca_cap_2); attr->flow_counter_bulk_alloc_bitmap = MLX5_GET(cmd_hca_cap, hcattr, flow_counter_bulk_alloc); attr->flow_counters_dump = MLX5_GET(cmd_hca_cap, hcattr, @@ -733,6 +735,32 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, mini_cqe_resp_flow_tag); attr->mini_cqe_resp_l3_l4_tag = MLX5_GET(cmd_hca_cap, hcattr, mini_cqe_resp_l3_l4_tag); + if (hca_cap_2_sup) { + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + MLX5_SET(query_hca_cap_in, in, opcode, + MLX5_CMD_OP_QUERY_HCA_CAP); + MLX5_SET(query_hca_cap_in, in, op_mod, + MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 | + MLX5_HCA_CAP_OPMOD_GET_CUR); + rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), + out, sizeof(out)); + if (rc) + goto error; + status = MLX5_GET(query_hca_cap_out, out, status); + syndrome = MLX5_GET(query_hca_cap_out, out, syndrome); + if (status) { + DRV_LOG(DEBUG, + "Failed to query DevX HCA capabilities 2," + " status %x, syndrome = %x", status, syndrome); + return -1; + } + hcattr = MLX5_ADDR_OF(query_hca_cap_out, out, capability); + attr->log_min_stride_wqe_sz = MLX5_GET(cmd_hca_cap_2, hcattr, + log_min_stride_wqe_sz); + } + if (attr->log_min_stride_wqe_sz == 0) + attr->log_min_stride_wqe_sz = MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE; if (attr->qos.sup) { MLX5_SET(query_hca_cap_in, in, op_mod, MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP | diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index 541f526194..c4ead8a724 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -79,6 +79,7 @@ struct mlx5_hca_attr { uint32_t eswitch_manager:1; uint32_t flow_counters_dump:1; uint32_t log_max_rqt_size:5; + uint32_t log_min_stride_wqe_sz:5; uint32_t parse_graph_flex_node:1; uint8_t flow_counter_bulk_alloc_bitmap; uint32_t eth_net_offloads:1; diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 201224cf24..45b47851d9 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -264,6 +264,9 @@ /* The maximum log value of segments per RQ WQE. */ #define MLX5_MAX_LOG_RQ_SEGS 5u +/* Log 2 of the default size of a WQE for Multi-Packet RQ. */ +#define MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE 14U + /* The alignment needed for WQ buffer. */ #define MLX5_WQE_BUF_ALIGNMENT rte_mem_page_size() @@ -1059,6 +1062,7 @@ enum { 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_VDPA_EMULATION = 0x13 << 1, + MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 = 0x20 << 1, }; #define MLX5_GENERAL_OBJ_TYPES_CAP_VIRTQ_NET_Q \ @@ -1119,7 +1123,9 @@ enum { #define MLX5_HCA_FLEX_ICMPV6_ENABLED (1UL << 9) struct mlx5_ifc_cmd_hca_cap_bits { - u8 reserved_at_0[0x30]; + u8 reserved_at_0[0x20]; + u8 hca_cap_2[0x1]; + u8 reserved_at_21[0xf]; u8 vhca_id[0x10]; u8 reserved_at_40[0x40]; u8 log_max_srq_sz[0x8]; @@ -1572,8 +1578,38 @@ struct mlx5_ifc_flow_table_nic_cap_bits { struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties; }; +/* + * HCA Capabilities 2 + */ +struct mlx5_ifc_cmd_hca_cap_2_bits { + u8 reserved_at_0[0x80]; /* End of DW4. */ + u8 reserved_at_80[0x3]; + u8 max_num_prog_sample_field[0x5]; + u8 reserved_at_88[0x3]; + u8 log_max_num_reserved_qpn[0x5]; + u8 reserved_at_90[0x3]; + u8 log_reserved_qpn_granularity[0x5]; + u8 reserved_at_98[0x3]; + u8 log_reserved_qpn_max_alloc[0x5]; /* End of DW5. */ + u8 max_reformat_insert_size[0x8]; + u8 max_reformat_insert_offset[0x8]; + u8 max_reformat_remove_size[0x8]; + u8 max_reformat_remove_offset[0x8]; /* End of DW6. */ + u8 reserved_at_c0[0x3]; + u8 log_min_stride_wqe_sz[0x5]; + u8 reserved_at_c8[0x3]; + u8 log_conn_track_granularity[0x5]; + u8 reserved_at_d0[0x3]; + u8 log_conn_track_max_alloc[0x5]; + u8 reserved_at_d8[0x3]; + u8 log_max_conn_track_offload[0x5]; + u8 reserved_at_e0[0x20]; /* End of DW7. */ + u8 reserved_at_100[0x700]; +}; + union mlx5_ifc_hca_cap_union_bits { struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap; + struct mlx5_ifc_cmd_hca_cap_2_bits cmd_hca_cap_2; struct mlx5_ifc_per_protocol_networking_offload_caps_bits per_protocol_networking_offload_caps; struct mlx5_ifc_qos_cap_bits qos_cap; -- 2.25.1