From patchwork Mon Feb 6 05:46:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 53003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2068565wrn; Sun, 5 Feb 2023 21:48:23 -0800 (PST) X-Google-Smtp-Source: AK7set9/HD24FeNY1CTqYSOw3Z2jYaUZ0aHaZadSDVEDlAgzrTwQGne8Vo/VRFX5PYMMh8WueQpy X-Received: by 2002:a05:6402:321e:b0:4a3:43c1:8434 with SMTP id g30-20020a056402321e00b004a343c18434mr13245272eda.8.1675662503340; Sun, 05 Feb 2023 21:48:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662503; cv=none; d=google.com; s=arc-20160816; b=gCbc1gHnK2yk+cBtpTJHBP5MDcdK5UyRtlSJs/hQ7ED/THkF+iNlFAc322CbFsWMTb zbSsuXVm7So7pmBnbIKDV+MVa/lPDJA+tFsrERDYbAZ40sw4gQl56h9Pa/S2spM8XuLe j26yRSuIsBTCx12bl0CjwAQf1jtGDGm+RvsFv1N4Yv5wWYU1IxgGZUwbNjYK1PpE/8PK FVQiR2tv/255bMRkKNfTz5/iJqOp4XCjBhrNDfUbEnr4Pfoxw1u106Qd48Gmyo9yvrwL ZMP2URwgeafQS0e3/7kiJAVRooBHHBgt6FRjWb7IYmgtWwPEfiH9JLNylDMEx4hel5Mf hwJA== 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=QRHYkhnQIR7fa6ABD07qK4OUPQL5XijPSi6WDlDWSv8=; b=LEN8GMAqHPSbKiIDHtdz742E1BF3paCEoZEMDXLGAxeiHacQC70sPRfuCmx0l2dbOP BlkMKYPtQ9q07+I6fUhcG12sYNTybpQpvNAoMQvP2lp5V6TGAkKf25bvUPXDom9V6YPS LPwtP7PePiFjdjvtM6xI5BJQmBiRObtMKNwZV4v3Qk/2b8LNb7ccgeyQakgWmu+eY2Oi GqkD7et+UF5no1a5QFmdYqWgWQYT0Khj1Ruayuk/1z5ftg5fUsidPsGYO6Mdl0HG/pMt NGLtMGYT+z2odp5v5yjVMvmusZBu3+PVdBKMI1Yn4jbnPG/Wl+nz7p9rXHr0Xk9g269s +bmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=EYqZQaap; 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 t21-20020aa7d715000000b004764be0b8f8si10652956edq.424.2023.02.05.21.47.59; Sun, 05 Feb 2023 21:48:23 -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=EYqZQaap; 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 S229557AbjBFFrS (ORCPT + 99 others); Mon, 6 Feb 2023 00:47:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjBFFrP (ORCPT ); Mon, 6 Feb 2023 00:47:15 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D8B3193E2; Sun, 5 Feb 2023 21:47:12 -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 315KpgjU019068; Sun, 5 Feb 2023 21:46:56 -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=QRHYkhnQIR7fa6ABD07qK4OUPQL5XijPSi6WDlDWSv8=; b=EYqZQaapzhufCMIHSzoGRqgXX2oEz/c46cMKcbl+rjVkWEnJB71k1hSpFTGf2X9a+mSZ 6oIIWx1+KDqH8mFxHPEqsyA0lYY9a4Gg/CN1UXSzCvxKlktV7c99lOpf46+0szUTOfpi fHqPMKyJP8UuN6TzfrSNJwyOevZkE6qcCutodNh4DuC3NrRkkQwISntpz6g8W3cbdnEL pb4etpnEznEi4EXugZqh4wZTJR01ci3EN0PLMOW8z72YT+gBDhndHNYLzUtV3BzsoAMn 3yT4BFljVqxgY6+PnXlfy28aRmam9e8H5SLwTipy26vbJjBFsQh9k2bGSajWvAnTUW5r lg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3nhqrt8m8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 05 Feb 2023 21:46:56 -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; Sun, 5 Feb 2023 21:46:53 -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; Sun, 5 Feb 2023 21:46:53 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 1BF153F7069; Sun, 5 Feb 2023 21:46:47 -0800 (PST) From: Hariprasad Kelam To: , CC: , , , , , , , , , , , , , , , , , , Subject: [net-next PATCH V3 1/4] sch_htb: Allow HTB priority parameter in offload mode Date: Mon, 6 Feb 2023 11:16:37 +0530 Message-ID: <20230206054640.5854-2-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230206054640.5854-1-hkelam@marvell.com> References: <20230206054640.5854-1-hkelam@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: QB4mOAXnibjv9-BNKuRn3T2Ks_CxozGk X-Proofpoint-ORIG-GUID: QB4mOAXnibjv9-BNKuRn3T2Ks_CxozGk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-06_02,2023-02-03_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?1757059484783390865?= X-GMAIL-MSGID: =?utf-8?q?1757059484783390865?= 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..b683dc787827 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 -EINVAL; + } + 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 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 cc28e41fb745..59e6099f767c 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);