1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Fri, 22 Jul 2022 09:06:19 +0200
3 Subject: [PATCH] net: ethernet: mtk-ppe: fix traffic offload with bridged wlan
5 A typical flow offload scenario for OpenWrt users is routed traffic
6 received by the wan interface that is redirected to a wlan device
7 belonging to the lan bridge. Current implementation fails to
8 fill wdma offload info in mtk_flow_get_wdma_info() since odev device is
9 the local bridge. Fix the issue running dev_fill_forward_path routine in
10 mtk_flow_get_wdma_info in order to identify the wlan device.
12 Tested-by: Paolo Valerio <pvalerio@redhat.com>
13 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
17 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
18 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
19 @@ -88,32 +88,28 @@ mtk_flow_offload_mangle_eth(const struct
21 mtk_flow_get_wdma_info(struct net_device *dev, const u8 *addr, struct mtk_wdma_info *info)
23 - struct net_device_path_ctx ctx = {
26 - struct net_device_path path = {};
27 + struct net_device_path_stack stack;
28 + struct net_device_path *path;
35 - memcpy(ctx.daddr, addr, sizeof(ctx.daddr));
37 if (!IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED))
40 - if (!dev->netdev_ops->ndo_fill_forward_path)
43 - if (dev->netdev_ops->ndo_fill_forward_path(&ctx, &path))
45 + err = dev_fill_forward_path(dev, addr, &stack);
49 - if (path.type != DEV_PATH_MTK_WDMA)
50 + path = &stack.path[stack.num_paths - 1];
51 + if (path->type != DEV_PATH_MTK_WDMA)
54 - info->wdma_idx = path.mtk_wdma.wdma_idx;
55 - info->queue = path.mtk_wdma.queue;
56 - info->bss = path.mtk_wdma.bss;
57 - info->wcid = path.mtk_wdma.wcid;
58 + info->wdma_idx = path->mtk_wdma.wdma_idx;
59 + info->queue = path->mtk_wdma.queue;
60 + info->bss = path->mtk_wdma.bss;
61 + info->wcid = path->mtk_wdma.wcid;