Skip to content

Commit

Permalink
net: ethernet: mtk_wed: introduce wed wo support
Browse files Browse the repository at this point in the history
Introduce WO chip support to mtk wed driver. MTK WED WO is used to
implement RX Wireless Ethernet Dispatch and offload traffic received by
wlan nic to the wired interface.

Tested-by: Daniel Golle <daniel@makrotopia.org>
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lorenzo Bianconi authored and David S. Miller committed Nov 11, 2022
1 parent cc51410 commit 7996844
Show file tree
Hide file tree
Showing 6 changed files with 622 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mediatek/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o
mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o
mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o mtk_wed_mcu.o
mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o mtk_wed_mcu.o mtk_wed_wo.o
ifdef CONFIG_DEBUG_FS
mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_debugfs.o
endif
Expand Down
7 changes: 6 additions & 1 deletion drivers/net/ethernet/mediatek/mtk_wed.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "mtk_wed_regs.h"
#include "mtk_wed.h"
#include "mtk_ppe.h"
#include "mtk_wed_wo.h"

#define MTK_PCIE_BASE(n) (0x1a143000 + (n) * 0x2000)

Expand Down Expand Up @@ -355,6 +356,8 @@ mtk_wed_detach(struct mtk_wed_device *dev)

mtk_wed_free_buffer(dev);
mtk_wed_free_tx_rings(dev);
if (hw->version != 1)
mtk_wed_wo_deinit(hw);

if (dev->wlan.bus_type == MTK_WED_BUS_PCIE) {
struct device_node *wlan_node;
Expand Down Expand Up @@ -878,9 +881,11 @@ mtk_wed_attach(struct mtk_wed_device *dev)
}

mtk_wed_hw_init_early(dev);
if (hw->hifsys)
if (hw->version == 1)
regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP,
BIT(hw->index), 0);
else
ret = mtk_wed_wo_init(hw);

out:
mutex_unlock(&hw_lock);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/mediatek/mtk_wed.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/netdevice.h>

struct mtk_eth;
struct mtk_wed_wo;

struct mtk_wed_hw {
struct device_node *node;
Expand All @@ -22,6 +23,7 @@ struct mtk_wed_hw {
struct regmap *mirror;
struct dentry *debugfs_dir;
struct mtk_wed_device *wed_dev;
struct mtk_wed_wo *wed_wo;
u32 debugfs_reg;
u32 num_flows;
u8 version;
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/mediatek/mtk_wed_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ mtk_wed_mcu_skb_send_msg(struct mtk_wed_wo *wo, struct sk_buff *skb,
if (id == MTK_WED_MODULE_ID_WO)
hdr->flag |= cpu_to_le16(MTK_WED_WARP_CMD_FLAG_FROM_TO_WO);

dev_kfree_skb(skb);
return 0;
return mtk_wed_wo_queue_tx_skb(wo, &wo->q_tx, skb);
}

static int
Expand Down
Loading

0 comments on commit 7996844

Please sign in to comment.