[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-kernel/linux-mac80211/files/patches/build/060-no_local_ssb_bcma.patch b/recipes-kernel/linux-mac80211/files/patches/build/060-no_local_ssb_bcma.patch
index 19a60d7..089ff21 100644
--- a/recipes-kernel/linux-mac80211/files/patches/build/060-no_local_ssb_bcma.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/build/060-no_local_ssb_bcma.patch
@@ -1,6 +1,6 @@
--- a/local-symbols
+++ b/local-symbols
-@@ -428,43 +428,6 @@ USB_VL600=
+@@ -451,43 +451,6 @@ USB_VL600=
USB_NET_CH9200=
USB_NET_AQC111=
USB_RTL8153_ECM=
@@ -192,7 +192,7 @@
select BRCMUTIL
--- a/Kconfig.local
+++ b/Kconfig.local
-@@ -1288,117 +1288,6 @@ config BACKPORTED_USB_NET_AQC111
+@@ -1357,117 +1357,6 @@ config BACKPORTED_USB_NET_AQC111
config BACKPORTED_USB_RTL8153_ECM
tristate
default USB_RTL8153_ECM
@@ -312,7 +312,7 @@
default USB_ACM
--- a/Kconfig.sources
+++ b/Kconfig.sources
-@@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/bus/mhi/Kc
+@@ -10,9 +10,6 @@ source "$BACKPORT_DIR/drivers/soc/qcom/K
source "$BACKPORT_DIR/drivers/net/wireless/Kconfig"
source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
@@ -324,8 +324,8 @@
source "$BACKPORT_DIR/drivers/staging/Kconfig"
--- a/Makefile.kernel
+++ b/Makefile.kernel
-@@ -42,8 +42,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
- obj-$(CPTCFG_QRTR) += net/qrtr/
+@@ -43,8 +43,6 @@ obj-$(CPTCFG_QRTR) += net/qrtr/
+ obj-$(CPTCFG_QCOM_QMI_HELPERS) += drivers/soc/qcom/
obj-$(CPTCFG_MHI_BUS) += drivers/bus/mhi/
obj-$(CPTCFG_WLAN) += drivers/net/wireless/
-obj-$(CPTCFG_SSB) += drivers/ssb/
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch
index 777c93c..1ceb2be 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch
@@ -52,7 +52,7 @@
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
-@@ -2949,6 +2949,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2948,6 +2948,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
if (!fwd_skb)
goto out;
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch
index c534d15..fba0912 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch
@@ -11,7 +11,7 @@
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -3001,15 +3001,19 @@ static void mac80211_hwsim_he_capab(stru
+@@ -3004,15 +3004,19 @@ static void mac80211_hwsim_he_capab(stru
{
u16 n_iftype_data;
@@ -34,7 +34,7 @@
return;
}
-@@ -3299,6 +3303,12 @@ static int mac80211_hwsim_new_radio(stru
+@@ -3302,6 +3306,12 @@ static int mac80211_hwsim_new_radio(stru
sband->vht_cap.vht_mcs.tx_mcs_map =
sband->vht_cap.vht_mcs.rx_mcs_map;
break;
@@ -47,7 +47,7 @@
case NL80211_BAND_S1GHZ:
memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
sizeof(sband->s1g_cap));
-@@ -3309,6 +3319,13 @@ static int mac80211_hwsim_new_radio(stru
+@@ -3312,6 +3322,13 @@ static int mac80211_hwsim_new_radio(stru
continue;
}
@@ -61,7 +61,7 @@
sband->ht_cap.ht_supported = true;
sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
IEEE80211_HT_CAP_GRN_FLD |
-@@ -3322,10 +3339,6 @@ static int mac80211_hwsim_new_radio(stru
+@@ -3325,10 +3342,6 @@ static int mac80211_hwsim_new_radio(stru
sband->ht_cap.mcs.rx_mask[0] = 0xff;
sband->ht_cap.mcs.rx_mask[1] = 0xff;
sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch
index 272d84f..4b9d874 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch
@@ -69,7 +69,7 @@
#endif /* __MAC80211_DRIVER_OPS */
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1485,7 +1485,7 @@ struct ieee80211_local {
+@@ -1490,7 +1490,7 @@ struct ieee80211_local {
};
static inline struct ieee80211_sub_if_data *
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch
index 16bcbc2..3be43b8 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch
@@ -18,7 +18,7 @@
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -700,7 +700,8 @@ minstrel_ht_calc_rate_stats(struct minst
+@@ -703,7 +703,8 @@ minstrel_ht_calc_rate_stats(struct minst
unsigned int cur_prob;
if (unlikely(mrs->attempts > 0)) {
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch
index a6817bd..13bed48 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch
@@ -18,7 +18,7 @@
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -511,6 +511,14 @@ minstrel_ht_set_best_prob_rate(struct mi
+@@ -514,6 +514,14 @@ minstrel_ht_set_best_prob_rate(struct mi
int cur_tp_avg, cur_group, cur_idx;
int max_gpr_group, max_gpr_idx;
int max_gpr_tp_avg, max_gpr_prob;
@@ -33,7 +33,7 @@
cur_group = MI_RATE_GROUP(index);
cur_idx = MI_RATE_IDX(index);
-@@ -532,11 +540,6 @@ minstrel_ht_set_best_prob_rate(struct mi
+@@ -535,11 +543,6 @@ minstrel_ht_set_best_prob_rate(struct mi
!minstrel_ht_is_legacy_group(max_tp_group))
return;
@@ -45,7 +45,7 @@
max_gpr_group = MI_RATE_GROUP(mg->max_group_prob_rate);
max_gpr_idx = MI_RATE_IDX(mg->max_group_prob_rate);
max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_avg;
-@@ -594,40 +597,6 @@ minstrel_ht_assign_best_tp_rates(struct
+@@ -597,40 +600,6 @@ minstrel_ht_assign_best_tp_rates(struct
}
@@ -86,7 +86,7 @@
static u16
__minstrel_ht_get_sample_rate(struct minstrel_ht_sta *mi,
enum minstrel_sample_type type)
-@@ -1107,8 +1076,6 @@ minstrel_ht_update_stats(struct minstrel
+@@ -1110,8 +1079,6 @@ minstrel_ht_update_stats(struct minstrel
mi->max_prob_rate = tmp_max_prob_rate;
@@ -95,7 +95,7 @@
minstrel_ht_refill_sample_rates(mi);
#ifdef CPTCFG_MAC80211_DEBUGFS
-@@ -1153,7 +1120,7 @@ minstrel_ht_txstat_valid(struct minstrel
+@@ -1156,7 +1123,7 @@ minstrel_ht_txstat_valid(struct minstrel
}
static void
@@ -104,7 +104,7 @@
{
int group, orig_group;
-@@ -1168,11 +1135,7 @@ minstrel_downgrade_rate(struct minstrel_
+@@ -1171,11 +1138,7 @@ minstrel_downgrade_rate(struct minstrel_
minstrel_mcs_groups[orig_group].streams)
continue;
@@ -117,7 +117,7 @@
}
}
-@@ -1183,7 +1146,7 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1186,7 +1149,7 @@ minstrel_ht_tx_status(void *priv, struct
struct ieee80211_tx_info *info = st->info;
struct minstrel_ht_sta *mi = priv_sta;
struct ieee80211_tx_rate *ar = info->status.rates;
@@ -126,7 +126,7 @@
struct minstrel_priv *mp = priv;
u32 update_interval = mp->update_interval;
bool last, update = false;
-@@ -1233,18 +1196,13 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1236,18 +1199,13 @@ minstrel_ht_tx_status(void *priv, struct
/*
* check for sudden death of spatial multiplexing,
* downgrade to a lower number of streams if necessary.
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch
index 4fc8b59..429886d 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch
@@ -238,7 +238,7 @@
static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
-@@ -783,6 +793,9 @@ static const struct nla_policy nl80211_p
+@@ -788,6 +798,9 @@ static const struct nla_policy nl80211_p
[NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 },
[NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 },
[NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy),
@@ -248,7 +248,7 @@
};
/* policy for the key attributes */
-@@ -2231,6 +2244,35 @@ fail:
+@@ -2236,6 +2249,35 @@ fail:
return -ENOBUFS;
}
@@ -284,7 +284,7 @@
struct nl80211_dump_wiphy_state {
s64 filter_wiphy;
long start;
-@@ -2816,6 +2858,9 @@ static int nl80211_send_wiphy(struct cfg
+@@ -2821,6 +2863,9 @@ static int nl80211_send_wiphy(struct cfg
if (nl80211_put_sar_specs(rdev, msg))
goto nla_put_failure;
@@ -294,7 +294,7 @@
/* done */
state->split_start = 0;
break;
-@@ -5005,6 +5050,96 @@ static int validate_beacon_tx_rate(struc
+@@ -5020,6 +5065,96 @@ static int validate_beacon_tx_rate(struc
return 0;
}
@@ -391,7 +391,7 @@
static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev,
struct nlattr *attrs[],
struct cfg80211_beacon_data *bcn)
-@@ -5085,6 +5220,17 @@ static int nl80211_parse_beacon(struct c
+@@ -5100,6 +5235,17 @@ static int nl80211_parse_beacon(struct c
bcn->ftm_responder = -1;
}
@@ -409,7 +409,7 @@
return 0;
}
-@@ -5541,6 +5687,17 @@ static int nl80211_start_ap(struct sk_bu
+@@ -5556,6 +5702,17 @@ static int nl80211_start_ap(struct sk_bu
goto out;
}
@@ -427,7 +427,7 @@
nl80211_calculate_ap_params(¶ms);
if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
-@@ -5562,6 +5719,11 @@ static int nl80211_start_ap(struct sk_bu
+@@ -5577,6 +5734,11 @@ static int nl80211_start_ap(struct sk_bu
out:
kfree(params.acl);
@@ -439,7 +439,7 @@
return err;
}
-@@ -5586,12 +5748,14 @@ static int nl80211_set_beacon(struct sk_
+@@ -5601,12 +5763,14 @@ static int nl80211_set_beacon(struct sk_
err = nl80211_parse_beacon(rdev, info->attrs, ¶ms);
if (err)
@@ -455,7 +455,7 @@
return err;
}
-@@ -9268,12 +9432,14 @@ static int nl80211_channel_switch(struct
+@@ -9283,12 +9447,14 @@ static int nl80211_channel_switch(struct
err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_after);
if (err)
@@ -473,7 +473,7 @@
err = nla_parse_nested_deprecated(csa_attrs, NL80211_ATTR_MAX,
info->attrs[NL80211_ATTR_CSA_IES],
-@@ -9392,6 +9558,8 @@ skip_beacons:
+@@ -9407,6 +9573,8 @@ skip_beacons:
wdev_unlock(wdev);
free:
@@ -482,7 +482,7 @@
kfree(csa_attrs);
return err;
}
-@@ -14939,6 +15107,8 @@ static int nl80211_color_change(struct s
+@@ -14959,6 +15127,8 @@ static int nl80211_color_change(struct s
wdev_unlock(wdev);
out:
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch
index 90c56b4..2038ee6 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch
@@ -286,7 +286,7 @@
+}
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -796,6 +796,7 @@ static const struct nla_policy nl80211_p
+@@ -801,6 +801,7 @@ static const struct nla_policy nl80211_p
[NL80211_ATTR_MBSSID_CONFIG] =
NLA_POLICY_NESTED(nl80211_mbssid_config_policy),
[NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED },
@@ -294,7 +294,7 @@
};
/* policy for the key attributes */
-@@ -9272,12 +9273,6 @@ static int nl80211_start_radar_detection
+@@ -9287,12 +9288,6 @@ static int nl80211_start_radar_detection
if (err)
return err;
@@ -307,7 +307,7 @@
err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype);
if (err < 0)
return err;
-@@ -9288,6 +9283,16 @@ static int nl80211_start_radar_detection
+@@ -9303,6 +9298,16 @@ static int nl80211_start_radar_detection
if (!cfg80211_chandef_dfs_usable(wiphy, &chandef))
return -EINVAL;
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch
index 567743d..a1b6e3c 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch
@@ -118,7 +118,7 @@
NL80211_RADAR_CAC_ABORTED);
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -9263,42 +9263,60 @@ static int nl80211_start_radar_detection
+@@ -9278,42 +9278,60 @@ static int nl80211_start_radar_detection
struct cfg80211_chan_def chandef;
enum nl80211_dfs_regions dfs_region;
unsigned int cac_time_ms;
@@ -198,7 +198,7 @@
cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef);
if (WARN_ON(!cac_time_ms))
-@@ -9311,6 +9329,9 @@ static int nl80211_start_radar_detection
+@@ -9326,6 +9344,9 @@ static int nl80211_start_radar_detection
wdev->cac_start_time = jiffies;
wdev->cac_time_ms = cac_time_ms;
}
@@ -208,7 +208,7 @@
return err;
}
-@@ -15941,7 +15962,8 @@ static const struct genl_small_ops nl802
+@@ -15961,7 +15982,8 @@ static const struct genl_small_ops nl802
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_start_radar_detection,
.flags = GENL_UNS_ADMIN_PERM,
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch
index c3a4c0d..483b87c 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch
@@ -472,7 +472,7 @@
}
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -796,7 +796,7 @@ static const struct nla_policy nl80211_p
+@@ -801,7 +801,7 @@ static const struct nla_policy nl80211_p
[NL80211_ATTR_MBSSID_CONFIG] =
NLA_POLICY_NESTED(nl80211_mbssid_config_policy),
[NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED },
@@ -481,7 +481,7 @@
};
/* policy for the key attributes */
-@@ -9291,9 +9291,9 @@ static int nl80211_start_radar_detection
+@@ -9306,9 +9306,9 @@ static int nl80211_start_radar_detection
goto unlock;
}
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/329-mac80211-minstrel_ht-fix-where-rate-stats-are-stored.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/329-mac80211-minstrel_ht-fix-where-rate-stats-are-stored.patch
deleted file mode 100644
index d7832ac..0000000
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/329-mac80211-minstrel_ht-fix-where-rate-stats-are-stored.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From: Peter Seiderer <ps.report@gmx.net>
-Date: Mon, 4 Apr 2022 18:54:14 +0200
-Subject: [PATCH] mac80211: minstrel_ht: fix where rate stats are stored (fixes
- debugfs output)
-
-Using an ath9k card the debugfs output of minstrel_ht looks like the following
-(note the zero values for the first four rates sum-of success/attempts):
-
- best ____________rate__________ ____statistics___ _____last____ ______sum-of________
-mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]
-OFDM 1 DP 6.0M 272 1640 5.2 3.1 53.8 3 0 0 0 0
-OFDM 1 C 9.0M 273 1104 7.7 4.6 53.8 4 0 0 0 0
-OFDM 1 B 12.0M 274 836 10.0 6.0 53.8 4 0 0 0 0
-OFDM 1 A S 18.0M 275 568 14.3 8.5 53.8 5 0 0 0 0
-OFDM 1 S 24.0M 276 436 18.1 0.0 0.0 5 0 1 80 1778
-OFDM 1 36.0M 277 300 24.9 0.0 0.0 0 0 1 0 107
-OFDM 1 S 48.0M 278 236 30.4 0.0 0.0 0 0 0 0 75
-OFDM 1 54.0M 279 212 33.0 0.0 0.0 0 0 0 0 72
-
-Total packet count:: ideal 16582 lookaround 885
-Average # of aggregated frames per A-MPDU: 1.0
-
-Debugging showed that the rate statistics for the first four rates where
-stored in the MINSTREL_CCK_GROUP instead of the MINSTREL_OFDM_GROUP because
-in minstrel_ht_get_stats() the supported check was not honoured as done in
-various other places, e.g net/mac80211/rc80211_minstrel_ht_debugfs.c:
-
- 74 if (!(mi->supported[i] & BIT(j)))
- 75 continue;
-
-With the patch applied the output looks good:
-
- best ____________rate__________ ____statistics___ _____last____ ______sum-of________
-mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]
-OFDM 1 D 6.0M 272 1640 5.2 5.2 100.0 3 0 0 1 1
-OFDM 1 C 9.0M 273 1104 7.7 7.7 100.0 4 0 0 38 38
-OFDM 1 B 12.0M 274 836 10.0 9.9 89.5 4 2 2 372 395
-OFDM 1 A P 18.0M 275 568 14.3 14.3 97.2 5 52 53 6956 7181
-OFDM 1 S 24.0M 276 436 18.1 0.0 0.0 0 0 1 6 163
-OFDM 1 36.0M 277 300 24.9 0.0 0.0 0 0 1 0 35
-OFDM 1 S 48.0M 278 236 30.4 0.0 0.0 0 0 0 0 38
-OFDM 1 S 54.0M 279 212 33.0 0.0 0.0 0 0 0 0 38
-
-Total packet count:: ideal 7097 lookaround 287
-Average # of aggregated frames per A-MPDU: 1.0
-
-Signed-off-by: Peter Seiderer <ps.report@gmx.net>
----
-
---- a/net/mac80211/rc80211_minstrel_ht.c
-+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -364,6 +364,9 @@ minstrel_ht_get_stats(struct minstrel_pr
-
- group = MINSTREL_CCK_GROUP;
- for (idx = 0; idx < ARRAY_SIZE(mp->cck_rates); idx++) {
-+ if (!(mi->supported[group] & BIT(idx)))
-+ continue;
-+
- if (rate->idx != mp->cck_rates[idx])
- continue;
-
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch
index 1a66aa8..0ca5386 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch
@@ -359,7 +359,7 @@
struct work_struct csa_finalize_work;
bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
struct cfg80211_chan_def csa_chandef;
-@@ -1180,44 +1182,6 @@ enum mac80211_scan_state {
+@@ -1185,44 +1187,6 @@ enum mac80211_scan_state {
SCAN_ABORT,
};
@@ -404,7 +404,7 @@
DECLARE_STATIC_KEY_FALSE(aql_disable);
struct ieee80211_local {
-@@ -1231,8 +1195,13 @@ struct ieee80211_local {
+@@ -1236,8 +1200,13 @@ struct ieee80211_local {
struct codel_params cparams;
/* protects active_txqs and txqi->schedule_order */
@@ -419,7 +419,7 @@
u32 aql_threshold;
atomic_t aql_total_pending_airtime;
-@@ -1649,125 +1618,6 @@ static inline bool txq_has_queue(struct
+@@ -1654,125 +1623,6 @@ static inline bool txq_has_queue(struct
return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets);
}
@@ -545,7 +545,7 @@
static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
{
return ether_addr_equal(raddr, addr) ||
-@@ -2013,14 +1863,6 @@ int ieee80211_tx_control_port(struct wip
+@@ -2018,14 +1868,6 @@ int ieee80211_tx_control_port(struct wip
u64 *cookie);
int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
const u8 *buf, size_t len);
@@ -594,7 +594,7 @@
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
-@@ -1584,8 +1584,12 @@ static void sta_ps_start(struct sta_info
+@@ -1583,8 +1583,12 @@ static void sta_ps_start(struct sta_info
for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) {
struct ieee80211_txq *txq = sta->sta.txq[tid];
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch
index 89718a8..42e1671 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch
@@ -15,7 +15,7 @@
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1211,6 +1211,7 @@ struct ieee80211_local {
+@@ -1216,6 +1216,7 @@ struct ieee80211_local {
u32 aql_txq_limit_high[IEEE80211_NUM_ACS];
u32 aql_threshold;
atomic_t aql_total_pending_airtime;
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/338-mac80211-fix-queue-selection-for-mesh-OCB-interfaces.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/338-mac80211-fix-queue-selection-for-mesh-OCB-interfaces.patch
deleted file mode 100644
index 9547db0..0000000
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/338-mac80211-fix-queue-selection-for-mesh-OCB-interfaces.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sat, 2 Jul 2022 16:41:32 +0200
-Subject: [PATCH] mac80211: fix queue selection for mesh/OCB interfaces
-
-When using iTXQ, the code assumes that there is only one vif queue for
-broadcast packets, using the BE queue. Allowing non-BE queue marking
-violates that assumption and txq->ac == skb_queue_mapping is no longer
-guaranteed. This can cause issues with queue handling in the driver and
-also causes issues with the recent ATF change, resulting in an AQL
-underflow warning.
-
-Cc: stable@vger.kernel.org
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/wme.c
-+++ b/net/mac80211/wme.c
-@@ -147,8 +147,8 @@ u16 __ieee80211_select_queue(struct ieee
- bool qos;
-
- /* all mesh/ocb stations are required to support WME */
-- if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
-- sdata->vif.type == NL80211_IFTYPE_OCB)
-+ if (sta && (sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
-+ sdata->vif.type == NL80211_IFTYPE_OCB))
- qos = true;
- else if (sta)
- qos = sta->sta.wme;
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/350-bss-color-collision.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/350-bss-color-collision.patch
index d2a4330..1e3486a 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/350-bss-color-collision.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/350-bss-color-collision.patch
@@ -56,7 +56,7 @@
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
-@@ -3181,6 +3181,49 @@ static void ieee80211_process_sa_query_r
+@@ -3180,6 +3180,49 @@ static void ieee80211_process_sa_query_r
ieee80211_tx_skb(sdata, skb);
}
@@ -106,7 +106,7 @@
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)
{
-@@ -3206,6 +3249,9 @@ ieee80211_rx_h_mgmt_check(struct ieee802
+@@ -3205,6 +3248,9 @@ ieee80211_rx_h_mgmt_check(struct ieee802
!(rx->flags & IEEE80211_RX_BEACON_REPORTED)) {
int sig = 0;
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/500-mac80211_configure_antenna_gain.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/500-mac80211_configure_antenna_gain.patch
index 171af5e..50c24a7 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/500-mac80211_configure_antenna_gain.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/500-mac80211_configure_antenna_gain.patch
@@ -87,7 +87,7 @@
CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump)
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1441,6 +1441,7 @@ struct ieee80211_local {
+@@ -1448,6 +1448,7 @@ struct ieee80211_local {
int dynamic_ps_forced_timeout;
int user_power_level; /* in dBm, for all interfaces */
@@ -129,7 +129,7 @@
local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -797,6 +797,7 @@ static const struct nla_policy nl80211_p
+@@ -802,6 +802,7 @@ static const struct nla_policy nl80211_p
NLA_POLICY_NESTED(nl80211_mbssid_config_policy),
[NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED },
[NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG },
@@ -137,7 +137,7 @@
};
/* policy for the key attributes */
-@@ -3377,6 +3378,22 @@ static int nl80211_set_wiphy(struct sk_b
+@@ -3391,6 +3392,22 @@ static int nl80211_set_wiphy(struct sk_b
if (result)
goto out;
}
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc b/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc
index 45566ee..79cb4e6 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc
@@ -26,7 +26,6 @@
file://325-mac80211-MBSSID-channel-switch.patch \
file://326-mac80211-update-bssid_indicator-in-ieee80211_assign_.patch \
file://328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch \
- file://329-mac80211-minstrel_ht-fix-where-rate-stats-are-stored.patch \
file://330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch \
file://331-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch \
file://332-mac80211-consider-aql_tx_pending-when-checking-airti.patch \
@@ -35,7 +34,6 @@
file://335-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch \
file://336-mac80211-only-accumulate-airtime-deficit-for-active-.patch \
file://337-mac80211-increase-quantum-for-airtime-scheduler.patch \
- file://338-mac80211-fix-queue-selection-for-mesh-OCB-interfaces.patch \
file://339-mac80211-exclude-multicast-packets-from-AQL-pending-.patch \
file://350-bss-color-collision.patch \
file://400-allow-ibss-mixed.patch \
diff --git a/recipes-kernel/linux-mac80211/linux-mac80211.bb b/recipes-kernel/linux-mac80211/linux-mac80211.bb
index 26dff46..8e49672 100644
--- a/recipes-kernel/linux-mac80211/linux-mac80211.bb
+++ b/recipes-kernel/linux-mac80211/linux-mac80211.bb
@@ -6,14 +6,14 @@
inherit module
-PV = "5.15.33"
+PV = "5.15.58"
SRC_URI = " \
https://cdn.kernel.org/pub/linux/kernel/projects/backports/stable/v${PV}/backports-${PV}-1.tar.xz \
file://config \
file://0001-rdkb-fix_build_issue-mac80211-without_depmod.patch;apply=no \
"
-SRC_URI[sha256sum] = "1b6b3bded4c81814ebebe2d194c2f8966d2399005b85ebb0557285b6e73f5422"
+SRC_URI[sha256sum] = "a3c2a2b7bbaf8943c65fd72f4e7d7ad5e205aeae28b26c835f9d8afa0f9810bf"
DEPENDS += "virtual/kernel"
DEPENDS += "bison-native coreutils-native flex-native"
diff --git a/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch b/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
index 737c694..0cc1f89 100644
--- a/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
+++ b/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
@@ -1,24 +1,24 @@
-From bac4df557d1674c557297e80b852867a650aa490 Mon Sep 17 00:00:00 2001
+From 379918ba724d761166f0677848b6266fe999486a Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Sun, 12 Jun 2022 16:38:45 +0800
Subject: [PATCH 3001/3003] mt76 add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- .../net/wireless/mediatek/mt76/mt76_connac.h | 1 +
- .../net/wireless/mediatek/mt76/mt7915/dma.c | 59 +++++++---
- .../net/wireless/mediatek/mt76/mt7915/mac.c | 4 +-
- .../net/wireless/mediatek/mt76/mt7915/main.c | 9 +-
- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +-
- .../net/wireless/mediatek/mt76/mt7915/mmio.c | 110 +++++++++++++++++-
- .../wireless/mediatek/mt76/mt7915/mt7915.h | 2 +
- .../net/wireless/mediatek/mt76/mt7915/pci.c | 72 +-----------
- .../net/wireless/mediatek/mt76/mt7915/regs.h | 15 +++
- .../net/wireless/mediatek/mt76/mt7915/soc.c | 16 ++-
+ mt76_connac.h | 1 +
+ mt7915/dma.c | 59 +++++++++++++++++++-------
+ mt7915/mac.c | 4 +-
+ mt7915/main.c | 9 +++-
+ mt7915/mcu.c | 2 +-
+ mt7915/mmio.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7915/mt7915.h | 2 +
+ mt7915/pci.c | 72 +------------------------------
+ mt7915/regs.h | 15 +++++++
+ mt7915/soc.c | 16 +++++--
10 files changed, 193 insertions(+), 97 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
-index 5a9c1c97..c8d86800 100644
+index 5a9c1c9..c8d8680 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -110,6 +110,7 @@ struct mt76_connac_sta_key_conf {
@@ -30,7 +30,7 @@
struct mt76_connac_fw_txp {
__le16 flags;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 9e3d14db..71223221 100644
+index 9e3d14d..7122322 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -12,7 +12,10 @@ mt7915_init_tx_queues(struct mt7915_phy *phy, int idx, int n_desc, int ring_base
@@ -144,7 +144,7 @@
return ret;
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 0310ca74..db21d83e 100644
+index 0310ca7..db21d83 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -835,9 +835,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
@@ -160,7 +160,7 @@
static void
diff --git a/mt7915/main.c b/mt7915/main.c
-index 6085e124..2e721cd0 100644
+index 6085e12..2e721cd 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1439,14 +1439,19 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
@@ -186,10 +186,10 @@
ctx->dev = NULL;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 681a2a7c..674cbc4e 100644
+index ffe0447..9e9a2ea 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -2381,7 +2381,7 @@ int mt7915_run_firmware(struct mt7915_dev *dev)
+@@ -2377,7 +2377,7 @@ int mt7915_run_firmware(struct mt7915_dev *dev)
if (ret)
return ret;
@@ -199,7 +199,7 @@
ret = mt7915_mcu_set_mwds(dev, 1);
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6d1dbdbd..b4a3120d 100644
+index 6d1dbdb..b4a3120 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -10,6 +10,9 @@
@@ -341,7 +341,7 @@
void __iomem *mem_base, u32 device_id)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 491566e9..39127922 100644
+index 491566e..3912792 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -533,6 +533,8 @@ static inline void mt7986_wmac_disable(struct mt7915_dev *dev)
@@ -354,7 +354,7 @@
void __iomem *mem_base, u32 device_id);
void mt7915_wfsys_reset(struct mt7915_dev *dev);
diff --git a/mt7915/pci.c b/mt7915/pci.c
-index d74f6097..c5da01a9 100644
+index d74f609..c5da01a 100644
--- a/mt7915/pci.c
+++ b/mt7915/pci.c
@@ -12,9 +12,6 @@
@@ -451,7 +451,7 @@
goto free_wed_or_irq_vector;
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 444440e1..ffda5f6b 100644
+index 444440e..ffda5f6 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -623,6 +623,7 @@ enum offs_rev {
@@ -498,7 +498,7 @@
#define MT_INT_TX_DONE_MCU (MT_INT_TX_MCU(MT_MCUQ_WA) | \
MT_INT_TX_MCU(MT_MCUQ_WM) | \
diff --git a/mt7915/soc.c b/mt7915/soc.c
-index 3618718d..8d0b2068 100644
+index 3618718..8d0b206 100644
--- a/mt7915/soc.c
+++ b/mt7915/soc.c
@@ -1171,10 +1171,6 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
@@ -539,5 +539,5 @@
return ret;
--
-2.25.1
+2.18.0
diff --git a/recipes-kernel/linux-mt76/files/patches/3002-mt76-add-wed-rx-support.patch b/recipes-kernel/linux-mt76/files/patches/3002-mt76-add-wed-rx-support.patch
index 8265434..49992bc 100644
--- a/recipes-kernel/linux-mt76/files/patches/3002-mt76-add-wed-rx-support.patch
+++ b/recipes-kernel/linux-mt76/files/patches/3002-mt76-add-wed-rx-support.patch
@@ -1,35 +1,38 @@
-From a6bbc51840c63e5992c2d0cee9fbbb795312da0c Mon Sep 17 00:00:00 2001
+From 50c04081556744438d6017c11ddfa3b7239efd26 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Tue, 5 Jul 2022 19:42:55 +0800
Subject: [PATCH 3002/3003] mt76 add wed rx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- drivers/net/wireless/mediatek/mt76/dma.c | 250 +++++++++++++++---
- drivers/net/wireless/mediatek/mt76/dma.h | 10 +
- drivers/net/wireless/mediatek/mt76/mac80211.c | 8 +-
- drivers/net/wireless/mediatek/mt76/mt76.h | 24 +-
- .../net/wireless/mediatek/mt76/mt7603/dma.c | 2 +-
- .../wireless/mediatek/mt76/mt7603/mt7603.h | 2 +-
- .../net/wireless/mediatek/mt76/mt7615/mac.c | 2 +-
- .../wireless/mediatek/mt76/mt7615/mt7615.h | 2 +-
- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 9 +
- drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 +-
- .../net/wireless/mediatek/mt76/mt76x02_txrx.c | 2 +-
- .../net/wireless/mediatek/mt76/mt7915/dma.c | 10 +
- .../net/wireless/mediatek/mt76/mt7915/mac.c | 103 +++++++-
- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 3 +
- .../net/wireless/mediatek/mt76/mt7915/mmio.c | 26 +-
- .../wireless/mediatek/mt76/mt7915/mt7915.h | 7 +-
- .../net/wireless/mediatek/mt76/mt7915/regs.h | 14 +-
- .../net/wireless/mediatek/mt76/mt7921/mac.c | 2 +-
- .../wireless/mediatek/mt76/mt7921/mt7921.h | 4 +-
- .../wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +-
- drivers/net/wireless/mediatek/mt76/tx.c | 34 +++
- 21 files changed, 448 insertions(+), 68 deletions(-)
+ dma.c | 250 ++++++++++++++++++++++++++++++++++++++--------
+ dma.h | 10 ++
+ mac80211.c | 8 +-
+ mt76.h | 25 ++++-
+ mt7603/dma.c | 2 +-
+ mt7603/mt7603.h | 2 +-
+ mt7615/mac.c | 2 +-
+ mt7615/mt7615.h | 2 +-
+ mt76_connac_mcu.c | 9 ++
+ mt76x02.h | 2 +-
+ mt76x02_txrx.c | 2 +-
+ mt7915/dma.c | 25 +++--
+ mt7915/init.c | 9 ++
+ mt7915/mac.c | 103 ++++++++++++++++++-
+ mt7915/main.c | 25 ++++-
+ mt7915/mcu.c | 14 ++-
+ mt7915/mcu.h | 1 +
+ mt7915/mmio.c | 26 ++++-
+ mt7915/mt7915.h | 10 +-
+ mt7915/regs.h | 14 ++-
+ mt7921/mac.c | 2 +-
+ mt7921/mt7921.h | 4 +-
+ mt7921/pci_mac.c | 4 +-
+ tx.c | 34 +++++++
+ 24 files changed, 504 insertions(+), 81 deletions(-)
diff --git a/dma.c b/dma.c
-index 03ee9109..3acba9a3 100644
+index 03ee9109..4d4d4046 100644
--- a/dma.c
+++ b/dma.c
@@ -98,6 +98,63 @@ mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
@@ -271,7 +274,7 @@
{
int idx = q->tail;
-@@ -314,7 +433,7 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
+@@ -314,7 +435,7 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
q->tail = (q->tail + 1) % q->ndesc;
q->queued--;
@@ -280,7 +283,7 @@
}
static int
-@@ -336,7 +455,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -336,7 +457,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
buf.len = skb->len;
spin_lock_bh(&q->lock);
@@ -289,7 +292,7 @@
mt76_dma_kick_queue(dev, q);
spin_unlock_bh(&q->lock);
-@@ -413,7 +532,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -413,7 +534,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
goto unmap;
return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
@@ -298,7 +301,7 @@
unmap:
for (n--; n > 0; n--)
-@@ -448,6 +567,8 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -448,6 +569,8 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
int frames = 0;
int len = SKB_WITH_OVERHEAD(q->buf_size);
int offset = q->buf_offset;
@@ -307,7 +310,7 @@
if (!q->ndesc)
return 0;
-@@ -456,10 +577,29 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -456,10 +579,29 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
while (q->queued < q->ndesc - 1) {
struct mt76_queue_buf qbuf;
@@ -340,7 +343,7 @@
addr = dma_map_single(dev->dma_dev, buf, len, DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(dev->dma_dev, addr))) {
-@@ -470,7 +610,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -470,7 +612,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
qbuf.addr = addr + offset;
qbuf.len = len - offset;
qbuf.skip_unmap = false;
@@ -349,7 +352,7 @@
frames++;
}
-@@ -516,6 +656,11 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -516,6 +658,11 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
if (!ret)
q->wed_regs = wed->txfree_ring.reg_base;
break;
@@ -361,7 +364,7 @@
default:
ret = -EINVAL;
}
-@@ -531,7 +676,8 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -531,7 +678,8 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
int idx, int n_desc, int bufsize,
u32 ring_base)
{
@@ -371,7 +374,7 @@
spin_lock_init(&q->lock);
spin_lock_init(&q->cleanup_lock);
-@@ -541,6 +687,11 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -541,6 +689,11 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
q->buf_size = bufsize;
q->hw_idx = idx;
@@ -383,7 +386,7 @@
size = q->ndesc * sizeof(struct mt76_desc);
q->desc = dmam_alloc_coherent(dev->dma_dev, size, &q->desc_dma, GFP_KERNEL);
if (!q->desc)
-@@ -573,7 +724,7 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -573,7 +726,7 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
spin_lock_bh(&q->lock);
do {
@@ -392,7 +395,7 @@
if (!buf)
break;
-@@ -614,7 +765,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
+@@ -614,7 +767,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
static void
mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
@@ -401,7 +404,7 @@
{
struct sk_buff *skb = q->rx_head;
struct skb_shared_info *shinfo = skb_shinfo(skb);
-@@ -634,7 +785,7 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
+@@ -634,7 +787,7 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
q->rx_head = NULL;
if (nr_frags < ARRAY_SIZE(shinfo->frags))
@@ -410,7 +413,7 @@
else
dev_kfree_skb(skb);
}
-@@ -655,6 +806,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -655,6 +808,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
}
while (done < budget) {
@@ -418,7 +421,7 @@
u32 info;
if (check_ddone) {
-@@ -665,10 +817,13 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -665,10 +819,13 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
break;
}
@@ -433,7 +436,7 @@
if (q->rx_head)
data_len = q->buf_size;
else
-@@ -681,7 +836,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -681,7 +838,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
}
if (q->rx_head) {
@@ -442,7 +445,7 @@
continue;
}
-@@ -708,7 +863,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -708,7 +865,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
continue;
}
@@ -451,7 +454,7 @@
continue;
free_frag:
-@@ -785,7 +940,7 @@ EXPORT_SYMBOL_GPL(mt76_dma_attach);
+@@ -785,7 +942,7 @@ EXPORT_SYMBOL_GPL(mt76_dma_attach);
void mt76_dma_cleanup(struct mt76_dev *dev)
{
@@ -460,7 +463,7 @@
mt76_worker_disable(&dev->tx_worker);
netif_napi_del(&dev->tx_napi);
-@@ -801,12 +956,17 @@ void mt76_dma_cleanup(struct mt76_dev *dev)
+@@ -801,12 +958,17 @@ void mt76_dma_cleanup(struct mt76_dev *dev)
mt76_for_each_q_rx(dev, i) {
netif_napi_del(&dev->napi[i]);
@@ -532,7 +535,7 @@
mt76_rx_complete(dev, &frames, napi);
diff --git a/mt76.h b/mt76.h
-index 49314895..9162213a 100644
+index 49314895..0043c7c8 100644
--- a/mt76.h
+++ b/mt76.h
@@ -20,6 +20,8 @@
@@ -597,7 +600,7 @@
struct mt76_queue *q_mcu[__MT_MCUQ_MAX];
struct mt76_queue q_rx[__MT_RXQ_MAX];
const struct mt76_queue_ops *queue_ops;
-@@ -785,6 +794,9 @@ struct mt76_dev {
+@@ -785,12 +794,16 @@ struct mt76_dev {
u16 wed_token_count;
u16 token_count;
u16 token_size;
@@ -607,7 +610,14 @@
wait_queue_head_t tx_wait;
/* spinclock used to protect wcid pktid linked list */
-@@ -1352,6 +1364,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+ spinlock_t status_lock;
+
+ u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
++ u32 wcid_wds_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
+ u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
+
+ u64 vif_mask;
+@@ -1352,6 +1365,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
}
void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
@@ -616,7 +626,7 @@
void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
struct napi_struct *napi);
void mt76_rx_poll_complete(struct mt76_dev *dev, enum mt76_rxq_id q,
-@@ -1496,6 +1510,12 @@ struct mt76_txwi_cache *
+@@ -1496,6 +1511,12 @@ struct mt76_txwi_cache *
mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi);
void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
@@ -756,40 +766,96 @@
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
void *rxwi = skb->data;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 71223221..ac98e01b 100644
+index 71223221..7d8d60bb 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
-@@ -376,6 +376,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
- FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
- FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX1, 19) |
- FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_RX1, 1));
-+ mt76_rmw(dev, MT_WFDMA0_EXT0_CFG, MT_WFDMA0_EXT0_RXWB_KEEP,
-+ MT_WFDMA0_EXT0_RXWB_KEEP);
+@@ -356,6 +356,7 @@ static int mt7915_dma_enable(struct mt7915_dev *dev)
+ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ {
+ struct mt76_dev *mdev = &dev->mt76;
++ struct mtk_wed_device *wed = &mdev->mmio.wed;
+ u32 wa_rx_base, wa_rx_idx;
+ u32 hif1_ofs = 0;
+ int ret;
+@@ -372,10 +373,12 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) && !is_mt7986(mdev)) {
+ mt76_set(dev, MT_WFDMA_HOST_CONFIG, MT_WFDMA_HOST_CONFIG_WED);
+ if(is_mt7915(mdev)) {
+- mt76_wr(dev, MT_WFDMA_WED_RING_CONTROL,
+- FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
+- FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX1, 19) |
+- FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_RX1, 1));
++ mt76_wr(dev, MT_WFDMA_WED_RING_CONTROL,
++ FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
++ FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX1, 19) |
++ FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_RX1, 1));
++ mt76_rmw(dev, MT_WFDMA0_EXT0_CFG, MT_WFDMA0_EXT0_RXWB_KEEP,
++ MT_WFDMA0_EXT0_RXWB_KEEP);
} else {
mt76_wr(dev, MT_WFDMA_WED_RING_CONTROL,
FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
-@@ -451,6 +453,10 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+@@ -435,7 +438,7 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ return ret;
+
+ /* event from WA */
+- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(mdev)) {
++ if (mtk_wed_device_active(wed) && is_mt7915(mdev)) {
+ wa_rx_base = MT_WED_RX_RING_BASE;
+ wa_rx_idx = MT7915_RXQ_MCU_WA;
+ dev->mt76.q_rx[MT_RXQ_MCU_WA].flags = MT_WED_Q_TXFREE;
+@@ -451,6 +454,11 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
/* rx data queue for band0 */
if (!dev->phy.band_idx) {
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
-+ dev->mt76.mmio.wed.ver > MTK_WED_V1)
++ if (mtk_wed_device_active(wed) && wed->ver > MTK_WED_V1) {
+ dev->mt76.q_rx[MT_RXQ_MAIN].flags = MT_WED_Q_RX(MT7915_RXQ_BAND0);
++ dev->mt76.rx_token_size += MT7915_RX_RING_SIZE;
++ }
+
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
MT_RXQ_ID(MT_RXQ_MAIN),
MT7915_RX_RING_SIZE,
-@@ -482,6 +488,10 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+@@ -465,7 +473,7 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ wa_rx_base = MT_RXQ_RING_BASE(MT_RXQ_MAIN_WA);
+ wa_rx_idx = MT_RXQ_ID(MT_RXQ_MAIN_WA);
+
+- if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ if (mtk_wed_device_active(wed)) {
+ dev->mt76.q_rx[MT_RXQ_MAIN_WA].flags = MT_WED_Q_TXFREE;
+ if (is_mt7916(mdev)) {
+ wa_rx_base = MT_WED_RX_RING_BASE;
+@@ -482,6 +490,11 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
if (dev->dbdc_support || dev->phy.band_idx) {
/* rx data queue for band1 */
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
-+ dev->mt76.mmio.wed.ver > MTK_WED_V1)
++ if (mtk_wed_device_active(wed) && wed->ver > MTK_WED_V1) {
+ dev->mt76.q_rx[MT_RXQ_EXT].flags = MT_WED_Q_RX(MT7915_RXQ_BAND1);
++ dev->mt76.rx_token_size += MT7915_RX_RING_SIZE;
++ }
+
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_EXT],
MT_RXQ_ID(MT_RXQ_EXT),
MT7915_RX_RING_SIZE,
+diff --git a/mt7915/init.c b/mt7915/init.c
+index b549fa04..eb321b77 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -695,6 +695,15 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ return ret;
+ }
+
++ /* wds workaround for mt7986 */
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7986(&dev->mt76)) {
++ for(idx = MT7915_WTBL_WDS_START; idx < MT7915_WTBL_WDS_END; idx++)
++ mt76_wcid_mask_set(dev->mt76.wcid_mask, idx);
++
++ for (idx = 0; idx < DIV_ROUND_UP(MT7915_WTBL_STA, 32); idx++)
++ dev->mt76.wcid_wds_mask[idx] = ~dev->mt76.wcid_mask[idx];
++ }
++
+ /* Beacon and mgmt frames should occupy wcid 0 */
+ idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
+ if (idx)
diff --git a/mt7915/mac.c b/mt7915/mac.c
index db21d83e..1f8e1230 100644
--- a/mt7915/mac.c
@@ -939,11 +1005,62 @@
mt76_rx(&dev->mt76, q, skb);
return;
}
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 2e721cd0..9c808ff4 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -670,8 +670,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ #endif
+ int ret, idx;
+ u32 addr;
++ bool wed_wds = false;
+
+- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
++ if (mtk_wed_device_active(&mdev->mmio.wed))
++ wed_wds = !!test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
++
++ if (wed_wds)
++ idx = mt76_wcid_alloc(mdev->wcid_wds_mask, MT7915_WTBL_STA);
++ else
++ idx = mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA);
+ if (idx < 0)
+ return -ENOSPC;
+
+@@ -1107,6 +1114,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
+ else
+ clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
+
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ (msta->wcid.idx < MT7915_WTBL_WDS_START ||
++ msta->wcid.idx > MT7915_WTBL_WDS_END)) {
++ mt7915_sta_remove(hw, vif, sta);
++ mt7915_sta_add(hw, vif, sta);
++ }
++
+ mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
+ }
+
+@@ -1449,9 +1463,12 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+ /* fw will find the wcid by dest addr */
+ if(is_mt7915(&dev->mt76))
+ path->mtk_wdma.wcid = 0xff;
+- else
+- path->mtk_wdma.wcid = 0x3ff;
+-
++ else {
++ if (test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags))
++ path->mtk_wdma.wcid = msta->wcid.idx;
++ else
++ path->mtk_wdma.wcid = 0x3ff;
++ }
+ path->mtk_wdma.queue = phy != &dev->phy;
+
+ ctx->dev = NULL;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 674cbc4e..0ae6daf3 100644
+index 9e9a2ea0..dd712283 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -1723,6 +1723,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1719,6 +1719,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable)
{
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
@@ -951,7 +1068,7 @@
struct mt7915_sta *msta;
struct sk_buff *skb;
int ret;
-@@ -1775,6 +1776,8 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1771,6 +1772,8 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
return ret;
}
out:
@@ -960,8 +1077,45 @@
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD(STA_REC_UPDATE), true);
}
+@@ -2348,6 +2351,7 @@ mt7915_mcu_init_rx_airtime(struct mt7915_dev *dev)
+ int mt7915_run_firmware(struct mt7915_dev *dev)
+ {
+ int ret;
++ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
+
+ /* force firmware operation mode into normal state,
+ * which should be set before firmware download stage.
+@@ -2377,8 +2381,14 @@ int mt7915_run_firmware(struct mt7915_dev *dev)
+ if (ret)
+ return ret;
+
+- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
+- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
++ if (mtk_wed_device_active(wed)) {
++ if (is_mt7915(&dev->mt76))
++ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
++ 0, 0, 0);
++ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
++ MCU_WA_PARAM_WED_VERSION,
++ wed->rev_id, 0);
++ }
+
+ ret = mt7915_mcu_set_mwds(dev, 1);
+ if (ret)
+diff --git a/mt7915/mcu.h b/mt7915/mcu.h
+index b8a433e5..ce50e606 100644
+--- a/mt7915/mcu.h
++++ b/mt7915/mcu.h
+@@ -268,6 +268,7 @@ enum {
+ MCU_WA_PARAM_RED_SHOW_STA = 0xf,
+ MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
+ #endif
++ MCU_WA_PARAM_WED_VERSION = 0x32,
+ };
+
+ enum mcu_mmps_mode {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index b4a3120d..08ff556e 100644
+index b4a3120d..9316e056 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -28,6 +28,9 @@ static const u32 mt7915_reg[] = {
@@ -1031,7 +1185,7 @@
+ wed->wlan.init_rx_buf = mt7915_wed_init_rx_buf;
+ wed->wlan.release_rx_buf = mt7915_wed_release_rx_buf;
+
-+ dev->mt76.rx_token_size = wed->wlan.rx_pkt + MT7915_RX_RING_SIZE * 2;
++ dev->mt76.rx_token_size = wed->wlan.rx_pkt;
if (mtk_wed_device_attach(wed) != 0)
return 0;
@@ -1042,10 +1196,20 @@
dev->mt76.dma_dev = wed->dev;
mdev->token_size = wed->wlan.token_start;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 39127922..22399cc7 100644
+index 39127922..97eac730 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -78,6 +78,7 @@
+@@ -18,6 +18,9 @@
+ #define MT7915_WTBL_STA (MT7915_WTBL_RESERVED - \
+ MT7915_MAX_INTERFACES)
+
++#define MT7915_WTBL_WDS_START 256
++#define MT7915_WTBL_WDS_END 274
++
+ #define MT7915_WATCHDOG_TIME (HZ / 10)
+ #define MT7915_RESET_TIMEOUT (30 * HZ)
+
+@@ -78,6 +81,7 @@
#define MT7915_MAX_STA_TWT_AGRT 8
#define MT7915_MIN_TWT_DUR 64
#define MT7915_MAX_QUEUE (__MT_RXQ_MAX + __MT_MCUQ_MAX + 2)
@@ -1053,7 +1217,7 @@
struct mt7915_vif;
struct mt7915_sta;
-@@ -541,7 +542,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
+@@ -541,7 +545,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
@@ -1064,7 +1228,7 @@
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
int mt7915_eeprom_init(struct mt7915_dev *dev);
-@@ -693,7 +696,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -693,7 +699,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct mt76_tx_info *tx_info);
void mt7915_tx_token_put(struct mt7915_dev *dev);
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -1219,5 +1383,5 @@
+}
+EXPORT_SYMBOL_GPL(mt76_rx_token_release);
--
-2.25.1
+2.18.0
diff --git a/recipes-kernel/linux-mt76/files/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch b/recipes-kernel/linux-mt76/files/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch
index 19e0e99..37ebdd1 100644
--- a/recipes-kernel/linux-mt76/files/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch
+++ b/recipes-kernel/linux-mt76/files/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch
@@ -1,18 +1,18 @@
-From 4206557087f5b77b3993818b70885e21d7dcffbb Mon Sep 17 00:00:00 2001
+From 552c7b193e72472b522153449f195fbb46f2b6ed Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Thu, 19 May 2022 13:44:42 +0800
Subject: [PATCH 3003/3003] mt76: add fill receive path to report wed idx
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- .../net/wireless/mediatek/mt76/mt7915/main.c | 19 +++++++++++++++++++
+ mt7915/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 2e721cd0..cfc522f7 100644
+index 9c808ff..74c6f7c 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1458,6 +1458,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1475,6 +1475,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
return 0;
}
@@ -37,7 +37,7 @@
#endif
const struct ieee80211_ops mt7915_ops = {
-@@ -1509,5 +1527,6 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1526,5 +1544,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,
@@ -45,5 +45,5 @@
#endif
};
--
-2.25.1
+2.18.0
diff --git a/recipes-kernel/linux-mt76/files/patches/3004-mt76-add-ser-spport-when-wed-on.patch b/recipes-kernel/linux-mt76/files/patches/3004-mt76-add-ser-spport-when-wed-on.patch
new file mode 100755
index 0000000..f1c1b02
--- /dev/null
+++ b/recipes-kernel/linux-mt76/files/patches/3004-mt76-add-ser-spport-when-wed-on.patch
@@ -0,0 +1,175 @@
+From 6a2341ff1a75100d530982d0c021a133124174cc Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Thu, 28 Jul 2022 11:16:15 +0800
+Subject: [PATCH 3/3] mt76 add ser spport when wed on
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ dma.c | 26 ++++++++++++++++++--------
+ dma.h | 2 +-
+ mt7915/dma.c | 26 +++++++++++++++++++++-----
+ mt7915/mac.c | 6 ++++++
+ 4 files changed, 46 insertions(+), 14 deletions(-)
+
+diff --git a/dma.c b/dma.c
+index 4d4d4046..9c821442 100644
+--- a/dma.c
++++ b/dma.c
+@@ -624,14 +624,18 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+ return frames;
+ }
+
+-static int
+-mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
++int
++mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q, bool reset)
+ {
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ struct mtk_wed_device *wed = &dev->mmio.wed;
+ int ret, type, ring;
+- u8 flags = q->flags;
++ u8 flags;
++
++ if (!q || !q->ndesc)
++ return -EINVAL;
+
++ flags = q->flags;
+ if (!mtk_wed_device_active(wed))
+ q->flags &= ~MT_QFLAG_WED;
+
+@@ -643,7 +647,7 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
+
+ switch (type) {
+ case MT76_WED_Q_TX:
+- ret = mtk_wed_device_tx_ring_setup(wed, ring, q->regs);
++ ret = mtk_wed_device_tx_ring_setup(wed, ring, q->regs, reset);
+ if (!ret)
+ q->wed_regs = wed->tx_ring[ring].reg_base;
+ break;
+@@ -659,7 +663,7 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
+ q->wed_regs = wed->txfree_ring.reg_base;
+ break;
+ case MT76_WED_Q_RX:
+- ret = mtk_wed_device_rx_ring_setup(wed, ring, q->regs);
++ ret = mtk_wed_device_rx_ring_setup(wed, ring, q->regs, reset);
+ if (!ret)
+ q->wed_regs = wed->rx_ring[ring].reg_base;
+ break;
+@@ -672,6 +676,7 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
+ return 0;
+ #endif
+ }
++EXPORT_SYMBOL_GPL(mt76_dma_wed_setup);
+
+ static int
+ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -704,7 +709,7 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
+ if (!q->entry)
+ return -ENOMEM;
+
+- ret = mt76_dma_wed_setup(dev, q);
++ ret = mt76_dma_wed_setup(dev, q, false);
+ if (ret)
+ return ret;
+
+@@ -755,8 +760,13 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
+ q->desc[i].ctrl = cpu_to_le32(MT_DMA_CTL_DMA_DONE);
+
+ mt76_dma_rx_cleanup(dev, q);
+- mt76_dma_sync_idx(dev, q);
+- mt76_dma_rx_fill(dev, q);
++
++ mt76_dma_wed_setup(dev, q, true);
++
++ if (q->flags != MT_WED_Q_TXFREE) {
++ mt76_dma_sync_idx(dev, q);
++ mt76_dma_rx_fill(dev, q);
++ }
+
+ if (!q->rx_head)
+ return;
+diff --git a/dma.h b/dma.h
+index 90370d12..083cbca4 100644
+--- a/dma.h
++++ b/dma.h
+@@ -58,5 +58,5 @@ enum mt76_mcu_evt_type {
+ int mt76_dma_rx_poll(struct napi_struct *napi, int budget);
+ void mt76_dma_attach(struct mt76_dev *dev);
+ void mt76_dma_cleanup(struct mt76_dev *dev);
+-
++int mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q, bool reset);
+ #endif
+diff --git a/mt7915/dma.c b/mt7915/dma.c
+index 7d8d60bb..8df7d0ee 100644
+--- a/mt7915/dma.c
++++ b/mt7915/dma.c
+@@ -549,28 +549,44 @@ int mt7915_dma_reset(struct mt7915_dev *dev, bool force)
+ mt7915_wfsys_reset(dev);
+
+ /* disable wfdma */
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
++ mtk_wed_device_dma_reset(&dev->mt76.mmio.wed);
+ mt7915_dma_disable(dev, force);
+
+ /* reset hw queues */
+ for (i = 0; i < __MT_TXQ_MAX; i++) {
+ mt76_queue_reset(dev, dev->mphy.q_tx[i]);
+- if (mphy_ext)
++ if (mphy_ext) {
+ mt76_queue_reset(dev, mphy_ext->q_tx[i]);
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
++ mt76_dma_wed_setup(&dev->mt76,
++ mphy_ext->q_tx[i],
++ true);
++ }
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
++ mt76_dma_wed_setup(&dev->mt76, dev->mphy.q_tx[i],
++ true);
+ }
+
+ for (i = 0; i < __MT_MCUQ_MAX; i++)
+ mt76_queue_reset(dev, dev->mt76.q_mcu[i]);
+
+- mt76_for_each_q_rx(&dev->mt76, i)
+- mt76_queue_reset(dev, &dev->mt76.q_rx[i]);
++ mt76_for_each_q_rx(&dev->mt76, i) {
++ if (dev->mt76.q_rx[i].flags != MT_WED_Q_TXFREE)
++ mt76_queue_reset(dev, &dev->mt76.q_rx[i]);
++ }
+
+ mt76_tx_status_check(&dev->mt76, true);
+
+- mt7915_dma_enable(dev);
+-
+ mt76_for_each_q_rx(&dev->mt76, i)
+ mt76_queue_rx_reset(dev, i);
+
++ if(mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
++ mt76_rmw(dev, MT_WFDMA0_EXT0_CFG, MT_WFDMA0_EXT0_RXWB_KEEP,
++ MT_WFDMA0_EXT0_RXWB_KEEP);
++
++ mt7915_dma_enable(dev);
++
+ return 0;
+ }
+
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index 1f8e1230..f53de870 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -1674,6 +1674,12 @@ void mt7915_mac_reset_work(struct work_struct *work)
+ if (!(READ_ONCE(dev->reset_state) & MT_MCU_CMD_STOP_DMA))
+ return;
+
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
++ mtk_wed_device_stop(&dev->mt76.mmio.wed, true);
++ if (!is_mt7986(&dev->mt76))
++ mt76_wr(dev, MT_INT_WED_MASK_CSR, 0);
++ }
++
+ ieee80211_stop_queues(mt76_hw(dev));
+ if (ext_phy)
+ ieee80211_stop_queues(ext_phy->hw);
+--
+2.18.0
+
diff --git a/recipes-kernel/linux-mt76/files/patches/patches.inc b/recipes-kernel/linux-mt76/files/patches/patches.inc
index 01068a3..5211e4a 100644
--- a/recipes-kernel/linux-mt76/files/patches/patches.inc
+++ b/recipes-kernel/linux-mt76/files/patches/patches.inc
@@ -29,4 +29,5 @@
file://3001-mt76-add-wed-tx-support.patch \
file://3002-mt76-add-wed-rx-support.patch \
file://3003-mt76-add-fill-receive-path-to-report-wed-idx.patch \
+ file://3004-mt76-add-ser-spport-when-wed-on.patch \
"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
index 4c4f631..9327f0c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
@@ -177,10 +177,17 @@
void mtk_dump_netsys_info(void *_eth)
{
struct mtk_eth *eth = _eth;
+ u32 id = 0;
mtk_dump_reg(eth, "FE", 0x0, 0x500);
mtk_dump_reg(eth, "ADMA", PDMA_BASE, 0x300);
- mtk_dump_reg(eth, "QDMA", QDMA_BASE, 0x400);
+ for (id = 0; id < MTK_QDMA_PAGE_NUM; id++){
+ mtk_w32(eth, id, MTK_QDMA_PAGE);
+ pr_info("\nQDMA PAGE:%x ",mtk_r32(eth, MTK_QDMA_PAGE));
+ mtk_dump_reg(eth, "QDMA", QDMA_BASE, 0x100);
+ mtk_w32(eth, 0, MTK_QDMA_PAGE);
+ }
+ mtk_dump_reg(eth, "QDMA", MTK_QRX_BASE_PTR0, 0x300);
mtk_dump_reg(eth, "WDMA", WDMA_BASE(0), 0x600);
mtk_dump_reg(eth, "PPE", 0x2200, 0x200);
mtk_dump_reg(eth, "GMAC", 0x10000, 0x300);
@@ -192,6 +199,10 @@
static u32 timestamp = 0;
static u32 err_cnt1 = 0, err_cnt2 = 0, err_cnt3 = 0;
static u32 prev_wdidx = 0;
+ unsigned int mib_base = MTK_GDM1_TX_GBCNT;
+ static u32 prev_gdm2rx = 0;
+
+ /*wdma tx path*/
u32 cur_wdidx = mtk_r32(eth, MTK_WDMA_DTX_PTR(0));
u32 is_wtx_busy = mtk_r32(eth, MTK_WDMA_GLO_CFG(0)) & MTK_TX_DMA_BUSY;
u32 is_oq_free = ((mtk_r32(eth, MTK_PSE_OQ_STA(0)) & 0x01FF0000) == 0) &&
@@ -199,20 +210,31 @@
((mtk_r32(eth, MTK_PSE_OQ_STA(4)) & 0x01FF0000) == 0);
u32 is_cdm_full =
!(mtk_r32(eth, MTK_WDMA_TX_DBG_MON0(0)) & MTK_CDM_TXFIFO_RDY);
+ /*qdma tx path*/
u32 is_qfsm_hang = mtk_r32(eth, MTK_QDMA_FSM) != 0;
u32 is_qfwd_hang = mtk_r32(eth, MTK_QDMA_FWD_CNT) == 0;
u32 is_qfq_hang = mtk_r32(eth, MTK_QDMA_FQ_CNT) !=
((MTK_DMA_SIZE << 16) | MTK_DMA_SIZE);
+ u32 is_gdm1_tx = (mtk_r32(eth, MTK_FE_GDM1_FSM) & 0xFFFF0000) > 0;
+ u32 is_gdm2_tx = (mtk_r32(eth, MTK_FE_GDM2_FSM) & 0xFFFF0000) > 0;
+ u32 is_gmac1_tx = (mtk_r32(eth, MTK_MAC_FSM(0)) & 0xFF000000) != 0x1000000;
+ u32 is_gmac2_tx = (mtk_r32(eth, MTK_MAC_FSM(1)) & 0xFF000000) != 0x1000000;
+ u32 gdm1_fc = mtk_r32(eth, mib_base+0x24);
+ u32 gdm2_fc = mtk_r32(eth, mib_base+0x64);
+ /*adma rx path*/
u32 is_oq0_stuck = (mtk_r32(eth, MTK_PSE_OQ_STA(0)) & 0x1FF) != 0;
u32 is_cdm1_busy = (mtk_r32(eth, MTK_FE_CDM1_FSM) & 0xFFFF0000) != 0;
u32 is_adma_busy = ((mtk_r32(eth, MTK_ADMA_RX_DBG0) & 0x1F) == 0) &&
((mtk_r32(eth, MTK_ADMA_RX_DBG0) & 0x40) == 0);
+ /*gmac2 rx path*/
+ u32 gmac2_rx = (mtk_r32(eth, MTK_MAC_FSM(1)) & 0xFF0000 != 0x10000);
+ u32 gdm2_rx_cnt = mtk_r32(eth, mib_base+0x48);
if (cur_wdidx == prev_wdidx && is_wtx_busy &&
is_oq_free && is_cdm_full) {
err_cnt1++;
if (err_cnt1 >= 3) {
- pr_info("WDMA CDM Hang !\n");
+ pr_info("WDMA CDM Info\n");
pr_info("============== Time: %d ================\n",
timestamp);
pr_info("err_cnt1 = %d", err_cnt1);
@@ -242,10 +264,11 @@
schedule_work(ð->pending_work);
}
}
- } else if (is_qfsm_hang && is_qfwd_hang) {
+ } else if (is_qfsm_hang && is_qfwd_hang &&
+ ((is_gdm1_tx && is_gmac1_tx && (gdm1_fc < 1)) || (is_gdm2_tx && is_gmac2_tx && (gdm2_fc < 1)))) {
err_cnt2++;
if (err_cnt2 >= 3) {
- pr_info("QDMA Tx Hang !\n");
+ pr_info("QDMA Tx Info\n");
pr_info("============== Time: %d ================\n",
timestamp);
pr_info("err_cnt2 = %d", err_cnt2);
@@ -259,6 +282,8 @@
mtk_r32(eth, MTK_QDMA_FWD_CNT));
pr_info("MTK_QDMA_FQ_CNT = 0x%x\n",
mtk_r32(eth, MTK_QDMA_FQ_CNT));
+ pr_info("GDM1 FC = 0x%x\n",gdm1_fc);
+ pr_info("GDM2 FC = 0x%x\n",gdm2_fc);
pr_info("==============================\n");
if ((atomic_read(&reset_lock) == 0) &&
@@ -270,7 +295,7 @@
} else if (is_oq0_stuck && is_cdm1_busy && is_adma_busy) {
err_cnt3++;
if (err_cnt3 >= 3) {
- pr_info("ADMA Rx Hang !\n");
+ pr_info("ADMA Rx Info\n");
pr_info("============== Time: %d ================\n",
timestamp);
pr_info("err_cnt3 = %d", err_cnt3);
@@ -291,6 +316,22 @@
schedule_work(ð->pending_work);
}
}
+ }else if ((gdm2_rx_cnt == prev_gdm2rx) && gmac2_rx) {
+ err_cnt3++;
+ if (err_cnt3 >= 3) {
+ pr_info("GMAC Rx Info\n");
+ pr_info("============== Time: %d ================\n",
+ timestamp);
+ pr_info("err_cnt3 = %d", err_cnt3);
+ pr_info("gmac2_rx = %d\n", gmac2_rx);
+ pr_info("gdm2_rx_cnt = %d\n", gdm2_rx_cnt);
+ pr_info("==============================\n");
+ if ((atomic_read(&reset_lock) == 0) &&
+ (atomic_read(&force) == 0)){
+ atomic_inc(&force);
+ schedule_work(ð->pending_work);
+ }
+ }
} else {
err_cnt1 = 0;
err_cnt2 = 0;
@@ -298,6 +339,7 @@
}
prev_wdidx = cur_wdidx;
+ prev_gdm2rx = gdm2_rx_cnt;
mod_timer(ð->mtk_dma_monitor_timer, jiffies + 1 * HZ);
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 7fa0db8..60939f2 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -363,6 +363,9 @@
/* QDMA RX DMA Pointer Register */
#define MTK_QRX_DRX_IDX0 (QDMA_BASE + 0x10c)
+/* QDMA Page Configuration Register */
+#define MTK_QDMA_PAGE (QDMA_BASE + 0x1f0)
+
/* QDMA Global Configuration Register */
#define MTK_QDMA_GLO_CFG (QDMA_BASE + 0x204)
#define MTK_RX_2B_OFFSET BIT(31)
@@ -475,6 +478,7 @@
/* QDMA TX NUM */
#define MTK_QDMA_TX_NUM 16
+#define MTK_QDMA_PAGE_NUM 8
#define MTK_QDMA_TX_MASK ((MTK_QDMA_TX_NUM) - 1)
#define QID_LOW_BITS(x) ((x) & 0xf)
#define QID_HIGH_BITS(x) ((((x) >> 4) & 0x3) << 20)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9997-add-wed-rx-support-for-mt7896.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9997-add-wed-rx-support-for-mt7896.patch
index 3df0ab7..7f159a0 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9997-add-wed-rx-support-for-mt7896.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9997-add-wed-rx-support-for-mt7896.patch
@@ -8,19 +8,18 @@
arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 42 +-
arch/arm64/boot/dts/mediatek/mt7986b.dtsi | 42 +-
drivers/net/ethernet/mediatek/Makefile | 2 +-
- drivers/net/ethernet/mediatek/mtk_wed.c | 613 ++++++++++++++++--
+ drivers/net/ethernet/mediatek/mtk_wed.c | 627 ++++++++++++++++--
drivers/net/ethernet/mediatek/mtk_wed.h | 51 ++
drivers/net/ethernet/mediatek/mtk_wed_ccif.c | 133 ++++
drivers/net/ethernet/mediatek/mtk_wed_ccif.h | 45 ++
.../net/ethernet/mediatek/mtk_wed_debugfs.c | 90 +++
drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 561 ++++++++++++++++
drivers/net/ethernet/mediatek/mtk_wed_mcu.h | 125 ++++
- drivers/net/ethernet/mediatek/mtk_wed_regs.h | 147 ++++-
- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 588 +++++++++++++++++
+ drivers/net/ethernet/mediatek/mtk_wed_regs.h | 145 +++-
+ drivers/net/ethernet/mediatek/mtk_wed_wo.c | 588 ++++++++++++++++
drivers/net/ethernet/mediatek/mtk_wed_wo.h | 336 ++++++++++
- include/linux/soc/mediatek/mtk_wed.h | 63 +-
+ include/linux/soc/mediatek/mtk_wed.h | 64 +-
14 files changed, 2643 insertions(+), 69 deletions(-)
- mode change 100644 => 100755 drivers/net/ethernet/mediatek/mtk_wed.c
create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_ccif.c
create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_ccif.h
create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_mcu.c
@@ -182,7 +181,7 @@
+obj-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_ops.o mtk_wed_wo.o mtk_wed_mcu.o mtk_wed_ccif.o
obj-$(CONFIG_NET_MEDIATEK_HNAT) += mtk_hnat/
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 48b0353..4d47b3a 100644
+index 48b0353..0750def 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -13,11 +13,19 @@
@@ -277,7 +276,7 @@
+ u32 value;
+ unsigned long timeout = jiffies + WOCPU_TIMEOUT;
+
-+ mtk_wdma_rx_reset(dev);
++ mtk_wdma_tx_reset(dev);
+
+ mtk_wed_reset(dev, MTK_WED_RESET_WED);
+
@@ -450,7 +449,7 @@
}
wdma_w32(dev, MTK_WDMA_INT_MASK, wdma_mask);
-@@ -312,6 +476,39 @@ mtk_wed_set_512_support(struct mtk_wed_device *dev, bool en)
+@@ -312,6 +476,40 @@ mtk_wed_set_512_support(struct mtk_wed_device *dev, bool en)
}
}
@@ -464,13 +463,14 @@
+
+ do {
+ regs = MTK_WED_WPDMA_RING_RX_DATA(idx) +
-+ MTK_WED_RING_OFS_COUNT;
++ MTK_WED_RING_OFS_CPU_IDX;
+ cur_idx = wed_r32(dev, regs);
+ if (cur_idx == MTK_WED_RX_RING_SIZE - 1)
+ break;
+
+ usleep_range(100000, 200000);
-+ } while (timeout-- > 0);
++ timeout--;
++ } while (timeout > 0);
+
+ if (timeout) {
+ unsigned int val;
@@ -490,7 +490,7 @@
static void
mtk_wed_dma_enable(struct mtk_wed_device *dev)
{
-@@ -336,9 +533,14 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)
+@@ -336,9 +534,15 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)
wdma_set(dev, MTK_WDMA_GLO_CFG,
MTK_WDMA_GLO_CFG_RX_INFO3_PRERES);
} else {
@@ -500,12 +500,13 @@
MTK_WED_WPDMA_CTRL_SDL1_FIXED);
+ wed_set(dev, MTK_WED_WDMA_GLO_CFG,
++ MTK_WED_WDMA_GLO_CFG_TX_DRV_EN |
+ MTK_WED_WDMA_GLO_CFG_TX_DDONE_CHK);
+
wed_set(dev, MTK_WED_WPDMA_GLO_CFG,
MTK_WED_WPDMA_GLO_CFG_RX_DRV_R0_PKT_PROC |
MTK_WED_WPDMA_GLO_CFG_RX_DRV_R0_CRX_SYNC);
-@@ -346,6 +548,15 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)
+@@ -346,6 +550,15 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)
wed_clr(dev, MTK_WED_WPDMA_GLO_CFG,
MTK_WED_WPDMA_GLO_CFG_TX_TKID_KEEP |
MTK_WED_WPDMA_GLO_CFG_TX_DMAD_DW3_PREV);
@@ -521,7 +522,7 @@
}
}
-@@ -363,19 +574,23 @@ mtk_wed_dma_disable(struct mtk_wed_device *dev)
+@@ -363,19 +576,23 @@ mtk_wed_dma_disable(struct mtk_wed_device *dev)
MTK_WED_GLO_CFG_TX_DMA_EN |
MTK_WED_GLO_CFG_RX_DMA_EN);
@@ -549,20 +550,23 @@
}
}
-@@ -384,8 +599,11 @@ mtk_wed_stop(struct mtk_wed_device *dev)
+@@ -383,10 +600,12 @@ static void
+ mtk_wed_stop(struct mtk_wed_device *dev)
{
mtk_wed_dma_disable(dev);
++ mtk_wed_set_512_support(dev, false);
- if (dev->ver > MTK_WED_V1)
+- mtk_wed_set_512_support(dev, false);
+-
+ if (dev->ver > MTK_WED_V1) {
- mtk_wed_set_512_support(dev, false);
+ wed_w32(dev, MTK_WED_EXT_INT_MASK1, 0);
+ wed_w32(dev, MTK_WED_EXT_INT_MASK2, 0);
+ }
-
mtk_wed_set_ext_int(dev, false);
-@@ -395,6 +613,11 @@ mtk_wed_stop(struct mtk_wed_device *dev)
+ wed_clr(dev, MTK_WED_CTRL,
+@@ -395,6 +614,11 @@ mtk_wed_stop(struct mtk_wed_device *dev)
MTK_WED_CTRL_WED_TX_BM_EN |
MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
@@ -574,7 +578,7 @@
wed_w32(dev, MTK_WED_WPDMA_INT_TRIGGER, 0);
wed_w32(dev, MTK_WED_WDMA_INT_TRIGGER, 0);
wdma_w32(dev, MTK_WDMA_INT_MASK, 0);
-@@ -417,8 +640,19 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+@@ -417,8 +641,19 @@ mtk_wed_detach(struct mtk_wed_device *dev)
mtk_wed_reset(dev, MTK_WED_RESET_WED);
@@ -590,11 +594,11 @@
+ mtk_wed_wo_exit(hw);
+ }
+
-+ mtk_wdma_tx_reset(dev);
++ mtk_wdma_rx_reset(dev);
if (dev->wlan.bus_type == MTK_BUS_TYPE_PCIE) {
wlan_node = dev->wlan.pci_dev->dev.of_node;
-@@ -477,7 +711,6 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
+@@ -477,7 +712,6 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
value = wed_r32(dev, MTK_WED_PCIE_CFG_INTM);
value = wed_r32(dev, MTK_WED_PCIE_CFG_BASE);
@@ -602,7 +606,7 @@
wed_w32(dev, MTK_WED_PCIE_INT_TRIGGER, BIT(24));
wed_r32(dev, MTK_WED_PCIE_INT_TRIGGER);
-@@ -501,6 +734,9 @@ mtk_wed_set_wpdma(struct mtk_wed_device *dev)
+@@ -501,6 +735,9 @@ mtk_wed_set_wpdma(struct mtk_wed_device *dev)
wed_w32(dev, MTK_WED_WPDMA_CFG_INT_MASK, dev->wlan.wpdma_mask);
wed_w32(dev, MTK_WED_WPDMA_CFG_TX, dev->wlan.wpdma_tx);
wed_w32(dev, MTK_WED_WPDMA_CFG_TX_FREE, dev->wlan.wpdma_txfree);
@@ -612,7 +616,7 @@
} else {
wed_w32(dev, MTK_WED_WPDMA_CFG_BASE, dev->wlan.wpdma_phys);
}
-@@ -549,24 +785,92 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
+@@ -549,24 +786,92 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
FIELD_PREP(MTK_WED_WDMA_OFST1_RX_CTRL,
MTK_WDMA_RING_RX(0)));
}
@@ -713,18 +717,16 @@
rev_size = size;
thr = 0;
}
-@@ -609,13 +913,48 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
+@@ -609,13 +914,46 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
}
static void
-mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale)
+mtk_wed_rx_hw_init(struct mtk_wed_device *dev)
-+{
+ {
+ wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX,
-+ MTK_WED_WPDMA_RX_D_RST_CRX_IDX0 |
-+ MTK_WED_WPDMA_RX_D_RST_CRX_IDX1 |
-+ MTK_WED_WPDMA_RX_D_RST_DRV_IDX0 |
-+ MTK_WED_WPDMA_RX_D_RST_DRV_IDX1);
++ MTK_WED_WPDMA_RX_D_RST_CRX_IDX |
++ MTK_WED_WPDMA_RX_D_RST_DRV_IDX);
+
+ wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX, 0);
+
@@ -748,7 +750,7 @@
+
+static void
+mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
- {
++{
+ __le32 ctrl;
int i;
@@ -764,7 +766,7 @@
desc->buf1 = 0;
desc->info = 0;
desc += scale;
-@@ -674,7 +1013,7 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -674,7 +1012,7 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
if (!desc)
continue;
@@ -773,7 +775,16 @@
}
if (mtk_wed_poll_busy(dev))
-@@ -729,9 +1068,24 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -692,6 +1030,8 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+ wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_RX);
+ wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
+
++ mtk_wdma_rx_reset(dev);
++
+ if (busy) {
+ mtk_wed_reset(dev, MTK_WED_RESET_WDMA_INT_AGENT);
+ mtk_wed_reset(dev, MTK_WED_RESET_WDMA_RX_DRV);
+@@ -729,9 +1069,24 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
}
@@ -799,7 +810,7 @@
{
ring->desc = dma_alloc_coherent(dev->hw->dev,
size * sizeof(*ring->desc) * scale,
-@@ -740,17 +1094,18 @@ mtk_wed_ring_alloc(struct mtk_wed_device *dev, struct mtk_wed_ring *ring,
+@@ -740,17 +1095,18 @@ mtk_wed_ring_alloc(struct mtk_wed_device *dev, struct mtk_wed_ring *ring,
return -ENOMEM;
ring->size = size;
@@ -821,7 +832,7 @@
return -ENOMEM;
wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_BASE,
-@@ -767,22 +1122,143 @@ mtk_wed_wdma_ring_setup(struct mtk_wed_device *dev, int idx, int size)
+@@ -767,22 +1123,143 @@ mtk_wed_wdma_ring_setup(struct mtk_wed_device *dev, int idx, int size)
return 0;
}
@@ -971,10 +982,11 @@
mtk_wed_set_ext_int(dev, true);
if (dev->ver == MTK_WED_V1) {
-@@ -797,6 +1273,19 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -797,8 +1274,20 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
val |= BIT(0);
regmap_write(dev->hw->mirror, dev->hw->index * 4, val);
} else {
+- mtk_wed_set_512_support(dev, true);
+ /* driver set mid ready and only once */
+ wed_w32(dev, MTK_WED_EXT_INT_MASK1,
+ MTK_WED_EXT_INT_STATUS_WPDMA_MID_RDY);
@@ -987,12 +999,28 @@
+ ret = mtk_wed_rro_cfg(dev);
+ if (ret)
+ return;
-+
- mtk_wed_set_512_support(dev, true);
}
++ mtk_wed_set_512_support(dev, true);
+
+ mtk_wed_dma_enable(dev);
+ dev->running = true;
+@@ -809,6 +1298,7 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+ __releases(RCU)
+ {
+ struct mtk_wed_hw *hw;
++ u16 ver;
+ int ret = 0;
+
+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
+@@ -839,11 +1329,24 @@ mtk_wed_attach(struct mtk_wed_device *dev)
-@@ -841,9 +1330,17 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+ dev->ver = FIELD_GET(MTK_WED_REV_ID_MAJOR,
wed_r32(dev, MTK_WED_REV_ID));
++ if (dev->ver > MTK_WED_V1)
++ ver = FIELD_GET(MTK_WED_REV_ID_MINOR,
++ wed_r32(dev, MTK_WED_REV_ID));
++
++ dev->rev_id = ((dev->ver << 28) | ver << 16);
ret = mtk_wed_buffer_alloc(dev);
- if (ret) {
@@ -1012,7 +1040,7 @@
}
mtk_wed_hw_init_early(dev);
-@@ -851,7 +1348,12 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -851,7 +1354,12 @@ mtk_wed_attach(struct mtk_wed_device *dev)
if (dev->ver == MTK_WED_V1)
regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP,
BIT(hw->index), 0);
@@ -1025,7 +1053,7 @@
out:
mutex_unlock(&hw_lock);
-@@ -877,10 +1379,10 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
+@@ -877,10 +1385,10 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
BUG_ON(idx > ARRAY_SIZE(dev->tx_ring));
@@ -1038,7 +1066,7 @@
return -ENOMEM;
ring->reg_base = MTK_WED_RING_TX(idx);
-@@ -927,6 +1429,35 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
+@@ -927,6 +1435,35 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
return 0;
}
@@ -1074,7 +1102,7 @@
static u32
mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
{
-@@ -1014,6 +1545,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1014,6 +1551,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.attach = mtk_wed_attach,
.tx_ring_setup = mtk_wed_tx_ring_setup,
.txfree_ring_setup = mtk_wed_txfree_ring_setup,
@@ -1083,7 +1111,7 @@
.start = mtk_wed_start,
.stop = mtk_wed_stop,
.reset_dma = mtk_wed_reset_dma,
-@@ -1022,6 +1555,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1022,6 +1561,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.irq_get = mtk_wed_irq_get,
.irq_set_mask = mtk_wed_irq_set_mask,
.detach = mtk_wed_detach,
@@ -1091,6 +1119,14 @@
};
struct device_node *eth_np = eth->dev->of_node;
struct platform_device *pdev;
+@@ -1077,6 +1617,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+ regmap_write(hw->mirror, 0, 0);
+ regmap_write(hw->mirror, 4, 0);
+ }
++ hw->ver = MTK_WED_V1;
+ }
+
+ mtk_wed_hw_add_debugfs(hw);
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.h b/drivers/net/ethernet/mediatek/mtk_wed.h
index 9b17b74..8ef5253 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.h
@@ -1385,7 +1421,7 @@
+
+#endif
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
-index f420f18..fea7ae2 100644
+index f420f18..4a9e684 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
@@ -2,6 +2,7 @@
@@ -1521,7 +1557,7 @@
debugfs_create_file_unsafe("regval", 0600, dir, hw, &fops_regval);
debugfs_create_file_unsafe("txinfo", 0400, dir, hw, &wed_txinfo_fops);
+ debugfs_create_file_unsafe("rxinfo", 0400, dir, hw, &wed_rxinfo_fops);
-+ if (hw->ver > MTK_WED_V1) {
++ if (hw->ver != MTK_WED_V1) {
+ wed_wo_mcu_debugfs(hw, dir);
+ }
}
@@ -2224,7 +2260,7 @@
+
+#endif
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index e107de7..64a2483 100644
+index e107de7..9d021e2 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
@@ -4,6 +4,8 @@
@@ -2244,7 +2280,15 @@
struct mtk_wdma_desc {
__le32 buf0;
-@@ -41,6 +44,8 @@ struct mtk_wdma_desc {
+@@ -31,6 +34,7 @@ struct mtk_wdma_desc {
+ #define MTK_WED_REV_ID 0x000
+ #define MTK_WED_REV_ID_MAJOR GENMASK(7, 0)
+ #endif
++#define MTK_WED_REV_ID_MINOR GENMASK(27, 16)
+
+ #define MTK_WED_RESET 0x008
+ #define MTK_WED_RESET_TX_BM BIT(0)
+@@ -41,6 +45,8 @@ struct mtk_wdma_desc {
#define MTK_WED_RESET_WED_TX_DMA BIT(12)
#define MTK_WED_RESET_WDMA_RX_DRV BIT(17)
#define MTK_WED_RESET_WDMA_INT_AGENT BIT(19)
@@ -2253,7 +2297,7 @@
#define MTK_WED_RESET_WED BIT(31)
#define MTK_WED_CTRL 0x00c
-@@ -52,8 +57,12 @@ struct mtk_wdma_desc {
+@@ -52,8 +58,12 @@ struct mtk_wdma_desc {
#define MTK_WED_CTRL_WED_TX_BM_BUSY BIT(9)
#define MTK_WED_CTRL_WED_TX_FREE_AGENT_EN BIT(10)
#define MTK_WED_CTRL_WED_TX_FREE_AGENT_BUSY BIT(11)
@@ -2268,7 +2312,7 @@
#define MTK_WED_CTRL_FINAL_DIDX_READ BIT(24)
#define MTK_WED_CTRL_ETH_DMAD_FMT BIT(25)
#define MTK_WED_CTRL_MIB_READ_CLEAR BIT(28)
-@@ -68,8 +77,8 @@ struct mtk_wdma_desc {
+@@ -68,8 +78,8 @@ struct mtk_wdma_desc {
#define MTK_WED_EXT_INT_STATUS_TX_TKID_LO_TH BIT(10)
#define MTK_WED_EXT_INT_STATUS_TX_TKID_HI_TH BIT(11)
#endif
@@ -2279,7 +2323,7 @@
#define MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR BIT(16)
#define MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR BIT(17)
#define MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT BIT(18)
-@@ -86,8 +95,8 @@ struct mtk_wdma_desc {
+@@ -86,8 +96,8 @@ struct mtk_wdma_desc {
#define MTK_WED_EXT_INT_STATUS_ERROR_MASK (MTK_WED_EXT_INT_STATUS_TF_LEN_ERR | \
MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD | \
MTK_WED_EXT_INT_STATUS_TKID_TITO_INVALID | \
@@ -2290,7 +2334,7 @@
MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR | \
MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR | \
MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT | \
-@@ -96,6 +105,8 @@ struct mtk_wdma_desc {
+@@ -96,6 +106,8 @@ struct mtk_wdma_desc {
MTK_WED_EXT_INT_STATUS_TX_DMA_W_RESP_ERR)
#define MTK_WED_EXT_INT_MASK 0x028
@@ -2299,7 +2343,7 @@
#define MTK_WED_STATUS 0x060
#define MTK_WED_STATUS_TX GENMASK(15, 8)
-@@ -183,6 +194,9 @@ struct mtk_wdma_desc {
+@@ -183,6 +195,9 @@ struct mtk_wdma_desc {
#define MTK_WED_RING_RX(_n) (0x400 + (_n) * 0x10)
@@ -2309,7 +2353,7 @@
#define MTK_WED_WPDMA_INT_TRIGGER 0x504
#define MTK_WED_WPDMA_INT_TRIGGER_RX_DONE BIT(1)
#define MTK_WED_WPDMA_INT_TRIGGER_TX_DONE GENMASK(5, 4)
-@@ -239,13 +253,19 @@ struct mtk_wdma_desc {
+@@ -239,13 +254,19 @@ struct mtk_wdma_desc {
#define MTK_WED_WPDMA_INT_CTRL_TX 0x530
#define MTK_WED_WPDMA_INT_CTRL_TX0_DONE_EN BIT(0)
@@ -2330,7 +2374,7 @@
#define MTK_WED_WPDMA_INT_CTRL_TX_FREE 0x538
#define MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_EN BIT(0)
-@@ -270,13 +290,43 @@ struct mtk_wdma_desc {
+@@ -270,13 +291,40 @@ struct mtk_wdma_desc {
#define MTK_WED_WPDMA_TX_MIB(_n) (0x5a0 + (_n) * 4)
#define MTK_WED_WPDMA_TX_COHERENT_MIB(_n) (0x5d0 + (_n) * 4)
@@ -2339,8 +2383,7 @@
+
#define MTK_WED_WPDMA_RING_TX(_n) (0x600 + (_n) * 0x10)
#define MTK_WED_WPDMA_RING_RX(_n) (0x700 + (_n) * 0x10)
-+#define MTK_WED_WPDMA_RING_RX_DATA(_n) (0x730 + (_n) * 0x10)
-+
++#define MTK_WED_WPDMA_RING_RX_DATA(_n) (0x730 + (_n) * 0x10)
+
+#define MTK_WED_WPDMA_RX_D_GLO_CFG 0x75c
+#define MTK_WED_WPDMA_RX_D_RX_DRV_EN BIT(0)
@@ -2348,10 +2391,8 @@
+#define MTK_WED_WPDMA_RX_D_RXD_READ_LEN GENMASK(31, 24)
+
+#define MTK_WED_WPDMA_RX_D_RST_IDX 0x760
-+#define MTK_WED_WPDMA_RX_D_RST_CRX_IDX0 BIT(16)
-+#define MTK_WED_WPDMA_RX_D_RST_CRX_IDX1 BIT(17)
-+#define MTK_WED_WPDMA_RX_D_RST_DRV_IDX0 BIT(24)
-+#define MTK_WED_WPDMA_RX_D_RST_DRV_IDX1 BIT(25)
++#define MTK_WED_WPDMA_RX_D_RST_CRX_IDX GENMASK(17, 16)
++#define MTK_WED_WPDMA_RX_D_RST_DRV_IDX GENMASK(25, 24)
+
+#define MTK_WED_WPDMA_RX_GLO_CFG 0x76c
+#define MTK_WED_WPDMA_RX_RING 0x770
@@ -2374,7 +2415,7 @@
#define MTK_WED_WDMA_GLO_CFG_RX_DRV_EN BIT(2)
#define MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY BIT(3)
#define MTK_WED_WDMA_GLO_CFG_BT_SIZE GENMASK(5, 4)
-@@ -320,6 +370,20 @@ struct mtk_wdma_desc {
+@@ -320,6 +368,20 @@ struct mtk_wdma_desc {
#define MTK_WED_WDMA_RX_RECYCLE_MIB(_n) (0xae8 + (_n) * 4)
#define MTK_WED_WDMA_RX_PROCESSED_MIB(_n) (0xaf0 + (_n) * 4)
@@ -2395,7 +2436,7 @@
#define MTK_WED_RING_OFS_BASE 0x00
#define MTK_WED_RING_OFS_COUNT 0x04
#define MTK_WED_RING_OFS_CPU_IDX 0x08
-@@ -330,7 +394,9 @@ struct mtk_wdma_desc {
+@@ -330,12 +392,13 @@ struct mtk_wdma_desc {
#define MTK_WDMA_GLO_CFG 0x204
#define MTK_WDMA_GLO_CFG_TX_DMA_EN BIT(0)
@@ -2405,7 +2446,12 @@
#define MTK_WDMA_GLO_CFG_RX_INFO3_PRERES BIT(26)
#define MTK_WDMA_GLO_CFG_RX_INFO2_PRERES BIT(27)
#define MTK_WDMA_GLO_CFG_RX_INFO1_PRERES BIT(28)
-@@ -359,4 +425,71 @@ struct mtk_wdma_desc {
+
+-
+ #define MTK_WDMA_RESET_IDX 0x208
+ #define MTK_WDMA_RESET_IDX_TX GENMASK(3, 0)
+ #define MTK_WDMA_RESET_IDX_RX GENMASK(17, 16)
+@@ -359,4 +422,70 @@ struct mtk_wdma_desc {
/* DMA channel mapping */
#define HIFSYS_DMA_AG_MAP 0x008
@@ -2444,7 +2490,6 @@
+#define MTK_WED_RROQ_BASE_L 0xc80
+#define MTK_WED_RROQ_BASE_H 0xc84
+
-+
+#define MTK_WED_RROQM_MIOD_CFG 0xc8c
+#define MTK_WED_RROQM_MIOD_MID_DW GENMASK(5, 0)
+#define MTK_WED_RROQM_MIOD_MOD_DW GENMASK(13, 8)
@@ -3414,7 +3459,7 @@
+#endif
+
diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
-index 24742604b..b6b6823ae 100644
+index ffd547a..9a9cc1b 100644
--- a/include/linux/soc/mediatek/mtk_wed.h
+++ b/include/linux/soc/mediatek/mtk_wed.h
@@ -7,6 +7,9 @@
@@ -3452,7 +3497,12 @@
struct mtk_wed_device {
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
const struct mtk_wed_ops *ops;
-@@ -46,19 +67,27 @@ struct mtk_wed_device {
+@@ -42,39 +63,57 @@ struct mtk_wed_device {
+ int wdma_idx;
+ int irq;
+ u8 ver;
++ u32 rev_id;
+
struct mtk_wed_ring tx_ring[MTK_WED_TX_QUEUES];
struct mtk_wed_ring txfree_ring;
struct mtk_wed_ring tx_wdma[MTK_WED_TX_QUEUES];
@@ -3483,9 +3533,8 @@
u32 bus_type;
+ u32 phy_base;
- union {
- u32 wpdma_phys;
-@@ -67,16 +96,25 @@ struct mtk_wed_device {
+ u32 wpdma_phys;
+ u32 wpdma_int;
u32 wpdma_mask;
u32 wpdma_tx;
u32 wpdma_txfree;
@@ -3511,7 +3560,7 @@
} wlan;
#endif
};
-@@ -87,6 +125,10 @@ struct mtk_wed_ops {
+@@ -85,6 +124,10 @@ struct mtk_wed_ops {
void __iomem *regs);
int (*txfree_ring_setup)(struct mtk_wed_device *dev,
void __iomem *regs);
@@ -3522,16 +3571,16 @@
void (*detach)(struct mtk_wed_device *dev);
void (*stop)(struct mtk_wed_device *dev);
-@@ -98,6 +140,8 @@ struct mtk_wed_ops {
+@@ -96,6 +139,8 @@ struct mtk_wed_ops {
u32 (*irq_get)(struct mtk_wed_device *dev, u32 mask);
void (*irq_set_mask)(struct mtk_wed_device *dev, u32 mask);
-+ void (*ppe_check)(struct mtk_wed_device *dev, struct sk_buff *skb,
++ void (*ppe_check)(struct mtk_wed_device *dev, struct sk_buff *skb,
+ u32 reason, u32 hash);
};
extern const struct mtk_wed_ops __rcu *mtk_soc_wed_ops;
-@@ -130,6 +174,10 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
+@@ -128,6 +173,10 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
(_dev)->ops->tx_ring_setup(_dev, _ring, _regs)
#define mtk_wed_device_txfree_ring_setup(_dev, _regs) \
(_dev)->ops->txfree_ring_setup(_dev, _regs)
@@ -3542,7 +3591,7 @@
#define mtk_wed_device_reg_read(_dev, _reg) \
(_dev)->ops->reg_read(_dev, _reg)
#define mtk_wed_device_reg_write(_dev, _reg, _val) \
-@@ -138,6 +186,8 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
+@@ -136,6 +185,8 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
(_dev)->ops->irq_get(_dev, _mask)
#define mtk_wed_device_irq_set_mask(_dev, _mask) \
(_dev)->ops->irq_set_mask(_dev, _mask)
@@ -3551,7 +3600,7 @@
#else
static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
{
-@@ -147,10 +197,13 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
+@@ -145,10 +196,13 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
#define mtk_wed_device_start(_dev, _mask) do {} while (0)
#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs) -ENODEV
#define mtk_wed_device_txfree_ring_setup(_dev, _ring, _regs) -ENODEV
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch
new file mode 100755
index 0000000..fcc5e3a
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch
@@ -0,0 +1,630 @@
+From f70e83ccdca85840c3bf9e7a31fb871a12724dc2 Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Thu, 28 Jul 2022 14:49:16 +0800
+Subject: [PATCH 3/3] add wed ser support
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ drivers/net/ethernet/mediatek/mtk_wed.c | 298 ++++++++++++++-----
+ drivers/net/ethernet/mediatek/mtk_wed.h | 1 +
+ drivers/net/ethernet/mediatek/mtk_wed_regs.h | 12 +
+ include/linux/soc/mediatek/mtk_wed.h | 24 +-
+ 4 files changed, 245 insertions(+), 90 deletions(-)
+
+diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
+index 0750def..7b6b777 100644
+--- a/drivers/net/ethernet/mediatek/mtk_wed.c
++++ b/drivers/net/ethernet/mediatek/mtk_wed.c
+@@ -71,23 +71,27 @@ mtk_wdma_read_reset(struct mtk_wed_device *dev)
+ return wdma_r32(dev, MTK_WDMA_GLO_CFG);
+ }
+
+-static void
++static int
+ mtk_wdma_rx_reset(struct mtk_wed_device *dev)
+ {
+ u32 status;
+ u32 mask = MTK_WDMA_GLO_CFG_RX_DMA_BUSY;
+- int i;
++ int busy, i;
+
+ wdma_clr(dev, MTK_WDMA_GLO_CFG, MTK_WDMA_GLO_CFG_RX_DMA_EN);
+- if (readx_poll_timeout(mtk_wdma_read_reset, dev, status,
+- !(status & mask), 0, 1000))
+- WARN_ON_ONCE(1);
++ busy = readx_poll_timeout(mtk_wdma_read_reset, dev, status,
++ !(status & mask), 0, 10000);
++
++ wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_RX);
++ wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
+
+ for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++)
+ if (!dev->rx_wdma[i].desc) {
+ wdma_w32(dev, MTK_WDMA_RING_RX(i) +
+ MTK_WED_RING_OFS_CPU_IDX, 0);
+ }
++
++ return busy;
+ }
+
+ static void
+@@ -99,9 +103,11 @@ mtk_wdma_tx_reset(struct mtk_wed_device *dev)
+
+ wdma_clr(dev, MTK_WDMA_GLO_CFG, MTK_WDMA_GLO_CFG_TX_DMA_EN);
+ if (readx_poll_timeout(mtk_wdma_read_reset, dev, status,
+- !(status & mask), 0, 1000))
++ !(status & mask), 0, 10000))
+ WARN_ON_ONCE(1);
+
++ wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_TX);
++ wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
+ for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
+ if (!dev->tx_wdma[i].desc) {
+ wdma_w32(dev, MTK_WDMA_RING_TX(i) +
+@@ -505,8 +511,8 @@ mtk_wed_check_wfdma_rx_fill(struct mtk_wed_device *dev, int idx)
+ wifi_w32(dev, dev->wlan.wpdma_rx_glo -
+ dev->wlan.phy_base, val);
+ } else {
+- dev_err(dev->hw->dev, "mtk_wed%d: rx dma enable failed!\n",
+- dev->hw->index);
++ dev_err(dev->hw->dev, "mtk_wed%d: rx(%d) dma enable failed!\n",
++ dev->hw->index, idx);
+ }
+ }
+
+@@ -557,7 +563,7 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)
+ FIELD_PREP(MTK_WED_WPDMA_RX_D_INIT_PHASE_RXEN_SEL,
+ 0x2));
+
+- for (idx = 0; idx < MTK_WED_RX_QUEUES; idx++)
++ for (idx = 0; idx < dev->hw->ring_num; idx++)
+ mtk_wed_check_wfdma_rx_fill(dev, idx);
+ }
+ }
+@@ -597,26 +603,31 @@ mtk_wed_dma_disable(struct mtk_wed_device *dev)
+ }
+
+ static void
+-mtk_wed_stop(struct mtk_wed_device *dev)
++mtk_wed_stop(struct mtk_wed_device *dev, bool reset)
+ {
+- mtk_wed_dma_disable(dev);
+- mtk_wed_set_512_support(dev, false);
+-
+ if (dev->ver > MTK_WED_V1) {
+ wed_w32(dev, MTK_WED_EXT_INT_MASK1, 0);
+ wed_w32(dev, MTK_WED_EXT_INT_MASK2, 0);
+ }
+ mtk_wed_set_ext_int(dev, false);
+
+- wed_clr(dev, MTK_WED_CTRL,
+- MTK_WED_CTRL_WDMA_INT_AGENT_EN |
+- MTK_WED_CTRL_WPDMA_INT_AGENT_EN |
+- MTK_WED_CTRL_WED_TX_BM_EN |
+- MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
+-
+- if (dev->ver > MTK_WED_V1) {
++ if (!reset) {
++ mtk_wed_dma_disable(dev);
++ mtk_wed_set_512_support(dev, false);
++ if (dev->ver > MTK_WED_V1) {
++ wed_clr(dev, MTK_WED_CTRL,
++ MTK_WED_CTRL_RX_RRO_QM_EN |
++ MTK_WED_CTRL_RX_ROUTE_QM_EN |
++ MTK_WED_CTRL_WED_RX_BM_EN);
++ } else {
++ regmap_write(dev->hw->mirror,
++ dev->hw->index * 4, 0);
++ }
+ wed_clr(dev, MTK_WED_CTRL,
+- MTK_WED_CTRL_WED_RX_BM_EN);
++ MTK_WED_CTRL_WDMA_INT_AGENT_EN |
++ MTK_WED_CTRL_WPDMA_INT_AGENT_EN |
++ MTK_WED_CTRL_WED_TX_BM_EN |
++ MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
+ }
+
+ wed_w32(dev, MTK_WED_WPDMA_INT_TRIGGER, 0);
+@@ -634,16 +645,13 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+
+ mutex_lock(&hw_lock);
+
+- mtk_wed_stop(dev);
++ mtk_wed_stop(dev, false);
+
+- wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_RX);
+- wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
++ mtk_wdma_rx_reset(dev);
+
+ mtk_wed_reset(dev, MTK_WED_RESET_WED);
+
+- wdma_clr(dev, MTK_WDMA_GLO_CFG, MTK_WDMA_GLO_CFG_TX_DMA_EN);
+- wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_TX);
+- wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
++ mtk_wdma_tx_reset(dev);
+
+ mtk_wed_free_buffer(dev);
+ mtk_wed_free_tx_rings(dev);
+@@ -653,8 +661,6 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+ mtk_wed_wo_exit(hw);
+ }
+
+- mtk_wdma_rx_reset(dev);
+-
+ if (dev->wlan.bus_type == MTK_BUS_TYPE_PCIE) {
+ wlan_node = dev->wlan.pci_dev->dev.of_node;
+ if (of_dma_is_coherent(wlan_node))
+@@ -748,7 +754,7 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
+ {
+ u32 mask, set;
+
+- mtk_wed_stop(dev);
++ mtk_wed_stop(dev, false);
+ mtk_wed_reset(dev, MTK_WED_RESET_WED);
+
+ if (dev->ver > MTK_WED_V1)
+@@ -961,44 +967,127 @@ mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
+ }
+
+ static u32
+-mtk_wed_check_busy(struct mtk_wed_device *dev)
++mtk_wed_check_busy(struct mtk_wed_device *dev, u32 reg, u32 mask)
+ {
+- if (wed_r32(dev, MTK_WED_GLO_CFG) & MTK_WED_GLO_CFG_TX_DMA_BUSY)
+- return true;
+-
+- if (wed_r32(dev, MTK_WED_WPDMA_GLO_CFG) &
+- MTK_WED_WPDMA_GLO_CFG_TX_DRV_BUSY)
+- return true;
+-
+- if (wed_r32(dev, MTK_WED_CTRL) & MTK_WED_CTRL_WDMA_INT_AGENT_BUSY)
+- return true;
+-
+- if (wed_r32(dev, MTK_WED_WDMA_GLO_CFG) &
+- MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY)
+- return true;
+-
+- if (wdma_r32(dev, MTK_WDMA_GLO_CFG) &
+- MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY)
+- return true;
+-
+- if (wed_r32(dev, MTK_WED_CTRL) &
+- (MTK_WED_CTRL_WED_TX_BM_BUSY | MTK_WED_CTRL_WED_TX_FREE_AGENT_BUSY))
++ if (wed_r32(dev, reg) & mask)
+ return true;
+
+ return false;
+ }
+
+ static int
+-mtk_wed_poll_busy(struct mtk_wed_device *dev)
++mtk_wed_poll_busy(struct mtk_wed_device *dev, u32 reg, u32 mask)
+ {
+- int sleep = 15000;
++ int sleep = 1000;
+ int timeout = 100 * sleep;
+ u32 val;
+
+ return read_poll_timeout(mtk_wed_check_busy, val, !val, sleep,
+- timeout, false, dev);
++ timeout, false, dev, reg, mask);
+ }
+
++static void
++mtk_wed_rx_reset(struct mtk_wed_device *dev)
++{
++ struct mtk_wed_wo *wo = dev->hw->wed_wo;
++ u8 state = WO_STATE_SER_RESET;
++ bool busy = false;
++ int i;
++
++ mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, WO_CMD_CHANGE_STATE,
++ &state, sizeof(state), true);
++
++ wed_clr(dev, MTK_WED_WPDMA_RX_D_GLO_CFG, MTK_WED_WPDMA_RX_D_RX_DRV_EN);
++ busy = mtk_wed_poll_busy(dev, MTK_WED_WPDMA_RX_D_GLO_CFG,
++ MTK_WED_WPDMA_RX_D_RX_DRV_BUSY);
++ if (busy) {
++ mtk_wed_reset(dev, MTK_WED_RESET_WPDMA_INT_AGENT);
++ mtk_wed_reset(dev, MTK_WED_RESET_WPDMA_RX_D_DRV);
++ } else {
++ wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX,
++ MTK_WED_WPDMA_RX_D_RST_CRX_IDX |
++ MTK_WED_WPDMA_RX_D_RST_DRV_IDX);
++
++ wed_set(dev, MTK_WED_WPDMA_RX_D_GLO_CFG,
++ MTK_WED_WPDMA_RX_D_RST_INIT_COMPLETE |
++ MTK_WED_WPDMA_RX_D_FSM_RETURN_IDLE);
++ wed_clr(dev, MTK_WED_WPDMA_RX_D_GLO_CFG,
++ MTK_WED_WPDMA_RX_D_RST_INIT_COMPLETE |
++ MTK_WED_WPDMA_RX_D_FSM_RETURN_IDLE);
++
++ wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX, 0);
++ }
++
++ /* reset rro qm */
++ wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_RX_RRO_QM_EN);
++ busy = mtk_wed_poll_busy(dev, MTK_WED_CTRL,
++ MTK_WED_CTRL_RX_RRO_QM_BUSY);
++ if (busy) {
++ mtk_wed_reset(dev, MTK_WED_RESET_RX_RRO_QM);
++ } else {
++ wed_set(dev, MTK_WED_RROQM_RST_IDX,
++ MTK_WED_RROQM_RST_IDX_MIOD |
++ MTK_WED_RROQM_RST_IDX_FDBK);
++ wed_w32(dev, MTK_WED_RROQM_RST_IDX, 0);
++ }
++
++ /* reset route qm */
++ wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_RX_ROUTE_QM_EN);
++ busy = mtk_wed_poll_busy(dev, MTK_WED_CTRL,
++ MTK_WED_CTRL_RX_ROUTE_QM_BUSY);
++ if (busy) {
++ mtk_wed_reset(dev, MTK_WED_RESET_RX_ROUTE_QM);
++ } else {
++ wed_set(dev, MTK_WED_RTQM_GLO_CFG,
++ MTK_WED_RTQM_Q_RST);
++ }
++
++ /* reset tx wdma */
++ mtk_wdma_tx_reset(dev);
++
++ /* reset tx wdma drv */
++ wed_clr(dev, MTK_WED_WDMA_GLO_CFG, MTK_WED_WDMA_GLO_CFG_TX_DRV_EN);
++ mtk_wed_poll_busy(dev, MTK_WED_CTRL,
++ MTK_WED_CTRL_WDMA_INT_AGENT_BUSY);
++ mtk_wed_reset(dev, MTK_WED_RESET_WDMA_TX_DRV);
++
++ /* reset wed rx dma */
++ busy = mtk_wed_poll_busy(dev, MTK_WED_GLO_CFG,
++ MTK_WED_GLO_CFG_RX_DMA_BUSY);
++ wed_clr(dev, MTK_WED_GLO_CFG, MTK_WED_GLO_CFG_RX_DMA_EN);
++ if (busy) {
++ mtk_wed_reset(dev, MTK_WED_RESET_WED_RX_DMA);
++ } else {
++ wed_set(dev, MTK_WED_RESET_IDX,
++ MTK_WED_RESET_IDX_RX);
++ wed_w32(dev, MTK_WED_RESET_IDX, 0);
++ }
++
++ /* reset rx bm */
++ wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_WED_RX_BM_EN);
++ mtk_wed_poll_busy(dev, MTK_WED_CTRL,
++ MTK_WED_CTRL_WED_RX_BM_BUSY);
++ mtk_wed_reset(dev, MTK_WED_RESET_RX_BM);
++
++ /* wo change to enable state */
++ state = WO_STATE_ENABLE;
++ mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, WO_CMD_CHANGE_STATE,
++ &state, sizeof(state), true);
++
++ /* wed_rx_ring_reset */
++ for (i = 0; i < ARRAY_SIZE(dev->rx_ring); i++) {
++ struct mtk_wdma_desc *desc = dev->rx_ring[i].desc;
++
++ if (!desc)
++ continue;
++
++ mtk_wed_ring_reset(desc, MTK_WED_RX_RING_SIZE, 1, false);
++ }
++
++ mtk_wed_free_rx_bm(dev);
++}
++
++
+ static void
+ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+ {
+@@ -1012,25 +1101,28 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+ if (!desc)
+ continue;
+
+- mtk_wed_ring_reset(desc, MTK_WED_TX_RING_SIZE, dev->ver, true);
++ mtk_wed_ring_reset(desc, MTK_WED_TX_RING_SIZE, 1, true);
+ }
+
+- if (mtk_wed_poll_busy(dev))
+- busy = mtk_wed_check_busy(dev);
++ /* 1.Reset WED Tx DMA */
++ wed_clr(dev, MTK_WED_GLO_CFG, MTK_WED_GLO_CFG_TX_DMA_EN);
++ busy = mtk_wed_poll_busy(dev, MTK_WED_GLO_CFG, MTK_WED_GLO_CFG_TX_DMA_BUSY);
+
+ if (busy) {
+ mtk_wed_reset(dev, MTK_WED_RESET_WED_TX_DMA);
+ } else {
+ wed_w32(dev, MTK_WED_RESET_IDX,
+- MTK_WED_RESET_IDX_TX |
+- MTK_WED_RESET_IDX_RX);
++ MTK_WED_RESET_IDX_TX);
+ wed_w32(dev, MTK_WED_RESET_IDX, 0);
+ }
+
+- wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_RX);
+- wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
++ /* 2. Reset WDMA Rx DMA/Driver_Engine */
++ busy = !!mtk_wdma_rx_reset(dev);
+
+- mtk_wdma_rx_reset(dev);
++ wed_clr(dev, MTK_WED_WDMA_GLO_CFG, MTK_WED_WDMA_GLO_CFG_RX_DRV_EN);
++ busy = !!(busy ||
++ mtk_wed_poll_busy(dev, MTK_WED_WDMA_GLO_CFG,
++ MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY));
+
+ if (busy) {
+ mtk_wed_reset(dev, MTK_WED_RESET_WDMA_INT_AGENT);
+@@ -1047,15 +1139,30 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+ MTK_WED_WDMA_GLO_CFG_RST_INIT_COMPLETE);
+ }
+
++ /* 3. Reset WED WPDMA Tx Driver Engine */
++ wed_clr(dev, MTK_WED_CTRL,
++ MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
++
+ for (i = 0; i < 100; i++) {
+ val = wed_r32(dev, MTK_WED_TX_BM_INTF);
+ if (FIELD_GET(MTK_WED_TX_BM_INTF_TKFIFO_FDEP, val) == 0x40)
+ break;
+ }
+-
+ mtk_wed_reset(dev, MTK_WED_RESET_TX_FREE_AGENT);
++
++ wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_WED_TX_BM_EN);
+ mtk_wed_reset(dev, MTK_WED_RESET_TX_BM);
+
++ /* 4. Reset WED WPDMA Tx Driver Engine */
++ busy = mtk_wed_poll_busy(dev, MTK_WED_WPDMA_GLO_CFG,
++ MTK_WED_WPDMA_GLO_CFG_TX_DRV_BUSY);
++ wed_clr(dev, MTK_WED_WPDMA_GLO_CFG,
++ MTK_WED_WPDMA_GLO_CFG_TX_DRV_EN |
++ MTK_WED_WPDMA_GLO_CFG_RX_DRV_EN);
++
++ busy = !!(busy ||
++ mtk_wed_poll_busy(dev, MTK_WED_WPDMA_GLO_CFG,
++ MTK_WED_WPDMA_GLO_CFG_RX_DRV_BUSY));
+ if (busy) {
+ mtk_wed_reset(dev, MTK_WED_RESET_WPDMA_INT_AGENT);
+ mtk_wed_reset(dev, MTK_WED_RESET_WPDMA_TX_DRV);
+@@ -1065,6 +1172,16 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+ MTK_WED_WPDMA_RESET_IDX_TX |
+ MTK_WED_WPDMA_RESET_IDX_RX);
+ wed_w32(dev, MTK_WED_WPDMA_RESET_IDX, 0);
++ if (dev->ver > MTK_WED_V1) {
++ wed_w32(dev, MTK_WED_RESET_IDX,
++ MTK_WED_RESET_WPDMA_IDX_RX);
++ wed_w32(dev, MTK_WED_RESET_IDX, 0);
++ }
++ }
++
++ if (dev->ver > MTK_WED_V1) {
++ dev->init_done = false;
++ mtk_wed_rx_reset(dev);
+ }
+
+ }
+@@ -1253,6 +1370,9 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+ {
+ int i, ret;
+
++ if (dev->ver > MTK_WED_V1)
++ ret = mtk_wed_rx_bm_alloc(dev);
++
+ for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
+ if (!dev->tx_wdma[i].desc)
+ mtk_wed_wdma_rx_ring_setup(dev, i, 16);
+@@ -1340,10 +1460,6 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+ goto error;
+
+ if (dev->ver > MTK_WED_V1) {
+- ret = mtk_wed_rx_bm_alloc(dev);
+- if (ret)
+- goto error;
+-
+ ret = mtk_wed_rro_alloc(dev);
+ if (ret)
+ goto error;
+@@ -1367,7 +1483,8 @@ out:
+ }
+
+ static int
+-mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
++mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx,
++ void __iomem *regs, bool reset)
+ {
+ struct mtk_wed_ring *ring = &dev->tx_ring[idx];
+
+@@ -1385,12 +1502,15 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
+
+ BUG_ON(idx > ARRAY_SIZE(dev->tx_ring));
+
+- if (mtk_wed_ring_alloc(dev, ring, MTK_WED_TX_RING_SIZE, 1, true))
+- return -ENOMEM;
+-
+- if (mtk_wed_wdma_rx_ring_setup(dev, idx, MTK_WED_WDMA_RING_SIZE))
+- return -ENOMEM;
++ if (!reset) {
++ if (mtk_wed_ring_alloc(dev, ring, MTK_WED_TX_RING_SIZE,
++ 1, true))
++ return -ENOMEM;
+
++ if (mtk_wed_wdma_rx_ring_setup(dev, idx,
++ MTK_WED_WDMA_RING_SIZE))
++ return -ENOMEM;
++ }
+ ring->reg_base = MTK_WED_RING_TX(idx);
+ ring->wpdma = regs;
+
+@@ -1436,21 +1556,39 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
+ }
+
+ static int
+-mtk_wed_rx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
++mtk_wed_rx_ring_setup(struct mtk_wed_device *dev,
++ int idx, void __iomem *regs, bool reset)
+ {
+ struct mtk_wed_ring *ring = &dev->rx_ring[idx];
+
+ BUG_ON(idx > ARRAY_SIZE(dev->rx_ring));
+
++ if (!reset) {
++ if (mtk_wed_ring_alloc(dev, ring, MTK_WED_RX_RING_SIZE,
++ 1, false))
++ return -ENOMEM;
+
+- if (mtk_wed_ring_alloc(dev, ring, MTK_WED_RX_RING_SIZE, 1, false))
+- return -ENOMEM;
+-
+- if (mtk_wed_wdma_tx_ring_setup(dev, idx, MTK_WED_WDMA_RING_SIZE))
+- return -ENOMEM;
+-
++ if (mtk_wed_wdma_tx_ring_setup(dev, idx,
++ MTK_WED_WDMA_RING_SIZE))
++ return -ENOMEM;
++ } else {
++ struct mtk_wed_ring *wdma = &dev->rx_wdma[idx];
++
++ mtk_wed_ring_reset(wdma->desc, MTK_WED_WDMA_RING_SIZE, dev->ver, true);
++ if (idx == 0) {
++ wed_w32(dev, MTK_WED_WDMA_RING_TX
++ + MTK_WED_RING_OFS_BASE, wdma->desc_phys);
++ wed_w32(dev, MTK_WED_WDMA_RING_TX
++ + MTK_WED_RING_OFS_COUNT, MTK_WED_WDMA_RING_SIZE);
++ wed_w32(dev, MTK_WED_WDMA_RING_TX
++ + MTK_WED_RING_OFS_CPU_IDX, 0);
++ wed_w32(dev, MTK_WED_WDMA_RING_TX
++ + MTK_WED_RING_OFS_DMA_IDX, 0);
++ }
++ }
+ ring->reg_base = MTK_WED_RING_RX_DATA(idx);
+ ring->wpdma = regs;
++ dev->hw->ring_num = idx + 1;
+
+ /* WPDMA -> WED */
+ wpdma_rx_w32(dev, idx, MTK_WED_RING_OFS_BASE, ring->desc_phys);
+diff --git a/drivers/net/ethernet/mediatek/mtk_wed.h b/drivers/net/ethernet/mediatek/mtk_wed.h
+index 8ef5253..27aba72 100644
+--- a/drivers/net/ethernet/mediatek/mtk_wed.h
++++ b/drivers/net/ethernet/mediatek/mtk_wed.h
+@@ -47,6 +47,7 @@ struct mtk_wed_hw {
+ u32 num_flows;
+ u32 wdma_phy;
+ char dirname[5];
++ int ring_num;
+ int irq;
+ int index;
+ u32 ver;
+diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
+index 9d021e2..cfcd94f 100644
+--- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
++++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
+@@ -38,11 +38,15 @@ struct mtk_wdma_desc {
+
+ #define MTK_WED_RESET 0x008
+ #define MTK_WED_RESET_TX_BM BIT(0)
++#define MTK_WED_RESET_RX_BM BIT(1)
+ #define MTK_WED_RESET_TX_FREE_AGENT BIT(4)
+ #define MTK_WED_RESET_WPDMA_TX_DRV BIT(8)
+ #define MTK_WED_RESET_WPDMA_RX_DRV BIT(9)
++#define MTK_WED_RESET_WPDMA_RX_D_DRV BIT(10)
+ #define MTK_WED_RESET_WPDMA_INT_AGENT BIT(11)
+ #define MTK_WED_RESET_WED_TX_DMA BIT(12)
++#define MTK_WED_RESET_WED_RX_DMA BIT(13)
++#define MTK_WED_RESET_WDMA_TX_DRV BIT(16)
+ #define MTK_WED_RESET_WDMA_RX_DRV BIT(17)
+ #define MTK_WED_RESET_WDMA_INT_AGENT BIT(19)
+ #define MTK_WED_RESET_RX_RRO_QM BIT(20)
+@@ -186,7 +190,12 @@ struct mtk_wdma_desc {
+
+ #define MTK_WED_RESET_IDX 0x20c
+ #define MTK_WED_RESET_IDX_TX GENMASK(3, 0)
++#if defined(CONFIG_MEDIATEK_NETSYS_V2)
++#define MTK_WED_RESET_IDX_RX GENMASK(7, 6)
++#else
+ #define MTK_WED_RESET_IDX_RX GENMASK(17, 16)
++#endif
++#define MTK_WED_RESET_WPDMA_IDX_RX GENMASK(31, 30)
+
+ #define MTK_WED_TX_MIB(_n) (0x2a0 + (_n) * 4)
+ #define MTK_WED_RX_MIB(_n) (0x2e0 + (_n) * 4)
+@@ -300,6 +309,9 @@ struct mtk_wdma_desc {
+
+ #define MTK_WED_WPDMA_RX_D_GLO_CFG 0x75c
+ #define MTK_WED_WPDMA_RX_D_RX_DRV_EN BIT(0)
++#define MTK_WED_WPDMA_RX_D_RX_DRV_BUSY BIT(1)
++#define MTK_WED_WPDMA_RX_D_FSM_RETURN_IDLE BIT(3)
++#define MTK_WED_WPDMA_RX_D_RST_INIT_COMPLETE BIT(4)
+ #define MTK_WED_WPDMA_RX_D_INIT_PHASE_RXEN_SEL GENMASK(11, 7)
+ #define MTK_WED_WPDMA_RX_D_RXD_READ_LEN GENMASK(31, 24)
+
+diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
+index 9a9cc1b..bb23a7a 100644
+--- a/include/linux/soc/mediatek/mtk_wed.h
++++ b/include/linux/soc/mediatek/mtk_wed.h
+@@ -121,16 +121,16 @@ struct mtk_wed_device {
+ struct mtk_wed_ops {
+ int (*attach)(struct mtk_wed_device *dev);
+ int (*tx_ring_setup)(struct mtk_wed_device *dev, int ring,
+- void __iomem *regs);
++ void __iomem *regs, bool reset);
+ int (*txfree_ring_setup)(struct mtk_wed_device *dev,
+ void __iomem *regs);
+ int (*rx_ring_setup)(struct mtk_wed_device *dev, int ring,
+- void __iomem *regs);
++ void __iomem *regs, bool reset);
+ int (*msg_update)(struct mtk_wed_device *dev, int cmd_id,
+ void *data, int len);
+ void (*detach)(struct mtk_wed_device *dev);
+
+- void (*stop)(struct mtk_wed_device *dev);
++ void (*stop)(struct mtk_wed_device *dev, bool reset);
+ void (*start)(struct mtk_wed_device *dev, u32 irq_mask);
+ void (*reset_dma)(struct mtk_wed_device *dev);
+
+@@ -169,12 +169,13 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
+ #define mtk_wed_device_active(_dev) !!(_dev)->ops
+ #define mtk_wed_device_detach(_dev) (_dev)->ops->detach(_dev)
+ #define mtk_wed_device_start(_dev, _mask) (_dev)->ops->start(_dev, _mask)
+-#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs) \
+- (_dev)->ops->tx_ring_setup(_dev, _ring, _regs)
++#define mtk_wed_device_stop(_dev, _reset) (_dev)->ops->stop(_dev, _reset)
++#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs, _reset) \
++ (_dev)->ops->tx_ring_setup(_dev, _ring, _regs, _reset)
+ #define mtk_wed_device_txfree_ring_setup(_dev, _regs) \
+ (_dev)->ops->txfree_ring_setup(_dev, _regs)
+-#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs) \
+- (_dev)->ops->rx_ring_setup(_dev, _ring, _regs)
++#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs, _reset) \
++ (_dev)->ops->rx_ring_setup(_dev, _ring, _regs, _reset)
+ #define mtk_wed_device_update_msg(_dev, _id, _msg, _len) \
+ (_dev)->ops->msg_update(_dev, _id, _msg, _len)
+ #define mtk_wed_device_reg_read(_dev, _reg) \
+@@ -185,6 +186,8 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
+ (_dev)->ops->irq_get(_dev, _mask)
+ #define mtk_wed_device_irq_set_mask(_dev, _mask) \
+ (_dev)->ops->irq_set_mask(_dev, _mask)
++#define mtk_wed_device_dma_reset(_dev) \
++ (_dev)->ops->reset_dma(_dev)
+ #define mtk_wed_device_ppe_check(_dev, _skb, _reason, _hash) \
+ (_dev)->ops->ppe_check(_dev, _skb, _reason, _hash)
+ #else
+@@ -194,14 +197,15 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
+ }
+ #define mtk_wed_device_detach(_dev) do {} while (0)
+ #define mtk_wed_device_start(_dev, _mask) do {} while (0)
+-#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs) -ENODEV
++#define mtk_wed_device_stop(_dev, _reset) do {} while (0)
++#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs, _reset) -ENODEV
+ #define mtk_wed_device_txfree_ring_setup(_dev, _ring, _regs) -ENODEV
+-#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs) -ENODEV
+-#define mtk_wed_device_update_msg(_dev, _id, _msg, _len) -ENODEV
++#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs, _reset) -ENODEV
+ #define mtk_wed_device_reg_read(_dev, _reg) 0
+ #define mtk_wed_device_reg_write(_dev, _reg, _val) do {} while (0)
+ #define mtk_wed_device_irq_get(_dev, _mask) 0
+ #define mtk_wed_device_irq_set_mask(_dev, _mask) do {} while (0)
++#define mtk_wed_device_dma_reset(_dev) do {} while (0)
+ #define mtk_wed_device_ppe_check(_dev, _hash) do {} while (0)
+ #endif
+
+--
+2.18.0
+
diff --git a/recipes-kernel/wireless-regdb/files/patches/600-world-regd-6GHz.patch b/recipes-kernel/wireless-regdb/files/patches/600-world-regd-6GHz.patch
index cd3545e..34e6369 100644
--- a/recipes-kernel/wireless-regdb/files/patches/600-world-regd-6GHz.patch
+++ b/recipes-kernel/wireless-regdb/files/patches/600-world-regd-6GHz.patch
@@ -1,5 +1,5 @@
diff --git a/db.txt b/db.txt
-index 4f36062..f7c0082 100644
+index 4f36062..0d7a170 100644
--- a/db.txt
+++ b/db.txt
@@ -26,6 +26,8 @@ country 00:
@@ -11,6 +11,15 @@
# IEEE 802.11ad (60GHz), channels 1..3
(57240 - 63720 @ 2160), (0)
+@@ -1727,7 +1729,7 @@ country US: DFS-FCC
+ (5850 - 5895 @ 40), (27), NO-OUTDOOR, AUTO-BW, NO-IR
+ # 6g band
+ # https://www.federalregister.gov/documents/2020/05/26/2020-11236/unlicensed-use-of-the-6ghz-band
+- (5925 - 7125 @ 320), (12), NO-OUTDOOR, NO-IR
++ (5925 - 7125 @ 320), (12), NO-OUTDOOR
+ # 60g band
+ # reference: section IV-D https://docs.fcc.gov/public/attachments/FCC-16-89A1.pdf
+ # channels 1-6 EIRP=40dBm(43dBm peak)
--
-2.18.0
+2.36.1