netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] dpaa2-switch: various fixes
@ 2023-12-12 16:43 Ioana Ciornei
  2023-12-12 16:43 ` [PATCH net v2 1/2] dpaa2-switch: fix size of the dma_unmap Ioana Ciornei
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ioana Ciornei @ 2023-12-12 16:43 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, netdev; +Cc: vladimir.oltean, Ioana Ciornei

The first patch fixes the size passed to two dma_unmap_single() calls
which was wrongly put as the size of the pointer.

The second patch is new to this series and reverts the behavior of the
dpaa2-switch driver to not ask for object replay upon offloading so that
we avoid the errors encountered when a VLAN is installed multiple times
on the same port.

Changes in v2:
- 1/2: Fixed the same issue in the 2nd dma_unmap from the remove path
- 2/2: Patch is new

Ioana Ciornei (2):
  dpaa2-switch: fix size of the dma_unmap
  dpaa2-switch: do not ask for MDB, VLAN and FDB replay

 .../ethernet/freescale/dpaa2/dpaa2-switch-flower.c    |  7 ++++---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c   | 11 ++---------
 2 files changed, 6 insertions(+), 12 deletions(-)

-- 
2.34.1


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

* [PATCH net v2 1/2] dpaa2-switch: fix size of the dma_unmap
  2023-12-12 16:43 [PATCH net v2 0/2] dpaa2-switch: various fixes Ioana Ciornei
@ 2023-12-12 16:43 ` Ioana Ciornei
  2023-12-12 16:43 ` [PATCH net v2 2/2] dpaa2-switch: do not ask for MDB, VLAN and FDB replay Ioana Ciornei
  2023-12-14  3:00 ` [PATCH net v2 0/2] dpaa2-switch: various fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ioana Ciornei @ 2023-12-12 16:43 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, netdev; +Cc: vladimir.oltean, Ioana Ciornei

The size of the DMA unmap was wrongly put as a sizeof of a pointer.
Change the value of the DMA unmap to be the actual macro used for the
allocation and the DMA map.

Fixes: 1110318d83e8 ("dpaa2-switch: add tc flower hardware offload on ingress traffic")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changes in v2:
- Fixed the same issue in the 2nd dma_unmap from the remove path


 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c
