netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: microchip: sparx5: fix deletion of existing DSCP mappings
@ 2023-03-07 11:21 Daniel Machon
  2023-03-07 16:33 ` Simon Horman
  2023-03-08 13:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Machon @ 2023-03-07 11:21 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
	daniel.machon, UNGLinuxDriver, joe, error27, linux-arm-kernel,
	linux-kernel

Fix deletion of existing DSCP mappings in the APP table.

Adding and deleting DSCP entries are replicated per-port, since the
mapping table is global for all ports in the chip. Whenever a mapping
for a DSCP value already exists, the old mapping is deleted first.
However, it is only deleted for the specified port. Fix this by calling
sparx5_dcb_ieee_delapp() instead of dcb_ieee_delapp() as it ought to be.

Reproduce:

// Map and remap DSCP value 63
$ dcb app add dev eth0 dscp-prio 63:1
$ dcb app add dev eth0 dscp-prio 63:2

$ dcb app show dev eth0 dscp-prio
dscp-prio 63:2

$ dcb app show dev eth1 dscp-prio
dscp-prio 63:1 63:2 <-- 63:1 should not be there

Fixes: 8dcf69a64118 ("net: microchip: sparx5: add support for offloading dscp table")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
 .../ethernet/microchip/sparx5/sparx5_dcb.c    | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c b/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
index 871a3e62f852..2d763664dcda 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
@@ -249,6 +249,21 @@ static int sparx5_dcb_ieee_dscp_setdel(struct net_device *dev,
 	return 0;
 }
 
+static int sparx5_dcb_ieee_delapp(struct net_device *dev, struct dcb_app *app)
+{
+	int err;
+
+	if (app->selector == IEEE_8021QAZ_APP_SEL_DSCP)
+		err = sparx5_dcb_ieee_dscp_setdel(dev, app, dcb_ieee_delapp);
+	else
+		err = dcb_ieee_delapp(dev, app);
+
+	if (err < 0)
+		return err;
+
+	return sparx5_dcb_app_update(dev);
+}
+
 static int sparx5_dcb_ieee_setapp(struct net_device *dev, struct dcb_app *app)
 {
 	struct dcb_app app_itr;
@@ -264,7 +279,7 @@ static int sparx5_dcb_ieee_setapp(struct net_device *dev, struct dcb_app *app)
 	if (prio) {
 		app_itr = *app;
 		app_itr.priority = prio;
-		dcb_ieee_delapp(dev, &app_itr);
+		sparx5_dcb_ieee_delapp(dev, &app_itr);
 	}
 
 	if (app->selector == IEEE_8021QAZ_APP_SEL_DSCP)
@@ -281,21 +296,6 @@ static int sparx5_dcb_ieee_setapp(struct net_device *dev, struct dcb_app *app)
 	return err;
 }
 
-static int sparx5_dcb_ieee_delapp(struct net_device *dev, struct dcb_app *app)
-{
-	int err;
-
-	if (app->selector == IEEE_8021QAZ_APP_SEL_DSCP)
-		err = sparx5_dcb_ieee_dscp_setdel(dev, app, dcb_ieee_delapp);
-	else
-		err = dcb_ieee_delapp(dev, app);
-
-	if (err < 0)
-		return err;
-
-	return sparx5_dcb_app_update(dev);
-}
-
 static int sparx5_dcb_setapptrust(struct net_device *dev, u8 *selectors,
 				  int nselectors)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: microchip: sparx5: fix deletion of existing DSCP mappings
  2023-03-07 11:21 [PATCH net] net: microchip: sparx5: fix deletion of existing DSCP mappings Daniel Machon
@ 2023-03-07 16:33 ` Simon Horman
  2023-03-08 13:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-03-07 16:33 UTC (permalink / raw)
  To: Daniel Machon
  Cc: netdev, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, UNGLinuxDriver, joe, error27, linux-arm-kernel,
	linux-kernel

On Tue, Mar 07, 2023 at 12:21:03PM +0100, Daniel Machon wrote:
> Fix deletion of existing DSCP mappings in the APP table.
> 
> Adding and deleting DSCP entries are replicated per-port, since the
> mapping table is global for all ports in the chip. Whenever a mapping
> for a DSCP value already exists, the old mapping is deleted first.
> However, it is only deleted for the specified port. Fix this by calling
> sparx5_dcb_ieee_delapp() instead of dcb_ieee_delapp() as it ought to be.
> 
> Reproduce:
> 
> // Map and remap DSCP value 63
> $ dcb app add dev eth0 dscp-prio 63:1
> $ dcb app add dev eth0 dscp-prio 63:2
> 
> $ dcb app show dev eth0 dscp-prio
> dscp-prio 63:2
> 
> $ dcb app show dev eth1 dscp-prio
> dscp-prio 63:1 63:2 <-- 63:1 should not be there
> 
> Fixes: 8dcf69a64118 ("net: microchip: sparx5: add support for offloading dscp table")
> Signed-off-by: Daniel Machon <daniel.machon@microchip.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: microchip: sparx5: fix deletion of existing DSCP mappings
  2023-03-07 11:21 [PATCH net] net: microchip: sparx5: fix deletion of existing DSCP mappings Daniel Machon
  2023-03-07 16:33 ` Simon Horman
@ 2023-03-08 13:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-08 13:10 UTC (permalink / raw)
  To: Daniel Machon
  Cc: netdev, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, UNGLinuxDriver, joe, error27, linux-arm-kernel,
	linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 7 Mar 2023 12:21:03 +0100 you wrote:
> Fix deletion of existing DSCP mappings in the APP table.
> 
> Adding and deleting DSCP entries are replicated per-port, since the
> mapping table is global for all ports in the chip. Whenever a mapping
> for a DSCP value already exists, the old mapping is deleted first.
> However, it is only deleted for the specified port. Fix this by calling
> sparx5_dcb_ieee_delapp() instead of dcb_ieee_delapp() as it ought to be.
> 
> [...]

Here is the summary with links:
  - [net] net: microchip: sparx5: fix deletion of existing DSCP mappings
    https://git.kernel.org/netdev/net/c/cdd28833100c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-08 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07 11:21 [PATCH net] net: microchip: sparx5: fix deletion of existing DSCP mappings Daniel Machon
2023-03-07 16:33 ` Simon Horman
2023-03-08 13:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).