From patchwork Wed Jan 18 10:04:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 45171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2268751wrn; Wed, 18 Jan 2023 02:59:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXtVWaPLGK8q6eW+Atcf3OvSZ6a0KD3WPup39FST8ly59RVZAF2HatFv6do/noKFjf2SBaGl X-Received: by 2002:a17:907:a708:b0:86d:e1ce:5c9c with SMTP id vw8-20020a170907a70800b0086de1ce5c9cmr6323180ejc.76.1674039589432; Wed, 18 Jan 2023 02:59:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039589; cv=none; d=google.com; s=arc-20160816; b=AOr2PfBlxK8TuslIlDt+sBmRFPpYif17DhV4rYWSDxQlixxXJNiBtyR9B6yRNmkwYS iiydQGtPA0lwpV9xxZxKw9sWAAxut2u6VivAdhi3z9Wa4vtzIgvcVLyVle3SS31L3DKl DkFUhyx6enC3VvMs2V3FDbJGA7L4LJoU3DcjrzrxZ4kCz5OwoYWNchqAnTLyUgYT2WB7 B8A1leu+RJg1Pcy/WfkYcwn+KdXPVxxMxVN7jRRN2RJ29Lx7IfakFoySucf4XkseTtDI yJ1zmMjKQkjaFp3w8UwSJCj4pnNqq9v3+sG2g0Q2ER1aHtJ5YHyevMf+k8+1JrSloXte +7Hw== 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=y1grzq7R9RDVjtctRgb/VN3YQCLX4mIMdl3YjdWZcCI=; b=VcCrRB+2X+9mDLcbV+iK/Ki5uDqzPtr7L2iy/B3+4x22Blp/an0WWaUM8v0byb49A1 D5Bc/hBOFdVW95BXczGu3QPTNb+dssPer33dyoeUdkQsJuJ1SXoBSF/ELpk/jXqywEGG r+9TZtATS9XlzQ3M/pbVloGAdlH0ug918eMTXEH8rXYbmigZRqoCbn+lwdXqU+PjUPBZ zd9n37Acw2S6EhDegDm+UBdxtnLHHh/ZPA9JomtJoEz55LEpbLvrjpooUK44W8jVVcL8 nwxtQGiFdJNtexxrfmf2lJXcT72a3EuPZkIVnWYLUXts63w+BIRbpsM8KOHdno+KHdai dAPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=bn9Z3gpF; 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 ht14-20020a170907608e00b0078d484e0e7esi5182803ejc.488.2023.01.18.02.59.25; Wed, 18 Jan 2023 02:59:49 -0800 (PST) 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=bn9Z3gpF; 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 S230176AbjARK5v (ORCPT + 99 others); Wed, 18 Jan 2023 05:57:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbjARKzj (ORCPT ); Wed, 18 Jan 2023 05:55:39 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BC8D5CE44; Wed, 18 Jan 2023 02:04:36 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30I9uxjJ029997; Wed, 18 Jan 2023 02:04:25 -0800 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=y1grzq7R9RDVjtctRgb/VN3YQCLX4mIMdl3YjdWZcCI=; b=bn9Z3gpFV1CLmOR2mpuRuVSEQShAEasPpZq90h7zkyM3aVmE3XqOZB1+O/iGIsKix7+2 uIkpdJkB/yjdfiXuhFHTpy38Y26Cx2Zxv4wbBG49hhBSxOqaj5gpBw632FNMiCado5dg v0efDzOeLrBpj1V15HbEl0L2hGmqpnc+pka6ez4XC2JF278agOPxqyw0dbWXgBaDfn6W LO9VpxGrR+BdFpLzEmzvGdO7KXpb1WG0m5wHkqgo9MhTE7dSt4oUZLg46gYdEPPdDJmS ogA1r+BqOg1IrYIb2Cs78SjJUErsh2zIozcyYtXwnRNMDDE1ahjXd57Ia8efT1gU2ept qA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n3vstgarp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 02:04:25 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 18 Jan 2023 02:04:23 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Wed, 18 Jan 2023 02:04:23 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 63D165B6947; Wed, 18 Jan 2023 02:04:17 -0800 (PST) From: Hariprasad Kelam To: , CC: , , , , , , , , , , , , , , , , , , Subject: [net-next Patch v2 1/5] sch_htb: Allow HTB priority parameter in offload mode Date: Wed, 18 Jan 2023 15:34:06 +0530 Message-ID: <20230118100410.8834-2-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230118100410.8834-1-hkelam@marvell.com> References: <20230118100410.8834-1-hkelam@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4ldRqT51klEvFuu06I3huCWnxWttyKO7 X-Proofpoint-GUID: 4ldRqT51klEvFuu06I3huCWnxWttyKO7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-18_04,2023-01-18_01,2022-06-22_01 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_NONE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357736639630524?= X-GMAIL-MSGID: =?utf-8?q?1755357736639630524?= From: Naveen Mamindlapalli The current implementation of HTB offload returns the EINVAL error for unsupported parameters like prio and quantum. This patch removes the error returning checks for 'prio' parameter and populates its value to tc_htb_qopt_offload structure such that driver can use the same. Add prio parameter check in mlx5 driver, as mlx5 devices are not capable of supporting the prio parameter when htb offload is used. Report error if prio parameter is set to a non-default value. Signed-off-by: Naveen Mamindlapalli Co-developed-by: Rahul Rameshbabu Signed-off-by: Rahul Rameshbabu Signed-off-by: Hariprasad Kelam Signed-off-by: Sunil Kovvuri Goutham --- v2* ensure other drivers won't effect by allowing 'prio' parameter in htb offload mode drivers/net/ethernet/mellanox/mlx5/core/en/qos.c | 6 ++++++ include/net/pkt_cls.h | 1 + net/sched/sch_htb.c | 7 +++---- 3 files changed, 10 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c index 2842195ee548..e16b3d6ea471 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c @@ -379,6 +379,12 @@ 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) { + NL_SET_ERR_MSG(htb_qopt->extack, + "prio parameter is not supported by device with HTB offload enabled."); + return -EINVAL; + } + switch (htb_qopt->command) { case TC_HTB_CREATE: if (!mlx5_qos_is_supported(priv->mdev)) { diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 4cabb32a2ad9..02afb1baf39d 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -864,6 +864,7 @@ struct tc_htb_qopt_offload { u16 qid; u64 rate; u64 ceil; + u8 prio; }; #define TC_HTB_CLASSID_ROOT U32_MAX diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 2238edece1a4..f2d034cdd7bd 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -1806,10 +1806,6 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, NL_SET_ERR_MSG(extack, "HTB offload doesn't support the quantum parameter"); goto failure; } - if (hopt->prio) { - NL_SET_ERR_MSG(extack, "HTB offload doesn't support the prio parameter"); - goto failure; - } } /* Keeping backward compatible with rate_table based iproute2 tc */ @@ -1905,6 +1901,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, TC_HTB_CLASSID_ROOT, .rate = max_t(u64, hopt->rate.rate, rate64), .ceil = max_t(u64, hopt->ceil.rate, ceil64), + .prio = hopt->prio, .extack = extack, }; err = htb_offload(dev, &offload_opt); @@ -1925,6 +1922,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, TC_H_MIN(parent->common.classid), .rate = max_t(u64, hopt->rate.rate, rate64), .ceil = max_t(u64, hopt->ceil.rate, ceil64), + .prio = hopt->prio, .extack = extack, }; err = htb_offload(dev, &offload_opt); @@ -2010,6 +2008,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, .classid = cl->common.classid, .rate = max_t(u64, hopt->rate.rate, rate64), .ceil = max_t(u64, hopt->ceil.rate, ceil64), + .prio = hopt->prio, .extack = extack, }; err = htb_offload(dev, &offload_opt);