index 4798fb7fe35d..b6a534a3e0b1 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c
@@ -139,7 +139,8 @@ int dpaa2_switch_acl_entry_add(struct dpaa2_switch_filter_block *filter_block,
 	err = dpsw_acl_add_entry(ethsw->mc_io, 0, ethsw->dpsw_handle,
 				 filter_block->acl_id, acl_entry_cfg);
 
-	dma_unmap_single(dev, acl_entry_cfg->key_iova, sizeof(cmd_buff),
+	dma_unmap_single(dev, acl_entry_cfg->key_iova,
+			 DPAA2_ETHSW_PORT_ACL_CMD_BUF_SIZE,
 			 DMA_TO_DEVICE);
 	if (err) {
 		dev_err(dev, "dpsw_acl_add_entry() failed %d\n", err);
@@ -181,8 +182,8 @@ dpaa2_switch_acl_entry_remove(struct dpaa2_switch_filter_block *block,
 	err = dpsw_acl_remove_entry(ethsw->mc_io, 0, ethsw->dpsw_handle,
 				    block->acl_id, acl_entry_cfg);
 
-	dma_unmap_single(dev, acl_entry_cfg->key_iova, sizeof(cmd_buff),
-			 DMA_TO_DEVICE);
+	dma_unmap_single(dev, acl_entry_cfg->key_iova,
+			 DPAA2_ETHSW_PORT_ACL_CMD_BUF_SIZE, DMA_TO_DEVICE);
 	if (err) {
 		dev_err(dev, "dpsw_acl_remove_entry() failed %d\n", err);
 		kfree(cmd_buff);
-- 
2.34.1


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

* [PATCH net v2 2/2] dpaa2-switch: do not ask for MDB, VLAN and FDB replay
  2023-12-12 16:43 [PATCH net v2 0/2] dpaa2-switch: various fixes Ioana Ciornei
  2023-12-12 16:43 ` [PATCH net v2 1/2] dpaa2-switch: fix size of the dma_unmap Ioana Ciornei
@ 2023-12-12 16:43 ` Ioana Ciornei
  2023-12-14  3:00 ` [PATCH net v2 0/2] dpaa2-switch: various fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ioana Ciornei @ 2023-12-12 16:43 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, netdev; +Cc: vladimir.oltean, Ioana Ciornei

Starting with commit 4e51bf44a03a ("net: bridge: move the switchdev
object replay helpers to "push" mode") the switchdev_bridge_port_offload()
helper was extended with the intention to provide switchdev drivers easy
access to object addition and deletion replays. This works by calling
the replay helpers with non-NULL notifier blocks.

In the same commit, the dpaa2-switch driver was updated so that it
passes valid notifier blocks to the helper. At that moment, no
regression was identified through testing.

In the meantime, the blamed commit changed the behavior in terms of
which ports get hit by the replay. Before this commit, only the initial
port which identified itself as offloaded through
switchdev_bridge_port_offload() got a replay of all port objects and
FDBs. After this, the newly joining port will trigger a replay of
objects on all bridge ports and on the bridge itself.

This behavior leads to errors in dpaa2_switch_port_vlans_add() when a
VLAN gets installed on the same interface multiple times.

The intended mechanism to address this is to pass a non-NULL ctx to the
switchdev_bridge_port_offload() helper and then check it against the
port's private structure. But since the driver does not have any use for
the replayed port objects and FDBs until it gains support for LAG
offload, it's better to fix the issue by reverting the dpaa2-switch
driver to not ask for replay. The pointers will be added back when we
are prepared to ignore replays on unrelated ports.

Fixes: b28d580e2939 ("net: bridge: switchdev: replay all VLAN groups")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changes in v2:
 - Patch is new

 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index 97d3151076d5..e01a246124ac 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -1998,9 +1998,6 @@ static int dpaa2_switch_port_attr_set_event(struct net_device *netdev,
 	return notifier_from_errno(err);
 }
 
-static struct notifier_block dpaa2_switch_port_switchdev_nb;
-static struct notifier_block dpaa2_switch_port_switchdev_blocking_nb;
-
 static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
 					 struct net_device *upper_dev,
 					 struct netlink_ext_ack *extack)
@@ -2043,9 +2040,7 @@ static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
 		goto err_egress_flood;
 
 	err = switchdev_bridge_port_offload(netdev, netdev, NULL,
-					    &dpaa2_switch_port_switchdev_nb,
-					    &dpaa2_switch_port_switchdev_blocking_nb,
-					    false, extack);
+					    NULL, NULL, false, extack);
 	if (err)
 		goto err_switchdev_offload;
 
@@ -2079,9 +2074,7 @@ static int dpaa2_switch_port_restore_rxvlan(struct net_device *vdev, int vid, vo
 
 static void dpaa2_switch_port_pre_bridge_leave(struct net_device *netdev)
 {
-	switchdev_bridge_port_unoffload(netdev, NULL,
-					&dpaa2_switch_port_switchdev_nb,
-					&dpaa2_switch_port_switchdev_blocking_nb);
+	switchdev_bridge_port_unoffload(netdev, NULL, NULL, NULL);
 }
 
 static int dpaa2_switch_port_bridge_leave(struct net_device *netdev)
-- 
2.34.1


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

* Re: [PATCH net v2 0/2] dpaa2-switch: various fixes
  2023-12-12 16:43 [PATCH net v2 0/2] dpaa2-switch: various fixes Ioana Ciornei
  2023-12-12 16:43 ` [PATCH net v2 1/2] dpaa2-switch: fix size of the dma_unmap Ioana Ciornei
  2023-12-12 16:43 ` [PATCH net v2 2/2] dpaa2-switch: do not ask for MDB, VLAN and FDB replay Ioana Ciornei
@ 2023-12-14  3:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-14  3:00 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: davem, edumazet, kuba, pabeni, netdev, vladimir.oltean

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 12 Dec 2023 18:43:24 +0200 you wrote:
> The first patch fixes the size passed to two dma_unmap_single() calls
> which was wrongly put as the size of the pointer.
> 
> The second patch is new to this series and reverts the behavior of the
> dpaa2-switch driver to not ask for object replay upon offloading so that
> we avoid the errors encountered when a VLAN is installed multiple times
> on the same port.
> 
> [...]

Here is the summary with links:
  - [net,v2,1/2] dpaa2-switch: fix size of the dma_unmap
    https://git.kernel.org/netdev/net/c/2aad7d4189a9
  - [net,v2,2/2] dpaa2-switch: do not ask for MDB, VLAN and FDB replay
    https://git.kernel.org/netdev/net/c/f24a49a375f6

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] 4+ messages in thread

end of thread, other threads:[~2023-12-14  3:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12 16:43 [PATCH net v2 0/2] dpaa2-switch: various fixes Ioana Ciornei
2023-12-12 16:43 ` [PATCH net v2 1/2] dpaa2-switch: fix size of the dma_unmap Ioana Ciornei
2023-12-12 16:43 ` [PATCH net v2 2/2] dpaa2-switch: do not ask for MDB, VLAN and FDB replay Ioana Ciornei
2023-12-14  3:00 ` [PATCH net v2 0/2] dpaa2-switch: various fixes 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).