Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethernet: mtk-ppe: fix traffic offload with bridged wlan

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.

Tested-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Lorenzo Bianconi and committed by
David S. Miller
2830e314 360f9f31

+14 -18
+14 -18
drivers/net/ethernet/mediatek/mtk_ppe_offload.c
··· 88 88 static int 89 89 mtk_flow_get_wdma_info(struct net_device *dev, const u8 *addr, struct mtk_wdma_info *info) 90 90 { 91 - struct net_device_path_ctx ctx = { 92 - .dev = dev, 93 - }; 94 - struct net_device_path path = {}; 91 + struct net_device_path_stack stack; 92 + struct net_device_path *path; 93 + int err; 95 94 96 - if (!ctx.dev) 95 + if (!dev) 97 96 return -ENODEV; 98 - 99 - memcpy(ctx.daddr, addr, sizeof(ctx.daddr)); 100 97 101 98 if (!IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED)) 102 99 return -1; 103 100 104 - if (!dev->netdev_ops->ndo_fill_forward_path) 101 + err = dev_fill_forward_path(dev, addr, &stack); 102 + if (err) 103 + return err; 104 + 105 + path = &stack.path[stack.num_paths - 1]; 106 + if (path->type != DEV_PATH_MTK_WDMA) 105 107 return -1; 106 108 107 - if (dev->netdev_ops->ndo_fill_forward_path(&ctx, &path)) 108 - return -1; 109 - 110 - if (path.type != DEV_PATH_MTK_WDMA) 111 - return -1; 112 - 113 - info->wdma_idx = path.mtk_wdma.wdma_idx; 114 - info->queue = path.mtk_wdma.queue; 115 - info->bss = path.mtk_wdma.bss; 116 - info->wcid = path.mtk_wdma.wcid; 109 + info->wdma_idx = path->mtk_wdma.wdma_idx; 110 + info->queue = path->mtk_wdma.queue; 111 + info->bss = path->mtk_wdma.bss; 112 + info->wcid = path->mtk_wdma.wcid; 117 113 118 114 return 0; 119 115 }