From patchwork Thu Jul 13 06:01:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 119570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1633211vqm; Wed, 12 Jul 2023 23:50:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFBahalUH9jxYTyxPM7zLtUW/i989KyEcNDDhksVOlzCAmvaE1xQdx/vVPR/biGHMyE7oST X-Received: by 2002:a17:902:c211:b0:1b2:2c0c:d400 with SMTP id 17-20020a170902c21100b001b22c0cd400mr234659pll.52.1689231014598; Wed, 12 Jul 2023 23:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689231014; cv=none; d=google.com; s=arc-20160816; b=qI8EX80P/HzaJd0/Xzv8xXTi4NRvqk7IqAu6ScFA68h3LB4nTdUDn9fZ4UeOvNUwse 0npuO8S+YbkCunz2rrgtiTGNwnA2xo+l3gXgGSpFxlB3qrZQYaNGyowwtmV/w16fbgNA lcgZ5OYQYvv6nNZFCyAZLk8MIEteKikjkOSYKbiUK7Uq1foEYYa9Nu0P58FWe+XCUqzT ihfwsTvGpxT9mGEo6qs/O1phn4QUFTmXgrYX0dCubG0UTPeBUXZ1l56VWZwRM85SWxKG J9PcsQYrmRd+2olEWKfbVf1xtSqypVd7LsRBetQK2HuXxRKXRh0lr1oK5DObRlDsSAKG vvpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Rder2OAzgtZd3D78Lyy1oE9ERfYSQk2vWQvPHgIJsIA=; fh=WTB7wSncyt74iOQYSs1LHXSzBhyN3wdzAdsgdEGhJyY=; b=kB9kvujeAHvRhQrMjQXFjkaTJWZtImjaDSRJ7r4tAxopBoUH7PelLax/gOG2DHsMJJ UE99Ibg+zLXYVWplrCENoxRi7D/IoJ4x1rEaTgcAkE0fIuQaVS97GWX4rfNB4goJPAxk R2M3UXNYbKG6XI5sU4FNtJ1Pcz40tVclSl2c215yTtbTs2Haq3g1Y3lTKI17tqKRVg7o btqJRE4A0opQHgAr/q3nqLoTnwB0POS+TbJihNzFJAiAuLgFElCW8OVuupVWUUVYeRA4 Z5WOkzCVS1ksHLh2B9/iQ9W28GLvskZlsevpV3py60/PCTDYrVkJALBFVbvVh1Qy6stA pkUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=HoTPrllE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kv5-20020a17090328c500b001b7f4696a2csi4473955plb.347.2023.07.12.23.50.01; Wed, 12 Jul 2023 23:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=HoTPrllE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234005AbjGMGBw (ORCPT + 99 others); Thu, 13 Jul 2023 02:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232430AbjGMGBp (ORCPT ); Thu, 13 Jul 2023 02:01:45 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5821FDE; Wed, 12 Jul 2023 23:01:44 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36D0bWCT029333; Wed, 12 Jul 2023 23:01:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=Rder2OAzgtZd3D78Lyy1oE9ERfYSQk2vWQvPHgIJsIA=; b=HoTPrllEUWetgqBrczDd+JpdueAm0EjUHttCtpHjCW8nNg0Tgg4MElT7l3b9JdVB5Zop J9XhDO0V/3KHcG6dMpTVoDLUbM7DDrthXP3dR/nuwuIAcVS8z9tI5dPJe6kaVXyVM0Dd pPorGm9wfqZePKaGYKe47OGiYWh341M7M9SHlEbsztJGCdGAGUr8y0g/hBimtUfy1Ljj 14BO75x3NYfLUK6kGiqjKmak+bDzri7TG0sYoId4DOOOG5MgMwm8Mslp2WVB/6AOSk8m LMNiDbZR6sA3dZgS7UOfVmnIvbjyqpcxXruoBw/oedd4OL60ERWA+rhifnEw4Ug9zFqM 5g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3rsb7rf074-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 23:01:32 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 12 Jul 2023 23:01:30 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 12 Jul 2023 23:01:30 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 1D2D13F7075; Wed, 12 Jul 2023 23:01:24 -0700 (PDT) From: Hariprasad Kelam To: , CC: , , , , , , , , , , , , , , , , , , Subject: [net-next Patchv2 2/3] sch_htb: Allow HTB quantum parameter in offload mode Date: Thu, 13 Jul 2023 11:31:10 +0530 Message-ID: <20230713060111.14169-3-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230713060111.14169-1-hkelam@marvell.com> References: <20230713060111.14169-1-hkelam@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: _OCsBrhDtcJMOJ0pTtd4cYwV_w4EVb3P X-Proofpoint-ORIG-GUID: _OCsBrhDtcJMOJ0pTtd4cYwV_w4EVb3P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-13_02,2023-07-11_01,2023-05-22_02 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771287100572852258 X-GMAIL-MSGID: 1771287100572852258 From: Naveen Mamindlapalli The current implementation of HTB offload returns the EINVAL error for quantum parameter. This patch removes the error returning checks for 'quantum' parameter and populates its value to tc_htb_qopt_offload structure such that driver can use the same. Add quantum parameter check in mlx5 driver, as mlx5 devices are not capable of supporting the quantum parameter when htb offload is used. Report error if quantum parameter is set to a non-default value. Signed-off-by: Naveen Mamindlapalli Signed-off-by: Hariprasad Kelam --- drivers/net/ethernet/mellanox/mlx5/core/en/qos.c | 4 ++-- include/net/pkt_cls.h | 1 + net/sched/sch_htb.c | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c index 1874c2f0587f..244bc15a42ab 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c @@ -379,9 +379,9 @@ int mlx5e_htb_setup_tc(struct mlx5e_priv *priv, struct tc_htb_qopt_offload *htb_ if (!htb && htb_qopt->command != TC_HTB_CREATE) return -EINVAL; - if (htb_qopt->prio) { + if (htb_qopt->prio || htb_qopt->quantum) { NL_SET_ERR_MSG_MOD(htb_qopt->extack, - "prio parameter is not supported by device with HTB offload enabled."); + "prio and quantum parameters are not supported by device with HTB offload enabled."); return -EOPNOTSUPP; } diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index a2ea45c7b53e..139cd09828af 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -866,6 +866,7 @@ struct tc_htb_qopt_offload { u32 parent_classid; u16 classid; u16 qid; + u32 quantum; u64 rate; u64 ceil; u8 prio; diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 325c29041c7d..333800a7d4eb 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -1810,10 +1810,6 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, NL_SET_ERR_MSG(extack, "HTB offload doesn't support the mpu parameter"); goto failure; } - if (hopt->quantum) { - NL_SET_ERR_MSG(extack, "HTB offload doesn't support the quantum parameter"); - goto failure; - } } /* Keeping backward compatible with rate_table based iproute2 tc */ @@ -1910,6 +1906,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, .rate = max_t(u64, hopt->rate.rate, rate64), .ceil = max_t(u64, hopt->ceil.rate, ceil64), .prio = hopt->prio, + .quantum = hopt->quantum, .extack = extack, }; err = htb_offload(dev, &offload_opt); @@ -1931,6 +1928,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, .rate = max_t(u64, hopt->rate.rate, rate64), .ceil = max_t(u64, hopt->ceil.rate, ceil64), .prio = hopt->prio, + .quantum = hopt->quantum, .extack = extack, }; err = htb_offload(dev, &offload_opt); @@ -2017,6 +2015,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, .rate = max_t(u64, hopt->rate.rate, rate64), .ceil = max_t(u64, hopt->ceil.rate, ceil64), .prio = hopt->prio, + .quantum = hopt->quantum, .extack = extack, }; err = htb_offload(dev, &offload_opt);