Skip to content

Commit

Permalink
Merge branch 'add-wed-support-for-mt7988-chipset'
Browse files Browse the repository at this point in the history
Lorenzo Bianconi says:

====================
Add WED support for MT7988 chipset

Similar to MT7622 and MT7986, introduce Wireless Ethernet Dispatcher (WED)
support for MT7988 chipset in order to offload to the hw packet engine traffic
received from LAN/WAN device to WLAN nic (MT7996E).
Add WED RX support in order to offload traffic received by WLAN nic to the
wired interfaces (LAN/WAN).
====================

Link: https://lore.kernel.org/r/cover.1695032290.git.lorenzo@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Paolo Abeni committed Sep 19, 2023
2 parents fa17a6d + 1543b8f commit 5bed8d5
Show file tree
Hide file tree
Showing 16 changed files with 2,109 additions and 328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ properties:
- mediatek,mt7622-wed
- mediatek,mt7981-wed
- mediatek,mt7986-wed
- mediatek,mt7988-wed
- const: syscon

reg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ properties:
items:
- enum:
- mediatek,mt7986-wo-ccif
- mediatek,mt7988-wo-ccif
- const: syscon

reg:
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static const struct mtk_reg_map mt7988_reg_map = {
.wdma_base = {
[0] = 0x4800,
[1] = 0x4c00,
[2] = 0x5000,
},
.pse_iq_sta = 0x0180,
.pse_oq_sta = 0x01a0,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mediatek/mtk_eth_soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ struct mtk_reg_map {
u32 gdm1_cnt;
u32 gdma_to_ppe;
u32 ppe_base;
u32 wdma_base[2];
u32 wdma_base[3];
u32 pse_iq_sta;
u32 pse_oq_sta;
};
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/ethernet/mediatek/mtk_ppe.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ int mtk_foe_entry_set_pppoe(struct mtk_eth *eth, struct mtk_foe_entry *entry,
}

int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
int wdma_idx, int txq, int bss, int wcid)
int wdma_idx, int txq, int bss, int wcid,
bool amsdu_en)
{
struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry);
u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
Expand All @@ -437,6 +438,7 @@ int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
MTK_FOE_IB2_WDMA_WINFO_V2;
l2->w3info = FIELD_PREP(MTK_FOE_WINFO_WCID_V3, wcid) |
FIELD_PREP(MTK_FOE_WINFO_BSS_V3, bss);
l2->amsdu = FIELD_PREP(MTK_FOE_WINFO_AMSDU_EN, amsdu_en);
break;
case 2:
*ib2 &= ~MTK_FOE_IB2_PORT_MG_V2;
Expand Down
19 changes: 10 additions & 9 deletions drivers/net/ethernet/mediatek/mtk_ppe.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ enum {
#define MTK_FOE_WINFO_BSS_V3 GENMASK(23, 16)
#define MTK_FOE_WINFO_WCID_V3 GENMASK(15, 0)

#define MTK_FOE_WINFO_PAO_USR_INFO GENMASK(15, 0)
#define MTK_FOE_WINFO_PAO_TID GENMASK(19, 16)
#define MTK_FOE_WINFO_PAO_IS_FIXEDRATE BIT(20)
#define MTK_FOE_WINFO_PAO_IS_PRIOR BIT(21)
#define MTK_FOE_WINFO_PAO_IS_SP BIT(22)
#define MTK_FOE_WINFO_PAO_HF BIT(23)
#define MTK_FOE_WINFO_PAO_AMSDU_EN BIT(24)
#define MTK_FOE_WINFO_AMSDU_USR_INFO GENMASK(15, 0)
#define MTK_FOE_WINFO_AMSDU_TID GENMASK(19, 16)
#define MTK_FOE_WINFO_AMSDU_IS_FIXEDRATE BIT(20)
#define MTK_FOE_WINFO_AMSDU_IS_PRIOR BIT(21)
#define MTK_FOE_WINFO_AMSDU_IS_SP BIT(22)
#define MTK_FOE_WINFO_AMSDU_HF BIT(23)
#define MTK_FOE_WINFO_AMSDU_EN BIT(24)

enum {
MTK_FOE_STATE_INVALID,
Expand Down Expand Up @@ -123,7 +123,7 @@ struct mtk_foe_mac_info {

/* netsys_v3 */
u32 w3info;
u32 wpao;
u32 amsdu;
};

/* software-only entry type */
Expand Down Expand Up @@ -392,7 +392,8 @@ int mtk_foe_entry_set_vlan(struct mtk_eth *eth, struct mtk_foe_entry *entry,
int mtk_foe_entry_set_pppoe(struct mtk_eth *eth, struct mtk_foe_entry *entry,
int sid);
int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
int wdma_idx, int txq, int bss, int wcid);
int wdma_idx, int txq, int bss, int wcid,
bool amsdu_en);
int mtk_foe_entry_set_queue(struct mtk_eth *eth, struct mtk_foe_entry *entry,
unsigned int queue);
int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/mediatek/mtk_ppe_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ mtk_flow_get_wdma_info(struct net_device *dev, const u8 *addr, struct mtk_wdma_i
info->queue = path->mtk_wdma.queue;
info->bss = path->mtk_wdma.bss;
info->wcid = path->mtk_wdma.wcid;
info->amsdu = path->mtk_wdma.amsdu;

return 0;
}
Expand Down Expand Up @@ -192,7 +193,7 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,

if (mtk_flow_get_wdma_info(dev, dest_mac, &info) == 0) {
mtk_foe_entry_set_wdma(eth, foe, info.wdma_idx, info.queue,
info.bss, info.wcid);
info.bss, info.wcid, info.amsdu);
if (mtk_is_netsys_v2_or_greater(eth)) {
switch (info.wdma_idx) {
case 0:
Expand All @@ -201,6 +202,9 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
case 1:
pse_port = PSE_WDMA1_PORT;
break;
case 2:
pse_port = PSE_WDMA2_PORT;
break;
default:
return -EINVAL;
}
Expand Down
Loading

0 comments on commit 5bed8d5

Please sign in to comment.