Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1899257rwl; Sun, 26 Mar 2023 11:15:18 -0700 (PDT) X-Google-Smtp-Source: AKy350YnmrXlHs9ald8e4oi5dBe+3ZG98wbU4D4YOVfWIx3rCsoJ0ga2QYEVHwDQGqVtF1TU/vm9 X-Received: by 2002:a17:90b:3ecb:b0:23b:3641:cf16 with SMTP id rm11-20020a17090b3ecb00b0023b3641cf16mr9328154pjb.11.1679854517910; Sun, 26 Mar 2023 11:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679854517; cv=none; d=google.com; s=arc-20160816; b=F8puczGKpA3ZKFAbTSKEo31YFcLF+2p3pHCvFoJ705sC2j0yADcFPfrkKdpesSN0Yz ZJCDQQzx6cAnE2kFPHXbFFi6fhpoamaQXEgDziXlZK7inyOedEaWzNm+tXTXPnucN+BO 9SsDl4p9s3SBdlVpJ6FAtkQ366HuMw7I84L3KFDRNOYm5T4QZ9sROzIIPqmttrc2MAYG OyR+g7iwmtOvanCJE7ZoDPfcMlPSia3NpwbeI04ij8irkI4C1hqoKuYA2G7SvV+mgtCR 5VcM61gqj8LflHR1YuFneNVFBiY51M8Iaqqv2C0/lVzz7z7ay45ahtP8IjIkyFHIQv7r Kgzg== 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=UwaiQtkl+qbIlhH6TYmo7NQvDfY7VKhSRVBjO/W/A9E=; b=FIr71p2OBs1HJNGGSlEURHva95gy2HVRftvGmOXFG1DtPYw8VT8CO0ajydWlumOzFJ EilQBV25sifgADamMbAfKvnJ1aTCk0M3QoqFmWCKfrkBQUujMLBYDS8+EGxanhzVT5D0 fJjhnQXrHQC3uP2OXuM49+PijQrAb8sFXwaQbkfDVS74qP+F89cmE3inu6FwUhM9/c2K x/m1oIEjmnZJXH4ZESD+JrDjE0q2Q5NemBTGhDUeijDY6t8Ypmj37JZTxvwDfnCVhbcb fBlczDTNsu+QrsKMDFiPIH2FUUd9WpvmrN6P+mxYiNtVIxDOVt+wuRwOlPSvXkpri/P1 +nkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="A6/80DIn"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020a17090aaa0800b0023d3fad2294si8580443pjq.10.2023.03.26.11.15.05; Sun, 26 Mar 2023 11:15:17 -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="A6/80DIn"; 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 S230309AbjCZSNR (ORCPT + 99 others); Sun, 26 Mar 2023 14:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjCZSNO (ORCPT ); Sun, 26 Mar 2023 14:13:14 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9415E1FF2; Sun, 26 Mar 2023 11:13:12 -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 32QHnfMA005170; Sun, 26 Mar 2023 11:12:59 -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=UwaiQtkl+qbIlhH6TYmo7NQvDfY7VKhSRVBjO/W/A9E=; b=A6/80DInT7QZNFGp7lrL80VrCnZ/oHfsagd/Sj4EaIOQxdotaEa7vWnNKJ2ALFfl+wIs +5Y3xFWe1RCaJjGhDKA/NO1WnHZAtbbueTMc8eC7aFQK/84rD3kxD0ikJIKOeR6D+m2h DRTCYrltxvSWpTrILFbiFSZybF5Hqi3eag/N0EiTIzetCeAJrZnyNvb45GyHIMT8QOSI kniZgzgLmdTGpUGfSjuXFJzslKxes/xzQ9uacRm+Y/JcY60fePYFTrrEuRFnOgOBZ/dR hyCUSu3TBc4BgyoM3/jkP9RssJi/LDQlO3INRroVTSLIjxs4p4pW4a0MOE2oqepK8hFU xw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3phxas3ud6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 26 Mar 2023 11:12:59 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 26 Mar 2023 11:12:57 -0700 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.48 via Frontend Transport; Sun, 26 Mar 2023 11:12:57 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 912823F709F; Sun, 26 Mar 2023 11:12:52 -0700 (PDT) From: Hariprasad Kelam To: , CC: , , , , , , , , , , , , , , , , Subject: [net-next Patch v5 1/6] sch_htb: Allow HTB priority parameter in offload mode Date: Sun, 26 Mar 2023 23:42:40 +0530 Message-ID: <20230326181245.29149-2-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230326181245.29149-1-hkelam@marvell.com> References: <20230326181245.29149-1-hkelam@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: v4QccWmta-JGegX55NolQYY9TBfKUyfT X-Proofpoint-ORIG-GUID: v4QccWmta-JGegX55NolQYY9TBfKUyfT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 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 --- drivers/net/ethernet/mellanox/mlx5/core/en/qos.c | 7 ++++++- include/net/pkt_cls.h | 1 + net/sched/sch_htb.c | 7 +++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c index 2842195ee548..1874c2f0587f 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_MOD(htb_qopt->extack, + "prio parameter is not supported by device with HTB offload enabled."); + return -EOPNOTSUPP; + } + switch (htb_qopt->command) { case TC_HTB_CREATE: if (!mlx5_qos_is_supported(priv->mdev)) { @@ -515,4 +521,3 @@ int mlx5e_mqprio_rl_get_node_hw_id(struct mlx5e_mqprio_rl *rl, int tc, u32 *hw_i *hw_id = rl->leaves_id[tc]; return 0; } - diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index b3b5b0b62f16..a2ea45c7b53e 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -868,6 +868,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 92f2975b6a82..1cd9b48c96cd 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -1814,10 +1814,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 */ @@ -1913,6 +1909,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); @@ -1933,6 +1930,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); @@ -2018,6 +2016,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); -- 2.17.1