netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mtk-ppe: fix traffic offload with bridged wlan
@ 2022-07-18 18:36 Lorenzo Bianconi
  2022-07-20  0:40 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2022-07-18 18:36 UTC (permalink / raw)
  To: netdev
  Cc: nbd, john, sean.wang, Mark-MC.Lee, davem, edumazet, kuba, pabeni,
	pablo, matthias.bgg, linux-mediatek, lorenzo.bianconi, Ryder.Lee,
	Evelyn.Tsai

A typical flow offload scenario for OpenWrt users is routed traffic
received by the wan interface that is redirected to a wlan device
belonging to the lan bridge. Current implementation fails to
fill wdma offload info in mtk_flow_get_wdma_info() since odev device is
the local bridge. Fix the issue running dev_fill_forward_path routine in
mtk_flow_get_wdma_info in order to identify the wlan device.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../net/ethernet/mediatek/mtk_ppe_offload.c   | 29 +++++++++----------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
index 90e7dfd011c9..25dc3c3aa31d 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
@@ -88,29 +88,28 @@ mtk_flow_offload_mangle_eth(const struct flow_action_entry *act, void *eth)
 static int
 mtk_flow_get_wdma_info(struct net_device *dev, const u8 *addr, struct mtk_wdma_info *info)
 {
-	struct net_device_path_ctx ctx = {
-		.dev = dev,
-	};
-	struct net_device_path path = {};
+	struct net_device_path_stack stack;
+	struct net_device_path *path;
+	int err;
 
-	memcpy(ctx.daddr, addr, sizeof(ctx.daddr));
+	if (!dev)
+		return -ENODEV;
 
 	if (!IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED))
 		return -1;
 
-	if (!dev->netdev_ops->ndo_fill_forward_path)
-		return -1;
-
-	if (dev->netdev_ops->ndo_fill_forward_path(&ctx, &path))
-		return -1;
+	err = dev_fill_forward_path(dev, addr, &stack);
+	if (err)
+		return err;
 
-	if (path.type != DEV_PATH_MTK_WDMA)
+	path = &stack.path[stack.num_paths - 1];
+	if (path->type != DEV_PATH_MTK_WDMA)
 		return -1;
 
-	info->wdma_idx = path.mtk_wdma.wdma_idx;
-	info->queue = path.mtk_wdma.queue;
-	info->bss = path.mtk_wdma.bss;
-	info->wcid = path.mtk_wdma.wcid;
+	info->wdma_idx = path->mtk_wdma.wdma_idx;
+	info->queue = path->mtk_wdma.queue;
+	info->bss = path->mtk_wdma.bss;
+	info->wcid = path->mtk_wdma.wcid;
 
 	return 0;
 }
-- 
2.36.1


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

* Re: [PATCH net-next] net: ethernet: mtk-ppe: fix traffic offload with bridged wlan
  2022-07-18 18:36 [PATCH net-next] net: ethernet: mtk-ppe: fix traffic offload with bridged wlan Lorenzo Bianconi
@ 2022-07-20  0:40 ` Jakub Kicinski
  2022-07-20  7:45   ` Lorenzo Bianconi
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-07-20  0:40 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, nbd, john, sean.wang, Mark-MC.Lee, davem, edumazet,
	pabeni, pablo, matthias.bgg, linux-mediatek, lorenzo.bianconi,
	Ryder.Lee, Evelyn.Tsai

On Mon, 18 Jul 2022 20:36:39 +0200 Lorenzo Bianconi wrote:
> A typical flow offload scenario for OpenWrt users is routed traffic
> received by the wan interface that is redirected to a wlan device
> belonging to the lan bridge. Current implementation fails to
> fill wdma offload info in mtk_flow_get_wdma_info() since odev device is
> the local bridge. Fix the issue running dev_fill_forward_path routine in
> mtk_flow_get_wdma_info in order to identify the wlan device.

AFAIU this will conflict with 53eb9b04560c ("net: ethernet: mtk_ppe:
fix possible NULL pointer dereference in mtk_flow_get_wdma_info")? 
We merge net -> net-next every Thu, please wait for that to happen 
and then repost. Conflicting patches are extra work for Stephen and
for me.

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

* Re: [PATCH net-next] net: ethernet: mtk-ppe: fix traffic offload with bridged wlan
  2022-07-20  0:40 ` Jakub Kicinski
@ 2022-07-20  7:45   ` Lorenzo Bianconi
  0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2022-07-20  7:45 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, nbd, john, sean.wang, Mark-MC.Lee, davem, edumazet,
	pabeni, pablo, matthias.bgg, linux-mediatek, lorenzo.bianconi,
	Ryder.Lee, Evelyn.Tsai

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

> On Mon, 18 Jul 2022 20:36:39 +0200 Lorenzo Bianconi wrote:
> > A typical flow offload scenario for OpenWrt users is routed traffic
> > received by the wan interface that is redirected to a wlan device
> > belonging to the lan bridge. Current implementation fails to
> > fill wdma offload info in mtk_flow_get_wdma_info() since odev device is
> > the local bridge. Fix the issue running dev_fill_forward_path routine in
> > mtk_flow_get_wdma_info in order to identify the wlan device.
> 
> AFAIU this will conflict with 53eb9b04560c ("net: ethernet: mtk_ppe:
> fix possible NULL pointer dereference in mtk_flow_get_wdma_info")? 
> We merge net -> net-next every Thu, please wait for that to happen 
> and then repost. Conflicting patches are extra work for Stephen and
> for me.

ack, right, sorry for that. I will repost after the merge.

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2022-07-20  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-18 18:36 [PATCH net-next] net: ethernet: mtk-ppe: fix traffic offload with bridged wlan Lorenzo Bianconi
2022-07-20  0:40 ` Jakub Kicinski
2022-07-20  7:45   ` Lorenzo Bianconi

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).