[MTK] multiple ppe:what's the purpose of ppe1?

Hi All,

I've been confused by a question for a long time.

I'm using BPI-R3 with mt7986 SoC. I don't understand the user case of
ppe1. I tested LAN<->WAN, LAN<->WLAN and WLAN<->WAN and all traffic is offloaded to ppe0 according to /sys/kernel/debug/ppeX/bind even though below two patches are
applied into my FW.

Is the ppe1 for PCIe Wifi chip? Thanks!

  1. Patch 1 in mt76 repo:
commit 56f0cd4d5ea6ab91eeb605adce5677685a82c2d4
Author: Felix Fietkau <nbd@nbd.name>
Date:   Mon Mar 20 20:47:04 2023 +0100

    wifi: mt76: mt7915 add tc offloading support

    This is used for offloading flows from WLAN to Ethernet, or from
WLAN to WLAN

    Signed-off-by: Felix Fietkau <nbd@nbd.name>

diff --git a/mt7915/init.c b/mt7915/init.c
index b88c3827..ff8b49ab 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -346,6 +346,9 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
        hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
        hw->netdev_features = NETIF_F_RXCSUM;

+       if (mtk_wed_device_active(&mdev->mmio.wed))
+               hw->netdev_features |= NETIF_F_HW_TC;
+
        hw->radiotap_timestamp.units_pos =
                IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;

diff --git a/mt7915/main.c b/mt7915/main.c
index 3bbccbdf..e82596ed 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1516,6 +1516,20 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,

        return 0;
 }
+
+static int
+mt7915_net_setup_tc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                   struct net_device *netdev, enum tc_setup_type type,
+                   void *type_data)
+{
+       struct mt7915_dev *dev = mt7915_hw_dev(hw);
+       struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
+
+       if (!mtk_wed_device_active(wed))
+               return -EOPNOTSUPP;
+
+       return mtk_wed_device_setup_tc(wed, netdev, type, type_data);
+}
 #endif

 const struct ieee80211_ops mt7915_ops = {
@@ -1568,5 +1582,6 @@ const struct ieee80211_ops mt7915_ops = {
        .set_radar_background = mt7915_set_radar_background,
 #ifdef CONFIG_NET_MEDIATEK_SOC_WED
        .net_fill_forward_path = mt7915_net_fill_forward_path,
+       .net_setup_tc = mt7915_net_setup_tc,
 #endif
 };

  1. Patch 2 in openwrt repo:
commit d0a06965e8ab0a92a4813fddbb8e045407897310
Author: Felix Fietkau <nbd@nbd.name>
Date:   Mon Mar 20 18:51:06 2023 +0100

    mediatek: add kernel code for supporting offloading wlan->eth and
wlan->wlan flows

    Will be enabled by an upcoming mt76 update

    Signed-off-by: Felix Fietkau <nbd@nbd.name>

diff --git a/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch
b/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regis
t.patch
new file mode 100644
index 0000000000..f1807bdc8a
--- /dev/null
+++ b/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch
@@ -0,0 +1,149 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Mon, 20 Mar 2023 14:28:08 +0100
+Subject: [PATCH] wifi: mac80211: add support for letting drivers register tc
+ offload support
+
+On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can
+be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is
+needed.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -4196,6 +4196,10 @@ struct ieee80211_prep_tx_info {
+  *    Note that a sta can also be inserted or removed with valid links,
+  *    i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
+  *    In fact, cannot change from having valid_links and not having them.
++ * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware
++ *    flow offloading for flows originating from the vif.
++ *    Note that the driver must not assume that the vif driver_data is valid
++ *    at this point, since the callback can be called during netdev teardown.
+  */
+ struct ieee80211_ops {
+       void (*tx)(struct ieee80211_hw *hw,
+@@ -4551,6 +4555,11 @@ struct ieee80211_ops {
+                               struct ieee80211_vif *vif,
+                               struct ieee80211_sta *sta,
+                               u16 old_links, u16 new_links);
++      int (*net_setup_tc)(struct ieee80211_hw *hw,
++                          struct ieee80211_vif *vif,
++                          struct net_device *dev,
++                          enum tc_setup_type type,
++                          void *type_data);
+ };
+
+ /**
+--- a/net/mac80211/driver-ops.h
++++ b/net/mac80211/driver-ops.h
+@@ -1470,6 +1470,23 @@ static inline int drv_net_fill_forward_p
+       return ret;
+ }
...........................
.........................