From patchwork Mon Oct 14 20:52:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835480 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2081.outbound.protection.outlook.com [40.107.212.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA1EE1D0E05 for ; Mon, 14 Oct 2024 20:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939258; cv=fail; b=BY0t6bwfxxExq9Dd7Ujlqwh7YnaE2Pccqiq49+19750C5MUWFuOKB/BK4RDBObpMnGrDMODbJvGvBFd5VHGIweQa1h36xYWzraFDsT69Tmg0M4ngx0wCSnHrgQ5zK1lBlNIUT1Xo3JepuTWt7sS781nYSh+xp6GnvvrcEriBxQg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939258; c=relaxed/simple; bh=weMCZS39IOKCF+hKMXNbsD+dX5AKEe6J1hDxl+XqDLU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=edJNvghys/vWXRB2omC49tlbVseggkiUkoWfakJCyNu5HIf7HSxI3LkWihqiV4sXQPj8JMrukRduxYK7pZcTDOjfx6KGA+8312YH5K3JM9wdKfNSB4i4mmwaFGHJi2E9l3Rg8mUteWPXT/JXNXzOJgNv7WuyF1N5HroZLctXcZE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=AV/9pTx3; arc=fail smtp.client-ip=40.107.212.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="AV/9pTx3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lX+RBStWiUy7P3kZJq3kw/OJ1xEfQ1bTsOfe/GRiolzD7hePjP3prApbj58SPkqu42uMHG62I7YQEQo5q1zFIMSBbAKWlC6kU3ln4z/kvWD4D3SCwjBlnTqGAT1erizr+mYBRBgxnWrk4fHVmdBhvFXUF8yWsvQg16p13O3Cy4Ms06geTSVwclcOeetAQwTtfjmwrLkdSFAHL8rOeoxuZru2Ro1Dvbvw+xPaHAPIqKIRH1LNeQYqr9d7p06sMVBASHgXy/Lmec7nxeWcip5MavzvAJ00ZfEdwpibySULZWrMzwnSTIIYQOMX+asPJd0aqEpF7ExjF1ewDLTyAaVkLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=q5bCgS1PIpHXIzENYErpe9PopDJLKHrzX0iMvdqJ5+E=; b=HM6Qppwp4YIHzk9NzKok76FcGccjemplF+gldt0FWK8EacomOxqu07MwKIZeeBOZ49pntlBiWPGz+n7kdUI05B9HSewn153bWB9X4VSrXPE8nmW72+nuo//M6Isye4Ax40QjwqIOjAHq0htShYRtdz4y/AcMjkGhTua6SwqAneFGCySnsUIR8bReG9ROHiG5p9DKCvpVBDK7vSJA/t4T3JHEa+QqujZrB6bkSSJQtotibUfBzTAQw5GkQM5f9z2CKlvAGkOBtlXtSwYeqysquD2DaUFYPCD3vk06rICtEzSA2ULBfKd/TUQrm+XXMmZZH8EC+BPMP+KyLzQff6uVbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=q5bCgS1PIpHXIzENYErpe9PopDJLKHrzX0iMvdqJ5+E=; b=AV/9pTx3fmxOcmg61W6Ot0Tf/n6EhisVCEsYynriVnGRhdzurwQGxuiBsqfdt2hVf2bW2TiskkQEzzFU2iqM+zrQFH6j4ec0hZokg8F4FhXtqfJq2LelTv5I12k+Lxch/fMZuQb6rv0Y1wDV7BYmm+rJ2rXHqB5uyMRKEodlr+cyj8v5jGYH/APG1fcoMQHhqCYL4ddsfNkovZOr/sGtgp7I1/mPeG2D5i9+OKH0/nw2g+W2aLcPeSe++N0oscflB9b9UCUnF1/LjXMXxhbx1QsPQXMj9DKilNI2gWzr9j8cF9Pj7Zz93hpkrR1XkDNfyFgfHbGWFsoNMydNg9yZQg== Received: from CH2PR03CA0016.namprd03.prod.outlook.com (2603:10b6:610:59::26) by BY5PR12MB4131.namprd12.prod.outlook.com (2603:10b6:a03:212::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Mon, 14 Oct 2024 20:54:11 +0000 Received: from CH3PEPF00000017.namprd21.prod.outlook.com (2603:10b6:610:59:cafe::c) by CH2PR03CA0016.outlook.office365.com (2603:10b6:610:59::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.24 via Frontend Transport; Mon, 14 Oct 2024 20:54:11 +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 CH3PEPF00000017.mail.protection.outlook.com (10.167.244.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:10 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:00 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:00 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:53:57 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 01/15] net/mlx5: Refactor QoS group scheduling element creation Date: Mon, 14 Oct 2024 23:52:46 +0300 Message-ID: <20241014205300.193519-2-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000017:EE_|BY5PR12MB4131:EE_ X-MS-Office365-Filtering-Correlation-Id: 601cedfb-c0d1-4eee-8766-08dcec925a7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: WnAtDlvOXGJ6YTSvauFBt1+mto9OZzpHsuW6kKnbfEA/ChKI3oyxF/yBqzXaej1/+7NqXLVZ1aSnqgobZ3dnGDkrPkN/qeinWHhnagWAC7aEjPPr1bZhIAF9jBdsr1KtMfwKq8WEvXvlmawJfIhx9q48JmODtVO9S3UQMfotPbsk3oTBD7oHZM8VKknUQc4zrMGcgCAvCILWYIw8LWaOS4pUg5ItjrANIbxws96uFu9ifI2km0p5esfT8VWfRlC+CXc69BbK1CeF4D4xB4agwONaumemcaGNY5DsU4GZOC490WfubFuPuUD8pFNZ91WdJ0ZFc6zxKtPgC38JmvtYJXITm2dXNZ/awLdEovHOghgmpgGn0gdE6CbQSpGu4VbQ4gg5Zs6v9JHUBb/KympO5TS0kf4IOgzaX3DNoC62JZxq/JKBB3yME/U0wdyVg++ac8K6LwCm3ZQWDeLlA8qXAaKDHy8j1pxIeSGLepJennNbsYJR5cqPwal2Y3FYmCmNySGKN4Roq6WptxuTKUiET5U2quEKTJmCE5uc80QDFvEQtbity/PUf7mmPtoyjDaphY7sBOYtdmcvOQZhZTBc6Ufilz7JRj3F1WetIx28mZbuX+x/17Gr7qtG32f1nlGVsy9ia2CK+5bWZD/Jo6T0mkgpkLHrGsTZcwhI7e8oxd1wldrUPBX28duuDJuqDN9oM96E7SM7iolMTNONoETZ4feG9Hqi+wy2cTCLrs7j5lqq7a+oj1ZPC11zdL6eVV79A9BX1s/Z1BL1ql0x7Zm2FJy/q2g3/qP/bpSWzrnNMrfeKJakQ/7EbfX2OHEgBcrqmS7JHTIu+dRAPdMG7wCa2A4AboCSULr73rea/pfkyv3Cydu1VqYROoH08lQrd7Go98IiYgTdB2B+qBtqGN0vdGQDxssWeUCR1eZ6hqJuTtKkscNx09erR7gC7ElXskCQ2XfvRauAulmbnqTW3QRsFzLmr4ecCviLjq5B3XF/nc+kHNbl41oSL9bzvz8Xe2zzz2lu5M9ASu9CDyFT+5/n68GPGVKJGrRRPIrY9nEZdINYLQaEZYngvgp1EWUWz/gEbsHDkGd1gtx3YlCtfUouLmkDToO+XP/s7prbDTGqmd27zO57d9xcZJ3p/ytihJaKK23muaptdQnrDYTpzHWyAdBgDkiNMaXkrDa0jyfAiCIyIjD7IkW2y0rrD+yA5rzz908wG8k+o4Ja625tlcJQ0W6cqKQpu5o8916Jk1i5mY2pySb5QIF2a2w9Bg/skifq+FTzB3h7sNNnRGakjRlR2KccH00OUnl8pAydkw5Lng+jd/RPvfSp07CETaRHzj6G3b0OqDF0U2R2lRRTariVo0n6ge9t0aywRevKHrWPvtnFK762EHCMTuuCXj3qehnO 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:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:10.5827 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 601cedfb-c0d1-4eee-8766-08dcec925a7e 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: CH3PEPF00000017.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4131 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Introduce `esw_qos_create_group_sched_elem` to handle the creation of group scheduling elements for E-Switch QoS, Transmit Scheduling Arbiter (TSAR). This reduces duplication and simplifies code for TSAR setup. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 64 +++++++++---------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index ee6f76a6f0b5..7732f948e9c6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -371,6 +371,33 @@ static int esw_qos_set_group_max_rate(struct mlx5_esw_rate_group *group, return err; } +static int esw_qos_create_group_sched_elem(struct mlx5_core_dev *dev, u32 parent_element_id, + u32 *tsar_ix) +{ + u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; + void *attr; + + if (!mlx5_qos_element_type_supported(dev, + SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR, + SCHEDULING_HIERARCHY_E_SWITCH) || + !mlx5_qos_tsar_type_supported(dev, + TSAR_ELEMENT_TSAR_TYPE_DWRR, + SCHEDULING_HIERARCHY_E_SWITCH)) + return -EOPNOTSUPP; + + MLX5_SET(scheduling_context, tsar_ctx, element_type, + SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); + MLX5_SET(scheduling_context, tsar_ctx, parent_element_id, + parent_element_id); + attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes); + MLX5_SET(tsar_element, attr, tsar_type, TSAR_ELEMENT_TSAR_TYPE_DWRR); + + return mlx5_create_scheduling_element_cmd(dev, + SCHEDULING_HIERARCHY_E_SWITCH, + tsar_ctx, + tsar_ix); +} + static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, u32 max_rate, u32 bw_share) { @@ -496,21 +523,11 @@ static void __esw_qos_free_rate_group(struct mlx5_esw_rate_group *group) static struct mlx5_esw_rate_group * __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) { - u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; struct mlx5_esw_rate_group *group; - int tsar_ix, err; - void *attr; + u32 tsar_ix; + int err; - MLX5_SET(scheduling_context, tsar_ctx, element_type, - SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); - MLX5_SET(scheduling_context, tsar_ctx, parent_element_id, - esw->qos.root_tsar_ix); - attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes); - MLX5_SET(tsar_element, attr, tsar_type, TSAR_ELEMENT_TSAR_TYPE_DWRR); - err = mlx5_create_scheduling_element_cmd(esw->dev, - SCHEDULING_HIERARCHY_E_SWITCH, - tsar_ctx, - &tsar_ix); + err = esw_qos_create_group_sched_elem(esw->dev, esw->qos.root_tsar_ix, &tsar_ix); if (err) { NL_SET_ERR_MSG_MOD(extack, "E-Switch create TSAR for group failed"); return ERR_PTR(err); @@ -591,32 +608,13 @@ static int __esw_qos_destroy_rate_group(struct mlx5_esw_rate_group *group, static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) { - u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; struct mlx5_core_dev *dev = esw->dev; - void *attr; int err; if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) return -EOPNOTSUPP; - if (!mlx5_qos_element_type_supported(dev, - SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR, - SCHEDULING_HIERARCHY_E_SWITCH) || - !mlx5_qos_tsar_type_supported(dev, - TSAR_ELEMENT_TSAR_TYPE_DWRR, - SCHEDULING_HIERARCHY_E_SWITCH)) - return -EOPNOTSUPP; - - MLX5_SET(scheduling_context, tsar_ctx, element_type, - SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR); - - attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes); - MLX5_SET(tsar_element, attr, tsar_type, TSAR_ELEMENT_TSAR_TYPE_DWRR); - - err = mlx5_create_scheduling_element_cmd(dev, - SCHEDULING_HIERARCHY_E_SWITCH, - tsar_ctx, - &esw->qos.root_tsar_ix); + err = esw_qos_create_group_sched_elem(esw->dev, 0, &esw->qos.root_tsar_ix); if (err) { esw_warn(dev, "E-Switch create root TSAR failed (%d)\n", err); return err; From patchwork Mon Oct 14 20:52:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835481 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2064.outbound.protection.outlook.com [40.107.223.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC36B1CB330 for ; Mon, 14 Oct 2024 20:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939263; cv=fail; b=N1u4xNK6ZGP9WL7L2K6G43zuHMtmJyE4CbBwuVYnxoWacBpd1tTkpa9d8+fIX9J2qotMuNDFaVVEPsJuuirSY/HPAAAH0q4VhWNRGAWgGEdKWOoyux8WVfrfpslV/Z5gnNa/Gi65LdITMDbie7faMxHpUGapdnVYWrBh1d1Uo94= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939263; c=relaxed/simple; bh=kZYr4fJVLqKrtKYPpwYkNDd3xCHnVUp/xycW5qf9Rpk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AOW4Msm2cFWNhDPzwGwv8Ddx3IK9TZOMzEmNn3HpB0cpjnR4GvM7QG5Wep68h3EOm4AoQH5u3D0bOQqzFiSCsqHTGGjOYgkNkhjH+Z1IsqR9Cepg0lWM0GmULUi9022blLTf3Q1PDB6EcP6esUXAt18iRgzzulsdur1oqhI58N0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=BCxQ2PiZ; arc=fail smtp.client-ip=40.107.223.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="BCxQ2PiZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hQaGc4A8yHDxRtcvpLZi8ELuOTRT116PExASV97WGJcTmv2PiUed0y9w+2h7MFEMoe3DhLW/Q4OH+Wes21xeab0R5zIjMPzrJ2zTdUG0rf8N/a61qo11vgFu9bIuWvNgKoJ6NZC+IySMKNvrW1S4x9v6lB6QcfawHfwjzI8vCg08IkBBvaRjWgmkjKOC9fizYTSReTIJRECpu0m7tv+zQI1LCcK/0hvJbTzyXz6t+t2eKATXLHUO3E8boDgRuLPkPrMb+Vkav/E8lOGzhL9xzykxpc6gzWJ20ak0nabvKvVQg2/gIgG1DcTl8Zu0QVtuYtXRxvznNHWKyff6o3pbwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Y9bZdxbR4M3tw1Z8t+Zp9hI8dB82663xO1SRUQ8yE/0=; b=TUUOxLnXgJes0rkCpHUIjvzJ8d6Zbk0OXyvorlydV24gUeusyf61GpkX5TJee9k2pVLbTR7luGUxNkayaI/yNNokqboLDctjgFG9s/OrsPmUu3Ydt1OK9UXxZbILqv356CH7eTwxkjiAjaWywJ8Tw5jNhdrttz1BB26NV/Gc0ONOyQ+sjLISti7pmpYY+ePra8jTpJcozuFC/JOmW8nFbW2RF/8zhEVvAdjCVvOJLg3sNSjbdg5eldTdv5YIR25gV7RAySjdGVJIXE3Mq2TiNT6kTDP8d7AMuc5Zv8uZiMPCv1zqPTezngMzmXWqd6ZjLE3Y807ksppbuGeiWgLpfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=Y9bZdxbR4M3tw1Z8t+Zp9hI8dB82663xO1SRUQ8yE/0=; b=BCxQ2PiZdnIROWgEZdk21Ve3HaAqK5Hn8JOnbFs6RO88vUFPSqIuYODWPKpAgQNDynZI8nd9nyNKlMFPhrib3LGYJLjXNB5b3qhHON+frFxkvdTn66aVvTYOkTZZu4adr/kiDEW2LplCsH+vbM6E/6L5q9tC4C9wWlxQPowyz9OqWlTQQmcag/qiKxPnh2mG75nDs3GMksyqR+zdwPVvVCkCINgTo2tBa0VKx01lu0k2KouNHrz70H5taWaj+sHt632XFW08nkdWbbZJ+pnLCfMjegdVb4IaIFEaqDxQbc5wnL6ZxbK0lKetkeGx9T68crxasKz3uf7R21j7nKQhqw== Received: from BYAPR08CA0072.namprd08.prod.outlook.com (2603:10b6:a03:117::49) by MW6PR12MB8661.namprd12.prod.outlook.com (2603:10b6:303:23f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:16 +0000 Received: from SJ1PEPF00001CDF.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::fb) by BYAPR08CA0072.outlook.office365.com (2603:10b6:a03:117::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 20:54:15 +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 SJ1PEPF00001CDF.mail.protection.outlook.com (10.167.242.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:15 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.1544.4; Mon, 14 Oct 2024 13:54:04 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.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.1544.4; Mon, 14 Oct 2024 13:54:03 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:00 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 02/15] net/mlx5: Introduce node type to rate group structure Date: Mon, 14 Oct 2024 23:52:47 +0300 Message-ID: <20241014205300.193519-3-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CDF:EE_|MW6PR12MB8661:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f0d0ca6-32b8-4829-39d3-08dcec925d64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: dDtWWXAcqoaLUyjuQjNm3FBLACVbeFFLnp6Yy/wbDddlZWE4aVdVCDraAO9JNpkj6eZ+gWGlljymFuPQsmHnXSEf2w44pTcfewkLXaxvTjjnsiPlDy1+UrSkKI3lvdfMEuJjJrOB4K9ETFPUq3k2em24HkD7PdvmbOlbOyJ1r4fPUhWhCudiKWJFmeFQZMkxJMGnB+TC0mEN9HhwU0H5x0hBKVxZ4dGCpiewDO9GGX+uH5zJ8LzdLWU6wVdlvSAgK7KEzY22MruR2eIIPqiw/mzr4u65R38Uguox5bvhLPStbti2ec5lST6JUefxmE/1FaDSRBG+VQYztW0PH6hXtuiNs3v5NL7/h4kU0gxVHHqrlZcihW5s5DLV2coWCfgdeXd5nv2K/KtHJWgxP00lFBGiZtMkPQ61SzW5Xw64uQUYilxaEa915WHB5kTruN+gmulmH4gGvzrjG5HASAocrjeH21VIZX0ZymVsSDwd72bJ2qN9X70XcG+042PoKlbsZKVtCbrVlLYjihjrlBGktIKjA00PGXWa4p2fQy6Ii2bGTRGIpMotEOz/1SRbMgX5dSCWbpg8W3Z6Hsk112UPXGViVVm8QyAHHjkoDcqlEfxsa2RZNfwN1BroiU5IA+WEvfxevQO9BwXdWZJZ5MmUDwNXgjMfDRJX6fdSDOTwAj6/ROHXlnUKGB1Pe5rI5ttNg/CDl78XOs72WH0tivXxxnXWiQhDRb1FIKibwXJYjdY4cx+WDTs7i1mtUKWEK+kDnIfBueqXEbKlRt2AvZj68+jCpUXArSxRV0VoHK/Cesbwh+MTxYgDpG8Q4IKLtMHQNdHO1mFZls9vgZeJiW8tMpnYGiVK1Yf+Nfl/CUfLEE1IASS7eEe8py/TEl0Ck88WxC173NMpT5ityn8kmnZgrD1VsOrTIoUUwKt8aQp6xO0Gb8wJmG1vMEDYAL0TU0vsjk9IIYiGFHn5+K7P7bJ66hffORQtjM9GrKuZN/bHYBFB6Aq2wBSTOXctBqWAc3izqT04VH8pve264/RL0td00zwYOTpN6NK7dPjCS8C6h3W4zV46OH33moKVa1TXb8FiBaPEVzCg//eAgU/YJYJtmMcxxF20qs07vycIj3ejcaPrifL0yv5ulP0KQ1RCw8yFnevyrmFR8dkKlS9Hkk1c2Z04aiBqA1zb2r+5hpyNIHbPzZcRS0/erBlpnUqBvKIEpIrQZyq6lFjb2wqT5TDT/ct0oOrLzV0vQ6JTjPplb/SAThaRYoznPPaIg8/dzRRhxjECk4v1ahtVaJpLtqF7EERZUPjW0oSiG9AbQddReK6AErx5L/Wyju+SF4/n1HEfTfC1tYmBWD4uBbv2Pf7ZnOtj2kA8wTqjaoocPcq4JJSgRespOsrenfh8Rllpc830 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:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:15.4747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f0d0ca6-32b8-4829-39d3-08dcec925d64 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: SJ1PEPF00001CDF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8661 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Introduce the `sched_node_type` enum to represent both the group and its members as scheduling nodes in the rate hierarchy. Add the `type` field to the rate group structure to specify the type of the node membership in the rate hierarchy. Generalize comments to reflect this flexibility within the rate group structure. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index 7732f948e9c6..b324a6b1b9ff 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -61,6 +61,10 @@ static void esw_qos_domain_release(struct mlx5_eswitch *esw) esw->qos.domain = NULL; } +enum sched_node_type { + SCHED_NODE_TYPE_VPORTS_TSAR, +}; + struct mlx5_esw_rate_group { u32 tsar_ix; /* Bandwidth parameters. */ @@ -68,11 +72,13 @@ struct mlx5_esw_rate_group { u32 min_rate; /* A computed value indicating relative min_rate between group members. */ u32 bw_share; - /* Membership in the qos domain 'groups' list. */ + /* Membership in the parent list. */ struct list_head parent_entry; + /* The type of this group node in the rate hierarchy. */ + enum sched_node_type type; /* The eswitch this group belongs to. */ struct mlx5_eswitch *esw; - /* Vport members of this group.*/ + /* Members of this group.*/ struct list_head members; }; @@ -499,7 +505,7 @@ static int esw_qos_vport_update_group(struct mlx5_vport *vport, } static struct mlx5_esw_rate_group * -__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix) +__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type) { struct mlx5_esw_rate_group *group; @@ -509,6 +515,7 @@ __esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix) group->esw = esw; group->tsar_ix = tsar_ix; + group->type = type; INIT_LIST_HEAD(&group->members); list_add_tail(&group->parent_entry, &esw->qos.domain->groups); return group; @@ -521,7 +528,7 @@ static void __esw_qos_free_rate_group(struct mlx5_esw_rate_group *group) } static struct mlx5_esw_rate_group * -__esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) +__esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) { struct mlx5_esw_rate_group *group; u32 tsar_ix; @@ -533,7 +540,7 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex return ERR_PTR(err); } - group = __esw_qos_alloc_rate_group(esw, tsar_ix); + group = __esw_qos_alloc_rate_group(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR); if (!group) { NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc group failed"); err = -ENOMEM; @@ -563,7 +570,7 @@ static int esw_qos_get(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) static void esw_qos_put(struct mlx5_eswitch *esw); static struct mlx5_esw_rate_group * -esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) +esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) { struct mlx5_esw_rate_group *group; int err; @@ -576,7 +583,7 @@ esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta if (err) return ERR_PTR(err); - group = __esw_qos_create_rate_group(esw, extack); + group = __esw_qos_create_vports_rate_group(esw, extack); if (IS_ERR(group)) esw_qos_put(esw); @@ -621,12 +628,13 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta } if (MLX5_CAP_QOS(dev, log_esw_max_sched_depth)) { - esw->qos.group0 = __esw_qos_create_rate_group(esw, extack); + esw->qos.group0 = __esw_qos_create_vports_rate_group(esw, extack); } else { /* The eswitch doesn't support scheduling groups. * Create a software-only group0 using the root TSAR to attach vport QoS to. */ - if (!__esw_qos_alloc_rate_group(esw, esw->qos.root_tsar_ix)) + if (!__esw_qos_alloc_rate_group(esw, esw->qos.root_tsar_ix, + SCHED_NODE_TYPE_VPORTS_TSAR)) esw->qos.group0 = ERR_PTR(-ENOMEM); } if (IS_ERR(esw->qos.group0)) { @@ -1038,7 +1046,7 @@ int mlx5_esw_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv, goto unlock; } - group = esw_qos_create_rate_group(esw, extack); + group = esw_qos_create_vports_rate_group(esw, extack); if (IS_ERR(group)) { err = PTR_ERR(group); goto unlock; From patchwork Mon Oct 14 20:52:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835482 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2079.outbound.protection.outlook.com [40.107.92.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E83171D172B for ; Mon, 14 Oct 2024 20:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939268; cv=fail; b=mmF5+0jAt6vLaXqZlu3XoSaub0LoUNqyjibz/te+pKWrO8zfovG2ER2iabpkX54vTEObWsIjC7J49VdXAB/mdx7ChglUH7orCX/7mjSCsrQ+KvMoxxbyFp1+Cto1rqA5ZnbGHyMjfoEoPSrMEuPlwGFJJDZDdkF6yQy11NhBLxI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939268; c=relaxed/simple; bh=4P1l46gBYeBUVreAIKyB3gUKf3FpThn7JObUxVsAfzw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JdTWjEk8eDHNxVepOswYkP1zuhfiIVsxqMJMN2aLMrxhQPapAxqeYaZiVJAxDWaAnlPkISIrBH0mmss3Om4WEdTF9ijdvT4Lkg402DS1z1c2vRz4gEK902LP0l5NGDXaTUxRp1yAfD0SE5h0tkUP2g1bY/hzfw8wTHWlKzLvTUo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Yu9HLb7N; arc=fail smtp.client-ip=40.107.92.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Yu9HLb7N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wxzWPid9is93zQ2Txyccf2xocMUE5lh7J3aHfBRYxOAFF4guc4abNvgHeRfK8208qs7M812iA9MTbVIhhoyZHsk4DgrUIQsaIUEBv6MqACmqJ1rZFWwCytizVUX9VaS3DEUUlJ4nwNcLkl5p4Ooqd1TgXpB0LIldWJ+WhEqjnaSniFwNIaGSyy1XlG3KBg6atUvuVqlURgBX4ofZejqQMEbSE1ll6leMvi/EfYcd7Sssd1pPsO5Q4Hxr4R1kzJKuWZjjch5beg+JgSo9zoi5LUrnY40CSPWfE6NplmQfQssv1d0afss0Vd66SJxXDyuTom0Ir+ngCIhunooViEOJ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=c5Rq6+voAr41stTFgInmp4ByXbWM0b0Au3R9Ag49qkg=; b=EAuJNMKwiCJjShrvFWo1dBH3LPOzrMg2SksEilq92TsF86i9NNM/MF2fIkmrlkC+x5zMgKWBUF/hHJFvz4m0i6uAdEHY5TVPn+RK+g6gsZ1elUJFqqyPn8pSMRJar5L0nWrhStxiiRloUPkRNt4kE9Z1UO4ZDeogMRx2/BPj4l+p618zux/DAbZWIOxqt9cHs6Q0sQcTve3IZvxOxFHzDZCnclzbQAPgI+QL+KGN7oLlapvmcxcoHpYV5ymtXyb8ztBG3fPDsEZtTUnHaYG02UiWUeSbKRKww3WbDZLDnRRjPk/LFU/O7398xdTfjBjOPbKGcLXzAdKOiEjmyCfcjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=c5Rq6+voAr41stTFgInmp4ByXbWM0b0Au3R9Ag49qkg=; b=Yu9HLb7NwzxbHMpnoO6nNbdyggtmAMEDTzU3hZPaf4AEMpkwlphMVnKJJS+nguwXEI1hBsAmn2dfpCNMbTPi38pnovpxdO3fGk90lNX0auRuwYXs3Ob6YmX/yRyI0DzgsWjlR781EsBZbXpCKl57mvayoM/kpj/nihzOqvBpaqN6hAExlXMX3k3oshvNYFTa5OV1+BiXZXDm/pBKej96XzPGE7hlF6c0GQlfSqM0qFNvOcNiFZDB0D1gtAXyU0G3ak/M+hCkVWiO6S/q2eH5tj2wEZuYP0EwY7IBtIkNsQvfu5cqRmxsktnNPz6Eql4eLBdCcHyN8qSp8NOr0wZ9yA== Received: from BYAPR08CA0038.namprd08.prod.outlook.com (2603:10b6:a03:117::15) by IA1PR12MB7543.namprd12.prod.outlook.com (2603:10b6:208:42d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:20 +0000 Received: from SJ1PEPF00001CE2.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::3a) by BYAPR08CA0038.outlook.office365.com (2603:10b6:a03:117::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Mon, 14 Oct 2024 20:54:19 +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 SJ1PEPF00001CE2.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:19 +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.1544.4; Mon, 14 Oct 2024 13:54:07 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.1544.4; Mon, 14 Oct 2024 13:54:07 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:04 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 03/15] net/mlx5: Add parent group support in rate group structure Date: Mon, 14 Oct 2024 23:52:48 +0300 Message-ID: <20241014205300.193519-4-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE2:EE_|IA1PR12MB7543:EE_ X-MS-Office365-Filtering-Correlation-Id: ce396853-8179-4850-02e2-08dcec925f8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: XKJ5mdmyg5XrUdzST7nFqEY/zb3+9IzWx4SN2Y3OwmHt+dEOw452XPGrHrI0Q7Sj+LBeY5TsnHzIjZdIVtxs+MohH7arikadGoeoCunkr0ZLluTl6lUAR0UgfLPZuL6LawUSbdTIefW1Lgr1+dOeLQ6BHWYNY6zs5W4e0IpmZ74Mhb+yCaLhK0zVx9I0bMr+2iDBKfcAq85PcorGp09BFR90WewdW/5Tm8PdsTZTiDaPVhqr8A6Y7H+BIL7MJCXBIEUG79EYQuMqWSkU62XRLXxCXOFAmAD2p+ppMgnuE1amdCXiVEOfPLb8DWN4x4kUV8nPHKhBiChvPYNlOWs9KMeTKtGKJ/Le8cplIVdoJQTlwi8sBYeRpnYGwN5u/2VA/NCCX5dA0n0pCRrSmw9Y2ennUn+UnXzuWa7EYcqc+rxhkr5MdRntW22+zZgwg2KwdNPCDfaQ7ePIOzaZg1UxZj7LH/Enqo29GjXguXs4FBZLUt6nGx3aNDz728mZJv0KfH9HGXlRNSaDtEq3B6YzGUyykHrx8WHkOrgvwDw1RK3KcZm39NCm2B08abTpJVzb0xGjd3mMg0xRUGOq6PL45pOz8KGLPwtlwNjJrzRWpkqzRYLWFjlKd4c4MeBOr/Ca36FGgc6A3YOb+zdTKbOCg99RUvGuiwO/mHvnBMAREJKszksM810LFQNUzMiRT3fBtEzdjk/sYt3IsADxcdsx4QRZzvzfl/Ag9l8+4zjNsPjWq2U+j9t+2bYHHNYFxnAOv0lGGLrr+wcW855uJTSl8tkZhemaiTN/GUF4fnc7sh9PRHLlS37Me85O+3LiQoHWyoJg3uteWcBv07BJGyzaVd7lNFkJ0F7OZs9CDR03se552gefsj02fYTp0GcAThDt1aed7IlF6mNhKqkHryGg4FjkeModtPGHmclkVEO/0Zv1lo8mq9WXfdS9+ymDcyqh9iRJ7Wg2uVU7GuThFy4DorRTE8J02W0Vq5TbKzJrS/G7MB8ZnTEM+j0KlqTcZJ+kjs0sTyaOzbZc+Qn9onP0OaGpe4SO76TQjHjzL5icNnIdmmYS4p7Zq0J+G6gldeErEEAWTvO26fv8Q9dq19kkCMXSttGlvyrydqLfx9DNaQVyqir9TqJySGXHMC3dQ4hyK+xnkM8CTPrZmi8x8Q4HcPj26U1xU+VhWQmInoPVEKeVdk1hZCagNhVMz3oEivBd5NCm3PqOgunlXg3+wv19GccDCSaVIb+zhW/yeBFTSqm9P8ZO7mQEA7Uaxsqoykii8hG4RZuomDtMTZRCmTxeN5qt3Txxw3EqM5AeuVerukoIZrwVmdBsS4rqtoU2+deNyNPdQu+Pm520oazXtd+eCfJ9oYaGkIujPC0jEsg5GMcohHntzJbS2MF6/NApn7TQ 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:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:19.1106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce396853-8179-4850-02e2-08dcec925f8f 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: SJ1PEPF00001CE2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7543 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Introduce a `parent` field in the `mlx5_esw_rate_group` structure to support hierarchical group relationships. The `parent` can reference another group or be set to `NULL`, indicating the group is connected to the root TSAR. This change enables the ability to manage groups in a hierarchical structure for future enhancements. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index b324a6b1b9ff..f2a0d59fa5bb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -72,6 +72,8 @@ struct mlx5_esw_rate_group { u32 min_rate; /* A computed value indicating relative min_rate between group members. */ u32 bw_share; + /* The parent group of this group. */ + struct mlx5_esw_rate_group *parent; /* Membership in the parent list. */ struct list_head parent_entry; /* The type of this group node in the rate hierarchy. */ @@ -505,7 +507,8 @@ static int esw_qos_vport_update_group(struct mlx5_vport *vport, } static struct mlx5_esw_rate_group * -__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type) +__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type, + struct mlx5_esw_rate_group *parent) { struct mlx5_esw_rate_group *group; @@ -516,6 +519,7 @@ __esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_nod group->esw = esw; group->tsar_ix = tsar_ix; group->type = type; + group->parent = parent; INIT_LIST_HEAD(&group->members); list_add_tail(&group->parent_entry, &esw->qos.domain->groups); return group; @@ -528,7 +532,8 @@ static void __esw_qos_free_rate_group(struct mlx5_esw_rate_group *group) } static struct mlx5_esw_rate_group * -__esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) +__esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct mlx5_esw_rate_group *parent, + struct netlink_ext_ack *extack) { struct mlx5_esw_rate_group *group; u32 tsar_ix; @@ -540,7 +545,7 @@ __esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ return ERR_PTR(err); } - group = __esw_qos_alloc_rate_group(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR); + group = __esw_qos_alloc_rate_group(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR, parent); if (!group) { NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc group failed"); err = -ENOMEM; @@ -583,7 +588,7 @@ esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ac if (err) return ERR_PTR(err); - group = __esw_qos_create_vports_rate_group(esw, extack); + group = __esw_qos_create_vports_rate_group(esw, NULL, extack); if (IS_ERR(group)) esw_qos_put(esw); @@ -628,13 +633,13 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta } if (MLX5_CAP_QOS(dev, log_esw_max_sched_depth)) { - esw->qos.group0 = __esw_qos_create_vports_rate_group(esw, extack); + esw->qos.group0 = __esw_qos_create_vports_rate_group(esw, NULL, extack); } else { /* The eswitch doesn't support scheduling groups. * Create a software-only group0 using the root TSAR to attach vport QoS to. */ if (!__esw_qos_alloc_rate_group(esw, esw->qos.root_tsar_ix, - SCHED_NODE_TYPE_VPORTS_TSAR)) + SCHED_NODE_TYPE_VPORTS_TSAR, NULL)) esw->qos.group0 = ERR_PTR(-ENOMEM); } if (IS_ERR(esw->qos.group0)) { From patchwork Mon Oct 14 20:52:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835483 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 732661D14FF for ; Mon, 14 Oct 2024 20:54:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939271; cv=fail; b=EfFcar3ea8FpDGPkrcHXsHTjhLDeMY6Sl8Q46I1G7kfkLdTydUdjDc9xPr2PbPkxkzpGlzPijBPM23zSjm6P2AfhZu4atVSDMFV+WCGGyoXU/0ISDAa4fgadPT/bheWQ5VPVjp5LvV8HK5Ck9KTflQwp6eyoxM4NbISDwhZKY+c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939271; c=relaxed/simple; bh=yi/WAt4FKeVEnwXWY1D8NLSIx9Oan8PLGgZu5Fa+NCg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Da1eMxGSb7zeLRjb0uYFFOmyFGdNf4Fsg2pqXv38nlt2qzXCVhjAI3UF5Nt4gDmfSJbYA1tqSRzlLnhIO8lks4N0WbiEqgBBk4blrJYVn4YtGX+M564OVf4T7ESB+5OQzpxHCIJfQqK1xcJcKfpeBJRxRAxiKd1XvpahvlyXDB8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=eMfc5QLk; arc=fail smtp.client-ip=40.107.237.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="eMfc5QLk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m0Rxd1+LXj+iolV/b/yKue2tRfPAtpp7d+jqf08e2Sm/ZSgSTyYfAjI9IvqZ+lOx4mNawuZtB1kv2sesOQw9F95X5NLGThiS+OJbAgnjx7cgWoCa3v+9Mw9Sjd4R3Tl1XeSkyjvCXQxPRC3U+0iw5svvdCqzWOLJ+PVo5DCgULQPTiLgwU4Luurk0PG8BGtlBmKrpRycySlbYwEBSdMnek5d6RdswlLZaEnbnp9NHJHa+1j1rw/1W0qQtx4FUXpoPH1f17uFFoHlPiCBzE5djNudlme2f7+LQNlEaFoG8xb4Uz3lo78n3Zpx9MxvCzWueIecxHKzojFuWuPoNlQFfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=yVui3GmxpBP9JDLQnPyA7x/QTjiKuC95ERIXJuNgd78=; b=G7SV9GONd4rP6cHNkx0/ESYCI0M6BLU7krgXUfA76uLhMK4rKfVK6RlHxiA1/mzJ4OIsyulDS30TUroX6enXKTg8qLYaBCTFG/pGUlApJAlvgK8l19ldH0X2rDi7L2iL4v+QZs+4ukBOkti6Ha4jo8XTfDc3ZMAgpVcDkl4RWEJOoiF3HJyIDF3+qKUgWP++J9/lqu5Ad4U0SoPmIJL8Vtlr1Cvy3WjgKgcD/eYHOONTThLmldm4UKWCocuXhte+P94Pe5oGLFmf53KdW9wSeKRRpeywRn7BnTEUfpDW5EA/rB4pNC7MzO3wGv7sRaDuw9tJJBJaDBpAPen799HwZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=yVui3GmxpBP9JDLQnPyA7x/QTjiKuC95ERIXJuNgd78=; b=eMfc5QLk2v3qEWpd5/eJ6Lu5RwCYaIAwYw3Iud9+qkgs8dGOiKmut2AGdjQMMwHxtNF7qIhnRdNMHZmnidtJ2ymD/k1pRsvbHf+YXaUCmDQACnBj/PLbYzGWQKtwqZXdMRjRNvlzB5nH7P6tGyhUTH30NHAly476hXzpmA2p7sTg/KYTwWynTbKk+rgTpilkh8I6UKBpMD5UuT1IO8XwJ7hnz80SPhbedWGVQF6rcPp9m0rLLxuvgvlapxDNekm5gkkppMtTVpnsM7tQ19XW/Z45gM9YtTjLE+PRLZeXLtSX/i8kpbkyswf1ZRId8ePKsjHfFomJFqrWot8TzRqsyA== Received: from BYAPR08CA0044.namprd08.prod.outlook.com (2603:10b6:a03:117::21) by DS0PR12MB9422.namprd12.prod.outlook.com (2603:10b6:8:1bb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:25 +0000 Received: from SJ1PEPF00001CE2.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::99) by BYAPR08CA0044.outlook.office365.com (2603:10b6:a03:117::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 20:54:25 +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 SJ1PEPF00001CE2.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:25 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:10 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:10 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:07 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 04/15] net/mlx5: Restrict domain list insertion to root TSAR ancestors Date: Mon, 14 Oct 2024 23:52:49 +0300 Message-ID: <20241014205300.193519-5-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE2:EE_|DS0PR12MB9422:EE_ X-MS-Office365-Filtering-Correlation-Id: 5daf1027-9f9c-4b7d-898d-08dcec926360 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: brat3whFHg0zlFc0fmnP20gMrtOia0kw+wPkGtrH4bk3VIxmmPq657D3QV0ifXghtRfWuAup8IABPd6WRkBCjBZAmkc18B/+y7m+cr18rGfS51q6vy6GMeXyjNaUfpEcPhvLOGkO9S/uSSnJZUQ3ei8o4aQSeIM4snVcHi57GN8jCgfYrju3ifTCshVpiCVZ+/HWSvlnYT5KysPqmmruItWj+aPOzMqDNzft1DbVsjIqMzHCEJVTn+Gh5YgfHQ6OqcnFrCsjX7sy/V+J/NgvZ9iy4XALbGe4PdxwIrnGCnb1WaHSdjDQeeI6DS/2SoZAV9SnBvApJkP9RvaB7aNMfenb720/nidussZnNQpoZElbGtPFsq8wroL3Bzdot3+A9VtPBpgNEM9wlaDvuVQwUErIpKZ1yZ2EEFMTp7/nZ6lnVQ6/uVidWMNLkfniFKXfxzDMIru7/ggMNf3qPy89FY2YWpjZNrddJUnbaG8GCgL9gIZmI6eFX5r4kvNlSJ8TF4es4GM8Cm2mMlpwDDvJOTc5CaQ77Z2uf037zOC76pSqDVO9GweOhkMcWIAeb6cE3BJBqMoeYy51Di6ZqtHURDO0AzlyqptJCsdWr/kf1lQA+JQQcoq4nHZkDMc643s9sXGDC10HGFzvKg200CbX/YNO5OoHuWsZvI3Qag+vxU6+DIJAlVCyCdKxISFnarzAWb5gkAp/PVfCgL2VNNOp7bibfGPo46fVAuau1i40xwrRKcPS7t0xroKVJST5NFpy74Zx3pKCXoNwsp3If9kqvA9qpkKp+/0lTr2blSzsdpTb5fXkwx3Z88WmFeghA6bPA4HTZbl3CfSeZYwFw1thxxcuqdFT8UDNlFFGyZ+wWRA4aDerp/MuwFnhibgRPYv+N4rYfcGRNU2SK+3zVrMWCHqQmsSrf8+yGebolkK9dnLyTaMsGRnY4d3Vu6qjHvWWFfQlyLQ2GMwC2ztZwNo8iBSqzdLw3PrCTGRyCdw8yL6hQI711pQ5td24TV9+4Z75dmTz3M5tDuT1k177FhOiGf+xEr53Yub8hxW0u8yM1M03fUwy5/378PfBKayv1nNMZoLrWcZFC1uTpI6Vf7T9ar2GUdpqrynp8gwalIbl8Lbdf7susQhWtNrXac/m/OB6gdY4cKhwGt3nHcrtgWJZPBd+prsIX0SIbjZ0uziBVhS3nrzhrAq22JW3wcGww4idx1dgsA4H59AHwyAeKITJurKVpNOVZZprxj0pqsKB1Rs6HuYUXL/KCdCMKzrxviOcelXQQOjQ0xhtt9z5F1cN36kKpNFUxOY+R2c96RRqxWU3cRAeBts2WBT8b4Nz9MWoImmbNbrSDcEYfpOCOWQe6vUMJNqH/XWn08RoZn/0ABY= 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:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:25.5325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5daf1027-9f9c-4b7d-898d-08dcec926360 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: SJ1PEPF00001CE2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9422 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Update the logic for adding rate groups to the E-Switch domain list, ensuring only groups with the root Transmit Scheduling Arbiter as their parent are included. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index f2a0d59fa5bb..dd6fe729f456 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -511,6 +511,7 @@ __esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_nod struct mlx5_esw_rate_group *parent) { struct mlx5_esw_rate_group *group; + struct list_head *parent_list; group = kzalloc(sizeof(*group), GFP_KERNEL); if (!group) @@ -521,7 +522,9 @@ __esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_nod group->type = type; group->parent = parent; INIT_LIST_HEAD(&group->members); - list_add_tail(&group->parent_entry, &esw->qos.domain->groups); + parent_list = parent ? &parent->members : &esw->qos.domain->groups; + list_add_tail(&group->parent_entry, parent_list); + return group; } From patchwork Mon Oct 14 20:52:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835484 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44FE01D1318 for ; Mon, 14 Oct 2024 20:54:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939276; cv=fail; b=oYDWff8zxYEdO0UNoVP706JRrWjxqrYNrpJTu/hwWBOb/TfWTfzYMkawHJT3UTVp2UIKNaJjE8f85R5NH9Ujc1p1y7H+UHG+4P6nqwDfWMfGEWxeyXuhRfDSQ25ytAfZgemhq471KKo6BHhcLYLtmUuWQOBGmX3EKIibHgLS5+4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939276; c=relaxed/simple; bh=+HKWVqN7eu5uSpMzfyLASNS1ga42Mz+S0ePlS+NgX0w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FbRHt7GqTPoClDjGVnOq6rugF/eQ+iuqrtQqeU/5yOMbiblg2Iu4usG/vCbMIQqOn7GklNYDP3m+qpNJF2FvbZ6JDkGoW/xg680e6a6Ty+QQO8WgTa5ILbFbVZU9eomaUjmNvdFG7tyvBF23/80WGXDEZpBqYXTcQnhYQjDCc2c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=bcDbG0+r; arc=fail smtp.client-ip=40.107.94.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="bcDbG0+r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q6MQ2AgM6qn3SxoGHqR5pjVsKhdCWWkWOJ+vP4x4991goYpGScbCE3Tp1+JhZRxqp24cBeIncxcKu3YZ3F5r69TtCjkOyfV4vCu2JrnpW7gENf2oAJTgo2Woyi6LNzmdgjvjqZ6W/AbQCdOv5EWkC4wMVN/0mz3fL6dpautPdcygSuHQGvQ8THrGC20NPQd3WWalAoBWC0U3BjmKJbHq7BeX+4tYgA4WdWyGzkmK2iC8v3RG6K4NMVJPytSo6xK+4eJUASNvV/yf6LvvBTpJfrNXCEpDW3Hh3e6l2WYgXQqbWNTtKjzBsdlP9PMuHYG7UI8T4y4nf5yjQeiiDsd6Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=me44sRfqa0xvul1JJbXSzmkdk1hr18wl44TfkkQ6LW8=; b=oHbDGu0Tjch3GQeEobZktloPtQqRRxLLpkfGRE8v0ousSJoYTygS20IN7ukL4Vn1PTRM1nmGL6ToZXC9NtFsHi5OiEgquB4C6TkdOWG2u7JixRUWbb4ECBPNOHWFXgdF6a2naZ4FADgkeQek+s7dVeaC+0HErad9Pv4dadyd6VPmmJDWJtZHQ0jy1ED8udX9EHFIUTa0s3bTT9DVArOV6chnrw9cKsrSKDJgWmw9yc8DPaSumHiZoXx3KtOnkNCLUqcNweFe32kyDJo0FK7JBslBl0angygkzzR0r/R1EAQpTqe/7g8Z96vEkYFnerkUgpHQcaT2Y3NBNnsfXho8LA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=me44sRfqa0xvul1JJbXSzmkdk1hr18wl44TfkkQ6LW8=; b=bcDbG0+rfJSPO8R2ecVEExViKFMBCqHrchR4y5FYbIvX53Gc4rz+IMfSsz9DOvY3ibtzVB6xjOdmJg+2wUYvqA0YBcliBYTCSHYEPdz96fcVX7AYXM0QlOMDpF3uBEqp1DcebTwhmx05EJNW6Yvv/L9pssZQNO0gd7y+THqdWO6re28P72zeLdYfp7jNMFVtvc1ixSbVIyGS+V7ZWHazlhjfq8eREJjKijnaeZ69DOmvvfRaxleVa0dITyOvJya2apb/vl1qUAmIvm5J2YP8rGwW6TglABDkQecZ7z2vPX/n58E3VtiQAG27qkRUo1VmZ3Tr766/haAtT4yLMoqYKA== Received: from DM6PR21CA0013.namprd21.prod.outlook.com (2603:10b6:5:174::23) by BL3PR12MB6474.namprd12.prod.outlook.com (2603:10b6:208:3ba::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.24; Mon, 14 Oct 2024 20:54:29 +0000 Received: from CH3PEPF00000015.namprd21.prod.outlook.com (2603:10b6:5:174:cafe::93) by DM6PR21CA0013.outlook.office365.com (2603:10b6:5:174::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.4 via Frontend Transport; Mon, 14 Oct 2024 20:54:29 +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 CH3PEPF00000015.mail.protection.outlook.com (10.167.244.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:28 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:14 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:13 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:11 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 05/15] net/mlx5: Rename vport QoS group reference to parent Date: Mon, 14 Oct 2024 23:52:50 +0300 Message-ID: <20241014205300.193519-6-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000015:EE_|BL3PR12MB6474:EE_ X-MS-Office365-Filtering-Correlation-Id: c6cb26b3-6511-4b7f-c6a3-08dcec926559 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: CXruT/d0yntf1Wf0x61tTv49vhiyAfT/SzwaR8k7g2+fiPKopP5eHRBhB+2g3Hyk5BT3Mx52BvK2lZRUKhU7Woe/ioYE64/EeZAWq+vG4OJBIp3n2ERSE1Xzbsc+hH4MlxRJeXtlDtHw0Aci0kHN+WqVToWTtoG4ZdIBCFOTdpAjyXVvsF6kWB2RoHgHqACdTM7ISSbbAZeqhWyC7vNjE4/q1/zti/ffO2EV4y2paWgvbvMmTATaTTuUGZx0kHSfPQWFjQ2mToT6j+rCslscHPAMoa0ihLSETVStQHlnIXT6yyCIlqyNFoA6Ep97YuSkwojXf85vrN3HwIPZMtG7Tmk6Ds7pLFjxwWfAMf5ai9/ihqTsJTKUjvokVuwWqeriCZeKA44TNVonoVcUNM7wDJfYVqKH5F94m9oFfTebDe3G1knIYv9lk6Jl2z7PAp9YyBZD16+B3zi1q38F0Nf5g+mkLNT0PbSq3XNsLo1cFlIrKI3ahL5fhAYwZ+CTiH7/r/gqym+UFGYVEKfmmEfBFgktqzbANkL4uOLo6566RuKy1KM/U/Bfrt1VhHiksn75uq/g4cn8XziiZj6hW7OkUNJZFc5jlws+/IHlE7WfDsGJ1cAF4X/fgLJAT2y35kCjDXk19Vj6nX6mRKeeiPnRfSbrEmCL338OY5ix3dEVBW9rkJS/QaKZWMLA8NxKGdCDL5yl4XsuJm1wEetzXl7mrBFBz7f/OSkS0F59SosB2vA3KuZ70kQkLxvV+51dXPoId7zPwYZgy921pI5UzHhQlaOHZVWRu6EaRHEsswMq36YIm3ye1WXmBiScDdNBL4jE1K/sHF8k7zaEhe5J1aBs/glnJqzNKIEwRO6/H3j6FvzZHVSZsfK7tKf1/RtnvWNbj3r41KVOlnCGEXgF+aErKsWl9gAKwJLL+n0I5Zm2m3yatHRnbcRb3/TNk3WVaI7HYNA2LinI4FK+s5Yve7/rlpPKNhjblzRjZVn7kKE95sEfW1xBgAdzvV+Owz8LWEiGFoC5Dx6OuYceiPtuA89BNXxqfygBVJxIRMpBXZov6s8y9CzDYT0oadqFu+P+CvUoSPOCot5pWegV211akIq6A00dC6EvSu9d0kZWJarQKgNj5ZFRUw6kWSBiErkvMts27J4HGGrfAhyQAx/o8KJjkVqrW/CT4bzISc2fiMm94ZtBdDwSey/JsllwdIHKGlWJmld92wgkJnAI51UC0LsO+CohfsQPejDhobgwGz5s5bVdlQwd4v6bRAsGnKd0O8t23FRaTDHOki5zynlx85kTgGPkZF0YlqgRQZAufQ8X+wMUHTMJY47c/3CXZYGWoF2mLNeI6i9fDhg7aZnFqCIVYNQTuT5AIUxu6CsdZ+l821AYuoPJ4RfwM3AHkgZhfUJw 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:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:28.7967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6cb26b3-6511-4b7f-c6a3-08dcec926559 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: CH3PEPF00000015.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6474 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Rename the `group` field in the `mlx5_vport` structure to `parent` to clarify the vport's role as a member of a parent group and distinguish it from the concept of a general group. Additionally, rename `group_entry` to `parent_entry` to reflect this update. This distinction will be important for handling more complex group structures and scheduling elements. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../mlx5/core/esw/diag/qos_tracepoint.h | 8 ++-- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 42 +++++++++---------- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 6 ++- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h index 645bad0d625f..2aea01959073 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h @@ -35,18 +35,18 @@ DECLARE_EVENT_CLASS(mlx5_esw_vport_qos_template, __field(unsigned int, sched_elem_ix) __field(unsigned int, bw_share) __field(unsigned int, max_rate) - __field(void *, group) + __field(void *, parent) ), TP_fast_assign(__assign_str(devname); __entry->vport_id = vport->vport; __entry->sched_elem_ix = vport->qos.esw_sched_elem_ix; __entry->bw_share = bw_share; __entry->max_rate = max_rate; - __entry->group = vport->qos.group; + __entry->parent = vport->qos.parent; ), - TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u group=%p\n", + TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u parent=%p\n", __get_str(devname), __entry->vport_id, __entry->sched_elem_ix, - __entry->bw_share, __entry->max_rate, __entry->group + __entry->bw_share, __entry->max_rate, __entry->parent ) ); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index dd6fe729f456..837c4dda814d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -84,11 +84,11 @@ struct mlx5_esw_rate_group { struct list_head members; }; -static void esw_qos_vport_set_group(struct mlx5_vport *vport, struct mlx5_esw_rate_group *group) +static void esw_qos_vport_set_parent(struct mlx5_vport *vport, struct mlx5_esw_rate_group *parent) { - list_del_init(&vport->qos.group_entry); - vport->qos.group = group; - list_add_tail(&vport->qos.group_entry, &group->members); + list_del_init(&vport->qos.parent_entry); + vport->qos.parent = parent; + list_add_tail(&vport->qos.parent_entry, &parent->members); } static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_ix, @@ -131,7 +131,7 @@ static int esw_qos_vport_config(struct mlx5_vport *vport, u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack) { - struct mlx5_core_dev *dev = vport->qos.group->esw->dev; + struct mlx5_core_dev *dev = vport->qos.parent->esw->dev; int err; err = esw_qos_sched_elem_config(dev, vport->qos.esw_sched_elem_ix, max_rate, bw_share); @@ -157,7 +157,7 @@ static u32 esw_qos_calculate_group_min_rate_divider(struct mlx5_esw_rate_group * /* Find max min_rate across all vports in this group. * This will correspond to fw_max_bw_share in the final bw_share calculation. */ - list_for_each_entry(vport, &group->members, qos.group_entry) { + list_for_each_entry(vport, &group->members, qos.parent_entry) { if (vport->qos.min_rate > max_guarantee) max_guarantee = vport->qos.min_rate; } @@ -217,7 +217,7 @@ static int esw_qos_normalize_group_min_rate(struct mlx5_esw_rate_group *group, u32 bw_share; int err; - list_for_each_entry(vport, &group->members, qos.group_entry) { + list_for_each_entry(vport, &group->members, qos.parent_entry) { bw_share = esw_qos_calc_bw_share(vport->qos.min_rate, divider, fw_max_bw_share); if (bw_share == vport->qos.bw_share) @@ -286,7 +286,7 @@ static int esw_qos_set_vport_min_rate(struct mlx5_vport *vport, previous_min_rate = vport->qos.min_rate; vport->qos.min_rate = min_rate; - err = esw_qos_normalize_group_min_rate(vport->qos.group, extack); + err = esw_qos_normalize_group_min_rate(vport->qos.parent, extack); if (err) vport->qos.min_rate = previous_min_rate; @@ -311,7 +311,7 @@ static int esw_qos_set_vport_max_rate(struct mlx5_vport *vport, /* Use parent group limit if new max rate is 0. */ if (!max_rate) - act_max_rate = vport->qos.group->max_rate; + act_max_rate = vport->qos.parent->max_rate; err = esw_qos_vport_config(vport, act_max_rate, vport->qos.bw_share, extack); @@ -366,7 +366,7 @@ static int esw_qos_set_group_max_rate(struct mlx5_esw_rate_group *group, group->max_rate = max_rate; /* Any unlimited vports in the group should be set with the value of the group. */ - list_for_each_entry(vport, &group->members, qos.group_entry) { + list_for_each_entry(vport, &group->members, qos.parent_entry) { if (vport->qos.max_rate) continue; @@ -409,9 +409,9 @@ static int esw_qos_create_group_sched_elem(struct mlx5_core_dev *dev, u32 parent static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, u32 max_rate, u32 bw_share) { + struct mlx5_esw_rate_group *parent = vport->qos.parent; u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; - struct mlx5_esw_rate_group *group = vport->qos.group; - struct mlx5_core_dev *dev = group->esw->dev; + struct mlx5_core_dev *dev = parent->esw->dev; void *attr; int err; @@ -424,7 +424,7 @@ static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT); attr = MLX5_ADDR_OF(scheduling_context, sched_ctx, element_attributes); MLX5_SET(vport_element, attr, vport_number, vport->vport); - MLX5_SET(scheduling_context, sched_ctx, parent_element_id, group->tsar_ix); + MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent->tsar_ix); MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate); MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share); @@ -458,7 +458,7 @@ static int esw_qos_update_group_scheduling_element(struct mlx5_vport *vport, return err; } - esw_qos_vport_set_group(vport, new_group); + esw_qos_vport_set_parent(vport, new_group); /* Use new group max rate if vport max rate is unlimited. */ max_rate = vport->qos.max_rate ? vport->qos.max_rate : new_group->max_rate; err = esw_qos_vport_create_sched_element(vport, max_rate, vport->qos.bw_share); @@ -470,7 +470,7 @@ static int esw_qos_update_group_scheduling_element(struct mlx5_vport *vport, return 0; err_sched: - esw_qos_vport_set_group(vport, curr_group); + esw_qos_vport_set_parent(vport, curr_group); max_rate = vport->qos.max_rate ? vport->qos.max_rate : curr_group->max_rate; if (esw_qos_vport_create_sched_element(vport, max_rate, vport->qos.bw_share)) esw_warn(curr_group->esw->dev, "E-Switch vport group restore failed (vport=%d)\n", @@ -488,7 +488,7 @@ static int esw_qos_vport_update_group(struct mlx5_vport *vport, int err; esw_assert_qos_lock_held(esw); - curr_group = vport->qos.group; + curr_group = vport->qos.parent; new_group = group ?: esw->qos.group0; if (curr_group == new_group) return 0; @@ -715,8 +715,8 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, if (err) return err; - INIT_LIST_HEAD(&vport->qos.group_entry); - esw_qos_vport_set_group(vport, esw->qos.group0); + INIT_LIST_HEAD(&vport->qos.parent_entry); + esw_qos_vport_set_parent(vport, esw->qos.group0); err = esw_qos_vport_create_sched_element(vport, max_rate, bw_share); if (err) @@ -743,10 +743,10 @@ void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) esw_qos_lock(esw); if (!vport->qos.enabled) goto unlock; - WARN(vport->qos.group != esw->qos.group0, + WARN(vport->qos.parent != esw->qos.group0, "Disabling QoS on port before detaching it from group"); - dev = vport->qos.group->esw->dev; + dev = vport->qos.parent->esw->dev; err = mlx5_destroy_scheduling_element_cmd(dev, SCHEDULING_HIERARCHY_E_SWITCH, vport->qos.esw_sched_elem_ix); @@ -888,7 +888,7 @@ int mlx5_esw_qos_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, u32 /* Eswitch QoS wasn't enabled yet. Enable it and vport QoS. */ err = esw_qos_vport_enable(vport, rate_mbps, vport->qos.bw_share, NULL); } else { - struct mlx5_core_dev *dev = vport->qos.group->esw->dev; + struct mlx5_core_dev *dev = vport->qos.parent->esw->dev; MLX5_SET(scheduling_context, ctx, max_average_bw, rate_mbps); bitmask = MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 3b901bd36d4b..e789fb14989b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -221,8 +221,10 @@ struct mlx5_vport { u32 max_rate; /* A computed value indicating relative min_rate between vports in a group. */ u32 bw_share; - struct mlx5_esw_rate_group *group; - struct list_head group_entry; + /* The parent group of this vport scheduling element. */ + struct mlx5_esw_rate_group *parent; + /* Membership in the parent 'members' list. */ + struct list_head parent_entry; } qos; u16 vport; From patchwork Mon Oct 14 20:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835485 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2086.outbound.protection.outlook.com [40.107.244.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A5B01D0141 for ; Mon, 14 Oct 2024 20:54:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939279; cv=fail; b=TjY58ucgqHwu4cA8H0OWanMzN+4jUajGWC3oFaj8PpTeZviiYHiHvzDGq67hlZN1eNJPpLX3BXJuFy8K8qronisBEy+uS4YB/pBty9xNdCzky+ufYqPFfrwEvgkToyezzSZvAvQTCbzcmVDQqye+v1ZXY0WabHJoRjQRiHqXddg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939279; c=relaxed/simple; bh=/qmFPBdQ8nsWXF/vdbPqocuO3D3DsYbxgRR+jX67xRU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NxPjHP4qFZUGPPoAkzewFzCVCEB5tmz8C82THBT3EfRMm8xbXfC+XFjnkiRAfgawA7M5gD+6QV+g9U+DhZ3+GjgWr7oJsgCP/W+ZAp+Y3iKSMlCXKbVL4ySXUUQ5SZgIuNlQVDGNNgbTxY/CUwTA9pL0whPH6kSzNVUu4oHxJKo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Pm15KIRP; arc=fail smtp.client-ip=40.107.244.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Pm15KIRP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gof+eU9tIkbYOW6GxexMt5xKswXMoCWNEBH1x+Lmdtn0O3P9GHnfaEl3z5vmMm1Niq8p0OQK8pMe3PgRL+Ul6AM4Aqg5TIY/dwAVytqXClSP8kfPF8hOg7SaP+B3hlagqIUcyvJtCYOWtk85Oe7BN62BxwJrR5hzQX7+rv5EYVIa73XvSLxczmXEmfKVFZQcZgZwh8NJrAHdnKepKY6SBvwKs6pR+ogEoLSG/ptyk2Zhw/cyIFI4pGHBzM3TLYqsEi3deEhpZNgjYRtKSue/2h1AbZFHZnGJLrDAkq5lqe3Y6aQVUqNxQ7SosAx0SEE7aqD5oiBgzjfbcl65SZjVcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Y4XuQC+bQjDsbbpmrjq4JrPHpUlshQfEG3amK5TzFJw=; b=MBU16ahuTsDFd3capf3oWX79b6TBk23vr1/16dLfjqlS3OJwfhMiF3hhzW7O068JUmoiU2nWwheOT2UUdSXWXVQaZVhe+ohHK8vYt1/Z99I3zZEWSwRl4jKMV4vwbUUJ8rkwYV0wsJi5raDhCnWpX4ABLngw5NEOnU1AfPB4tIr+gppfp/B5OveV2ynvkjG6Qp/UK9Et6cfP/G8Dpu4ujOo32dFWg8kD08jNN75fD8WCnoxCIuMvlyQdbdMqyR4g27JkxUJ7mCxvzXSOvNBKPBVBBXQo14Vl766Mgb2WDem4HHgG1KVv66nQQpYRjG803JfF0fL2Vs3JdYQe9DJv7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=Y4XuQC+bQjDsbbpmrjq4JrPHpUlshQfEG3amK5TzFJw=; b=Pm15KIRPFiNRW667atcG9uuAf5EIZ3OVCLoL54jRGmAWPpg38wZiXvOHFKfFZsXM+zQm7OCboO1UEXpHWsGXOAgoU1FotzH1L6NU16QZ5p8vqGxNITIgufPoe1h3TGdgQHB+BiZ8b5IOZ5P1iTY86XoxcXYO3E5g8IcIGxqRHexRz4v08ImcVwitMuTKJ2xkqmtYABsmfbcjmCh73+zupy/6RbrerrC0RDcdUjgK8iBo7MFejliPqqX8qL3aeTzEaGpqApOIryihKyItkhUfsWoqbIhmOyXtScjguoDlm8XoReuvJYT+65HnBY0arHZyJn96OZCwsvMJiRHSLLdsfA== Received: from BY3PR04CA0009.namprd04.prod.outlook.com (2603:10b6:a03:217::14) by PH7PR12MB7188.namprd12.prod.outlook.com (2603:10b6:510:204::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:32 +0000 Received: from SJ1PEPF00001CE3.namprd05.prod.outlook.com (2603:10b6:a03:217:cafe::aa) by BY3PR04CA0009.outlook.office365.com (2603:10b6:a03:217::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 20:54:32 +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 SJ1PEPF00001CE3.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:31 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:18 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:17 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:14 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 06/15] net/mlx5: Introduce node struct and rename group terminology to node Date: Mon, 14 Oct 2024 23:52:51 +0300 Message-ID: <20241014205300.193519-7-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE3:EE_|PH7PR12MB7188:EE_ X-MS-Office365-Filtering-Correlation-Id: f9506183-af77-497c-9cad-08dcec926715 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: tV2yxPjhJOqOu8t7Ddwt1zsJ177Sgac+cw4peH4KZFxf5l3BjBLOnl0nXIbTLU3H2LQ0zQ7sZaHSbY0oznylaUIe1GKPvyuI+KGep4VP806NhQ6vvSkD+qBRAf9gUzQ/JQ9ULushd/2sK9lgVGNXMZ9LbcSG5BKfntxvAtDUeTavapqzK1u+n2Gef7+OWhfexF0/ofnzDFa/3rZqdjuECgd6z2j0FVRMu4FCP4118F2TV6AMjDML6s8Mwg2rky6Xu2evtRUoEBe/FCMnzW0rSAJdsIDmD3s8OlX3lMtoho1cAhAeE0K8YUcj0ix74LPqfmtHfhXq2p8keW4iAYTHPuqhNA/dLsvan3qsoe6fGreaFaoYYHlSLtP/y2ysPkZ+I0HhORfUUFdfPTzBb5z/OMkuiUmOs9yfQChNJVoxr4+Vj0xaboxmNJOC1ha+ZzQOOHZ5KeR4BXvaEsQTjHE6nrQclhu+ViEWPFi3rsSfd+1XYOnPcQa46sQ2Hvo++v1VwE6V9Xn7Rix0eKUFMC+ctW2LA8H8LeGNWkwLSoUfg7vO3PXnB7WkdQ13kL6NNzNk/8YoF1Wfr2FuBg/Q+8xDIlfvh1ZREIO/y9udTn41zBR9sM6Vnfs/nNJEUAUnHKNQFc4auP/GBKh7V4RZgMa8G4uKQRUaL9JwO0HBoekPrkLzjbR/+Vqk6RZj1wYPRtG2WysF7fg4OYX3a7kRH9NHxV5+q45w/y0yuoSCHmkhfIbPzZwGKK4BhMG4FslTY0AHCqwqmktvjN02RpoyBtV2tPprcMWZ0djGUrfdq4+ZiPpum6XGHOOcgS9wFrrOgH+LsHAYkd20cI98rqdBWs3ggNXp63V6iFvMsJPhnNubix7tO72dFiZCSAe9vpZ8ImsCOEwYPg99HlZypHIqdjjFaZDblyiaWmOyxIdhsQFdQ36C6+B8cbsOfGsbmfpMJxqd9fU2JWTp0xUg+B5AYExFJVD2PvOsLspkN0D6qKwu7MT1rXVca2wpN9XuJO4Xd1razChaXJgmq4BvawlgkU3aOE8AJY906y9+xbz3pNrUGLxKl0uG79sF7cDdkLIMLCo8ScjVRPuH8g5kFW8hZteoBRxHzzlGLS1KjVRqx5+KgUjXePhPXL855rVZ3cePE1BQSiI5MKT55ZUhDuK5bQZ7iC8amCgqtW1T3/1TLQwi8ac8iH5g/2gcYimPcN66EmgF5C8n8xETNcNNP+wD+c+X5KLubEvGFDyuPDvW1J2XEda5j7yRy0t/olre0RY6fcksEeRaK/hK2cAP/iZPcfZkw0H1HFliHxuYZ+3Wu2UIe9RQuoZ+Gs56hoVlB0VPCkEyb2adqjX3mAvlDLrmOWRx/KDv/7ScwW+Zy2XAHGT+e+Y= 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:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:31.7367 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9506183-af77-497c-9cad-08dcec926715 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: SJ1PEPF00001CE3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7188 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Introduce the `mlx5_esw_sched_node` struct, consolidating all rate hierarchy related details, including membership and scheduling parameters. Since the group concept aligns with the `mlx5_esw_sched_node`, replace the `mlx5_esw_rate_group` struct with it and rename the "group" terminology to "node" throughout the rate hierarchy. All relevant code paths and structures have been updated to use the "node" terminology accordingly, laying the groundwork for future patches that will unify the handling of different types of members within the rate hierarchy. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../mellanox/mlx5/core/esw/devlink_port.c | 2 +- .../mlx5/core/esw/diag/qos_tracepoint.h | 40 +- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 374 +++++++++--------- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 16 +- 4 files changed, 217 insertions(+), 215 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c index 86af1891395f..d0f38818363f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c @@ -195,7 +195,7 @@ void mlx5_esw_offloads_devlink_port_unregister(struct mlx5_vport *vport) return; dl_port = vport->dl_port; - mlx5_esw_qos_vport_update_group(vport, NULL, NULL); + mlx5_esw_qos_vport_update_node(vport, NULL, NULL); devl_rate_leaf_destroy(&dl_port->dl_port); devl_port_unregister(&dl_port->dl_port); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h index 2aea01959073..0b50ef0871f2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h @@ -62,57 +62,57 @@ DEFINE_EVENT(mlx5_esw_vport_qos_template, mlx5_esw_vport_qos_config, TP_ARGS(dev, vport, bw_share, max_rate) ); -DECLARE_EVENT_CLASS(mlx5_esw_group_qos_template, +DECLARE_EVENT_CLASS(mlx5_esw_node_qos_template, TP_PROTO(const struct mlx5_core_dev *dev, - const struct mlx5_esw_rate_group *group, + const struct mlx5_esw_sched_node *node, unsigned int tsar_ix), - TP_ARGS(dev, group, tsar_ix), + TP_ARGS(dev, node, tsar_ix), TP_STRUCT__entry(__string(devname, dev_name(dev->device)) - __field(const void *, group) + __field(const void *, node) __field(unsigned int, tsar_ix) ), TP_fast_assign(__assign_str(devname); - __entry->group = group; + __entry->node = node; __entry->tsar_ix = tsar_ix; ), - TP_printk("(%s) group=%p tsar_ix=%u\n", - __get_str(devname), __entry->group, __entry->tsar_ix + TP_printk("(%s) node=%p tsar_ix=%u\n", + __get_str(devname), __entry->node, __entry->tsar_ix ) ); -DEFINE_EVENT(mlx5_esw_group_qos_template, mlx5_esw_group_qos_create, +DEFINE_EVENT(mlx5_esw_node_qos_template, mlx5_esw_node_qos_create, TP_PROTO(const struct mlx5_core_dev *dev, - const struct mlx5_esw_rate_group *group, + const struct mlx5_esw_sched_node *node, unsigned int tsar_ix), - TP_ARGS(dev, group, tsar_ix) + TP_ARGS(dev, node, tsar_ix) ); -DEFINE_EVENT(mlx5_esw_group_qos_template, mlx5_esw_group_qos_destroy, +DEFINE_EVENT(mlx5_esw_node_qos_template, mlx5_esw_node_qos_destroy, TP_PROTO(const struct mlx5_core_dev *dev, - const struct mlx5_esw_rate_group *group, + const struct mlx5_esw_sched_node *node, unsigned int tsar_ix), - TP_ARGS(dev, group, tsar_ix) + TP_ARGS(dev, node, tsar_ix) ); -TRACE_EVENT(mlx5_esw_group_qos_config, +TRACE_EVENT(mlx5_esw_node_qos_config, TP_PROTO(const struct mlx5_core_dev *dev, - const struct mlx5_esw_rate_group *group, + const struct mlx5_esw_sched_node *node, unsigned int tsar_ix, u32 bw_share, u32 max_rate), - TP_ARGS(dev, group, tsar_ix, bw_share, max_rate), + TP_ARGS(dev, node, tsar_ix, bw_share, max_rate), TP_STRUCT__entry(__string(devname, dev_name(dev->device)) - __field(const void *, group) + __field(const void *, node) __field(unsigned int, tsar_ix) __field(unsigned int, bw_share) __field(unsigned int, max_rate) ), TP_fast_assign(__assign_str(devname); - __entry->group = group; + __entry->node = node; __entry->tsar_ix = tsar_ix; __entry->bw_share = bw_share; __entry->max_rate = max_rate; ), - TP_printk("(%s) group=%p tsar_ix=%u bw_share=%u max_rate=%u\n", - __get_str(devname), __entry->group, __entry->tsar_ix, + TP_printk("(%s) node=%p tsar_ix=%u bw_share=%u max_rate=%u\n", + __get_str(devname), __entry->node, __entry->tsar_ix, __entry->bw_share, __entry->max_rate ) ); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index 837c4dda814d..840568c66a1a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -11,12 +11,12 @@ /* Minimum supported BW share value by the HW is 1 Mbit/sec */ #define MLX5_MIN_BW_SHARE 1 -/* Holds rate groups associated with an E-Switch. */ +/* Holds rate nodes associated with an E-Switch. */ struct mlx5_qos_domain { /* Serializes access to all qos changes in the qos domain. */ struct mutex lock; - /* List of all mlx5_esw_rate_groups. */ - struct list_head groups; + /* List of all mlx5_esw_sched_nodes. */ + struct list_head nodes; }; static void esw_qos_lock(struct mlx5_eswitch *esw) @@ -43,7 +43,7 @@ static struct mlx5_qos_domain *esw_qos_domain_alloc(void) return NULL; mutex_init(&qos_domain->lock); - INIT_LIST_HEAD(&qos_domain->groups); + INIT_LIST_HEAD(&qos_domain->nodes); return qos_domain; } @@ -65,30 +65,30 @@ enum sched_node_type { SCHED_NODE_TYPE_VPORTS_TSAR, }; -struct mlx5_esw_rate_group { - u32 tsar_ix; +struct mlx5_esw_sched_node { + u32 ix; /* Bandwidth parameters. */ u32 max_rate; u32 min_rate; - /* A computed value indicating relative min_rate between group members. */ + /* A computed value indicating relative min_rate between node's children. */ u32 bw_share; - /* The parent group of this group. */ - struct mlx5_esw_rate_group *parent; - /* Membership in the parent list. */ - struct list_head parent_entry; - /* The type of this group node in the rate hierarchy. */ + /* The parent node in the rate hierarchy. */ + struct mlx5_esw_sched_node *parent; + /* Entry in the parent node's children list. */ + struct list_head entry; + /* The type of this node in the rate hierarchy. */ enum sched_node_type type; - /* The eswitch this group belongs to. */ + /* The eswitch this node belongs to. */ struct mlx5_eswitch *esw; - /* Members of this group.*/ - struct list_head members; + /* The children nodes of this node, empty list for leaf nodes. */ + struct list_head children; }; -static void esw_qos_vport_set_parent(struct mlx5_vport *vport, struct mlx5_esw_rate_group *parent) +static void esw_qos_vport_set_parent(struct mlx5_vport *vport, struct mlx5_esw_sched_node *parent) { list_del_init(&vport->qos.parent_entry); vport->qos.parent = parent; - list_add_tail(&vport->qos.parent_entry, &parent->members); + list_add_tail(&vport->qos.parent_entry, &parent->children); } static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_ix, @@ -112,17 +112,17 @@ static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_i bitmask); } -static int esw_qos_group_config(struct mlx5_esw_rate_group *group, - u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack) +static int esw_qos_node_config(struct mlx5_esw_sched_node *node, + u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack) { - struct mlx5_core_dev *dev = group->esw->dev; + struct mlx5_core_dev *dev = node->esw->dev; int err; - err = esw_qos_sched_elem_config(dev, group->tsar_ix, max_rate, bw_share); + err = esw_qos_sched_elem_config(dev, node->ix, max_rate, bw_share); if (err) - NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed"); + NL_SET_ERR_MSG_MOD(extack, "E-Switch modify node TSAR element failed"); - trace_mlx5_esw_group_qos_config(dev, group, group->tsar_ix, bw_share, max_rate); + trace_mlx5_esw_node_qos_config(dev, node, node->ix, bw_share, max_rate); return err; } @@ -148,16 +148,16 @@ static int esw_qos_vport_config(struct mlx5_vport *vport, return 0; } -static u32 esw_qos_calculate_group_min_rate_divider(struct mlx5_esw_rate_group *group) +static u32 esw_qos_calculate_node_min_rate_divider(struct mlx5_esw_sched_node *node) { - u32 fw_max_bw_share = MLX5_CAP_QOS(group->esw->dev, max_tsar_bw_share); + u32 fw_max_bw_share = MLX5_CAP_QOS(node->esw->dev, max_tsar_bw_share); struct mlx5_vport *vport; u32 max_guarantee = 0; - /* Find max min_rate across all vports in this group. + /* Find max min_rate across all vports in this node. * This will correspond to fw_max_bw_share in the final bw_share calculation. */ - list_for_each_entry(vport, &group->members, qos.parent_entry) { + list_for_each_entry(vport, &node->children, qos.parent_entry) { if (vport->qos.min_rate > max_guarantee) max_guarantee = vport->qos.min_rate; } @@ -165,13 +165,13 @@ static u32 esw_qos_calculate_group_min_rate_divider(struct mlx5_esw_rate_group * if (max_guarantee) return max_t(u32, max_guarantee / fw_max_bw_share, 1); - /* If vports max min_rate divider is 0 but their group has bw_share + /* If vports max min_rate divider is 0 but their node has bw_share * configured, then set bw_share for vports to minimal value. */ - if (group->bw_share) + if (node->bw_share) return 1; - /* A divider of 0 sets bw_share for all group vports to 0, + /* A divider of 0 sets bw_share for all node vports to 0, * effectively disabling min guarantees. */ return 0; @@ -180,23 +180,23 @@ static u32 esw_qos_calculate_group_min_rate_divider(struct mlx5_esw_rate_group * static u32 esw_qos_calculate_min_rate_divider(struct mlx5_eswitch *esw) { u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share); - struct mlx5_esw_rate_group *group; + struct mlx5_esw_sched_node *node; u32 max_guarantee = 0; - /* Find max min_rate across all esw groups. + /* Find max min_rate across all esw nodes. * This will correspond to fw_max_bw_share in the final bw_share calculation. */ - list_for_each_entry(group, &esw->qos.domain->groups, parent_entry) { - if (group->esw == esw && group->tsar_ix != esw->qos.root_tsar_ix && - group->min_rate > max_guarantee) - max_guarantee = group->min_rate; + list_for_each_entry(node, &esw->qos.domain->nodes, entry) { + if (node->esw == esw && node->ix != esw->qos.root_tsar_ix && + node->min_rate > max_guarantee) + max_guarantee = node->min_rate; } if (max_guarantee) return max_t(u32, max_guarantee / fw_max_bw_share, 1); - /* If no group has min_rate configured, a divider of 0 sets all - * groups' bw_share to 0, effectively disabling min guarantees. + /* If no node has min_rate configured, a divider of 0 sets all + * nodes' bw_share to 0, effectively disabling min guarantees. */ return 0; } @@ -208,16 +208,16 @@ static u32 esw_qos_calc_bw_share(u32 min_rate, u32 divider, u32 fw_max) return min_t(u32, max_t(u32, DIV_ROUND_UP(min_rate, divider), MLX5_MIN_BW_SHARE), fw_max); } -static int esw_qos_normalize_group_min_rate(struct mlx5_esw_rate_group *group, - struct netlink_ext_ack *extack) +static int esw_qos_normalize_node_min_rate(struct mlx5_esw_sched_node *node, + struct netlink_ext_ack *extack) { - u32 fw_max_bw_share = MLX5_CAP_QOS(group->esw->dev, max_tsar_bw_share); - u32 divider = esw_qos_calculate_group_min_rate_divider(group); + u32 fw_max_bw_share = MLX5_CAP_QOS(node->esw->dev, max_tsar_bw_share); + u32 divider = esw_qos_calculate_node_min_rate_divider(node); struct mlx5_vport *vport; u32 bw_share; int err; - list_for_each_entry(vport, &group->members, qos.parent_entry) { + list_for_each_entry(vport, &node->children, qos.parent_entry) { bw_share = esw_qos_calc_bw_share(vport->qos.min_rate, divider, fw_max_bw_share); if (bw_share == vport->qos.bw_share) @@ -237,28 +237,29 @@ static int esw_qos_normalize_min_rate(struct mlx5_eswitch *esw, struct netlink_e { u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share); u32 divider = esw_qos_calculate_min_rate_divider(esw); - struct mlx5_esw_rate_group *group; + struct mlx5_esw_sched_node *node; u32 bw_share; int err; - list_for_each_entry(group, &esw->qos.domain->groups, parent_entry) { - if (group->esw != esw || group->tsar_ix == esw->qos.root_tsar_ix) + list_for_each_entry(node, &esw->qos.domain->nodes, entry) { + if (node->esw != esw || node->ix == esw->qos.root_tsar_ix) continue; - bw_share = esw_qos_calc_bw_share(group->min_rate, divider, fw_max_bw_share); + bw_share = esw_qos_calc_bw_share(node->min_rate, divider, + fw_max_bw_share); - if (bw_share == group->bw_share) + if (bw_share == node->bw_share) continue; - err = esw_qos_group_config(group, group->max_rate, bw_share, extack); + err = esw_qos_node_config(node, node->max_rate, bw_share, extack); if (err) return err; - group->bw_share = bw_share; + node->bw_share = bw_share; - /* All the group's vports need to be set with default bw_share + /* All the node's vports need to be set with default bw_share * to enable them with QOS */ - err = esw_qos_normalize_group_min_rate(group, extack); + err = esw_qos_normalize_node_min_rate(node, extack); if (err) return err; @@ -286,7 +287,7 @@ static int esw_qos_set_vport_min_rate(struct mlx5_vport *vport, previous_min_rate = vport->qos.min_rate; vport->qos.min_rate = min_rate; - err = esw_qos_normalize_group_min_rate(vport->qos.parent, extack); + err = esw_qos_normalize_node_min_rate(vport->qos.parent, extack); if (err) vport->qos.min_rate = previous_min_rate; @@ -309,7 +310,7 @@ static int esw_qos_set_vport_max_rate(struct mlx5_vport *vport, if (max_rate == vport->qos.max_rate) return 0; - /* Use parent group limit if new max rate is 0. */ + /* Use parent node limit if new max rate is 0. */ if (!max_rate) act_max_rate = vport->qos.parent->max_rate; @@ -321,10 +322,10 @@ static int esw_qos_set_vport_max_rate(struct mlx5_vport *vport, return err; } -static int esw_qos_set_group_min_rate(struct mlx5_esw_rate_group *group, - u32 min_rate, struct netlink_ext_ack *extack) +static int esw_qos_set_node_min_rate(struct mlx5_esw_sched_node *node, + u32 min_rate, struct netlink_ext_ack *extack) { - struct mlx5_eswitch *esw = group->esw; + struct mlx5_eswitch *esw = node->esw; u32 previous_min_rate; int err; @@ -332,17 +333,17 @@ static int esw_qos_set_group_min_rate(struct mlx5_esw_rate_group *group, MLX5_CAP_QOS(esw->dev, max_tsar_bw_share) < MLX5_MIN_BW_SHARE) return -EOPNOTSUPP; - if (min_rate == group->min_rate) + if (min_rate == node->min_rate) return 0; - previous_min_rate = group->min_rate; - group->min_rate = min_rate; + previous_min_rate = node->min_rate; + node->min_rate = min_rate; err = esw_qos_normalize_min_rate(esw, extack); if (err) { - NL_SET_ERR_MSG_MOD(extack, "E-Switch group min rate setting failed"); + NL_SET_ERR_MSG_MOD(extack, "E-Switch node min rate setting failed"); /* Attempt restoring previous configuration */ - group->min_rate = previous_min_rate; + node->min_rate = previous_min_rate; if (esw_qos_normalize_min_rate(esw, extack)) NL_SET_ERR_MSG_MOD(extack, "E-Switch BW share restore failed"); } @@ -350,23 +351,23 @@ static int esw_qos_set_group_min_rate(struct mlx5_esw_rate_group *group, return err; } -static int esw_qos_set_group_max_rate(struct mlx5_esw_rate_group *group, - u32 max_rate, struct netlink_ext_ack *extack) +static int esw_qos_set_node_max_rate(struct mlx5_esw_sched_node *node, + u32 max_rate, struct netlink_ext_ack *extack) { struct mlx5_vport *vport; int err; - if (group->max_rate == max_rate) + if (node->max_rate == max_rate) return 0; - err = esw_qos_group_config(group, max_rate, group->bw_share, extack); + err = esw_qos_node_config(node, max_rate, node->bw_share, extack); if (err) return err; - group->max_rate = max_rate; + node->max_rate = max_rate; - /* Any unlimited vports in the group should be set with the value of the group. */ - list_for_each_entry(vport, &group->members, qos.parent_entry) { + /* Any unlimited vports in the node should be set with the value of the node. */ + list_for_each_entry(vport, &node->children, qos.parent_entry) { if (vport->qos.max_rate) continue; @@ -379,8 +380,8 @@ static int esw_qos_set_group_max_rate(struct mlx5_esw_rate_group *group, return err; } -static int esw_qos_create_group_sched_elem(struct mlx5_core_dev *dev, u32 parent_element_id, - u32 *tsar_ix) +static int esw_qos_create_node_sched_elem(struct mlx5_core_dev *dev, u32 parent_element_id, + u32 *tsar_ix) { u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; void *attr; @@ -409,7 +410,7 @@ static int esw_qos_create_group_sched_elem(struct mlx5_core_dev *dev, u32 parent static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, u32 max_rate, u32 bw_share) { - struct mlx5_esw_rate_group *parent = vport->qos.parent; + struct mlx5_esw_sched_node *parent = vport->qos.parent; u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; struct mlx5_core_dev *dev = parent->esw->dev; void *attr; @@ -424,7 +425,7 @@ static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT); attr = MLX5_ADDR_OF(scheduling_context, sched_ctx, element_attributes); MLX5_SET(vport_element, attr, vport_number, vport->vport); - MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent->tsar_ix); + MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent->ix); MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate); MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share); @@ -442,15 +443,15 @@ static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, return 0; } -static int esw_qos_update_group_scheduling_element(struct mlx5_vport *vport, - struct mlx5_esw_rate_group *curr_group, - struct mlx5_esw_rate_group *new_group, - struct netlink_ext_ack *extack) +static int esw_qos_update_node_scheduling_element(struct mlx5_vport *vport, + struct mlx5_esw_sched_node *curr_node, + struct mlx5_esw_sched_node *new_node, + struct netlink_ext_ack *extack) { u32 max_rate; int err; - err = mlx5_destroy_scheduling_element_cmd(curr_group->esw->dev, + err = mlx5_destroy_scheduling_element_cmd(curr_node->esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, vport->qos.esw_sched_elem_ix); if (err) { @@ -458,129 +459,129 @@ static int esw_qos_update_group_scheduling_element(struct mlx5_vport *vport, return err; } - esw_qos_vport_set_parent(vport, new_group); - /* Use new group max rate if vport max rate is unlimited. */ - max_rate = vport->qos.max_rate ? vport->qos.max_rate : new_group->max_rate; + esw_qos_vport_set_parent(vport, new_node); + /* Use new node max rate if vport max rate is unlimited. */ + max_rate = vport->qos.max_rate ? vport->qos.max_rate : new_node->max_rate; err = esw_qos_vport_create_sched_element(vport, max_rate, vport->qos.bw_share); if (err) { - NL_SET_ERR_MSG_MOD(extack, "E-Switch vport group set failed."); + NL_SET_ERR_MSG_MOD(extack, "E-Switch vport node set failed."); goto err_sched; } return 0; err_sched: - esw_qos_vport_set_parent(vport, curr_group); - max_rate = vport->qos.max_rate ? vport->qos.max_rate : curr_group->max_rate; + esw_qos_vport_set_parent(vport, curr_node); + max_rate = vport->qos.max_rate ? vport->qos.max_rate : curr_node->max_rate; if (esw_qos_vport_create_sched_element(vport, max_rate, vport->qos.bw_share)) - esw_warn(curr_group->esw->dev, "E-Switch vport group restore failed (vport=%d)\n", + esw_warn(curr_node->esw->dev, "E-Switch vport node restore failed (vport=%d)\n", vport->vport); return err; } -static int esw_qos_vport_update_group(struct mlx5_vport *vport, - struct mlx5_esw_rate_group *group, - struct netlink_ext_ack *extack) +static int esw_qos_vport_update_node(struct mlx5_vport *vport, + struct mlx5_esw_sched_node *node, + struct netlink_ext_ack *extack) { struct mlx5_eswitch *esw = vport->dev->priv.eswitch; - struct mlx5_esw_rate_group *new_group, *curr_group; + struct mlx5_esw_sched_node *new_node, *curr_node; int err; esw_assert_qos_lock_held(esw); - curr_group = vport->qos.parent; - new_group = group ?: esw->qos.group0; - if (curr_group == new_group) + curr_node = vport->qos.parent; + new_node = node ?: esw->qos.node0; + if (curr_node == new_node) return 0; - err = esw_qos_update_group_scheduling_element(vport, curr_group, new_group, extack); + err = esw_qos_update_node_scheduling_element(vport, curr_node, new_node, extack); if (err) return err; - /* Recalculate bw share weights of old and new groups */ - if (vport->qos.bw_share || new_group->bw_share) { - esw_qos_normalize_group_min_rate(curr_group, extack); - esw_qos_normalize_group_min_rate(new_group, extack); + /* Recalculate bw share weights of old and new nodes */ + if (vport->qos.bw_share || new_node->bw_share) { + esw_qos_normalize_node_min_rate(curr_node, extack); + esw_qos_normalize_node_min_rate(new_node, extack); } return 0; } -static struct mlx5_esw_rate_group * -__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type, - struct mlx5_esw_rate_group *parent) +static struct mlx5_esw_sched_node * +__esw_qos_alloc_node(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type, + struct mlx5_esw_sched_node *parent) { - struct mlx5_esw_rate_group *group; - struct list_head *parent_list; + struct list_head *parent_children; + struct mlx5_esw_sched_node *node; - group = kzalloc(sizeof(*group), GFP_KERNEL); - if (!group) + node = kzalloc(sizeof(*node), GFP_KERNEL); + if (!node) return NULL; - group->esw = esw; - group->tsar_ix = tsar_ix; - group->type = type; - group->parent = parent; - INIT_LIST_HEAD(&group->members); - parent_list = parent ? &parent->members : &esw->qos.domain->groups; - list_add_tail(&group->parent_entry, parent_list); + node->esw = esw; + node->ix = tsar_ix; + node->type = type; + node->parent = parent; + INIT_LIST_HEAD(&node->children); + parent_children = parent ? &parent->children : &esw->qos.domain->nodes; + list_add_tail(&node->entry, parent_children); - return group; + return node; } -static void __esw_qos_free_rate_group(struct mlx5_esw_rate_group *group) +static void __esw_qos_free_node(struct mlx5_esw_sched_node *node) { - list_del(&group->parent_entry); - kfree(group); + list_del(&node->entry); + kfree(node); } -static struct mlx5_esw_rate_group * -__esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct mlx5_esw_rate_group *parent, +static struct mlx5_esw_sched_node * +__esw_qos_create_vports_sched_node(struct mlx5_eswitch *esw, struct mlx5_esw_sched_node *parent, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group; + struct mlx5_esw_sched_node *node; u32 tsar_ix; int err; - err = esw_qos_create_group_sched_elem(esw->dev, esw->qos.root_tsar_ix, &tsar_ix); + err = esw_qos_create_node_sched_elem(esw->dev, esw->qos.root_tsar_ix, &tsar_ix); if (err) { - NL_SET_ERR_MSG_MOD(extack, "E-Switch create TSAR for group failed"); + NL_SET_ERR_MSG_MOD(extack, "E-Switch create TSAR for node failed"); return ERR_PTR(err); } - group = __esw_qos_alloc_rate_group(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR, parent); - if (!group) { - NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc group failed"); + node = __esw_qos_alloc_node(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR, parent); + if (!node) { + NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc node failed"); err = -ENOMEM; - goto err_alloc_group; + goto err_alloc_node; } err = esw_qos_normalize_min_rate(esw, extack); if (err) { - NL_SET_ERR_MSG_MOD(extack, "E-Switch groups normalization failed"); + NL_SET_ERR_MSG_MOD(extack, "E-Switch nodes normalization failed"); goto err_min_rate; } - trace_mlx5_esw_group_qos_create(esw->dev, group, group->tsar_ix); + trace_mlx5_esw_node_qos_create(esw->dev, node, node->ix); - return group; + return node; err_min_rate: - __esw_qos_free_rate_group(group); -err_alloc_group: + __esw_qos_free_node(node); +err_alloc_node: if (mlx5_destroy_scheduling_element_cmd(esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, tsar_ix)) - NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR for group failed"); + NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR for node failed"); return ERR_PTR(err); } static int esw_qos_get(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack); static void esw_qos_put(struct mlx5_eswitch *esw); -static struct mlx5_esw_rate_group * -esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) +static struct mlx5_esw_sched_node * +esw_qos_create_vports_sched_node(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group; + struct mlx5_esw_sched_node *node; int err; esw_assert_qos_lock_held(esw); @@ -591,31 +592,30 @@ esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ac if (err) return ERR_PTR(err); - group = __esw_qos_create_vports_rate_group(esw, NULL, extack); - if (IS_ERR(group)) + node = __esw_qos_create_vports_sched_node(esw, NULL, extack); + if (IS_ERR(node)) esw_qos_put(esw); - return group; + return node; } -static int __esw_qos_destroy_rate_group(struct mlx5_esw_rate_group *group, - struct netlink_ext_ack *extack) +static int __esw_qos_destroy_node(struct mlx5_esw_sched_node *node, struct netlink_ext_ack *extack) { - struct mlx5_eswitch *esw = group->esw; + struct mlx5_eswitch *esw = node->esw; int err; - trace_mlx5_esw_group_qos_destroy(esw->dev, group, group->tsar_ix); + trace_mlx5_esw_node_qos_destroy(esw->dev, node, node->ix); err = mlx5_destroy_scheduling_element_cmd(esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, - group->tsar_ix); + node->ix); if (err) NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR_ID failed"); - __esw_qos_free_rate_group(group); + __esw_qos_free_node(node); err = esw_qos_normalize_min_rate(esw, extack); if (err) - NL_SET_ERR_MSG_MOD(extack, "E-Switch groups normalization failed"); + NL_SET_ERR_MSG_MOD(extack, "E-Switch nodes normalization failed"); return err; @@ -629,32 +629,34 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) return -EOPNOTSUPP; - err = esw_qos_create_group_sched_elem(esw->dev, 0, &esw->qos.root_tsar_ix); + err = esw_qos_create_node_sched_elem(esw->dev, 0, &esw->qos.root_tsar_ix); if (err) { esw_warn(dev, "E-Switch create root TSAR failed (%d)\n", err); return err; } if (MLX5_CAP_QOS(dev, log_esw_max_sched_depth)) { - esw->qos.group0 = __esw_qos_create_vports_rate_group(esw, NULL, extack); + esw->qos.node0 = __esw_qos_create_vports_sched_node(esw, NULL, extack); } else { - /* The eswitch doesn't support scheduling groups. - * Create a software-only group0 using the root TSAR to attach vport QoS to. + /* The eswitch doesn't support scheduling nodes. + * Create a software-only node0 using the root TSAR to attach vport QoS to. */ - if (!__esw_qos_alloc_rate_group(esw, esw->qos.root_tsar_ix, - SCHED_NODE_TYPE_VPORTS_TSAR, NULL)) - esw->qos.group0 = ERR_PTR(-ENOMEM); + if (!__esw_qos_alloc_node(esw, + esw->qos.root_tsar_ix, + SCHED_NODE_TYPE_VPORTS_TSAR, + NULL)) + esw->qos.node0 = ERR_PTR(-ENOMEM); } - if (IS_ERR(esw->qos.group0)) { - err = PTR_ERR(esw->qos.group0); - esw_warn(dev, "E-Switch create rate group 0 failed (%d)\n", err); - goto err_group0; + if (IS_ERR(esw->qos.node0)) { + err = PTR_ERR(esw->qos.node0); + esw_warn(dev, "E-Switch create rate node 0 failed (%d)\n", err); + goto err_node0; } refcount_set(&esw->qos.refcnt, 1); return 0; -err_group0: +err_node0: if (mlx5_destroy_scheduling_element_cmd(esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, esw->qos.root_tsar_ix)) esw_warn(esw->dev, "E-Switch destroy root TSAR failed.\n"); @@ -666,11 +668,11 @@ static void esw_qos_destroy(struct mlx5_eswitch *esw) { int err; - if (esw->qos.group0->tsar_ix != esw->qos.root_tsar_ix) - __esw_qos_destroy_rate_group(esw->qos.group0, NULL); + if (esw->qos.node0->ix != esw->qos.root_tsar_ix) + __esw_qos_destroy_node(esw->qos.node0, NULL); else - __esw_qos_free_rate_group(esw->qos.group0); - esw->qos.group0 = NULL; + __esw_qos_free_node(esw->qos.node0); + esw->qos.node0 = NULL; err = mlx5_destroy_scheduling_element_cmd(esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, @@ -716,7 +718,7 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, return err; INIT_LIST_HEAD(&vport->qos.parent_entry); - esw_qos_vport_set_parent(vport, esw->qos.group0); + esw_qos_vport_set_parent(vport, esw->qos.node0); err = esw_qos_vport_create_sched_element(vport, max_rate, bw_share); if (err) @@ -743,8 +745,8 @@ void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) esw_qos_lock(esw); if (!vport->qos.enabled) goto unlock; - WARN(vport->qos.parent != esw->qos.group0, - "Disabling QoS on port before detaching it from group"); + WARN(vport->qos.parent != esw->qos.node0, + "Disabling QoS on port before detaching it from node"); dev = vport->qos.parent->esw->dev; err = mlx5_destroy_scheduling_element_cmd(dev, @@ -1004,8 +1006,8 @@ int mlx5_esw_devlink_rate_leaf_tx_max_set(struct devlink_rate *rate_leaf, void * int mlx5_esw_devlink_rate_node_tx_share_set(struct devlink_rate *rate_node, void *priv, u64 tx_share, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group = priv; - struct mlx5_eswitch *esw = group->esw; + struct mlx5_esw_sched_node *node = priv; + struct mlx5_eswitch *esw = node->esw; int err; err = esw_qos_devlink_rate_to_mbps(esw->dev, "tx_share", &tx_share, extack); @@ -1013,7 +1015,7 @@ int mlx5_esw_devlink_rate_node_tx_share_set(struct devlink_rate *rate_node, void return err; esw_qos_lock(esw); - err = esw_qos_set_group_min_rate(group, tx_share, extack); + err = esw_qos_set_node_min_rate(node, tx_share, extack); esw_qos_unlock(esw); return err; } @@ -1021,8 +1023,8 @@ int mlx5_esw_devlink_rate_node_tx_share_set(struct devlink_rate *rate_node, void int mlx5_esw_devlink_rate_node_tx_max_set(struct devlink_rate *rate_node, void *priv, u64 tx_max, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group = priv; - struct mlx5_eswitch *esw = group->esw; + struct mlx5_esw_sched_node *node = priv; + struct mlx5_eswitch *esw = node->esw; int err; err = esw_qos_devlink_rate_to_mbps(esw->dev, "tx_max", &tx_max, extack); @@ -1030,7 +1032,7 @@ int mlx5_esw_devlink_rate_node_tx_max_set(struct devlink_rate *rate_node, void * return err; esw_qos_lock(esw); - err = esw_qos_set_group_max_rate(group, tx_max, extack); + err = esw_qos_set_node_max_rate(node, tx_max, extack); esw_qos_unlock(esw); return err; } @@ -1038,7 +1040,7 @@ int mlx5_esw_devlink_rate_node_tx_max_set(struct devlink_rate *rate_node, void * int mlx5_esw_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group; + struct mlx5_esw_sched_node *node; struct mlx5_eswitch *esw; int err = 0; @@ -1054,13 +1056,13 @@ int mlx5_esw_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv, goto unlock; } - group = esw_qos_create_vports_rate_group(esw, extack); - if (IS_ERR(group)) { - err = PTR_ERR(group); + node = esw_qos_create_vports_sched_node(esw, extack); + if (IS_ERR(node)) { + err = PTR_ERR(node); goto unlock; } - *priv = group; + *priv = node; unlock: esw_qos_unlock(esw); return err; @@ -1069,36 +1071,36 @@ int mlx5_esw_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv, int mlx5_esw_devlink_rate_node_del(struct devlink_rate *rate_node, void *priv, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group = priv; - struct mlx5_eswitch *esw = group->esw; + struct mlx5_esw_sched_node *node = priv; + struct mlx5_eswitch *esw = node->esw; int err; esw_qos_lock(esw); - err = __esw_qos_destroy_rate_group(group, extack); + err = __esw_qos_destroy_node(node, extack); esw_qos_put(esw); esw_qos_unlock(esw); return err; } -int mlx5_esw_qos_vport_update_group(struct mlx5_vport *vport, - struct mlx5_esw_rate_group *group, - struct netlink_ext_ack *extack) +int mlx5_esw_qos_vport_update_node(struct mlx5_vport *vport, + struct mlx5_esw_sched_node *node, + struct netlink_ext_ack *extack) { struct mlx5_eswitch *esw = vport->dev->priv.eswitch; int err = 0; - if (group && group->esw != esw) { + if (node && node->esw != esw) { NL_SET_ERR_MSG_MOD(extack, "Cross E-Switch scheduling is not supported"); return -EOPNOTSUPP; } esw_qos_lock(esw); - if (!vport->qos.enabled && !group) + if (!vport->qos.enabled && !node) goto unlock; err = esw_qos_vport_enable(vport, 0, 0, extack); if (!err) - err = esw_qos_vport_update_group(vport, group, extack); + err = esw_qos_vport_update_node(vport, node, extack); unlock: esw_qos_unlock(esw); return err; @@ -1109,12 +1111,12 @@ int mlx5_esw_devlink_rate_parent_set(struct devlink_rate *devlink_rate, void *priv, void *parent_priv, struct netlink_ext_ack *extack) { - struct mlx5_esw_rate_group *group; + struct mlx5_esw_sched_node *node; struct mlx5_vport *vport = priv; if (!parent) - return mlx5_esw_qos_vport_update_group(vport, NULL, extack); + return mlx5_esw_qos_vport_update_node(vport, NULL, extack); - group = parent_priv; - return mlx5_esw_qos_vport_update_group(vport, group, extack); + node = parent_priv; + return mlx5_esw_qos_vport_update_node(vport, node, extack); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index e789fb14989b..38f912f5a707 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -222,7 +222,7 @@ struct mlx5_vport { /* A computed value indicating relative min_rate between vports in a group. */ u32 bw_share; /* The parent group of this vport scheduling element. */ - struct mlx5_esw_rate_group *parent; + struct mlx5_esw_sched_node *parent; /* Membership in the parent 'members' list. */ struct list_head parent_entry; } qos; @@ -372,11 +372,11 @@ struct mlx5_eswitch { refcount_t refcnt; u32 root_tsar_ix; struct mlx5_qos_domain *domain; - /* Contains all vports with QoS enabled but no explicit group. - * Cannot be NULL if QoS is enabled, but may be a fake group - * referencing the root TSAR if the esw doesn't support groups. + /* Contains all vports with QoS enabled but no explicit node. + * Cannot be NULL if QoS is enabled, but may be a fake node + * referencing the root TSAR if the esw doesn't support nodes. */ - struct mlx5_esw_rate_group *group0; + struct mlx5_esw_sched_node *node0; } qos; struct mlx5_esw_bridge_offloads *br_offloads; @@ -436,9 +436,9 @@ int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw, u16 vport_num, bool setting); int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport, u32 max_rate, u32 min_rate); -int mlx5_esw_qos_vport_update_group(struct mlx5_vport *vport, - struct mlx5_esw_rate_group *group, - struct netlink_ext_ack *extack); +int mlx5_esw_qos_vport_update_node(struct mlx5_vport *vport, + struct mlx5_esw_sched_node *node, + struct netlink_ext_ack *extack); int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting); int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting); int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw, From patchwork Mon Oct 14 20:52:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835486 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCDD21D5AB8 for ; Mon, 14 Oct 2024 20:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939280; cv=fail; b=B0qa1Ckym4x+DnvDRmKIg2S9Fl5titBChgYPA1LKlC6SRehFll972dYUS699L1F45et1gf0nVLRrQePa6lm1yUGaKt6+zHXfuIJjfdHFuwhcCj6VTSJe8cpr4p+RVTrfFCYe2vHtmJO/SFDDmrYxaDA/H+cbOGEI7XX51duWgPs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939280; c=relaxed/simple; bh=MSWCVyeH9TgNYs5KvbJDVf1fdngaZ3o7bmwFc1BAmwQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WcjVoSVfth1MNL79RyddsEyzdF/5lFsfavYYf6KWVRQ+xgKmm2TU98+5m3KzoN2jPGD8DgvGo4IU2WprmCJNYyWPpX97/y3JX9z2WyT/PzTJqUHc3+KB5HuScAvObF41CjF2rXxK0OJ+ZOtXkZXuDW2rcpOjr/NwWTAgePleUdA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=dNSe78G6; arc=fail smtp.client-ip=40.107.100.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dNSe78G6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pbC2qsNEL3v7d26lwDI3jFBf6qhQ2FcdHAljgbwyG4CafoI84gKtt59gXS4JvlCCZE3no3kIMN/1YzX/Nc9Ew5TlPm1Ybq4BkPpjlc66V5JPqwlBxVTfVyhL1DbiOk7WI/+J8dGK1uN3DfOFHTwUT73hfHva+TQaeAGRlJAH2pB35+YVT69a/erT9D+U5yIhWBPzC84Y3DweNBKPDFdKfQG2Q8LmKquMAksvqoYMIQwuQSDcnhMErOmsDTKKkv17puVv9zEtPqDshNh4Ui0NqRYPPPlFvfJvREw9ObuWcSZclgPKAdsGUj474697rwCe5iXhv/UNY5rU6M+jOWWXLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=raD33nTQ1NeIuENpL4ip3zm3qx/Byd/TA2TsWr/K8eo=; b=lMkP/ufy9DQkGqlbZkb+9JLEOJv4znvHZHI2W/84Jra8JUOQYOEtQMhrvo5uE7xxNGHpfBbDkWJgQtxubccOM2W/fZegi//Ey42OHkzgUBo6p7JLNp50zWkdhbKNVz0n6Xi+ckZFezEgrAavx9cRrNtybn2Ms7KPgjZxwzmTlNad6HPSVq6l3dcpK0TCUKNXy2S8lnrBsFRAPhrOgjKl23jKixcuopfwyDKX+kmBwcd+JJBL27EpkfqnYiyH7Ano+uKpir2Nf6C94clpOtvACLJrfN7n/Zkb4MsTuoQYopqFB8KLvglgZj3nkRT4Yp3X3G1VZwCTnYxuYN3cqAM7XQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=raD33nTQ1NeIuENpL4ip3zm3qx/Byd/TA2TsWr/K8eo=; b=dNSe78G6WdDOnXhB8bNykSI/al1MU9nT+9TgYc5FO0R6zU70J7zSsY3N6BxD11s6BR6iCYUpYkQ0zsWUtwgiIY4ajTLncAy3CtbWV/98fohMawyLBGWOsqTQ+vHcxeBuyJY+QZWuC6CIgjUhXKCBcGs4bbUlSDpH9n3CnKqa4eyHgoe+OdscybeNXN/H4VGsAejIbe2o3Lk5j3R25gMPrRLazgzmQaj/U9zcuRN+OU2BthmvF0YCgYX6zXhNiZM5ma2RzGuRPNwZqBdOz4KzSI97ckiX0jl5MEAnKnc55Gfe3qxkdSo3Cmciu3Pu92s3Jjw1bcgUZXMcXaZ1MyeTWw== Received: from CH5PR03CA0021.namprd03.prod.outlook.com (2603:10b6:610:1f1::15) by MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Mon, 14 Oct 2024 20:54:34 +0000 Received: from CH3PEPF00000012.namprd21.prod.outlook.com (2603:10b6:610:1f1:cafe::17) by CH5PR03CA0021.outlook.office365.com (2603:10b6:610:1f1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 20:54:34 +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 CH3PEPF00000012.mail.protection.outlook.com (10.167.244.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:33 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:21 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:21 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:18 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 07/15] net/mlx5: Refactor vport scheduling element creation function Date: Mon, 14 Oct 2024 23:52:52 +0300 Message-ID: <20241014205300.193519-8-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000012:EE_|MN2PR12MB4373:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bfec468-33dc-40ab-53b3-08dcec926863 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: sfiC1AbB9EC6PaHHHbr5I+FQacXMEVUV0o9pGnxDLMcifoHuFPUAjDj/RotolAHHMFiuRL6GxOH9QXGJB0QxmDNNkCWW4cf6LBKnsrLBMZ4twjK1dAcEI8eT0fnaWRO4wqv/Jbv0upEsV+zoEjU4EGeR6GrwD25yxD7oXWc7ssxmYgASyn9HK6zbRq6j8xjTAm2HC5QsKceZHS0MQIidmlgTXKP++l1E7ZDNMdIFs0W1wqBxsL5B/sSQxpZJaEn61wihFFEiGYee/H4BPdNIA1HT1fySNI/wkVzZGA9eWoB5GPTE6pQmvqPqOTLwcD4QZfe9IMCh6elTvhyxyXiLIXSyxE+RmXSxqpv6UVfVPxx0m1DIIklUi8iZcrm9sw+/AjR1ndiZkpfylcJOG2CFGrlOwKHwG9Hb7Lf6qr3OjVdAhEYoagAo69YSlCfs7ufn6ILZ1Fd2jn9uAqaCrFXAit4FmXeSz+1dF28X7Ajp0kMk365WbBZWk6DCKHqxqwm2qb8SZnwBf2UpbTUzfjel6cyG2exI/e1OntiPhUrrzWPO7OSoHAB4izKTpnzvKKb9W9pqFloWRk9jFXSrRlV6MYbvqx4SHTSVERXrDPlAE8vExTETYhAYJIgwrMUZSsTfQGqab2QKtXPd2HpKoqujWbBppPWi86qXxsxBdOLPf1ZL02qqz7CndAPKI16AHRG+2Bc+XxbwI/RfMPtk1/nBu0jiN477AXfaqIGNuXw+6pFcs/J0zQ9dZqORkRdbtGHoj9F+TcbNIqDJvMWUSn2GJDSTgveJu+JmxOLUMHeaVy/rNXwQVUjQnMD6eg+8j0N8lahBzeFYC/1L0sgmn+bLlUJ0qapAHWrzIBXyJR+filqKem8rtg+bU83f1SHkXtzy2PiNUwPfI8ajhswkJKRJvMtXGme84nLaLZ4R7VbnjoBtCRCuipqIsdXDmUbEqN9wAMq0KIShQYBY2X5FoDCMorHHjL07zBbcL2DqNfzHTpuQWBZG9s8cfAToEBJ6b173kVH+JtPFua4PJMzS39ixQboG5BwqoXIfPzS7UdZcZpAhXYdXxaOxd0mcYEk1fSxVuMZhb2q1uf/F17/DIQMz/I5DiS2yYgDaMe57bGDgs1lUivqpvzf+yWp0XL0fOGq57zxuO2xQZxgn6TxmRAFMtv0w9KM+L5PQYtW/JXOTl+nLSpaWUlexDyKX3R1KEQGsbT7pSw1nB+nc+Odeb03C39gpscapUFBaYqTewc56jvRI8MxKtG6umEQ6hb0UyVcesI83Q16ZJLnzJfvyfY1+EaqjT+0IoaCalCt6PoIJ6tbySW/5mofus8FNUWJ8250x8rRzgSfF0Jv+diIEtc45FUVdEF8hW9XSoPoFZOrO05E= 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:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:33.8925 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bfec468-33dc-40ab-53b3-08dcec926863 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: CH3PEPF00000012.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4373 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Modify the vport scheduling element creation function to get the parent node directly, aligning it with the group creation function. This ensures a consistent flow for scheduling elements creation, as the parent nodes already contain the device and parent element index. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index 840568c66a1a..bcdb745994d2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -407,10 +407,10 @@ static int esw_qos_create_node_sched_elem(struct mlx5_core_dev *dev, u32 parent_ tsar_ix); } -static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, - u32 max_rate, u32 bw_share) +static int +esw_qos_vport_create_sched_element(struct mlx5_vport *vport, struct mlx5_esw_sched_node *parent, + u32 max_rate, u32 bw_share, u32 *sched_elem_ix) { - struct mlx5_esw_sched_node *parent = vport->qos.parent; u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; struct mlx5_core_dev *dev = parent->esw->dev; void *attr; @@ -432,7 +432,7 @@ static int esw_qos_vport_create_sched_element(struct mlx5_vport *vport, err = mlx5_create_scheduling_element_cmd(dev, SCHEDULING_HIERARCHY_E_SWITCH, sched_ctx, - &vport->qos.esw_sched_elem_ix); + sched_elem_ix); if (err) { esw_warn(dev, "E-Switch create vport scheduling element failed (vport=%d,err=%d)\n", @@ -459,21 +459,23 @@ static int esw_qos_update_node_scheduling_element(struct mlx5_vport *vport, return err; } - esw_qos_vport_set_parent(vport, new_node); /* Use new node max rate if vport max rate is unlimited. */ max_rate = vport->qos.max_rate ? vport->qos.max_rate : new_node->max_rate; - err = esw_qos_vport_create_sched_element(vport, max_rate, vport->qos.bw_share); + err = esw_qos_vport_create_sched_element(vport, new_node, max_rate, vport->qos.bw_share, + &vport->qos.esw_sched_elem_ix); if (err) { NL_SET_ERR_MSG_MOD(extack, "E-Switch vport node set failed."); goto err_sched; } + esw_qos_vport_set_parent(vport, new_node); + return 0; err_sched: - esw_qos_vport_set_parent(vport, curr_node); max_rate = vport->qos.max_rate ? vport->qos.max_rate : curr_node->max_rate; - if (esw_qos_vport_create_sched_element(vport, max_rate, vport->qos.bw_share)) + if (esw_qos_vport_create_sched_element(vport, curr_node, max_rate, vport->qos.bw_share, + &vport->qos.esw_sched_elem_ix)) esw_warn(curr_node->esw->dev, "E-Switch vport node restore failed (vport=%d)\n", vport->vport); @@ -717,13 +719,14 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, if (err) return err; - INIT_LIST_HEAD(&vport->qos.parent_entry); - esw_qos_vport_set_parent(vport, esw->qos.node0); - - err = esw_qos_vport_create_sched_element(vport, max_rate, bw_share); + err = esw_qos_vport_create_sched_element(vport, esw->qos.node0, max_rate, bw_share, + &vport->qos.esw_sched_elem_ix); if (err) goto err_out; + INIT_LIST_HEAD(&vport->qos.parent_entry); + esw_qos_vport_set_parent(vport, esw->qos.node0); + vport->qos.enabled = true; trace_mlx5_esw_vport_qos_create(vport->dev, vport, bw_share, max_rate); From patchwork Mon Oct 14 20:52:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835487 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 741031D0BA4 for ; Mon, 14 Oct 2024 20:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939286; cv=fail; b=s9QF0GlCLFP53UXcHEznRTIGSySRKkbtWbYMyrPrvwOf4v6Jl8bh5EQa8GKIs9hq2BCuNqr8qlR5yeaNMGwOxckJw4GWcSpXOEXlPiBOlr5HCnn/2KNE93RlF+anVtS2G78kUx2V6+OdFF+wEBdMqwIaPlEUslSl9lpN3vUTfrY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939286; c=relaxed/simple; bh=iO3n3eCf0wXnvJTRXjp8+S6dm6NSXTEj+bIzWNI6QGY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TwlcSwfM5UaRr9dSLLLX8edXSetjTl7fTH5AlpHrAzCBqgm3nWMJYfhh3Dn7tVcj/v3fl7Larcnj1EDPlR1prmE5weCzhb3DntBeKzMmU2mfBK8+6KqpIiB7Jr0KaVoM3EdusX4nQ0axOJxEFBCqagrpSWQOlrgOq3eFUwot80E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=tBBIXq41; arc=fail smtp.client-ip=40.107.93.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tBBIXq41" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tq3gzoNy6j1tjLMxBDqGRUWJLn3IrZ4aJ094EumFTRI2MAHPjKBmTbsFTICYB6nhOe528/K1YecSiBx4q5ZLX2L1dGq6zPWCjBaGdYcJnKfcde/1VKb990O9baeQ1ryhe4fB1utwUQx527OZ8qcTRuh2qkHFFuLnQYcuRCkdUamq6GYuxpDYUULkpvdXjGUH7DMD5Xe7tSuwJyLFrX8vSfy8IgNkPzkLl1u2LQskbT8OZiMKJ4V0hVjsiLZWybJQ4sA2qu0Hw2spL2ewHqsUbIuCROuVzS7YhSxAmvYh7HlOwyllerBV4Gys25v+da7B82nToIzo7eqXKB8XKRQ5LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=J5iZhoTp8eIfTaOOOShh1XgljUrHSSFrPvfngojSvOA=; b=qWCETMGD41XD0g69rYPibuq1vHA0NmX4By/PsPjghONnasf/6XxKxauAy+hFfPpUxHa9P+08SxyOuCy7mGzfYSKUOYEglz4ZBxcXplApHLFXuV7I6qe4LR1VV+m/5ofWzRG2i68BCKRMkVKwP3GXsdebLrjD8fGMR3RE51XbtxgaSiqPwomFz9P4HYx3c7fZTFzDcktGDEF9FWmcdcC+SdMudeWUljzRjhj8H5DHgX4pA3ZbaJt7W/TlyF0JNCe1ys46+pzJ0dg/H/cjB1QWKzcfZeSss+g572SXnUeE728b0jB8cupAn/UNjgzq7J31i0nY+LAmRSAWP5BxMcmt5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=J5iZhoTp8eIfTaOOOShh1XgljUrHSSFrPvfngojSvOA=; b=tBBIXq41Eg+RLp+aQG1QkKGpbzWlhzCgo1GMfkdAxpJJJnlP4m05TLqbJG7AeHU9Y+ayq5q5ojPWmtjjpEmYAs7e4sCsYvIXsTrpLWbUsRxb6z+r5gE9IyCTrBEeUfqOWiUahKQXqGmEpqY7P5w+PzhS5fOL4bpOiD5jJpjtFJ7t21avHI8M+ClDdrSid+e1SpObGqRccuQ1NrWT1t4XS7wh9x0skRtEL0w6MuwaqjIQyc1PiuWJ4Hp/zplan/dD4SpyUKN8wcJDIqDJ8Nh5pEngPoVgWgMcGyEmkwfIyke3ZEUFShiGJ5Hb50z03B+pphbJBdE6XZFpgHJlREg7Kg== Received: from BYAPR08CA0064.namprd08.prod.outlook.com (2603:10b6:a03:117::41) by BY5PR12MB4051.namprd12.prod.outlook.com (2603:10b6:a03:20c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Mon, 14 Oct 2024 20:54:38 +0000 Received: from SJ1PEPF00001CE2.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::a3) by BYAPR08CA0064.outlook.office365.com (2603:10b6:a03:117::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Mon, 14 Oct 2024 20:54:38 +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 SJ1PEPF00001CE2.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:38 +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.1544.4; Mon, 14 Oct 2024 13:54:25 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.1544.4; Mon, 14 Oct 2024 13:54:24 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:21 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 08/15] net/mlx5: Refactor vport QoS to use scheduling node structure Date: Mon, 14 Oct 2024 23:52:53 +0300 Message-ID: <20241014205300.193519-9-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE2:EE_|BY5PR12MB4051:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bf233b1-8fc1-4360-aa2d-08dcec926b16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: FSAzjfGjgXIKahh4IuRcplkywFwV/WxS/ucfyTcCdh7M3hbKDKtJGWyvp3/Bl4aOQK+Rpm91tpxg4/KJoDvFoi1FVxoRq8e1F3gzBODEHDhZu4NSKWTBMMrt2JW5uZLLYbxJy2sJBPs8ge5ezwEtJgslRtfIClza9SMExLGbe464tVHFE6HzlUMyy5Zvhj/dhufIebtnJHZR8BvuuPMS+eqYBYeOzAWxK5p6eIcho6JpIdEp1RKukF3AOMXlXoGIZ96OlAQ4kX5WAQre4MJHJKkQQJDlsWQwH9+DlEafDG7ZP5jhdS8e1sbivgIPkIqIo6TF3B1RiKqVN6mm+oZVz31PeJlzleDx+7vuvKStKCueYKk6LM6bCdDUBZVa9LupnJjhI8gIA6JVnWlOvHoqxqobZEKg5RMNieege4eLhqPceOukNQBUJWjMyz7g+ks4nkaaG77Oqnl1YmF5QCjW7phRhD3TvBKXvZx1KM+0S+xVNKyEU9Jb/MxDttt2aJ2FT/y8Sd5IOOUY5669boM3JPCUlZNBAlaLcXjnnHEP3LaPTi2lUyfiwUzjjOLdqLoZLjWCbfNBb2mYj0KKu4cCbcyUilRo6e8QBypGDg3NpvDKQOp+XE7A+uWJX6j+TKcHRe7v6XJMC+nfO/brUjPtvlm9aWxr6j2A5siMhtwnCqdfJZiX7b2npzd43cjWB0VpJh9q11SRKfLnoqR/9y48mpxVNZDo+vUmSvzrjfS01bwQrQEJiTVzxqOOxVJS8eoCO1Krp+GSvwbA7J7QhyZoFb9Q+ST5FQK3x2SGiWTiBijJNkTxANqaRXm97bJz2vqvNnIf/jtoGMUf/upK8NXoGnHPBMiSeSKCeC/qDAYl4FutAoLHslRYKo+/Y9igkY/SbQvXvSMd7Az3zJbpB2FtsaFTLJyGKg0q01AGlFNQQjmrLjzUzYjdJlH9jZxz0fZJFs5b4FCkL91mNK+4n1mLnD1ft1aJ1+Zs42dwyZm2K4XFQ+UVhqKbfvleRLseiyWBGdSEW21IQjhB/qOnmIweFez3y/lrgFHb5sIJn762zi4IJT7osof/tmSiSpppMrPap1QNmer+KGMytaylauQ347f/wwzxDajjiUnDQwbF9xKkCc/v2uqzWq0RbfogdKbDxtJXaDjjZAf4mfWvKXycpFTldwS4SO+Rj1o2jYQPVqG4OKuWTjln1ha5SgUCL6d/rfsTYb+izw9gor/VET0lqbxbZMzGxPm6aQcSeGrfP2AarQdOFGHPerM9mWzkkLWpxSsyQvJx5yPVEb8dRTv7mKFVSb2zZrg6iNanppk3MbN2NlbGL1KWicKdaejXfGOrK6L9o9p+ZjNIm8zHQLvIR+bWtUg1a6i6qZHUiRox2q03/JAa/IyUwLwTOirWxqoQ 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:(13230040)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:38.4545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bf233b1-8fc1-4360-aa2d-08dcec926b16 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: SJ1PEPF00001CE2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4051 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Refactor the vport QoS structure by moving group membership and scheduling details into the `mlx5_esw_sched_node` structure. This change consolidates the vport into the rate hierarchy by unifying the handling of different types of scheduling element nodes. In addition, add a direct reference to the mlx5_vport within the mlx5_esw_sched_node structure, to ensure that the vport is easily accessible when a scheduling node is associated with a vport. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../mlx5/core/esw/diag/qos_tracepoint.h | 7 +- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 154 +++++++++++------- .../net/ethernet/mellanox/mlx5/core/esw/qos.h | 3 + .../net/ethernet/mellanox/mlx5/core/eswitch.c | 2 + .../net/ethernet/mellanox/mlx5/core/eswitch.h | 11 +- 5 files changed, 110 insertions(+), 67 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h index 0b50ef0871f2..43550a416a6f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h @@ -9,6 +9,7 @@ #include #include "eswitch.h" +#include "qos.h" TRACE_EVENT(mlx5_esw_vport_qos_destroy, TP_PROTO(const struct mlx5_core_dev *dev, const struct mlx5_vport *vport), @@ -19,7 +20,7 @@ TRACE_EVENT(mlx5_esw_vport_qos_destroy, ), TP_fast_assign(__assign_str(devname); __entry->vport_id = vport->vport; - __entry->sched_elem_ix = vport->qos.esw_sched_elem_ix; + __entry->sched_elem_ix = mlx5_esw_qos_vport_get_sched_elem_ix(vport); ), TP_printk("(%s) vport=%hu sched_elem_ix=%u\n", __get_str(devname), __entry->vport_id, __entry->sched_elem_ix @@ -39,10 +40,10 @@ DECLARE_EVENT_CLASS(mlx5_esw_vport_qos_template, ), TP_fast_assign(__assign_str(devname); __entry->vport_id = vport->vport; - __entry->sched_elem_ix = vport->qos.esw_sched_elem_ix; + __entry->sched_elem_ix = mlx5_esw_qos_vport_get_sched_elem_ix(vport); __entry->bw_share = bw_share; __entry->max_rate = max_rate; - __entry->parent = vport->qos.parent; + __entry->parent = mlx5_esw_qos_vport_get_parent(vport); ), TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u parent=%p\n", __get_str(devname), __entry->vport_id, __entry->sched_elem_ix, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index bcdb745994d2..a665b8990dda 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -63,6 +63,7 @@ static void esw_qos_domain_release(struct mlx5_eswitch *esw) enum sched_node_type { SCHED_NODE_TYPE_VPORTS_TSAR, + SCHED_NODE_TYPE_VPORT, }; struct mlx5_esw_sched_node { @@ -82,13 +83,34 @@ struct mlx5_esw_sched_node { struct mlx5_eswitch *esw; /* The children nodes of this node, empty list for leaf nodes. */ struct list_head children; + /* Valid only if this node is associated with a vport. */ + struct mlx5_vport *vport; }; -static void esw_qos_vport_set_parent(struct mlx5_vport *vport, struct mlx5_esw_sched_node *parent) +static void +esw_qos_node_set_parent(struct mlx5_esw_sched_node *node, struct mlx5_esw_sched_node *parent) { - list_del_init(&vport->qos.parent_entry); - vport->qos.parent = parent; - list_add_tail(&vport->qos.parent_entry, &parent->children); + list_del_init(&node->entry); + node->parent = parent; + list_add_tail(&node->entry, &parent->children); + node->esw = parent->esw; +} + +u32 mlx5_esw_qos_vport_get_sched_elem_ix(const struct mlx5_vport *vport) +{ + if (!vport->qos.sched_node) + return 0; + + return vport->qos.sched_node->ix; +} + +struct mlx5_esw_sched_node * +mlx5_esw_qos_vport_get_parent(const struct mlx5_vport *vport) +{ + if (!vport->qos.sched_node) + return NULL; + + return vport->qos.sched_node->parent; } static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_ix, @@ -131,10 +153,11 @@ static int esw_qos_vport_config(struct mlx5_vport *vport, u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack) { - struct mlx5_core_dev *dev = vport->qos.parent->esw->dev; + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; + struct mlx5_core_dev *dev = vport_node->parent->esw->dev; int err; - err = esw_qos_sched_elem_config(dev, vport->qos.esw_sched_elem_ix, max_rate, bw_share); + err = esw_qos_sched_elem_config(dev, vport_node->ix, max_rate, bw_share); if (err) { esw_warn(dev, "E-Switch modify vport scheduling element failed (vport=%d,err=%d)\n", @@ -151,15 +174,15 @@ static int esw_qos_vport_config(struct mlx5_vport *vport, static u32 esw_qos_calculate_node_min_rate_divider(struct mlx5_esw_sched_node *node) { u32 fw_max_bw_share = MLX5_CAP_QOS(node->esw->dev, max_tsar_bw_share); - struct mlx5_vport *vport; + struct mlx5_esw_sched_node *vport_node; u32 max_guarantee = 0; /* Find max min_rate across all vports in this node. * This will correspond to fw_max_bw_share in the final bw_share calculation. */ - list_for_each_entry(vport, &node->children, qos.parent_entry) { - if (vport->qos.min_rate > max_guarantee) - max_guarantee = vport->qos.min_rate; + list_for_each_entry(vport_node, &node->children, entry) { + if (vport_node->min_rate > max_guarantee) + max_guarantee = vport_node->min_rate; } if (max_guarantee) @@ -213,21 +236,22 @@ static int esw_qos_normalize_node_min_rate(struct mlx5_esw_sched_node *node, { u32 fw_max_bw_share = MLX5_CAP_QOS(node->esw->dev, max_tsar_bw_share); u32 divider = esw_qos_calculate_node_min_rate_divider(node); - struct mlx5_vport *vport; + struct mlx5_esw_sched_node *vport_node; u32 bw_share; int err; - list_for_each_entry(vport, &node->children, qos.parent_entry) { - bw_share = esw_qos_calc_bw_share(vport->qos.min_rate, divider, fw_max_bw_share); + list_for_each_entry(vport_node, &node->children, entry) { + bw_share = esw_qos_calc_bw_share(vport_node->min_rate, divider, fw_max_bw_share); - if (bw_share == vport->qos.bw_share) + if (bw_share == vport_node->bw_share) continue; - err = esw_qos_vport_config(vport, vport->qos.max_rate, bw_share, extack); + err = esw_qos_vport_config(vport_node->vport, vport_node->max_rate, bw_share, + extack); if (err) return err; - vport->qos.bw_share = bw_share; + vport_node->bw_share = bw_share; } return 0; @@ -271,25 +295,25 @@ static int esw_qos_normalize_min_rate(struct mlx5_eswitch *esw, struct netlink_e static int esw_qos_set_vport_min_rate(struct mlx5_vport *vport, u32 min_rate, struct netlink_ext_ack *extack) { - struct mlx5_eswitch *esw = vport->dev->priv.eswitch; + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; u32 fw_max_bw_share, previous_min_rate; bool min_rate_supported; int err; - esw_assert_qos_lock_held(esw); + esw_assert_qos_lock_held(vport_node->esw); fw_max_bw_share = MLX5_CAP_QOS(vport->dev, max_tsar_bw_share); min_rate_supported = MLX5_CAP_QOS(vport->dev, esw_bw_share) && fw_max_bw_share >= MLX5_MIN_BW_SHARE; if (min_rate && !min_rate_supported) return -EOPNOTSUPP; - if (min_rate == vport->qos.min_rate) + if (min_rate == vport_node->min_rate) return 0; - previous_min_rate = vport->qos.min_rate; - vport->qos.min_rate = min_rate; - err = esw_qos_normalize_node_min_rate(vport->qos.parent, extack); + previous_min_rate = vport_node->min_rate; + vport_node->min_rate = min_rate; + err = esw_qos_normalize_node_min_rate(vport_node->parent, extack); if (err) - vport->qos.min_rate = previous_min_rate; + vport_node->min_rate = previous_min_rate; return err; } @@ -297,27 +321,27 @@ static int esw_qos_set_vport_min_rate(struct mlx5_vport *vport, static int esw_qos_set_vport_max_rate(struct mlx5_vport *vport, u32 max_rate, struct netlink_ext_ack *extack) { - struct mlx5_eswitch *esw = vport->dev->priv.eswitch; + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; u32 act_max_rate = max_rate; bool max_rate_supported; int err; - esw_assert_qos_lock_held(esw); + esw_assert_qos_lock_held(vport_node->esw); max_rate_supported = MLX5_CAP_QOS(vport->dev, esw_rate_limit); if (max_rate && !max_rate_supported) return -EOPNOTSUPP; - if (max_rate == vport->qos.max_rate) + if (max_rate == vport_node->max_rate) return 0; /* Use parent node limit if new max rate is 0. */ if (!max_rate) - act_max_rate = vport->qos.parent->max_rate; + act_max_rate = vport_node->parent->max_rate; - err = esw_qos_vport_config(vport, act_max_rate, vport->qos.bw_share, extack); + err = esw_qos_vport_config(vport, act_max_rate, vport_node->bw_share, extack); if (!err) - vport->qos.max_rate = max_rate; + vport_node->max_rate = max_rate; return err; } @@ -354,7 +378,7 @@ static int esw_qos_set_node_min_rate(struct mlx5_esw_sched_node *node, static int esw_qos_set_node_max_rate(struct mlx5_esw_sched_node *node, u32 max_rate, struct netlink_ext_ack *extack) { - struct mlx5_vport *vport; + struct mlx5_esw_sched_node *vport_node; int err; if (node->max_rate == max_rate) @@ -367,11 +391,12 @@ static int esw_qos_set_node_max_rate(struct mlx5_esw_sched_node *node, node->max_rate = max_rate; /* Any unlimited vports in the node should be set with the value of the node. */ - list_for_each_entry(vport, &node->children, qos.parent_entry) { - if (vport->qos.max_rate) + list_for_each_entry(vport_node, &node->children, entry) { + if (vport_node->max_rate) continue; - err = esw_qos_vport_config(vport, max_rate, vport->qos.bw_share, extack); + err = esw_qos_vport_config(vport_node->vport, max_rate, vport_node->bw_share, + extack); if (err) NL_SET_ERR_MSG_MOD(extack, "E-Switch vport implicit rate limit setting failed"); @@ -448,34 +473,37 @@ static int esw_qos_update_node_scheduling_element(struct mlx5_vport *vport, struct mlx5_esw_sched_node *new_node, struct netlink_ext_ack *extack) { + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; u32 max_rate; int err; err = mlx5_destroy_scheduling_element_cmd(curr_node->esw->dev, SCHEDULING_HIERARCHY_E_SWITCH, - vport->qos.esw_sched_elem_ix); + vport_node->ix); if (err) { NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy vport scheduling element failed"); return err; } /* Use new node max rate if vport max rate is unlimited. */ - max_rate = vport->qos.max_rate ? vport->qos.max_rate : new_node->max_rate; - err = esw_qos_vport_create_sched_element(vport, new_node, max_rate, vport->qos.bw_share, - &vport->qos.esw_sched_elem_ix); + max_rate = vport_node->max_rate ? vport_node->max_rate : new_node->max_rate; + err = esw_qos_vport_create_sched_element(vport, new_node, max_rate, + vport_node->bw_share, + &vport_node->ix); if (err) { NL_SET_ERR_MSG_MOD(extack, "E-Switch vport node set failed."); goto err_sched; } - esw_qos_vport_set_parent(vport, new_node); + esw_qos_node_set_parent(vport->qos.sched_node, new_node); return 0; err_sched: - max_rate = vport->qos.max_rate ? vport->qos.max_rate : curr_node->max_rate; - if (esw_qos_vport_create_sched_element(vport, curr_node, max_rate, vport->qos.bw_share, - &vport->qos.esw_sched_elem_ix)) + max_rate = vport_node->max_rate ? vport_node->max_rate : curr_node->max_rate; + if (esw_qos_vport_create_sched_element(vport, curr_node, max_rate, + vport_node->bw_share, + &vport_node->ix)) esw_warn(curr_node->esw->dev, "E-Switch vport node restore failed (vport=%d)\n", vport->vport); @@ -486,12 +514,13 @@ static int esw_qos_vport_update_node(struct mlx5_vport *vport, struct mlx5_esw_sched_node *node, struct netlink_ext_ack *extack) { + struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; struct mlx5_eswitch *esw = vport->dev->priv.eswitch; struct mlx5_esw_sched_node *new_node, *curr_node; int err; esw_assert_qos_lock_held(esw); - curr_node = vport->qos.parent; + curr_node = vport_node->parent; new_node = node ?: esw->qos.node0; if (curr_node == new_node) return 0; @@ -501,7 +530,7 @@ static int esw_qos_vport_update_node(struct mlx5_vport *vport, return err; /* Recalculate bw share weights of old and new nodes */ - if (vport->qos.bw_share || new_node->bw_share) { + if (vport_node->bw_share || new_node->bw_share) { esw_qos_normalize_node_min_rate(curr_node, extack); esw_qos_normalize_node_min_rate(new_node, extack); } @@ -709,6 +738,7 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack) { struct mlx5_eswitch *esw = vport->dev->priv.eswitch; + u32 sched_elem_ix; int err; esw_assert_qos_lock_held(esw); @@ -720,18 +750,28 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, return err; err = esw_qos_vport_create_sched_element(vport, esw->qos.node0, max_rate, bw_share, - &vport->qos.esw_sched_elem_ix); + &sched_elem_ix); if (err) goto err_out; - INIT_LIST_HEAD(&vport->qos.parent_entry); - esw_qos_vport_set_parent(vport, esw->qos.node0); + vport->qos.sched_node = __esw_qos_alloc_node(esw, sched_elem_ix, SCHED_NODE_TYPE_VPORT, + esw->qos.node0); + if (!vport->qos.sched_node) { + err = -ENOMEM; + goto err_alloc; + } vport->qos.enabled = true; + vport->qos.sched_node->vport = vport; + trace_mlx5_esw_vport_qos_create(vport->dev, vport, bw_share, max_rate); return 0; +err_alloc: + if (mlx5_destroy_scheduling_element_cmd(esw->dev, + SCHEDULING_HIERARCHY_E_SWITCH, sched_elem_ix)) + esw_warn(esw->dev, "E-Switch destroy vport scheduling element failed.\n"); err_out: esw_qos_put(esw); @@ -741,6 +781,7 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) { struct mlx5_eswitch *esw = vport->dev->priv.eswitch; + struct mlx5_esw_sched_node *vport_node; struct mlx5_core_dev *dev; int err; @@ -748,20 +789,23 @@ void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) esw_qos_lock(esw); if (!vport->qos.enabled) goto unlock; - WARN(vport->qos.parent != esw->qos.node0, + vport_node = vport->qos.sched_node; + WARN(vport_node->parent != esw->qos.node0, "Disabling QoS on port before detaching it from node"); - dev = vport->qos.parent->esw->dev; + dev = vport_node->esw->dev; + trace_mlx5_esw_vport_qos_destroy(dev, vport); + err = mlx5_destroy_scheduling_element_cmd(dev, SCHEDULING_HIERARCHY_E_SWITCH, - vport->qos.esw_sched_elem_ix); + vport_node->ix); if (err) esw_warn(dev, "E-Switch destroy vport scheduling element failed (vport=%d,err=%d)\n", vport->vport, err); + __esw_qos_free_node(vport_node); memset(&vport->qos, 0, sizeof(vport->qos)); - trace_mlx5_esw_vport_qos_destroy(dev, vport); esw_qos_put(esw); unlock: @@ -794,8 +838,8 @@ bool mlx5_esw_qos_get_vport_rate(struct mlx5_vport *vport, u32 *max_rate, u32 *m esw_qos_lock(esw); enabled = vport->qos.enabled; if (enabled) { - *max_rate = vport->qos.max_rate; - *min_rate = vport->qos.min_rate; + *max_rate = vport->qos.sched_node->max_rate; + *min_rate = vport->qos.sched_node->min_rate; } esw_qos_unlock(esw); return enabled; @@ -891,16 +935,16 @@ int mlx5_esw_qos_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, u32 esw_qos_lock(esw); if (!vport->qos.enabled) { /* Eswitch QoS wasn't enabled yet. Enable it and vport QoS. */ - err = esw_qos_vport_enable(vport, rate_mbps, vport->qos.bw_share, NULL); + err = esw_qos_vport_enable(vport, rate_mbps, vport->qos.sched_node->bw_share, NULL); } else { - struct mlx5_core_dev *dev = vport->qos.parent->esw->dev; + struct mlx5_core_dev *dev = vport->qos.sched_node->parent->esw->dev; MLX5_SET(scheduling_context, ctx, max_average_bw, rate_mbps); bitmask = MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW; err = mlx5_modify_scheduling_element_cmd(dev, SCHEDULING_HIERARCHY_E_SWITCH, ctx, - vport->qos.esw_sched_elem_ix, + vport->qos.sched_node->ix, bitmask); } esw_qos_unlock(esw); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.h index b4045efbaf9e..61a6fdd5c267 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.h @@ -13,6 +13,9 @@ int mlx5_esw_qos_set_vport_rate(struct mlx5_vport *evport, u32 max_rate, u32 min bool mlx5_esw_qos_get_vport_rate(struct mlx5_vport *vport, u32 *max_rate, u32 *min_rate); void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport); +u32 mlx5_esw_qos_vport_get_sched_elem_ix(const struct mlx5_vport *vport); +struct mlx5_esw_sched_node *mlx5_esw_qos_vport_get_parent(const struct mlx5_vport *vport); + int mlx5_esw_devlink_rate_leaf_tx_share_set(struct devlink_rate *rate_leaf, void *priv, u64 tx_share, struct netlink_ext_ack *extack); int mlx5_esw_devlink_rate_leaf_tx_max_set(struct devlink_rate *rate_leaf, void *priv, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 2bcd42305f46..09719e9b8611 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1061,6 +1061,7 @@ static void mlx5_eswitch_clear_vf_vports_info(struct mlx5_eswitch *esw) unsigned long i; mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) { + kfree(vport->qos.sched_node); memset(&vport->qos, 0, sizeof(vport->qos)); memset(&vport->info, 0, sizeof(vport->info)); vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO; @@ -1073,6 +1074,7 @@ static void mlx5_eswitch_clear_ec_vf_vports_info(struct mlx5_eswitch *esw) unsigned long i; mlx5_esw_for_each_ec_vf_vport(esw, i, vport, esw->esw_funcs.num_ec_vfs) { + kfree(vport->qos.sched_node); memset(&vport->qos, 0, sizeof(vport->qos)); memset(&vport->info, 0, sizeof(vport->info)); vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 38f912f5a707..e77ec82787de 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -216,15 +216,8 @@ struct mlx5_vport { struct { /* Initially false, set to true whenever any QoS features are used. */ bool enabled; - u32 esw_sched_elem_ix; - u32 min_rate; - u32 max_rate; - /* A computed value indicating relative min_rate between vports in a group. */ - u32 bw_share; - /* The parent group of this vport scheduling element. */ - struct mlx5_esw_sched_node *parent; - /* Membership in the parent 'members' list. */ - struct list_head parent_entry; + /* Vport scheduling element node. */ + struct mlx5_esw_sched_node *sched_node; } qos; u16 vport; From patchwork Mon Oct 14 20:52:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835488 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 036E01D1512 for ; Mon, 14 Oct 2024 20:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939288; cv=fail; b=PBKCn+ylV2nBqTLFERScaiedbELq1z3Kh1aCQCUCdDvOFAcot9iu3YXRoqkY6cNA1ErqRLjTRr/sRaJ7bb/mUayZW4xSSHraR2yP1rQKnLnB4ZADlyk0LdvHEtH3PDI7jsOyv3KHQehrccHCbBBvajCFzwjoji45enptYZD7/5A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939288; c=relaxed/simple; bh=U/G2gS9Ue0Z/UYEyy2Ch4Z4mEaN8bWbBC0GG5leJNGI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X9qj4jgFypP8ym+rZPqg6ZbobevIdgMY66CxcbGg9pAwhJfCFSricEO1LEIdIG4Z1ruP1eZYaVkDb70oqK7XI2GmIOliXbJvn9a7fCVVs9yDXWglzu/a76MhN4xbrOvgJLtWyLvJjcUqMDUF3pw+Q+UrM9vL50RxXUAir63DJrs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Rls+gdQM; arc=fail smtp.client-ip=40.107.223.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Rls+gdQM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ardULIvq8RJ9uz0QKRA+5epkrep3WcLcWlB0+sYWG2oh6rs7ZzbZy00r58daM4yJZSX6ChUf3Ml3jzZrZuw4/autRuoZLU0kfrD/ir1EBECNYVUJ0CgkQCRlMNvDsf+pLKTjoDM1F+ggZ1jcdNihJhRK3n9bEfQt/mrO2Nu9B0Y6R6VNYJcpcSjO0EIsJHzbCp15PIVH3RLfL3gbJhr8Ye4M3J+YdgPTDLmOH4FFi6jap5loSlzY9ZySWF1NKxLfaELuwHg+M3CZ8GdbqmzZHlqIZ5QPRdxYKLCo3E0Y63QOhwz07V88VzbFN0jZ547E5SCjK5ojUvKd/JYoL8rV1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=cN3eWKCowuMpK99awCwCq63kEy0/+WIkDoi9f0tBmNY=; b=wj4N6d1kJ3eockcvimSIBGwEubxag7anleICac3qHXPgzkiJtwxSh9Q5rzl9chsvsFLrja8s0YrHApjJnzSFlzRz2D1mzLEzfDK+NLlgb/pHM5LegT62dIfCTz0xecn7Z9sYnhiOPWnqlA7giibvNKp0XS/M31X8Kl19wXjHbDo7R1b/SNRoRZr68+5uyYKSbSSvSbSYn0+rr4Mk0DQDjxkeDJFI4E+8mtbY5vtvR/VN+eejY8T1kd33Ml8NHKLrVNTteXB+VKwT0KYzawVCZk4nXSS6elGdyhxNWvAHrb4XyrdAdoxQcGHeR2Qm7//Iik3o/gdNf0GD5657gqXpAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=cN3eWKCowuMpK99awCwCq63kEy0/+WIkDoi9f0tBmNY=; b=Rls+gdQMptveRXILv595Xq4osN0YJFxQq1tIj8OFnLaf7aNrJG97ZxBKftYck0mpw05l53j65EDiIQi6oaDH+GkP+/3rcRSJ9DaztRBlpwj918cvBrWLEByKMf0WdTMqfHmRouQypt1UJ1u+Z6z32TWhIXBa1VE1QLT4PcSniJ04BzY18xYrHzcKW9cSIJ14MEbRbrPqqHMbwlB6auFJn+XX2EwvReKoCsyZhXXHW52mR5loiW1mka6LIKurpQYTX8hRDkT7nDNoiwG+zwqTb8s4qa5LRjMLk0AD/67Q5RPfoUPEvWCQWbNZokOfBdJT4eS/qz/t/LtyCwFmQX7jtw== Received: from DM6PR21CA0027.namprd21.prod.outlook.com (2603:10b6:5:174::37) by PH0PR12MB7908.namprd12.prod.outlook.com (2603:10b6:510:28e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:41 +0000 Received: from CH3PEPF00000015.namprd21.prod.outlook.com (2603:10b6:5:174:cafe::17) by DM6PR21CA0027.outlook.office365.com (2603:10b6:5:174::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.4 via Frontend Transport; Mon, 14 Oct 2024 20:54:41 +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 CH3PEPF00000015.mail.protection.outlook.com (10.167.244.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:41 +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.1544.4; Mon, 14 Oct 2024 13:54:28 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.1544.4; Mon, 14 Oct 2024 13:54:27 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:25 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 09/15] net/mlx5: Remove vport QoS enabled flag Date: Mon, 14 Oct 2024 23:52:54 +0300 Message-ID: <20241014205300.193519-10-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000015:EE_|PH0PR12MB7908:EE_ X-MS-Office365-Filtering-Correlation-Id: 00ac08b2-2fe8-4072-ae1d-08dcec926cd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: fOl+iZwUVOZKEZhoSkxwo2xcOg9abMYnm/M3NLcPtZXEmqsVwH1GrVWnsX1x+rRyKXjTxPwukWb0Reggt2iZu/8z91NZaHHcvFbjXOE/VJk1ZxZ1733TStjGYM47D8W33OF3qBv2h2SjGbB1fLOcCrwa8KtmDZ1K70/s9XrKJNcobqL54ZKcyIJCAUf4V/pCBtlb4ivzCcSehUcTH5FxRokWtvTgCKMj0UeTe3PFo/YbZKQ0XHZWLuITZkE0yfRkA6OvGi7v2mz8QT+oRXOzcPcvXwBKtNtbPj2JRzT8QYNT2yqDkUtNWqPfo0wd8wF5Rh+pgMddNAGd5YzmvxLnZHSRreuvBsciZE38WxV+6f8DLDXFPbIOwG6SPuhzKSBzvxVCWCxMSsuDf9+Icd/yKUdYtSGLwhBZQVRDbxqfsTpciA/peSdkmC20NdXxX/NgxcgqkPIZ333dl9LqpCpwUbV8kPb+qY5ra+BMTwlQeC2S2bDiQpZydE3UKMyM+P4eoYBcv8g7RFZCeNFNAadeJelXvzSd8qw2zLrWXsfo4NwccKIc+V53K58cMj7HP2+qlgAJIq0takO2xjaB0r7Ja6NWorGNw2Ug/18tlN/U1X0QYHRrJ97NnWaJfFJmvuWfirbOdUJI/DL74fYkqUiG1/EdCy3zTVKa48AqB1OG6CmwwYkKF3ULKf+3ougfPrrxa7FAn8AxsGBp5mBo7b9VPjm4hVu07nhdgFDRS5xotsynsILXNgQZQfuh+mFBSUwFj3Ukz5YWgDPRiWzL8eTpzkSghqywwwZca620XYQOqH0cwwfV8Jx2Hg5q1X6GcnqBfnzmc+pqylLWddJDDyFSsAt9bSLibzXPxwDbaaOnYKUUzz6hmQplNNEN4B+EuX538cwsXAruXpjhRR0UbKDMi5yqvDsb4r1UFCZ+ST1NakZepBdS9uuQY3gwVr6kDkuey27ckLYawIeM3vlu2K3xsK6Mz1/0rwhT4GPraJNjJkwOj3LOGvhksk+vmghKvutK6me6FrJ3AAI5SCjWqSsrMnLopa6rj4nvs0jvZyuMr+BvKR9W/+OM/+gLpXuK/EJi/iL2nR3EabSfia6Gdr7D3d4VxLm2mBYexwjONIwnJ2MdzczNMrVF6V9S7IigXu0j3D4yIarxoTq7Nj2zwY5AbfL/1odOcRmHwhnJ48b6OHRqBc+Re/ovlHupdwXfT65hfsCpM2A3Qe83tFpYwPt+9UomQUAJbjLLaUBzesVEDnyEUu1lyH+WaRlP6cm7et6tj4NhQmYqA+s+BknbxB5xtHk51/olaYpDzPwxuG4VOtEf5RTVUWnWLuqQlUlfBTZxFTNn3QbyqoxWXyVGuJTIv3G1POHd2jb5TV6B1B7HxlBDVZHY0lQVClNBww5wXn3Y 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:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:41.3594 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00ac08b2-2fe8-4072-ae1d-08dcec926cd6 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: CH3PEPF00000015.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7908 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Remove the `enabled` flag from the `vport->qos` struct, as QoS now relies solely on the `sched_node` pointer to determine whether QoS features are in use. Currently, the vport `qos` struct consists only of the `sched_node`, introducing an unnecessary two-level reference. However, the qos struct is retained as it will be extended in future patches to support new QoS features. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 13 ++++++------- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index a665b8990dda..b36fbaf8ead0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -742,7 +742,7 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, int err; esw_assert_qos_lock_held(esw); - if (vport->qos.enabled) + if (vport->qos.sched_node) return 0; err = esw_qos_get(esw, extack); @@ -761,7 +761,6 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, goto err_alloc; } - vport->qos.enabled = true; vport->qos.sched_node->vport = vport; trace_mlx5_esw_vport_qos_create(vport->dev, vport, bw_share, max_rate); @@ -787,9 +786,9 @@ void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) lockdep_assert_held(&esw->state_lock); esw_qos_lock(esw); - if (!vport->qos.enabled) - goto unlock; vport_node = vport->qos.sched_node; + if (!vport_node) + goto unlock; WARN(vport_node->parent != esw->qos.node0, "Disabling QoS on port before detaching it from node"); @@ -836,7 +835,7 @@ bool mlx5_esw_qos_get_vport_rate(struct mlx5_vport *vport, u32 *max_rate, u32 *m bool enabled; esw_qos_lock(esw); - enabled = vport->qos.enabled; + enabled = !!vport->qos.sched_node; if (enabled) { *max_rate = vport->qos.sched_node->max_rate; *min_rate = vport->qos.sched_node->min_rate; @@ -933,7 +932,7 @@ int mlx5_esw_qos_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, u32 } esw_qos_lock(esw); - if (!vport->qos.enabled) { + if (!vport->qos.sched_node) { /* Eswitch QoS wasn't enabled yet. Enable it and vport QoS. */ err = esw_qos_vport_enable(vport, rate_mbps, vport->qos.sched_node->bw_share, NULL); } else { @@ -1142,7 +1141,7 @@ int mlx5_esw_qos_vport_update_node(struct mlx5_vport *vport, } esw_qos_lock(esw); - if (!vport->qos.enabled && !node) + if (!vport->qos.sched_node && !node) goto unlock; err = esw_qos_vport_enable(vport, 0, 0, extack); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index e77ec82787de..14dd42d44e6f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -214,8 +214,6 @@ struct mlx5_vport { /* Protected with the E-Switch qos domain lock. */ struct { - /* Initially false, set to true whenever any QoS features are used. */ - bool enabled; /* Vport scheduling element node. */ struct mlx5_esw_sched_node *sched_node; } qos; From patchwork Mon Oct 14 20:52:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835489 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2065.outbound.protection.outlook.com [40.107.223.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86E521D0BA4 for ; Mon, 14 Oct 2024 20:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939293; cv=fail; b=GqjZAJgFw9NAvqBEsXnOrUfCCqCOIggo/eUilQa6hLjl/6DrYAZXAMtiXfk1NjuBNKx6LLny7iwWpkCitfDCT1VbhFNUWObNmN8dk1JtgfEIEPf2xWh0+cry64OX07X9RIfWhdnveWRDHxwcZNJFlGqDk1ddPbidKOcxs8PSplw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939293; c=relaxed/simple; bh=Ehp3IebosekfWfKvIadpg1FiftoxqJgY4xTDuGQon5g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GGw3Wt31O9NKDKQec8MXYNsShamSRkDVboSd2fhpwGT7EDZ3YkfeadMLbSPj5Bfd64yeelaCk8Ul2tT0IDulTsEroIE6nqCssCoHbLfpqWlVFTF2QcEiN6wgDgggFQ5XGn02GCSFvlzBVWWhM9+Lh3aZ+5GN1U7uCRwG5g+Sgwo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=hXGwhO8/; arc=fail smtp.client-ip=40.107.223.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hXGwhO8/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=asRiuT3xHLOaET+ABH6xwS9HLm2j7ptdwSa6Re2WK1rp3F+v/YKGIsyVuMB7UV1Y+lsG//tuhobAq/lmRPtxjyJ3na95TRV5zI2OhWnT5lQ2ZoNuY5TnzUPwC3qyrrfigEsTEFLtMqnpKLMqkM3MfgOEIjc2453ZRb+TasjziXf0qWC8e2KF8VzAZuN6/9CBO6IcxUMR3hfzkqUB9jzqYiKHslSxy7RrtaknV18QsdgvWP3Nrhn/PDYFnly0/znARYKpIjw+j2rTwC7mm/34DlhOSG4ChGXsOQ9KM696XbA4PTUJWrStfLpLtcRvPY//7kpwViP/7T20a38pTuHjvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Bo1FS7dfw4ysr6Apr/rYgsVuLHIuEbYCIeRjfGNu4Ds=; b=YAzf5v2IVUVP+ImumXzfElaSQ7eBgEJ4rBFwyf2vggY97ubw64e8knqM7V+jbaFndCY43I6ejS1k5BZT3cqgzF+6D+1cF0VSh4oPwc7RyJnoN48VQNiHsgqx44vIX2viWnPTORK/8Nz2RJYGvtbpBoO4qaOo+NU8mC5IUmywpdf7qx/vYYG+pZI9gyn6b38v8yTInF6Tmuzce9b4O39r2BzIZvARxpbU+skzcBVreJIjsQJYz2SIeMarSM46T+T6BRiKEo312Xu1mXFAOgcpMKUEloKQwF8EP7mhfH3Obe3lXM57ZoKaf/+XDTpQt1iDSStOadi1/hs8iTovsjp0Rw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=Bo1FS7dfw4ysr6Apr/rYgsVuLHIuEbYCIeRjfGNu4Ds=; b=hXGwhO8/6ZvXm3p9fgpirD8PO/0q95Jm8AOPIVPz/dtnI/s/wtiOG/YYOZpxKPao1TOckMnVzN0WrtUB9zg/UJlQPigBLp3fLerZtYDCJj4UPrMg9Z2UgNBFiJGpffeFb9+6wVDfH4q300naql7d9JyWWAONEHWd/y2iiSxb7HOcABFKSjp7Vwn3nfYNL7FSz6Bed75HORiTG6zoj+t5Y5w23OitTfwiHQoqRusdDsbVTnQRc71dYbXf4yX9Vpu+zKpJH5NAwP8bPjPsTGN5fW9dbXwGyvp85BcRrI7eYukbl6NcgW+jG5Ig8m9gN/JHpsXPtelkUZ+gNqXgcigxvw== Received: from DM6PR06CA0095.namprd06.prod.outlook.com (2603:10b6:5:336::28) by MN0PR12MB5836.namprd12.prod.outlook.com (2603:10b6:208:37b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:46 +0000 Received: from CH3PEPF00000011.namprd21.prod.outlook.com (2603:10b6:5:336:cafe::6e) by DM6PR06CA0095.outlook.office365.com (2603:10b6:5:336::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 20:54:45 +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 CH3PEPF00000011.mail.protection.outlook.com (10.167.244.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:45 +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.1544.4; Mon, 14 Oct 2024 13:54:31 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.1544.4; Mon, 14 Oct 2024 13:54:31 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:28 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 10/15] net/mlx5: Simplify QoS scheduling element configuration Date: Mon, 14 Oct 2024 23:52:55 +0300 Message-ID: <20241014205300.193519-11-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000011:EE_|MN0PR12MB5836:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ea12ae4-b30d-4927-6b52-08dcec926f43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: 33YhQTQ4gMYagFMAzvX+wYdIZw7BW2a2x74AJaK0WP4sdUIGQhenoyANaYhlcdXi0KNOLA9pq5Ig81kA8W/XzGLtrIJvt1Dj5cI2PtZBzut1K+SLDZhtJnmb1lYQp05q9V6XHM33pfCKsjuozVsmKt0CnHS61Vguzo2BHm9cC57i3uXMQKSM8MquZKPdpe17s8XzimWQVsCiw0JanfFeXvQOAfjITf3rRmG7cF+yrwTNAXK1DMLwSLMf+LTnh2dXHoN+QIK0TnGg9E0xCmGxt+ce0Xo5giehE5NKMeseefmyrmfbuhczOLsHsmb8sjZgi5vt3FE52bwkFf2PNHkDk2fz24St9/ZRSmSdrQPexBw/0cxLk/E6QbgfQbMcrFz5qMqpsQ2UJKA07VSrzaQqBbBYt1HM1qNJEW94qrQte7jls++m/EKRCOlfliydUwsHTmuVaEyN+/uzxddCfViiGjTNFdeWEGI0obioI4JsU7jgqLO0diYBi5JzlgNWkzXfJVjmr6KC+mr08IK0sNb/8dvfcpoPDMa3neahKd9MLEjGrAKqj87b2xqM7WDELkbIfFiiJA6OMQ1F2FsZES/itseh36mDlhAl6ZbIPGgEvnOp1qXUh7d4gJXyOmZnJL2RpYOvPGjyXisO62ju2iWVr3CB/Qe2eXcmGbMRrogYHA6tNuTWovBdFuiL3YzAM6ZSAQ7lCHhRFFFTooqz0tWTgcSBpiY2oztl1MlGxlmOr9HDYqkh3ofrgiQhGLdxPDcK5CzHO8sYhgSG76f+rZZ++qu8rt4lQfBT3csDIjKqBa7PjRBv6HNzuvxSNsMs4+R+FIutr7a9rJ91eFb/D7MFsRU3UxGGaFWDPbNSAJDh/GqGNo8G6/WuXRb243nfW1MpXdLk4h/mzvOQaeiCGIh7mB1582jEt1xJcpCisfgaCtc7hLyCPsrpGN8lJy2bOPQVZTGbjUG+Csk4LnznLpjqXS9Llpy6iPxg5rHGqcdKTm2GCm13twqdX0bRmiZmnO3SEpFN7ECSwJ327488GFv9+v1DO8VDcvpn7KMc0o9Ri2dLtCpZTxGgRE/qOrQ+oKstSUk2EkC+eI2jphK36yUzXQ673kjzzWOEOmU5/INLzbAkV/kXIYiNconPr1YpqDRpBGaBrjPdSyT+0/kbf/jwJ6duhwn88yVWVTsXbZFR2Xt2pxjM2bJNlkQ7cA6QSVlY+A+giSzMfFKXg4tK0BEBCRdhvg72jTXaZhlhG6mlqwWSojAlOjcyBBbkHs3CZK7WDw56tT1XBQON1YtrkgjULQcLa2KecXuojiWuSy0opR482P7NMujdxs0ZN77D81n4FbvIf6R8tXFxGWeiIKkCZX04bhZOUKMiPqac5eA/BZTaajW9C4ccIrlmWJdFUMV8 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:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:45.4275 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ea12ae4-b30d-4927-6b52-08dcec926f43 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: CH3PEPF00000011.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5836 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Simplify the configuration of QoS scheduling elements by removing the separate functions `esw_qos_node_config` and `esw_qos_vport_config`. Instead, directly use the existing `esw_qos_sched_elem_config` function for both nodes and vports. This unification helps in generalizing operations on scheduling elements nodes. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 86 +++++++++---------- 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index b36fbaf8ead0..519af66e2325 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -66,6 +66,11 @@ enum sched_node_type { SCHED_NODE_TYPE_VPORT, }; +static const char * const sched_node_type_str[] = { + [SCHED_NODE_TYPE_VPORTS_TSAR] = "vports TSAR", + [SCHED_NODE_TYPE_VPORT] = "vport", +}; + struct mlx5_esw_sched_node { u32 ix; /* Bandwidth parameters. */ @@ -113,11 +118,27 @@ mlx5_esw_qos_vport_get_parent(const struct mlx5_vport *vport) return vport->qos.sched_node->parent; } -static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_ix, - u32 max_rate, u32 bw_share) +static void esw_qos_sched_elem_config_warn(struct mlx5_esw_sched_node *node, int err) +{ + if (node->vport) { + esw_warn(node->esw->dev, + "E-Switch modify %s scheduling element failed (vport=%d,err=%d)\n", + sched_node_type_str[node->type], node->vport->vport, err); + return; + } + + esw_warn(node->esw->dev, + "E-Switch modify %s scheduling element failed (err=%d)\n", + sched_node_type_str[node->type], err); +} + +static int esw_qos_sched_elem_config(struct mlx5_esw_sched_node *node, u32 max_rate, u32 bw_share, + struct netlink_ext_ack *extack) { u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; + struct mlx5_core_dev *dev = node->esw->dev; u32 bitmask = 0; + int err; if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) return -EOPNOTSUPP; @@ -127,46 +148,22 @@ static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_i bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW; bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_BW_SHARE; - return mlx5_modify_scheduling_element_cmd(dev, - SCHEDULING_HIERARCHY_E_SWITCH, - sched_ctx, - sched_elem_ix, - bitmask); -} - -static int esw_qos_node_config(struct mlx5_esw_sched_node *node, - u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack) -{ - struct mlx5_core_dev *dev = node->esw->dev; - int err; - - err = esw_qos_sched_elem_config(dev, node->ix, max_rate, bw_share); - if (err) - NL_SET_ERR_MSG_MOD(extack, "E-Switch modify node TSAR element failed"); - - trace_mlx5_esw_node_qos_config(dev, node, node->ix, bw_share, max_rate); - - return err; -} - -static int esw_qos_vport_config(struct mlx5_vport *vport, - u32 max_rate, u32 bw_share, - struct netlink_ext_ack *extack) -{ - struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; - struct mlx5_core_dev *dev = vport_node->parent->esw->dev; - int err; - - err = esw_qos_sched_elem_config(dev, vport_node->ix, max_rate, bw_share); + err = mlx5_modify_scheduling_element_cmd(dev, + SCHEDULING_HIERARCHY_E_SWITCH, + sched_ctx, + node->ix, + bitmask); if (err) { - esw_warn(dev, - "E-Switch modify vport scheduling element failed (vport=%d,err=%d)\n", - vport->vport, err); - NL_SET_ERR_MSG_MOD(extack, "E-Switch modify vport scheduling element failed"); + esw_qos_sched_elem_config_warn(node, err); + NL_SET_ERR_MSG_MOD(extack, "E-Switch modify scheduling element failed"); + return err; } - trace_mlx5_esw_vport_qos_config(dev, vport, bw_share, max_rate); + if (node->type == SCHED_NODE_TYPE_VPORTS_TSAR) + trace_mlx5_esw_node_qos_config(dev, node, node->ix, bw_share, max_rate); + else if (node->type == SCHED_NODE_TYPE_VPORT) + trace_mlx5_esw_vport_qos_config(dev, node->vport, bw_share, max_rate); return 0; } @@ -246,8 +243,7 @@ static int esw_qos_normalize_node_min_rate(struct mlx5_esw_sched_node *node, if (bw_share == vport_node->bw_share) continue; - err = esw_qos_vport_config(vport_node->vport, vport_node->max_rate, bw_share, - extack); + err = esw_qos_sched_elem_config(vport_node, vport_node->max_rate, bw_share, extack); if (err) return err; @@ -274,7 +270,7 @@ static int esw_qos_normalize_min_rate(struct mlx5_eswitch *esw, struct netlink_e if (bw_share == node->bw_share) continue; - err = esw_qos_node_config(node, node->max_rate, bw_share, extack); + err = esw_qos_sched_elem_config(node, node->max_rate, bw_share, extack); if (err) return err; @@ -338,8 +334,7 @@ static int esw_qos_set_vport_max_rate(struct mlx5_vport *vport, if (!max_rate) act_max_rate = vport_node->parent->max_rate; - err = esw_qos_vport_config(vport, act_max_rate, vport_node->bw_share, extack); - + err = esw_qos_sched_elem_config(vport_node, act_max_rate, vport_node->bw_share, extack); if (!err) vport_node->max_rate = max_rate; @@ -384,7 +379,7 @@ static int esw_qos_set_node_max_rate(struct mlx5_esw_sched_node *node, if (node->max_rate == max_rate) return 0; - err = esw_qos_node_config(node, max_rate, node->bw_share, extack); + err = esw_qos_sched_elem_config(node, max_rate, node->bw_share, extack); if (err) return err; @@ -395,8 +390,7 @@ static int esw_qos_set_node_max_rate(struct mlx5_esw_sched_node *node, if (vport_node->max_rate) continue; - err = esw_qos_vport_config(vport_node->vport, max_rate, vport_node->bw_share, - extack); + err = esw_qos_sched_elem_config(vport_node, max_rate, vport_node->bw_share, extack); if (err) NL_SET_ERR_MSG_MOD(extack, "E-Switch vport implicit rate limit setting failed"); From patchwork Mon Oct 14 20:52:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835490 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7F561D6DC8 for ; Mon, 14 Oct 2024 20:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939296; cv=fail; b=ACyr4M7zrkUYR3xg4DdA/Ro9POS7vSYyfKpvXQuHmAUkfxv9CD+63dJS7SqyQbNcHbOIhP1wEreHeraSy4ySMf7kJ2g3iNB906iNihtvEX1HjKH9EQvSNqSoPskSy71IOWICRxLVJKrh6aoUBY8snb2zihkcdSG42ybnIxtgnpI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939296; c=relaxed/simple; bh=VLwhQs9dnZ5XHtoV5ZLmcPkY4DWYxy+OozDblERFFZo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DXS5UmHNgFphqAnPv3Ca1aE9NeaULKnCL/2Ave6q3LqLsieWDm/bNY23OfFnmI/VCQpHQNcEC+2dea4CKlxvYsQlHSAcHQqBSwrMg0Er1idP9wNMJhqHMLQy55NYzOqtj4o9Vx4M2RvMo/EelKdOankJQMeuK3AgJM7fq0MuQfc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=LtRna55k; arc=fail smtp.client-ip=40.107.94.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="LtRna55k" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ck51AZyiswaVjQ4YYbB3NevVXCAycHCDF8YtWweiGBgdABw+wmH5+g7b8za1rF38anOZKCZ6sL5bv90S/p7vBOfJ18nsBaWtuXkf+ixfwF0ZDbTweB26CXzKNSvUHrB0F4J1/ASYeG9byefPP+w61Mz82ephnTsZVZV1PeTQuF2Fbn/2mMW91/mGZdbNBs7b/H+3JfE2t5RQWP1oV7wijH8ph7n2wfimF0sJDW8KEiReQmkrKzeVzeYq77d8Bqdj3dwvAjG29DTUtEiDTxHxrSf28/EARnaGdaAqzf3jYp+ZHszEQpHkc/F9/+vpHVAGBjINtQBEMh2VXjrOuUn4Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=deoJFWw2vZ5jyr4u0p3XwoAyApnlhas/WCocvCV5QQ8=; b=I5vmNQgjekpVg5IMpQREEt5WjqrOviK8dca4lqBCkLmKcrELRm0ZYS6RGWsrX8gFP1gdDx00uYzDehiUtnqq7e9tUf/fW5BoGjlaisnKajx2QlrcgY+0iX8SsgW31zzzU0RwTlfrva2aDaAeG/f36C2r2+27STYh6Zk7jxWIjf/x3uF5MW2aSxYTuO9twhVDzt4rTJv2xcOgXI7tjSYA05ewCMVE/KJixlk2MasK6TYWsigeSVMuAPRGxL/EwXmapJCJj3aBGBBIG8MLx/42AQX/A0eCOTKMt/n93VcvjuYEqKrSCbdSKbs5E6UIPCH70b+jtISAc14haVaduAITMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=deoJFWw2vZ5jyr4u0p3XwoAyApnlhas/WCocvCV5QQ8=; b=LtRna55kS+U84q1rKNujz5HPTdEc8RdUQ5/7hGLnKspvVNWS9n8rmPSJYnzRQARtxm5QhIqLznHl36l45VuJEPNyHtYcvOSSvIaEwZePEzAIwLwzCybwSOgW6Su0VAWhvKlCogp7gq3SmKfEQ24tD50vDMT5/drPQXqpNJ4YYOInhlqcdi8RIxbmqBvQu89J/tCmBogf34qj5C5tZMNxzoe2QYjjnAZ6jIx64jaWFV1z8ZIg4160zya1U8yiwR+2JJTrfK1ed7ikdYE77zx+XcYkwKe8Dw6uocTYQGp8KIiKtsOK70qWPRdcv+l16xPxXp+hwYgnwo8GMCfBG9NaPw== Received: from CH2PR03CA0002.namprd03.prod.outlook.com (2603:10b6:610:59::12) by CH3PR12MB9099.namprd12.prod.outlook.com (2603:10b6:610:1a5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Mon, 14 Oct 2024 20:54:49 +0000 Received: from CH3PEPF00000017.namprd21.prod.outlook.com (2603:10b6:610:59:cafe::fd) by CH2PR03CA0002.outlook.office365.com (2603:10b6:610:59::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.24 via Frontend Transport; Mon, 14 Oct 2024 20:54:49 +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 CH3PEPF00000017.mail.protection.outlook.com (10.167.244.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:49 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:35 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:34 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:31 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Tariq Toukan Subject: [PATCH net-next V2 11/15] net/mlx5: Generalize QoS operations for nodes and vports Date: Mon, 14 Oct 2024 23:52:56 +0300 Message-ID: <20241014205300.193519-12-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000017:EE_|CH3PR12MB9099:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b7f53a6-b4ca-4e91-a4b1-08dcec9271b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: wiouQv8XZPNybAL2krOpfZLTQtsnQcOhx/bE8I3ijqFTn3ZA2SNYu6eY0ReOoeu908NILVG4CpeOUzCivkahJJN6X82DszIoxCPy7MY/4LGlMF5fYA7ii8vXeQOb/nBcFRPhnkAKhREojtbmXkyeI1m2riWxTgLV6yGOMqiBk3vgdoHr6s5xtg9L0lY/Z0dvi9zlIyoVoE2M5neqKmvrXeHLS4GgWeoqyTf4+HfFQvB/2RiF43VtvaUIN9Ava4Kqzem0iRI8snVlsLobHiYca5iGhcvZscL0G5A2leqICnreh58V5LtbAoXYsHQDxneH5jG/KwG3kz+T1Eegb49Fx84it/hS/3KyEu/PZP47CgOwyGBWDTJsMGGxsRiC4245MUlbjDT67ff5X59CHzzbyc98GpXkwkhZ1Th643lGFnGZyqIDTGFQcLg8PwTqpEbuSt+slT5g0rZamthViuFQk7prd+CIYMqLAV2tmrvtnVnvPtppNWuk20gPNuF14SrL4bVc7W+MyPHRdjxoa1zbZgbWSeguaukF/AzVKQaF9wlG06piivQ5XiKFFbNLy8f0tHPbK6BgaD2gv6/29BbvLfV0YaNPt6Kn3PxAUQc6kNZ2MJuwClMROrYu0g+mbm6apwc8rV5TB4cOklvzAX+F/GYFlZLZgYFj6wKIm0nEy77z7HwvKDQZT1C0Ko72soZrbmZro29Jqr8H5oS5buMNdgFE6jjuKcs3iS8SQNCJZPKEzdTojjzcjpn9y6g/6SuZ8A4qIQJQoERG9X11SALeOeMEL0km6xPPazddkK3xK0gS+AOCFEe7/z4J7u5Juf3v3lePUjQetQCiURjwd1fg87P1jlj1GvcF+/waGuvpRj0U62TE+jocSgxLW0ayPCyU7nT6wUSglvIXzhlUdSjFDwYiSziifQlOUiV/dNeT1eke9A9WkpUbSLS9mOiPwOv9yIp0eF4jR1zYeSpsXXJ0LCeMMtRVFDvwiz5gajI9xAFQELRTEepKsprhBmCTwzrQjZ853ISmB9BF87cDuMsTaQXdbdqo3Gskx04PBjIvE+qks3KFT0zKmwz+H/pCdJzvS+VXzx7aug/GDRmHMGYL4rM7M3a77dSBNCcyDogf5129H+Iw2JKenOt2Hy8mxXFWOHqzl4UmH/FvBoVXvfUgrP2/htRWqN3Ub60SmlMrkhTBJOAvbpfAxf02GQ/TX5uHqaJbZXj4V4nuTYYoC+z8QcONB5Z8q2zjL3xYv9/+hE76qlRYdb466x2b2aqsOpOCwapsoHzfo4JgnTq+zfUgmLNdMzrXPBFNfKtWXGPIEAdVZcdpMHplnBgZXr8ohRE/3Li+9D3Q7NuMrgzSYFehkeCpbZv8Yvg82/RP9IylSwI= 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:(13230040)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:49.5511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b7f53a6-b4ca-4e91-a4b1-08dcec9271b8 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: CH3PEPF00000017.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9099 X-Patchwork-Delegate: kuba@kernel.org From: Carolina Jubran Refactor QoS normalization and rate calculation functions to operate on mlx5_esw_sched_node, allowing for generalized handling of both vports and nodes. Signed-off-by: Carolina Jubran Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 115 +++++++----------- 1 file changed, 43 insertions(+), 72 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c index 519af66e2325..7c3e84b7ce4c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c @@ -168,45 +168,18 @@ static int esw_qos_sched_elem_config(struct mlx5_esw_sched_node *node, u32 max_r return 0; } -static u32 esw_qos_calculate_node_min_rate_divider(struct mlx5_esw_sched_node *node) -{ - u32 fw_max_bw_share = MLX5_CAP_QOS(node->esw->dev, max_tsar_bw_share); - struct mlx5_esw_sched_node *vport_node; - u32 max_guarantee = 0; - - /* Find max min_rate across all vports in this node. - * This will correspond to fw_max_bw_share in the final bw_share calculation. - */ - list_for_each_entry(vport_node, &node->children, entry) { - if (vport_node->min_rate > max_guarantee) - max_guarantee = vport_node->min_rate; - } - - if (max_guarantee) - return max_t(u32, max_guarantee / fw_max_bw_share, 1); - - /* If vports max min_rate divider is 0 but their node has bw_share - * configured, then set bw_share for vports to minimal value. - */ - if (node->bw_share) - return 1; - - /* A divider of 0 sets bw_share for all node vports to 0, - * effectively disabling min guarantees. - */ - return 0; -} - -static u32 esw_qos_calculate_min_rate_divider(struct mlx5_eswitch *esw) +static u32 esw_qos_calculate_min_rate_divider(struct mlx5_eswitch *esw, + struct mlx5_esw_sched_node *parent) { + struct list_head *nodes = parent ? &parent->children : &esw->qos.domain->nodes; u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share); struct mlx5_esw_sched_node *node; u32 max_guarantee = 0; - /* Find max min_rate across all esw nodes. + /* Find max min_rate across all nodes. * This will correspond to fw_max_bw_share in the final bw_share calculation. */ - list_for_each_entry(node, &esw->qos.domain->nodes, entry) { + list_for_each_entry(node, nodes, entry) { if (node->esw == esw && node->ix != esw->qos.root_tsar_ix && node->min_rate > max_guarantee) max_guarantee = node->min_rate; @@ -215,7 +188,14 @@ static u32 esw_qos_calculate_min_rate_divider(struct mlx5_eswitch *esw) if (max_guarantee) return max_t(u32, max_guarantee / fw_max_bw_share, 1); - /* If no node has min_rate configured, a divider of 0 sets all + /* If nodes max min_rate divider is 0 but their parent has bw_share + * configured, then set bw_share for nodes to minimal value. + */ + + if (parent && parent->bw_share) + return 1; + + /* If the node nodes has min_rate configured, a divider of 0 sets all * nodes' bw_share to 0, effectively disabling min guarantees. */ return 0; @@ -228,59 +208,50 @@ static u32 esw_qos_calc_bw_share(u32 min_rate, u32 divider, u32 fw_max) return min_t(u32, max_t(u32, DIV_ROUND_UP(min_rate, divider), MLX5_MIN_BW_SHARE), fw_max); } -static int esw_qos_normalize_node_min_rate(struct mlx5_esw_sched_node *node, - struct netlink_ext_ack *extack) +static int esw_qos_update_sched_node_bw_share(struct mlx5_esw_sched_node *node, + u32 divider, + struct netlink_ext_ack *extack) { u32 fw_max_bw_share = MLX5_CAP_QOS(node->esw->dev, max_tsar_bw_share); - u32 divider = esw_qos_calculate_node_min_rate_divider(node); - struct mlx5_esw_sched_node *vport_node; u32 bw_share; int err; - list_for_each_entry(vport_node, &node->children, entry) { - bw_share = esw_qos_calc_bw_share(vport_node->min_rate, divider, fw_max_bw_share); + bw_share = esw_qos_calc_bw_share(node->min_rate, divider, fw_max_bw_share); - if (bw_share == vport_node->bw_share) - continue; + if (bw_share == node->bw_share) + return 0; - err = esw_qos_sched_elem_config(vport_node, vport_node->max_rate, bw_share, extack); - if (err) - return err; + err = esw_qos_sched_elem_config(node, node->max_rate, bw_share, extack); + if (err) + return err; - vport_node->bw_share = bw_share; - } + node->bw_share = bw_share; - return 0; + return err; } -static int esw_qos_normalize_min_rate(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack) +static int esw_qos_normalize_min_rate(struct mlx5_eswitch *esw, + struct mlx5_esw_sched_node *parent, + struct netlink_ext_ack *extack) { - u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share); - u32 divider = esw_qos_calculate_min_rate_divider(esw); + struct list_head *nodes = parent ? &parent->children : &esw->qos.domain->nodes; + u32 divider = esw_qos_calculate_min_rate_divider(esw, parent); struct mlx5_esw_sched_node *node; - u32 bw_share; - int err; - list_for_each_entry(node, &esw->qos.domain->nodes, entry) { - if (node->esw != esw || node->ix == esw->qos.root_tsar_ix) - continue; - bw_share = esw_qos_calc_bw_share(node->min_rate, divider, - fw_max_bw_share); + list_for_each_entry(node, nodes, entry) { + int err; - if (bw_share == node->bw_share) + if (node->esw != esw || node->ix == esw->qos.root_tsar_ix) continue; - err = esw_qos_sched_elem_config(node, node->max_rate, bw_share, extack); + err = esw_qos_update_sched_node_bw_share(node, divider, extack); if (err) return err; - node->bw_share = bw_share; - - /* All the node's vports need to be set with default bw_share - * to enable them with QOS - */ - err = esw_qos_normalize_node_min_rate(node, extack); + if (node->type != SCHED_NODE_TYPE_VPORTS_TSAR) + continue; + err = esw_qos_normalize_min_rate(node->esw, node, extack); if (err) return err; } @@ -307,7 +278,7 @@ static int esw_qos_set_vport_min_rate(struct mlx5_vport *vport, previous_min_rate = vport_node->min_rate; vport_node->min_rate = min_rate; - err = esw_qos_normalize_node_min_rate(vport_node->parent, extack); + err = esw_qos_normalize_min_rate(vport_node->parent->esw, vport_node->parent, extack); if (err) vport_node->min_rate = previous_min_rate; @@ -357,13 +328,13 @@ static int esw_qos_set_node_min_rate(struct mlx5_esw_sched_node *node, previous_min_rate = node->min_rate; node->min_rate = min_rate; - err = esw_qos_normalize_min_rate(esw, extack); + err = esw_qos_normalize_min_rate(esw, NULL, extack); if (err) { NL_SET_ERR_MSG_MOD(extack, "E-Switch node min rate setting failed"); /* Attempt restoring previous configuration */ node->min_rate = previous_min_rate; - if (esw_qos_normalize_min_rate(esw, extack)) + if (esw_qos_normalize_min_rate(esw, NULL, extack)) NL_SET_ERR_MSG_MOD(extack, "E-Switch BW share restore failed"); } @@ -525,8 +496,8 @@ static int esw_qos_vport_update_node(struct mlx5_vport *vport, /* Recalculate bw share weights of old and new nodes */ if (vport_node->bw_share || new_node->bw_share) { - esw_qos_normalize_node_min_rate(curr_node, extack); - esw_qos_normalize_node_min_rate(new_node, extack); + esw_qos_normalize_min_rate(curr_node->esw, curr_node, extack); + esw_qos_normalize_min_rate(new_node->esw, new_node, extack); } return 0; @@ -581,7 +552,7 @@ __esw_qos_create_vports_sched_node(struct mlx5_eswitch *esw, struct mlx5_esw_sch goto err_alloc_node; } - err = esw_qos_normalize_min_rate(esw, extack); + err = esw_qos_normalize_min_rate(esw, NULL, extack); if (err) { NL_SET_ERR_MSG_MOD(extack, "E-Switch nodes normalization failed"); goto err_min_rate; @@ -638,7 +609,7 @@ static int __esw_qos_destroy_node(struct mlx5_esw_sched_node *node, struct netli NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR_ID failed"); __esw_qos_free_node(node); - err = esw_qos_normalize_min_rate(esw, extack); + err = esw_qos_normalize_min_rate(esw, NULL, extack); if (err) NL_SET_ERR_MSG_MOD(extack, "E-Switch nodes normalization failed"); From patchwork Mon Oct 14 20:52:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835491 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA1611D2238 for ; Mon, 14 Oct 2024 20:54:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939300; cv=fail; b=dXAOx1v2gq0vFSLQlqEk6wfrZJ8zR9XuE1NiJYiGJX/L8ieYeXgD1ST2bsaoitypA8FwL44GUBaISeaTKHZre7kywPyGB2izS4XCknpbrBV/HwMaYPyM/1G9CYRl6AEVHtWcjNv2M+trIc4HYUst7R1qGD1hJexpx/ba3si0PJQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939300; c=relaxed/simple; bh=2TcKTPp0bKnP/mWG1aiVa/q3LWtt41hAOhsXyxShtXY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=azldG/6iHJ14SQaGkmdSm4y+y2M2yjhMLwYZgT6NDND09CvPkbXJthC34jll46idC1O3FjGpv6LHv5s176G0fb2e32PLW8h6j8wYWanQCxr+To3nl9m5mikicooUudPTji42/0BOiomUV0l6Io+hN10RCIsYR3x3rfYgZB3twWc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=sNBqosxv; arc=fail smtp.client-ip=40.107.220.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="sNBqosxv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=shRLgn4bp+A6UqjDlmQ6FxBZpYbD1wFhvM9Pya/DkRhLiYQAcwkA7ZxRK3TspTUT8TSr2et1oAiGIroEQ3qT1OkI7A1D09k1GYYHgNyRNNlhd8T8+fkOU+1u07q3sAJLGjC0VmCkLo4u3POxxoFJ+fG9kFYa+Ks1b9qcvHM65/Shz46tUC3A0iabnrnccScLL7GT7Bqp3CuyAnXiMfoXy2FlCmKhdm0ggRzSYZr45dEnt2ielXS6osvGw9ZP6VMucrtPObvOOcm3ZAizwOxw/1i2Ne4WhnHf6Aw1RbOXKakO0uB0BrLlBi6gGTOmVgpBHoHatEMnrzt+ZhlJo2zqug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CV1/mQR5oVJudf1fDkcVH8tyGjewAHXQXSphYh4Ty+I=; b=uAuKZwrSKn32YTt6SdzBLs85B0qeZiBPOMsdT5FWIu3QaLn6QumIdVDhub0co1EFRuXfNOl3KG2yf6qID0qUt/a1EQqP0kK5qo0KfCZZRheMYDFxWWYZUJ68W6CROHwSHnD3ZYkFnzskiPbP6cXb7diK81/jBJVBsrZuy3KhtPYivLXzONeKThAeFvPlPGhhoxfMwvA6rJskSog5MGzLzh4Nehl9jt3fgnJrvPscuZAngYAr8UpqJeHBczLQh7DbKiQRue78OSPGZ2bnQ2I26AedPiYUsLam/1QiXS3xOjFgfNJ7AbAyddn5HNNfDAGZ3Mz06xGrIFpgexH4Q5fTdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=CV1/mQR5oVJudf1fDkcVH8tyGjewAHXQXSphYh4Ty+I=; b=sNBqosxvW9qWzKz8AIX5pMqrbkpjX2omkhieI0WgWtSe6qKbgnjyc4EUG6VIFwQe2umoOotQWnXZTuQAj3eqCPyyZKHdUo/QqxLQBMPoT1XgPBrzOzDlTyd9107gkbWRCblzWjDmS9OyjCEk7ZN27cOTfE+Gegis2vY1oFJ+1pJc6vzUagM4u3bGM+S2SG8gY7m87jB8jfjiNKFM9gxXOx4vlcN7jdGfa/A6ZZcoeFq33RZiEO1a3BLVSBpbr/RrX5Sm5EQlHJzbdfQNeRfd9UY6XioAIML7Godjpj7dUmYFvZxuElx+l8AUvH2+UbSZiftphrb9y/p0bzvfYm0J9w== Received: from SJ0PR03CA0131.namprd03.prod.outlook.com (2603:10b6:a03:33c::16) by DM4PR12MB6328.namprd12.prod.outlook.com (2603:10b6:8:a0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Mon, 14 Oct 2024 20:54:55 +0000 Received: from SJ1PEPF00001CE0.namprd05.prod.outlook.com (2603:10b6:a03:33c:cafe::20) by SJ0PR03CA0131.outlook.office365.com (2603:10b6:a03:33c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Mon, 14 Oct 2024 20:54:55 +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 SJ1PEPF00001CE0.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:54 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.1544.4; Mon, 14 Oct 2024 13:54:38 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.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.1544.4; Mon, 14 Oct 2024 13:54:38 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:35 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Moshe Shemesh , Aya Levin , Tariq Toukan Subject: [PATCH net-next V2 12/15] net/mlx5: Add sync reset drop mode support Date: Mon, 14 Oct 2024 23:52:57 +0300 Message-ID: <20241014205300.193519-13-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE0:EE_|DM4PR12MB6328:EE_ X-MS-Office365-Filtering-Correlation-Id: 3366c018-dad5-491b-2185-08dcec9274dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: xbVRZGSiiRrXpKOmWWk5j3uFyTFcw3AYt6Sup/fu5FVl9BOQZFN0qlc83Qx+Ow87XXTco7HAl3tCofoX8KZ7MkO0vBcx9BIKQ5x9TgdiLVRzNtrflGf8Vd+VbEPl6Xsn3a9c/jJah2UtrxC2ZLbgT2hvHb0YK+r1WqrsOo9GLGLfxmh5ZSYKHH/hlc0uVXgVJI+AgX21CyePRh4+R/oHK2Iz3QTWnWBHIy2h0aNeLs4+dM1g5p94pPu0/RZT162jbHIBH3yceEnDwgJjYabd1XuwWHLcTz14vykzeNvGN1KdSRI8MhutSt/Jnk0+tdN2K+V8e/hBj0NwUm3I6EUuuFnowU6FWFOO9CheP8puoOokrU/3HxAFkdLBuvfRGMfwm8xAFNLpQv8+8FcvSYU6/uTtMnQar3A/O04g+0j2et8l1U3a2l/FPfUdFvjvs29hHDdBsVSuoRXp06RDmV3C0eViDI1cYX/Rtjxc2PPr3k0+hd3Q9XOv6ZDpEZ3YpXiPmlFMQi9nOc9WpCMw0QW3QpcKX5dmWfC05tWri2kjM4ZTt8xeYFkchS60TMpcXGRr5Ie0wBcmSYaV5LAB8KTXPhnw7G9FPN79cHPHgix67snCXpWBnqF0VSDIV6dcYNpfMwxIZF4ZoHgRR3RhPw7IbJokyAjkt920NREUS/31fiTi+BIL04v9CrAJQlOnme9c4LoIjOliky3X/UuoVxjg3KapqgLWzizbUKns9tyA2mMiUZ8dLSB/a3koP+KpppxDiOepQO/sIAJr2+tu+QPW/jymAUWklvWTZVeI7LbToWjOGtQHB2Rgy5iuH3GZvh1MByaJGHU9/9OHN5U+8DwGyz0PJM7xgD3HIBuSYvks2QObg8Vss8f21YqZhPsuRw5soZqXcRC7KXQyNuAgnc+b0KIv0GxrKgl78KH6AasJsSKtoZQvXwtPOGFvVym7VFjAb5wswJEyCXNN9ivDZct5x0qwjrRM2IruWvvpfBGkKuRPty+QEV+thjnhe4DXJoIhjQRft9Sz2AJ3uoCsJmqWsuakHHye+bx1HWFm/aci4T1fJgbN2j38M8GLeMBuJX536xVwK2LU3XZO4Nm1giodsEyMyqRKUpsyt07I72QdMuSEjHVVWJKrEUEsPetZstd4XG0edrnoqrN4VFDYMYbZ9TlYg49wxRFDZDoz5S3cwBefk2/whzBpxU2I9laDdsvo7viPjClLcPU6+zJg0zHxQDT1tp127SqCY5jrAmrmzmEnhwbfGHSGBOkdhgoqIKH+OgaJd5jFikqmm7YIHDn7Gn49MRRoYzSMYP6Tkb+ck3BI9GVTm2iO42AfceyZxqtJ6Oij00dYMH197V62ZNbdPfbcIhbxTDBdsR4VBqFrGyJDF6lrLFFxDSGD9QzLMUME 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:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:54.9106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3366c018-dad5-491b-2185-08dcec9274dc 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: SJ1PEPF00001CE0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6328 X-Patchwork-Delegate: kuba@kernel.org From: Moshe Shemesh On sync reset flow, firmware may request a PF, which already acknowledged the unload event, to move to drop mode. Drop mode means that this PF will reduce polling frequency, as this PF is not going to have another active part in the reset, but only reload back after the reset. Signed-off-by: Moshe Shemesh Reviewed-by: Aya Levin Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c index 4f55e55ecb55..566710d34a7b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -35,6 +35,7 @@ struct mlx5_fw_reset { enum { MLX5_FW_RST_STATE_IDLE = 0, MLX5_FW_RST_STATE_TOGGLE_REQ = 4, + MLX5_FW_RST_STATE_DROP_MODE = 5, }; enum { @@ -616,6 +617,7 @@ static void mlx5_sync_reset_unload_event(struct work_struct *work) struct mlx5_fw_reset *fw_reset; struct mlx5_core_dev *dev; unsigned long timeout; + int poll_freq = 20; bool reset_action; u8 rst_state; int err; @@ -651,7 +653,12 @@ static void mlx5_sync_reset_unload_event(struct work_struct *work) reset_action = true; break; } - msleep(20); + if (rst_state == MLX5_FW_RST_STATE_DROP_MODE) { + mlx5_core_info(dev, "Sync Reset Drop mode ack\n"); + mlx5_set_fw_rst_ack(dev); + poll_freq = 1000; + } + msleep(poll_freq); } while (!time_after(jiffies, timeout)); if (!reset_action) { From patchwork Mon Oct 14 20:52:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835492 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 921521D89F1 for ; Mon, 14 Oct 2024 20:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939303; cv=fail; b=Ve8FzQZ1SW0Gk3LAKDjzTSrU1Nb6ULbpr6Z+tCqufIhhTQEwxL9LLRSXwR3MhioVWMf9r8/hqjiXEz1wnCjhNEK002TmZk/K9wX3tipfi3/IxD/Pg+PF4MyFZBUVWRqXij2loqs1ZDxdERVsZuVcwxPjNy5ZjBM/9KZViMrFs5s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939303; c=relaxed/simple; bh=3ndkomccHSzoxvPlj+dYmHnV35jwci+om0km4oZnWzk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JazHqu/JIYECmsUs3ypL4+ZRrl4bjFTe7N3ZLurseeujTzT+DT9EuqPd+yhx/Ca2sSjfrypiGlcqkRINU/qNtditnNUdVhNr2GKdXmrJ8VEIMaWXt5NXstVN9SyoAfO+qqufTimgEBArAgNkNtjgly0mcq+saCChveGowpIVblc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=hNyqNcDe; arc=fail smtp.client-ip=40.107.223.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hNyqNcDe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JAj7Mt8XfEj1ymLgRRex4PCQ0Uj/Ioq2kH3rfG6R05riaZ5nrzq7Lenqb+dkkfI7Z3xUJ8u0VvXg+C1wbinvONQ+7I4BnCnOa+E5fRErR+SK9ODqyJP3qb9q7weScAE0oftIz6Swtyz03H+Sn/8K4zx8hhCol10C9sUd0tILGg+REnIlz70zZUPv/h7ccSvUOwgXFIyQODJxzMdE0/QdG4DbO2QWFE3g5oF76pqbBgLGJRv4r5Aay5hAXTA450G3a0Zd3iy3cLLqygfEgRxzJhe6yIxsGRITFsuVvSICWTAVj72PkxfHmvaU7rKJsldowx5Wn8rLhhcf9uW7qCmSdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jeYzfla2qMqlpadDr3MJ2Bc6hnipuwXYDrlL3CnlCo8=; b=DPxUCt547hT0F1dYqXRv2fsOV5ZCWgAlyLDkQnp5bLmE0fyHqGMX5Fag3kBNhBAg7V5bQR+Iha0OqlARI7jsTbCK2/oOHWiX2q+jqQt/XyhuOwiolmPPc/HbfvNNFbhcwclVc95s+QG9EO43iFMH1W83Y+yEGkJkPa1OeISPpi+5lXG1yqjS4yhU3jf3lsn0mXnkhzKw51eXccZuSzbOvfz5jqkZunDkYAOEzoiuIYz04CvtpmAmlJhQNxSwNuBHneebj6uD/P3IMToLko6MZd3cxA2Gm40DnxhpxbGNWQDClTAIkjBgfRG8mh5BdMwqfLfEX3cjSgWd0w9F/6bZew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=jeYzfla2qMqlpadDr3MJ2Bc6hnipuwXYDrlL3CnlCo8=; b=hNyqNcDe0U4rhva1IIlJnGcQr+RelOOivhbJeaZvgoM1/dNYncfckmZit/urKcQfVpE9Lb5Bodbyw3knEeDRD5ovIBRpU1Hr1GXJnecd0An4FD5bne27EslvohtA+wjzAUpsRZGEqQrRY6IIFx90aWVnSL5ejp7T4BqkMM+H4HXmsR9ed1BnmY/VyWKQ9J6oQMvVNob3DFV+CmxfAtNrf5SZgHWWFOams9BdalIjXEh8sq+gDKWFmWbylj4kDBP7Qp+8dTqG2iKD+lkixFJnXW28B+tuvvRDvyAYDA801N0car43HWiW6kSFGWLqR04alAKlon5/u/NHjJaOmOYXUg== Received: from BYAPR08CA0053.namprd08.prod.outlook.com (2603:10b6:a03:117::30) by PH7PR12MB9074.namprd12.prod.outlook.com (2603:10b6:510:2f4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Mon, 14 Oct 2024 20:54:57 +0000 Received: from SJ1PEPF00001CE2.namprd05.prod.outlook.com (2603:10b6:a03:117::4) by BYAPR08CA0053.outlook.office365.com (2603:10b6:a03:117::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Mon, 14 Oct 2024 20:54:57 +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 SJ1PEPF00001CE2.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:54:57 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.1544.4; Mon, 14 Oct 2024 13:54:42 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.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.1544.4; Mon, 14 Oct 2024 13:54:41 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:38 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Benjamin Poirier , Tariq Toukan Subject: [PATCH net-next V2 13/15] net/mlx5: Only create VEPA flow table when in VEPA mode Date: Mon, 14 Oct 2024 23:52:58 +0300 Message-ID: <20241014205300.193519-14-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE2:EE_|PH7PR12MB9074:EE_ X-MS-Office365-Filtering-Correlation-Id: c8111aef-b18c-4c9a-1a1a-08dcec927646 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: o45/p4bhUlCTN/mS/kwZ3pk51ouz8BTaXsThIPc6zdDWbkmHPFhyj3+12oLoBEWyU4mNMxe6UU3gyBqA0zVATTde89FL3B7MBfBwTX+CO9qmkn54VTOTQC8iRsXYElHgLsCO8m6yIy2i4OMhx6le2eQThnSuHKOYFcdH2xGMLOphuN8UZwF7FH0CG7BFbCJe9fI0ntd6+q4Z1+TRjnuxDHWa6UMsJ4/rYM1l9EfvL69yx/9j3Il+uhZjtaQIsMvtzhSDoW/OZ6UYfi62F0jc8K2KcuXYOzBufHZv5wMNxjkRjqp0n3gl8Zmg0q33HruHeMMy4pdp8ZJ9Wqr92A+rTuaRL9mCXHPUx4Ylewpk7vC/aVJrcNDlCP7/O2VJjwYAir60Seb26UdoSoEfzNMJwme9PdjpcOEvOxHG7QFygtk0axlcafyoSzLy7tmFjZWE4d/FOC9NSHHWv+ZUPSR2qKAzihPaVZDZC6MpAX18p15SmSi5Sxsp9eqgv+omlzE09hRyQRBFf1LhclYf9LbwJb3LPcHYK3y6nzkwPnArsTZ/q/MqAZg5Esn9jm97HaSn5w0E8bZfpxWI8up/DInyQ1E5v3RnLEIgZ83WCNtPyeq+7Is9gx8tsJILxLKSb0qoEBFi+SaSgnDGtBADSg06UGOJtMuakfdHsBBa1ZvlUw9KtkQc7gAmm1L4Z5wpuW22qk1kfx6z5xwUa4ZOX9RLx/VZG1MWOD49z0cZ1+nXFavdx+IFH2Mq3aj36t9f1FMEEVq8DRngHcSgwW+n7+qM76Kq9f99m0NxkX5HAdKTg80CEZd2mrfrvtaiGsiC0AmAxK+iXVvjW9bf3SVkY+1fPsVVJYKrWoF1fvaGICw69CDi9JKZnC6l4RuZIYVOO9XWkA+JdtZRe6EgbOYLdtD3UR6p3CM4PgjkZaR1m4sxRv9mGcueqJvm9ROF3zgVsyNtw3N09YmhG87ELWGJ/14LhqNfzJLdAAXvg9ieg0LbiRUUQfLla4J4087OEK658m+kgVZFx9rUQaYKYuAxtfRzHkT1m9ltMLNeT6ic12JCLbv3sKTKXYp6EtaZyJJ4/wHENUTgvGRpLFCnNDJHNx5V3SEBRZyPkt393oWAzKcu8y5sgQiAU9J7AUli9qc71cZNYluy29HOkTUPyWcGFyYOtahMEP9z1SgVISoKMRy/6j0EiyfHciNA1ci25FzV41XTt7NxkHwCZvUdJrVeES2ferR9BkeAwMBXRIp4YWTBEYANcN3Rmul0sozCozBBADyr5pGCAvh9UawS7UmcJ3htBjbWcFOaZ3M30qxlKvBx2eNmXzLLreqqnz4bILqyg2Ye7mT8KON32VT/p3cBXE9ZN6Hlbkg/EByePw7SVB14yYoEWPdMbYOfXx3D2+ixM9I6 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:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:57.2047 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8111aef-b18c-4c9a-1a1a-08dcec927646 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: SJ1PEPF00001CE2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9074 X-Patchwork-Delegate: kuba@kernel.org From: Benjamin Poirier Currently, when VFs are created, two flow tables are added for the eswitch: the "fdb" table, which contains rules for each VF and the "vepa_fdb" table. In the default VEB mode, the vepa_fdb table is empty. When switching to VEPA mode, flow steering rules are added to vepa_fdb. Even though the vepa_fdb table is empty in VEB mode, its presence adds some cost to packet processing. In some workloads, this leads to drops which are reported by the rx_discards_phy ethtool counter. In order to improve performance, only create vepa_fdb when in VEPA mode. Tests were done on a ConnectX-6 Lx adapter forwarding 64B packets between both ports using dpdk-testpmd. Numbers are Rx-pps for each port, as reported by testpmd. Without changes: traffic to unknown mac testpmd on PF numvfs=0,0 35257998,35264499 numvfs=1,1 24590124,24590888 testpmd on VF with numvfs=1,1 20434338,20434887 traffic to VF mac testpmd on VF with numvfs=1,1 30341014,30340749 With changes: traffic to unknown mac testpmd on PF numvfs=0,0 35404361,35383378 numvfs=1,1 29801247,29790757 testpmd on VF with numvfs=1,1 24310435,24309084 traffic to VF mac testpmd on VF with numvfs=1,1 34811436,34781706 Signed-off-by: Benjamin Poirier Reviewed-by: Cosmin Ratiu Reviewed-by: Saeed Mahameed Signed-off-by: Tariq Toukan --- .../ethernet/mellanox/mlx5/core/esw/legacy.c | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c index 288c797e4a78..45183de424f3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c @@ -176,20 +176,10 @@ static void esw_destroy_legacy_vepa_table(struct mlx5_eswitch *esw) static int esw_create_legacy_table(struct mlx5_eswitch *esw) { - int err; - memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb)); atomic64_set(&esw->user_count, 0); - err = esw_create_legacy_vepa_table(esw); - if (err) - return err; - - err = esw_create_legacy_fdb_table(esw); - if (err) - esw_destroy_legacy_vepa_table(esw); - - return err; + return esw_create_legacy_fdb_table(esw); } static void esw_cleanup_vepa_rules(struct mlx5_eswitch *esw) @@ -259,15 +249,22 @@ static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw, if (!setting) { esw_cleanup_vepa_rules(esw); + esw_destroy_legacy_vepa_table(esw); return 0; } if (esw->fdb_table.legacy.vepa_uplink_rule) return 0; + err = esw_create_legacy_vepa_table(esw); + if (err) + return err; + spec = kvzalloc(sizeof(*spec), GFP_KERNEL); - if (!spec) - return -ENOMEM; + if (!spec) { + err = -ENOMEM; + goto out; + } /* Uplink rule forward uplink traffic to FDB */ misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters); @@ -303,8 +300,10 @@ static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw, out: kvfree(spec); - if (err) + if (err) { esw_cleanup_vepa_rules(esw); + esw_destroy_legacy_vepa_table(esw); + } return err; } From patchwork Mon Oct 14 20:52:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835493 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5085D1D0F79 for ; Mon, 14 Oct 2024 20:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939304; cv=fail; b=YqzRXjlCTSfBnnbu7BVgFbTfBQniy4r0KaOoGWnSrq2N0/sBE8TIp73IRQW+Wc0Nr6Wd1zmVfdg3WomhRgRH+Jm1xUNVozIG8llDPTKiCacONnYUte9VUJ4PYCyHrmhHUR/KBc4u6tslPUKPsLaS6PzygMkw+xjHswfVrrfdmBI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939304; c=relaxed/simple; bh=VUOn6GXCvm7h50UJKNENBsm+dB0humSVJ2tCYNzLd9s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=J1DmYUhXw5E/YkP1BH/hj15izn8C5Gequbfo8iELFnWRhi3fhboH5kHhrfBgrhfn3Ej1i+sS3X/fPxkJRqLZHmrk+mTTWli1Ag5rAMBVSBydlSRQmoSQ/5wnqKmMHAMQLXYXS4DbWWmqB6okVB7cxe3Kor0E+pb44aUE4qKEYMQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=LcrEyenp; arc=fail smtp.client-ip=40.107.93.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="LcrEyenp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CLctbFBxFS+pA03TVThkMZ6Z1d+qqSxgbX/MEixPtgjw+6by6Yo73blvqk0ajYw1cocBKQ1npqulVXzhQBVXBrIRqyGoS2u1XQnAS9qXw7KeBjW+kZ4L1bffIuSt8/56Q9n0hGcFmPHkyN8eBsjEY6n2lxrsdReKEjuM9H3u5eqOcaRg1wAEoz1+e6yP6SZcy/08y6y6XOWSO69ftb8j7JopoeL/UHlTxITG0qOALeLqYljLXYeXNuIGhrtZdoCwDX+sq5aKpHYTA4uZUiYy0qASq5/wYlPFXoI5BQVRhV8mxXJHhQazdIbSSa0vz9OgGZsO7pbD35P18YU40CzHgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CbH93SHmMh18raBkI/tOE1it7xyJd1pXIMJ3n3AsNYY=; b=kAUuXzkv6SDjB+fesCu5mGowOuOxtG43JF707TN90fG5Eehf0vfIhM8lzLozh8ZLw9YZTttfRSG9k3CP3apUABCK5fXuq2VTkxzyJqQqF9F2y4W+BokeEmMN4rFnqszDyfzwawf8k1KiW29/Hsci31lgUahwkH9s1k7tAUbrg6rB9zxEvGgwZsyLO07Wa5F9JKl/gIT0BxHtI9QNq5r1eteNe9XRr9G7IH81XVue+DAESf/Y4/hA+Wra+C8PohHuIaxjvqNB02Vk/q1XRcIpPBYn7QfsWpNazW2ExfDeHvc6JRR548DcUaT0JKgYG6KgR5iMRrJx7BWyHHlWSEYWuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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 (0) 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=CbH93SHmMh18raBkI/tOE1it7xyJd1pXIMJ3n3AsNYY=; b=LcrEyenp37kxA3s64G9soDMGuwF0QFQ433GW8mLGwhJrkGMP0/GKa4LTSyIAKQoVDQ8S+Glc1OtFW6CnK4AZ9zuwx7oDaKOExnlYQwNTtS5P39rG+0zXVrT84d2VM3PE9MUQxnLsNzIUwzB3Uj+jwFYCF4WtlRAntmWhaSlkUY85etS6mXrLRLcdk5uyEkbJ72v1abLWiWOUBwarqc+8OZMzCX46Wsy+7uDzbHMN63DQ/kN5ESeDBzTt/2+x/IIHzhvh97bhRqNgMPcXN7+v013e0k8DzkEk+OPSqRvUY5JiWWhK8nb+d4lF/FWlCS2db9Gju/zXYir1mzcsBtoSkg== Received: from CH2PR03CA0018.namprd03.prod.outlook.com (2603:10b6:610:59::28) by IA0PR12MB7751.namprd12.prod.outlook.com (2603:10b6:208:430::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 20:54:58 +0000 Received: from CH3PEPF00000017.namprd21.prod.outlook.com (2603:10b6:610:59:cafe::3c) by CH2PR03CA0018.outlook.office365.com (2603:10b6:610:59::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Mon, 14 Oct 2024 20:54:58 +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 CH3PEPF00000017.mail.protection.outlook.com (10.167.244.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.1 via Frontend Transport; Mon, 14 Oct 2024 20:54:58 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.1544.4; Mon, 14 Oct 2024 13:54:46 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.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.1544.4; Mon, 14 Oct 2024 13:54:45 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:42 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Moshe Shemesh , Yevgeny Kliteynik , Tariq Toukan Subject: [PATCH net-next V2 14/15] net/mlx5: fs, rename packet reformat struct member action Date: Mon, 14 Oct 2024 23:52:59 +0300 Message-ID: <20241014205300.193519-15-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000017:EE_|IA0PR12MB7751:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f27dbe7-4bf1-4168-3d97-08dcec9276e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: nxwQisBnRmBTPUKYLMp0USf1Vdqn+zzJtcv468vFVLVo5ZOUPG9sfPpWVw6AO7jLic28MAP/GQht7NRhEHhJ+u90aIx3nuZaSEGQKV9HdPe6SKTlD0a+UacPn3f6Q3Kk8ZcsUsR8SAl6zRO+biT5OK00AqECB/vgC5u4P3DNgcTWRgnJ45s3BFrxS1CjO0zAAL6rlxhHJkM4gEnuaWFWb+4VLn7t7P8MHrJ6JvzIAw1E4v2CUmwXwd60/nh3NfQN7wdPBm3lLuv9jKRhmRFmf8mOfRQa9/u4CsDq9p3l6yaugQGk38SZ1Laz0ZXc1AMDYssoAxFaqxkKZqNiFLbtic+8Qb0hpynlexxjnW95SgUBkjzUpdhSG+qXre074dIhKgLRqikc83o/hFxMBu9G9uSQIvpdd7xBJLAi5+s7Gi/6tGVH463gK0hnFaseEr6DTf/16XlbTVbiE3c7cJtaL+B9wM7gQCHplMh0V2op+ABiclm/NpssL7bmkApEQUje6IEAl5vmBv/IMYBoRXnD/pS02X50V8tL2kbopzDbKsAbZPUvlLYFYdcbhcYpOghnK9+XoND1C1X+5e9pr74FCi96/c8Q+GPzNuNCdAaSwerU9rHmNMlPEq383y0jRpLHUwjbc+yP4ywYq+oeqqQgRSq3J52xgIDCg/6vhFldtg0vWHSCgwZwzCWz6pOzdycmBNwfoucQavWI+r+MEq7h3hIgW4/R+lwgsg0MCpawUbMYARiHn65r9X4defs/Jc7/PmPGPTmOSDQ81KSLBgaMXrRjjjCxQLPGAiLvWbfdY5WzeBPlrFScQU/JFhnc2apstYOEdk/II+pmJVpL34lsIdZd3epB0V9SqjNpinRAf53rjhbIejYi/nMUA4C441A/s3HqieJodGu4iKz/SXvOFaEtnRmsjeoRddVZiUPZNXtO3FzW6YAN62LN+7xKGhOmADUe+6DEMEYuIxOpAkj+5j7yP0wJHKTB4aMQQH06U9JpTYapggMuoMJKr5n3g+YjJupGfNuf/S+x1T6HPDHThx6NxLo+ECPBoMhM6be96r7MHSX1kIH/I2kewaQ/5DPndQJ7LeLzcli0y4fXiAictHEK1Jj+i7I3InDdrGOw+dEXKENn6lXo6b0m1/YM5uQ5/rlBeXuDRThntnwk8lBM7Na18Fj2PTRf0pC7j/zriXRKQDTsotTkEW43k/Yfbdj9FSfaPKsHnR7L8374jKFkQ3yLEdwQsSo5PUiw5IT5UAeWhZ9acWKnICUedRtKDnbTZWB93qtUf+Cr5rxH6ZH78tG6UKdFV8IIcLiqnSR4ro9DAcvT+LmAwv7+iBw2HXAMFHJ/zzISFZCoduPvsDeDxryJq3AMygVrGLJbJD7h1TRiluymNVQyTLX+l8Xmbb7j 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:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:54:58.2229 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f27dbe7-4bf1-4168-3d97-08dcec9276e6 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: CH3PEPF00000017.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7751 X-Patchwork-Delegate: kuba@kernel.org From: Moshe Shemesh As preparation for HW Steering support, rename packet reformat struct member action to fs_dr_action, to distinguish from fs_hws_action which will be added. Add a pointer where needed to keep code line shorter and more readable. Reviewed-by: Yevgeny Kliteynik Signed-off-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 2 +- .../mellanox/mlx5/core/steering/fs_dr.c | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h index 964937f17cf5..195f1cbd0a34 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h @@ -73,7 +73,7 @@ struct mlx5_pkt_reformat { int reformat_type; /* from mlx5_ifc */ enum mlx5_flow_resource_owner owner; union { - struct mlx5_fs_dr_action action; + struct mlx5_fs_dr_action fs_dr_action; u32 id; }; }; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c index 833cb68c744f..8dd412454c97 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c @@ -256,6 +256,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, { struct mlx5dr_domain *domain = ns->fs_dr_domain.dr_domain; struct mlx5dr_action_dest *term_actions; + struct mlx5_pkt_reformat *pkt_reformat; struct mlx5dr_match_parameters params; struct mlx5_core_dev *dev = ns->dev; struct mlx5dr_action **fs_dr_actions; @@ -332,18 +333,19 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, if (fte->act_dests.action.action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) { bool is_decap; - if (fte->act_dests.action.pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_FW) { + pkt_reformat = fte->act_dests.action.pkt_reformat; + if (pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_FW) { err = -EINVAL; mlx5dr_err(domain, "FW-owned reformat can't be used in SW rule\n"); goto free_actions; } - is_decap = fte->act_dests.action.pkt_reformat->reformat_type == + is_decap = pkt_reformat->reformat_type == MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2; if (is_decap) actions[num_actions++] = - fte->act_dests.action.pkt_reformat->action.dr_action; + pkt_reformat->fs_dr_action.dr_action; else delay_encap_set = true; } @@ -395,8 +397,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, } if (delay_encap_set) - actions[num_actions++] = - fte->act_dests.action.pkt_reformat->action.dr_action; + actions[num_actions++] = pkt_reformat->fs_dr_action.dr_action; /* The order of the actions below is not important */ @@ -458,9 +459,11 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, term_actions[num_term_actions].dest = tmp_action; if (dst->dest_attr.vport.flags & - MLX5_FLOW_DEST_VPORT_REFORMAT_ID) + MLX5_FLOW_DEST_VPORT_REFORMAT_ID) { + pkt_reformat = dst->dest_attr.vport.pkt_reformat; term_actions[num_term_actions].reformat = - dst->dest_attr.vport.pkt_reformat->action.dr_action; + pkt_reformat->fs_dr_action.dr_action; + } num_term_actions++; break; @@ -671,7 +674,7 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns } pkt_reformat->owner = MLX5_FLOW_RESOURCE_OWNER_SW; - pkt_reformat->action.dr_action = action; + pkt_reformat->fs_dr_action.dr_action = action; return 0; } @@ -679,7 +682,7 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns static void mlx5_cmd_dr_packet_reformat_dealloc(struct mlx5_flow_root_namespace *ns, struct mlx5_pkt_reformat *pkt_reformat) { - mlx5dr_action_destroy(pkt_reformat->action.dr_action); + mlx5dr_action_destroy(pkt_reformat->fs_dr_action.dr_action); } static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns, @@ -836,7 +839,7 @@ int mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL: case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL: case MLX5_REFORMAT_TYPE_INSERT_HDR: - return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->action.dr_action); + return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->fs_dr_action.dr_action); } return -EOPNOTSUPP; } From patchwork Mon Oct 14 20:53:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13835494 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2060.outbound.protection.outlook.com [40.107.236.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A9FD1D0F79 for ; Mon, 14 Oct 2024 20:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939312; cv=fail; b=ORehzH5gojBJgb9iv1dawVlUPQbocYJ+FC9Z5U0bkXjXi/bQMCMaAufkBR96GPcl0eX/HR0LiiwMAdHcz2yWI/8rf5uQHgmy5WCkEp+oi6q+TGHk/B0yDFM2JHGl35Vrve1tzEgwfMdSqPKs3WABewmmIFzqms3SZLGQrMRykKU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728939312; c=relaxed/simple; bh=XWoF5XaVejxIkEO45xtz3w48T0S5rypCOKStgFdtwlo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fFfXTaWLtRM5EBbSW+UWKEFUX2ffq4aDAO6S18jbvPevj52iaTDY6CaxYkbR14lRjKMh1GHgZFcHXkMmIsh8WoiyQGw4nc9sDi4QzHY738HL5axWtVd1qu27NQ3/ULBv81ym1B+0XtGF9T2P9QqA9PZZpVCsrbuZi2vWBALKlQI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=q47yzcYs; arc=fail smtp.client-ip=40.107.236.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="q47yzcYs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fDHE0hHLpMyu2d9/eRL54IVQroRVHq8MY3wTSE735XHBGDIARWzULK/dmdnqQoSt64pDu5AvDYobdnG9z54WJUBKbL5tHK4vRs849x4S5QK4P3H937fGi4EkTsU1Z6nGyMAZsaet6uQhdNEgI89RUb+k/vxSLhc3sj+1jQQzXPA9SI8LVq3jky07gWwPcjOlZkVdP2iD+V4MMUwOwQmkkkjYQT6UANwvwCJy2UPHDFPyBOuqOYFLjzKbJ/7Hg7DsNExiqL+vD+/fYejqAhCdvG1goonC8d2JRl9wz77CrwJkBMWuo0QLk/YqSzhziKsp6Je9aCWLXKaZwO88dn8t5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=aXmAcoLyOzxRrnd1ljArjHduOwLqEnTp9kIggX8ZN4w=; b=uCv5RfkYVrJyWSTEyQD7kAuV+7EwgGEr+o2tHDI+wI0RtonzdY0AHdxooGTd3W+TnqCAFK0Fwi+Cp+T/+vfV89OONPIV6Pmkz36BVPEWZ+9UKR3dsJ7XI8r7AJL7Ho9mAPjfowqZ9P9YKu7IpwP85Dt+mjnW9CUmk+B/wWEtJ7EGphGYOiJQFKVQadwd56BvBwzqJIYPQOKKZaWEbNX0KutbANxv8jNd3PDYqJLldvxJzqASUY+n6YObgH2S5SWetI59ZTGFyH9optv4aFBvCnpKPzKLcDdrTRbIC3JiUSklDMEC2Jncv3y2fNVuLIBu/xAVrMKGT6xOGLVc+/vBYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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 (0) 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=aXmAcoLyOzxRrnd1ljArjHduOwLqEnTp9kIggX8ZN4w=; b=q47yzcYsIXYBDC3s2bJ1zVAJcgNw8KJ5s16DC6Sk7c/TgbBAtD7ZKImcBKbTRZ9OOApXUe5QguyEs+dnPdorjVAg5MPMqfez9kCSKwsMCpnaNBIg10n4q8RPTVhH9s6qtVEcgz6bJSSKAMoyvZBw1ZxAgKDLKvfyBvIShEGhPJBLqHkl7ziSFFkNd4UdDtTVaLbtfGNBzoZPWnAOBE4CRK/ZOKXJM/MsZmYgo934dAGU1QPzixkY8pm8xGtUGszqRv0yoFNGJucOTMzsvuPKim6jQp/VVq6hEvGWFcNHUpS7xD5jNPMi+6Obi7YQzdV3u/GSztvnWKeEy8rL/V1R6Q== Received: from SJ0PR03CA0187.namprd03.prod.outlook.com (2603:10b6:a03:2ef::12) by MW6PR12MB8867.namprd12.prod.outlook.com (2603:10b6:303:249::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Mon, 14 Oct 2024 20:55:06 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2ef:cafe::55) by SJ0PR03CA0187.outlook.office365.com (2603:10b6:a03:2ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 20:55:06 +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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Mon, 14 Oct 2024 20:55:06 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Mon, 14 Oct 2024 13:54:49 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 13:54:49 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 13:54:46 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , , , Moshe Shemesh , Yevgeny Kliteynik , Tariq Toukan Subject: [PATCH net-next V2 15/15] net/mlx5: fs, rename modify header struct member action Date: Mon, 14 Oct 2024 23:53:00 +0300 Message-ID: <20241014205300.193519-16-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014205300.193519-1-tariqt@nvidia.com> References: <20241014205300.193519-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CDE:EE_|MW6PR12MB8867:EE_ X-MS-Office365-Filtering-Correlation-Id: e3d389b5-d344-4f6f-69a0-08dcec927b9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: QrGduj3PbRRbO9rfnDW2Oao5sT+KaKXyY8wA3mk0E7XHbb+ZGvT/wR+VqIhGFRoLNesW+yDxiDk/dQcddBXEabmeIHVKH+DfKAWEZRVYKYPZMK+aXHYhRQhcApIQb9Df3l0Mto2tCCXOJX5lMtZbT2IPIiH5ZDETOeQ7bbn2GRt1HCvMuzlCSywWN/3YP1D0q0htOEa/wYqBtwVXOHuPpIB80NBFGmM+ppN04RR4yqI77eT4dvzr4SjeK9SmRnN2SWvIqoiedNOB6Jsa/xKaKfPCrjwhvEd6kb+SSiFsmwWWfErDe0lrqG5HNL15RJREZurP/sSMaoE2ta385x9nYAW3O/C6qn+NzNL9oUanFzDlgdJo9CZL4NR3ZCswjbMc0zHFSatHEMZ41TJFfxxMUheyKSNBtRVzlGkC48NElN7CoiKD7Eo8B3ZHDr/o1ggb4miShmJiswCwWExVD09FWxneFrM97fHOQwV2r+9ZvDk6BXxnqkr8Lu9UFoGzm6TG11/Sg63NLQndhEskwBQeJYKNQ6v0Q1oQ5U53YC3LwIBHjtuXTyvi/6O9lFkf0DHBwXD4Hj35CU3UVP43oYDrEWk05XmtU7+ZzIuHqhAn6F3L4nAfkrNmlvQkRAv1TY7eJjdl9W3WNgw1hhaq9aeW+eu+E0Fq401diSs1U5nReSpk2BJK+rEmN/3RObY3ydgdedylLqhZkaCGTHd7oWfPVXbP/2GXOAoGnLg5O+y8WZ0CkVitubOBLv6ygW5jEEL8c//aaeU1RGPkvAgM6IRPTpjyKrpCjhTCNP/D4PQAi5dyfq821ZkPWPZdK5bl7HxS8AjOXZZz7Ms0zQu3RDT9UQMr7GyIYpnDGKTixiGmK42UKJ42bKDKK/Z/4Zqji0J3Dlv0WuS/soyBmPe9ycYtst/ZLulHI+f0kE6FAKT3XIGdenfWn4pfx+gOnDjXi7JS6rCLTlBHQ9ONT6syNjWyx1aIz71Yw6i6Qkp1aknjRK5dZgzuA6UraoTd6w+KJLaEOSQdDYUBRtwKrrXY7kQGrDWdOdAaeVziVNHMTe0TlkiOfwa1YagN3zyDK9eTxOkEKFod2YwfqnJdzQakUBcRNRwRcUAq8tFCauGS8zngvw8c0eLX1AbJxqCUDsKExTx1w6LrIDgCeRWZf2nzRNKAKYyAvEvs49MmhCVxvUeyfRm9U9c4aBNcn7ocn3Ut6MNxQzb66K8bl+pTrd1+uTMB/P3AoSoGB/7EUyCFO7YO6UvwcPtJwqdwGsjopd9ZR6CLhusaIHJPn11GnXTWuucQD70UWywvU0a9c5s/l+aG/tvE+wdsftToTGSPUdK9lIEFpFK7SbMU+AOh8X1tk6P+IbJbUNYxyXJitkQdNViMIATUXxP/lLiWDzub2xhT1/ZB 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:(13230040)(82310400026)(1800799024)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 20:55:06.1811 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3d389b5-d344-4f6f-69a0-08dcec927b9d 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8867 X-Patchwork-Delegate: kuba@kernel.org From: Moshe Shemesh As preparation for HW Steering support, rename modify header struct member action to fs_dr_action, to distinguish from fs_hws_action which will be added. Add a pointer where needed to keep code line shorter and more readable. Reviewed-by: Yevgeny Kliteynik Signed-off-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- .../ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 2 +- .../net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c index 1c062a2e8996..45737d039252 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c @@ -318,7 +318,7 @@ mlx5_ct_fs_smfs_ct_rule_add(struct mlx5_ct_fs *fs, struct mlx5_flow_spec *spec, } actions[num_actions++] = smfs_rule->count_action; - actions[num_actions++] = attr->modify_hdr->action.dr_action; + actions[num_actions++] = attr->modify_hdr->fs_dr_action.dr_action; actions[num_actions++] = fs_smfs->fwd_action; nat = (attr->ft == fs_smfs->ct_nat); @@ -379,7 +379,7 @@ static int mlx5_ct_fs_smfs_ct_rule_update(struct mlx5_ct_fs *fs, struct mlx5_ct_ struct mlx5dr_rule *rule; actions[0] = smfs_rule->count_action; - actions[1] = attr->modify_hdr->action.dr_action; + actions[1] = attr->modify_hdr->fs_dr_action.dr_action; actions[2] = fs_smfs->fwd_action; rule = mlx5_smfs_rule_create(smfs_rule->smfs_matcher->dr_matcher, spec, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h index 195f1cbd0a34..b30976627c6b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h @@ -63,7 +63,7 @@ struct mlx5_modify_hdr { enum mlx5_flow_namespace_type ns_type; enum mlx5_flow_resource_owner owner; union { - struct mlx5_fs_dr_action action; + struct mlx5_fs_dr_action fs_dr_action; u32 id; }; }; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c index 8dd412454c97..4b349d4005e4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c @@ -372,9 +372,11 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, actions[num_actions++] = tmp_action; } - if (fte->act_dests.action.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) - actions[num_actions++] = - fte->act_dests.action.modify_hdr->action.dr_action; + if (fte->act_dests.action.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { + struct mlx5_modify_hdr *modify_hdr = fte->act_dests.action.modify_hdr; + + actions[num_actions++] = modify_hdr->fs_dr_action.dr_action; + } if (fte->act_dests.action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { tmp_action = create_action_push_vlan(domain, &fte->act_dests.action.vlan[0]); @@ -705,7 +707,7 @@ static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns, } modify_hdr->owner = MLX5_FLOW_RESOURCE_OWNER_SW; - modify_hdr->action.dr_action = action; + modify_hdr->fs_dr_action.dr_action = action; return 0; } @@ -713,7 +715,7 @@ static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns, static void mlx5_cmd_dr_modify_header_dealloc(struct mlx5_flow_root_namespace *ns, struct mlx5_modify_hdr *modify_hdr) { - mlx5dr_action_destroy(modify_hdr->action.dr_action); + mlx5dr_action_destroy(modify_hdr->fs_dr_action.dr_action); } static int