Message ID | 20230228204742.2599151-1-horatiu.vultur@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3246725wrd; Tue, 28 Feb 2023 12:51:43 -0800 (PST) X-Google-Smtp-Source: AK7set8N8d+zH9Z6Icz0XaaEnf41hHTYyWz3qRi9dFjid3g9BETaRWHlDFvI3frWaK85STqC3ovG X-Received: by 2002:a17:907:c608:b0:905:a46b:a725 with SMTP id ud8-20020a170907c60800b00905a46ba725mr510326ejc.16.1677617503103; Tue, 28 Feb 2023 12:51:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677617503; cv=none; d=google.com; s=arc-20160816; b=a1l75euSVC2CAALBIhJIyStjzhtGokCBftojmQe8+gC5tQMjTI9thX5f0sDNpVWyvV heAhoA1T2hmHq7gMp8Dzkbf8Gv84do+MmV9g/Kiu45kNH4di8fTdTlOOfHxN933sM25m FXtLA4Omrh2cenoLm9cNTbrXUdKEKXVGMw15FGcv9JQErF3bG4QZ2mwUgiflI7nbLZfX ALZgECPkd8UyGA7DffHdNrNxq8vkEGMX1SjNfDWnIYFj5eLkASxZYE6SkDvtc5XqgRsv si6+2FK9A15wUYw7rte0w6r4i+o40gxhvGbraAlMaAGDWXG2Vj2t1vjZNXxbRPQdgASR 039A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=l6kGXr0Ln/xyBX/I92uWLaV0p1XcmM4E3B/49L14Cjc=; b=pZYdmS9zxzWVzwZ9K9lhEakRLYgCJMz3LN9VVXcWfjPFCJtZOjHRvGgcWIvbmwxf24 DB6xULURj3JuLUe2YDtI0a6+pZ7aCMcZVM2SQfZFkrjzlRio1UK9KH4KFGdP8hvii/YT YroSxwuywxTacLM/749Mdu70Ej5jeQrBDzYqwXgot+XjUmr15D9nje+V9f7XOXHY7rXj 4nrMvUYWsEl7Qj7TN03/5rB98uWtZdsMnxqZgThHq76e5yBUD1w+++FS2X/b/3Y1V/LN H32djR/JEitLDhlDhHJOAZz2EOss0YZiQhnvN3R+BIZhlcNp816l4WTD5R6i4HT9Aqgq 9/rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=EX0lPT2l; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020aa7d6cf000000b004acda6e2e65si1824079edr.43.2023.02.28.12.51.19; Tue, 28 Feb 2023 12:51:43 -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=@microchip.com header.s=mchp header.b=EX0lPT2l; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjB1UsT (ORCPT <rfc822;aaron.seo0120@gmail.com> + 99 others); Tue, 28 Feb 2023 15:48:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbjB1UsQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Feb 2023 15:48:16 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F659D304; Tue, 28 Feb 2023 12:48:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1677617288; x=1709153288; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WfkJSHVX8viEFAtDtKjqj0PzUjCvDzCn7Cy2sK93AaA=; b=EX0lPT2lGeaaJYVZUHefQLbj+N2jhTJIvvO5uJWssG11JMkMdd0BxkBl XDoQ5MFlX7DN3BAigU2QNqiUublXVXCrbAdU4vR/PfWo+EmKMwyF6fqww yvA/ZP8CnQNCT3MwLaoIQjMfUV1i99F+0fWRCjvTWz/gogKTb8KQZVNN0 uHUrjWVfzpKTwk0Gx2AeYCFCX7/AaZMEbh/of/r/r0W4BElxjswy0BRNA SUhZYmarijc81IYLQewu60z+OKLUYOpFOAN423/AXPZN5+fByHomQXZGf 4Dk3G3LI6+4O6WorpWmtkx2A/Qz/Yq2uOBNAe72qFWfnacU4/MfOzIA6W w==; X-IronPort-AV: E=Sophos;i="5.98,222,1673938800"; d="scan'208";a="202642252" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Feb 2023 13:48:08 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 28 Feb 2023 13:48:07 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Tue, 28 Feb 2023 13:48:05 -0700 From: Horatiu Vultur <horatiu.vultur@microchip.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <UNGLinuxDriver@microchip.com>, Horatiu Vultur <horatiu.vultur@microchip.com> Subject: [PATCH net] net: lan966x: Fix port police support using tc-matchall Date: Tue, 28 Feb 2023 21:47:42 +0100 Message-ID: <20230228204742.2599151-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759109450571651437?= X-GMAIL-MSGID: =?utf-8?q?1759109450571651437?= |
Series |
[net] net: lan966x: Fix port police support using tc-matchall
|
|
Commit Message
Horatiu Vultur
Feb. 28, 2023, 8:47 p.m. UTC
When the police was removed from the port, then it was trying to
remove the police from the police id and not from the actual
police index.
The police id represents the id of the police and police index
represents the position in HW where the police is situated.
The port police id can be any number while the port police index
is a number based on the port chip port.
Fix this by deleting the police from HW that is situated at the
police index and not police id.
Fixes: 5390334b59a3 ("net: lan966x: Add port police support using tc-matchall")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
drivers/net/ethernet/microchip/lan966x/lan966x_police.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Feb 28, 2023 at 09:47:42PM +0100, Horatiu Vultur wrote: > When the police was removed from the port, then it was trying to > remove the police from the police id and not from the actual > police index. > The police id represents the id of the police and police index > represents the position in HW where the police is situated. > The port police id can be any number while the port police index > is a number based on the port chip port. > Fix this by deleting the police from HW that is situated at the > police index and not police id. > > Fixes: 5390334b59a3 ("net: lan966x: Add port police support using tc-matchall") > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Simon Horman <simon.horman@corigine.com>
On Tue, Feb 28, 2023 at 09:47:42PM +0100, Horatiu Vultur wrote: > When the police was removed from the port, then it was trying to > remove the police from the police id and not from the actual > police index. > The police id represents the id of the police and police index > represents the position in HW where the police is situated. > The port police id can be any number while the port police index > is a number based on the port chip port. > Fix this by deleting the police from HW that is situated at the > police index and not police id. > > Fixes: 5390334b59a3 ("net: lan966x: Add port police support using tc-matchall") > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > --- > drivers/net/ethernet/microchip/lan966x/lan966x_police.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_police.c b/drivers/net/ethernet/microchip/lan966x/lan966x_police.c > index a9aec900d608d..7d66fe75cd3bf 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_police.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_police.c > @@ -194,7 +194,7 @@ int lan966x_police_port_del(struct lan966x_port *port, > return -EINVAL; > } > > - err = lan966x_police_del(port, port->tc.police_id); > + err = lan966x_police_del(port, POL_IDX_PORT + port->chip_port); > if (err) { > NL_SET_ERR_MSG_MOD(extack, > "Failed to add policer to port"); > -- > 2.38.0 > Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> but the extack message is also wrong; it says it failed to add the policer, when the operation that failed was a deletion.
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Tue, 28 Feb 2023 21:47:42 +0100 you wrote: > When the police was removed from the port, then it was trying to > remove the police from the police id and not from the actual > police index. > The police id represents the id of the police and police index > represents the position in HW where the police is situated. > The port police id can be any number while the port police index > is a number based on the port chip port. > Fix this by deleting the police from HW that is situated at the > police index and not police id. > > [...] Here is the summary with links: - [net] net: lan966x: Fix port police support using tc-matchall https://git.kernel.org/netdev/net/c/81563d8548b0 You are awesome, thank you!
The 03/01/2023 14:27, Vladimir Oltean wrote: Hi Vladimir, > > On Tue, Feb 28, 2023 at 09:47:42PM +0100, Horatiu Vultur wrote: > > When the police was removed from the port, then it was trying to > > remove the police from the police id and not from the actual > > police index. > > The police id represents the id of the police and police index > > represents the position in HW where the police is situated. > > The port police id can be any number while the port police index > > is a number based on the port chip port. > > Fix this by deleting the police from HW that is situated at the > > police index and not police id. > > > > Fixes: 5390334b59a3 ("net: lan966x: Add port police support using tc-matchall") > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > > --- > > drivers/net/ethernet/microchip/lan966x/lan966x_police.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_police.c b/drivers/net/ethernet/microchip/lan966x/lan966x_police.c > > index a9aec900d608d..7d66fe75cd3bf 100644 > > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_police.c > > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_police.c > > @@ -194,7 +194,7 @@ int lan966x_police_port_del(struct lan966x_port *port, > > return -EINVAL; > > } > > > > - err = lan966x_police_del(port, port->tc.police_id); > > + err = lan966x_police_del(port, POL_IDX_PORT + port->chip_port); > > if (err) { > > NL_SET_ERR_MSG_MOD(extack, > > "Failed to add policer to port"); > > -- > > 2.38.0 > > > > Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Thanks for the review. > > but the extack message is also wrong; it says it failed to add the > policer, when the operation that failed was a deletion. Good catch, but this err path will never be hit as the function lan966x_police_del always returns 0. I am planning to send a patch when the net-next gets open to actually change the return type of the function 'lan966x_police_del' and then the extack message will be removed.
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_police.c b/drivers/net/ethernet/microchip/lan966x/lan966x_police.c index a9aec900d608d..7d66fe75cd3bf 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_police.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_police.c @@ -194,7 +194,7 @@ int lan966x_police_port_del(struct lan966x_port *port, return -EINVAL; } - err = lan966x_police_del(port, port->tc.police_id); + err = lan966x_police_del(port, POL_IDX_PORT + port->chip_port); if (err) { NL_SET_ERR_MSG_MOD(extack, "Failed to add policer to port");