From patchwork Mon Apr 10 08:42:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 81432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1772808vqo; Mon, 10 Apr 2023 02:21:19 -0700 (PDT) X-Google-Smtp-Source: AKy350YjnxQvukaiht8wgNpNoK0Bc5n8XjIzQFVZ+PvDCTSwUv9zjL7MJz9BVQoPsM2TylJIZ1vd X-Received: by 2002:aa7:c156:0:b0:504:92f2:deb3 with SMTP id r22-20020aa7c156000000b0050492f2deb3mr4269070edp.26.1681118478802; Mon, 10 Apr 2023 02:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681118478; cv=none; d=google.com; s=arc-20160816; b=F0cFXho99JyFx4tvB5CIK6nrXZpcii4VpR2YNfbR+ArTI1OE62/WMKaAIUHxjsdTGi f6qdjbQFSNZpjbKlobpJdgzeo7dwdA4OTQ/iTHPo+tR2GIjpm/qlQIKrMD4sCSSOqF+3 LttaTnZxU4D6nCZKbVpyR7C0Eg+sp6eT3os+VwAmUSK3HPsmqIBEEVVRsB318Kw2/3JH DTkWHMEEevxmdw7qiXKFVkj5LVLLZZDJhak3vjmik9IPECymBTl5jN5DbGRSYOsU8o9B B1+dPri72zAhcbQN5zyFSfJELYM7tKvHXr+M7v0XO1XVxb++/bPrdjXy8AZWm5hFixnd DTIQ== 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=t3xVG4BCXk9qv0lEExqaQTQ8HYVvmwILzzAmbxz0/O8=; b=DiM63d7iArxxZnffx/T/ea3bLhLCoq3DnSkfASW4BT2+J7Mwub4QTCKrtcP0TuoD48 J4BUHUSWxscgVtdYoj9ZfD3XbBf5Gz1sI33PSEcF73aEE2hFvMNQhpYI21O7uA7kv9Ee sgiElBUaZ04gBt3DM0dVw8JiCnyvnbPbsakdhMy9rb9fzCYZXhAwiDNPmy0y6x7k4geJ cBXn3L/xNZ1bwubVTqGlAeMb8E0RxTRQV/+rWmvPtHTd6cxykdcS94gq1VksrRaiNeR+ SYo2cqh7e4QAzb2qSxXBGPX1IejGIOY9AEHVu7z7r1jXIqwwhaRZ4F89G3IIk20n+YDd UeeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Pvw1wOhX; 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 m13-20020a056402050d00b0050494223599si4095496edv.296.2023.04.10.02.20.54; Mon, 10 Apr 2023 02:21:18 -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=Pvw1wOhX; 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 S229535AbjDJJN0 (ORCPT + 99 others); Mon, 10 Apr 2023 05:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbjDJJNM (ORCPT ); Mon, 10 Apr 2023 05:13:12 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 750D34EC2; Mon, 10 Apr 2023 02:13:10 -0700 (PDT) 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 339NW1GN013920; Mon, 10 Apr 2023 01:42:40 -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=t3xVG4BCXk9qv0lEExqaQTQ8HYVvmwILzzAmbxz0/O8=; b=Pvw1wOhXZui6gsmSy2OSt2jkx4v24YPYpHhiHuk71OwPzw803ETXUfm2eG571+jN5t/K /T3FGsyb63MVLMRMBzYO+Aq+MYDf+f7VMa7A2w+ptiS+gxSEc4zhLPm3f0IANfNo4myS OoyCc2RA2XvkjDq2nkkvC0hD76PKCHAQfmEE92gt/PxtEbaT8D8N3uJulDQfDEhErcsJ HibL00EuSjdnsnVC6FZLlS3M0wv1J0fnBbzrxumXoRkTiHBG2gd/UgCPoXpnbglD8ZJG AIFG4LZIGauoVjlFyyAn1MqLaHvLJyTts0EwSyFOnHpA2iAS8V1GimtqAdl5gBErl2Rv sQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs42m0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 10 Apr 2023 01:42:40 -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; Mon, 10 Apr 2023 01:42:37 -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; Mon, 10 Apr 2023 01:42:37 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id EA13F5C68E4; Mon, 10 Apr 2023 01:42:30 -0700 (PDT) From: Hariprasad Kelam To: , CC: , , , , , , , , , , , , , , , , , Subject: [net-next Patch v8 1/6] sch_htb: Allow HTB priority parameter in offload mode Date: Mon, 10 Apr 2023 14:12:18 +0530 Message-ID: <20230410084223.5325-2-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230410084223.5325-1-hkelam@marvell.com> References: <20230410084223.5325-1-hkelam@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: IvQIlu_hgjb2pHfmbHr6cyoJoUH5poL2 X-Proofpoint-GUID: IvQIlu_hgjb2pHfmbHr6cyoJoUH5poL2 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-04-10_05,2023-04-06_03,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762780489546483009?= X-GMAIL-MSGID: =?utf-8?q?1762780489546483009?= 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 Reviewed-by: Simon Horman --- 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);