[rdkb][common][bsp][Refactor and sync wifi from openwrt]

[Description]
3a2eef0b [MAC80211][Release][Update release note for Filogic 880/860 MLO Beta release]
cfbd2411 [MAC80211][Release][Filogic 880/860 MLO Beta release]
6c180e3f [MAC80211][WiFi7][misc][Add Eagle BE14000 efem default bin]
a55f34db [MAC80211][Release][Prepare for Filogic 880/860 release]
5b45ebca [MAC80211][WiFi7][hostapd][Add puncture bitmap to ucode]
95bbea73 [MAC80211][WiFi6][mt76][Add PID to only report data-frame TX rate]
b15ced26 [MAC80211][WiFi6][hostapd][Fix DFS channel selection issue]
d59133cb [MAC80211][WiFi6][mt76][Fix pse info not correct information]
3921b4b2 [MAC80211][WiFi6][mt76][Fix incomplete QoS-map setting to FW]
4e7690c7 [MAC80211][WiFi6/7][app][Change ATECHANNEL mapping cmd]
eb37af90 [MAC80211][WiFi7][app][Add support for per-packet bw & primary selection]
0ea82adf [MAC80211][WiFi6][core][Fix DFS CAC issue after CSA]

[Release-log]

Change-Id: I9bec97ec1b2e1c49ed43a812a07a5b21fcbb70a6
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0121-mtk-mt76-mt7996-add-linux-tracing-support.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0121-mtk-mt76-mt7996-add-linux-tracing-support.patch
new file mode 100644
index 0000000..70831fd
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0121-mtk-mt76-mt7996-add-linux-tracing-support.patch
@@ -0,0 +1,394 @@
+From 5ef5041a7200a4e3877df4c3533bd3c5e2038615 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 7 Sep 2022 12:13:20 +0800
+Subject: [PATCH 121/199] mtk: mt76: mt7996: add linux tracing support
+
+Add static tracepoint support for besra.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ agg-rx.c              |   2 +
+ mac80211.c            |   3 +
+ mt7996/Makefile       |   2 +-
+ mt7996/mac.c          |   6 ++
+ mt7996/mcu.c          |   8 +++
+ mt7996/mt7996_trace.h | 141 ++++++++++++++++++++++++++++++++++++++++++
+ mt7996/trace.c        |  12 ++++
+ trace.h               |  58 +++++++++++++++++
+ 8 files changed, 231 insertions(+), 1 deletion(-)
+ create mode 100644 mt7996/mt7996_trace.h
+ create mode 100644 mt7996/trace.c
+
+diff --git a/agg-rx.c b/agg-rx.c
+index 07c386c7..b48943c4 100644
+--- a/agg-rx.c
++++ b/agg-rx.c
+@@ -3,6 +3,7 @@
+  * Copyright (C) 2018 Felix Fietkau <nbd@nbd.name>
+  */
+ #include "mt76.h"
++#include "trace.h"
+ 
+ static unsigned long mt76_aggr_tid_to_timeo(u8 tidno)
+ {
+@@ -187,6 +188,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
+ 	seqno = status->seqno;
+ 	size = tid->size;
+ 	sn_less = ieee80211_sn_less(seqno, head);
++	trace_mt76_rx_aggr_reorder(tid->dev, wcid, head, seqno, sn_less);
+ 
+ 	if (!tid->started) {
+ 		if (sn_less)
+diff --git a/mac80211.c b/mac80211.c
+index 5e4935f2..dc91e827 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -5,6 +5,7 @@
+ #include <linux/sched.h>
+ #include <linux/of.h>
+ #include "mt76.h"
++#include "trace.h"
+ 
+ static const struct ieee80211_channel mt76_channels_2ghz[] = {
+ 	CHAN2G(1, 2412),
+@@ -1307,6 +1308,7 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
+ 
+ 		mt76_check_ccmp_pn(skb);
+ 		skb_shinfo(skb)->frag_list = NULL;
++		trace_mt76_rx_complete(dev, (struct mt76_rx_status *)skb->cb, 0);
+ 		mt76_rx_convert(dev, skb, &hw, &sta);
+ 		ieee80211_rx_list(hw, sta, skb, &list);
+ 
+@@ -1316,6 +1318,7 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
+ 			nskb = nskb->next;
+ 			skb->next = NULL;
+ 
++			trace_mt76_rx_complete(dev, (struct mt76_rx_status *)skb->cb, 1);
+ 			mt76_rx_convert(dev, skb, &hw, &sta);
+ 			ieee80211_rx_list(hw, sta, skb, &list);
+ 		}
+diff --git a/mt7996/Makefile b/mt7996/Makefile
+index 49ec9154..936edc61 100644
+--- a/mt7996/Makefile
++++ b/mt7996/Makefile
+@@ -12,4 +12,4 @@ mt7996e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o \
+ mt7996e-$(CONFIG_DEV_COREDUMP) += coredump.o
+ mt7996e-$(CONFIG_NL80211_TESTMODE) += testmode.o
+ 
+-mt7996e-y += mtk_debugfs.o mtk_mcu.o mtk_debugfs_i.o
++mt7996e-y += mtk_debugfs.o mtk_mcu.o mtk_debugfs_i.o trace.o
+diff --git a/mt7996/mac.c b/mt7996/mac.c
+index c6816ab5..6ba07156 100644
+--- a/mt7996/mac.c
++++ b/mt7996/mac.c
+@@ -11,6 +11,7 @@
+ #include "mac.h"
+ #include "mcu.h"
+ #include "vendor.h"
++#include "mt7996_trace.h"
+ 
+ static const struct mt7996_dfs_radar_spec etsi_radar_specs = {
+ 	.pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 },
+@@ -344,6 +345,8 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ 	phy = mphy->priv;
+ 	status->phy_idx = mphy->band_idx;
+ 
++	trace_mt7996_fill_rx(phy, skb->data, skb->len);
++
+ 	if (!test_bit(MT76_STATE_RUNNING, &mphy->state))
+ 		return -EINVAL;
+ 
+@@ -609,6 +612,8 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,
+ 	    !(status->flag & RX_FLAG_8023))
+ 		mt76_connac3_mac_decode_he_radiotap(skb, rxv, mode);
+ 
++	trace_mt7996_fill_rx_done(phy, status->seqno, hdr_gap);
++
+ 	if (!status->wcid || !ieee80211_is_data_qos(fc) || hw_aggr)
+ 		return 0;
+ 
+@@ -998,6 +1003,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ 		mt7996_packet_log_to_host(dev, t->skb->data, t->skb->len, PKT_BIN_DEBUG_TX, 0);
+ 	mt7996_dump_bmac_txd_info(NULL, dev, (__le32 *)txwi, true, false);
+ #endif
++	trace_mt7996_tx_prepare(dev, wcid, qid, txwi, t->skb->data, t->skb->len);
+ 
+ 	return 0;
+ }
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 0b02b76b..1cc08a30 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -10,6 +10,7 @@
+ #include "mcu.h"
+ #include "mac.h"
+ #include "eeprom.h"
++#include "mt7996_trace.h"
+ 
+ #define fw_name(_dev, name, ...)	({			\
+ 	char *_fw;						\
+@@ -305,6 +306,9 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
+ 		else if (cmd & __MCU_CMD_FIELD_WM)
+ 			uni_txd->s2d_index = MCU_S2D_H2N;
+ 
++		trace_mt7996_mcu_cmd(dev, 1, uni_txd->cid, 0,
++				    skb->data, skb->len);
++
+ 		goto exit;
+ 	}
+ 
+@@ -332,6 +336,8 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
+ 	else
+ 		mcu_txd->s2d_index = MCU_S2D_H2N;
+ 
++	trace_mt7996_mcu_cmd(dev, 0, mcu_txd->cid, mcu_txd->ext_cid,
++			    skb->data, skb->len);
+ exit:
+ #ifdef CONFIG_MTK_DEBUG
+ 	if (dev->dbg.dump_mcu_pkt)
+@@ -1177,6 +1183,8 @@ void mt7996_mcu_rx_event(struct mt7996_dev *dev, struct sk_buff *skb)
+ {
+ 	struct mt7996_mcu_rxd *rxd = (struct mt7996_mcu_rxd *)skb->data;
+ 
++	trace_mt7996_mcu_event(dev, rxd->option & MCU_UNI_CMD_UNSOLICITED_EVENT,
++			      rxd->eid, rxd->ext_eid, skb->data, skb->len);
+ 	if (rxd->option & MCU_UNI_CMD_UNSOLICITED_EVENT) {
+ 		mt7996_mcu_uni_rx_unsolicited_event(dev, skb);
+ 		return;
+diff --git a/mt7996/mt7996_trace.h b/mt7996/mt7996_trace.h
+new file mode 100644
+index 00000000..5fa73482
+--- /dev/null
++++ b/mt7996/mt7996_trace.h
+@@ -0,0 +1,141 @@
++/* SPDX-License-Identifier: ISC */
++/*
++ * Copyright (C) 2022 MediaTek Inc.
++ */
++
++#if !defined(__MT7996_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
++#define __MT7996_TRACE_H
++
++#include <linux/types.h>
++#include <linux/tracepoint.h>
++#include "mt7996.h"
++
++#undef TRACE_SYSTEM
++#define TRACE_SYSTEM mt7996
++
++#define MAXNAME		32
++#define DEV_ENTRY	__array(char, wiphy_name, 32)
++#define DEV_ASSIGN(_w)	strlcpy(__entry->wiphy_name, wiphy_name(_w), MAXNAME)
++#define DEV_PR_FMT	"%s"
++#define DEV_PR_ARG	__entry->wiphy_name
++
++DECLARE_EVENT_CLASS(mt7996_mcu_debug,
++	TP_PROTO(struct mt7996_dev *dev, bool uni, u8 id, u8 ext_id,
++		 const void *data, size_t len),
++	TP_ARGS(dev, uni, id, ext_id, data, len),
++	TP_STRUCT__entry(
++		__field(bool, uni)
++		__field(u8, id)
++		__field(u8, ext_id)
++		__field(size_t, len)
++		__dynamic_array(u8, data, len)
++	),
++	TP_fast_assign(
++		__entry->uni = uni;
++		__entry->id = id;
++		__entry->ext_id = ext_id;
++		__entry->len = len;
++		memcpy(__get_dynamic_array(data), data, len);
++	),
++	TP_printk(
++		"uni: %d, id: %u, ext_id: %u, len: %zu",
++		__entry->uni,
++		__entry->id,
++		__entry->ext_id,
++		__entry->len
++	)
++);
++
++DEFINE_EVENT(mt7996_mcu_debug, mt7996_mcu_cmd,
++	TP_PROTO(struct mt7996_dev *dev, bool uni, u8 id, u8 ext_id,
++		 const void *data, size_t len),
++	TP_ARGS(dev, uni, id, ext_id, data, len)
++);
++
++DEFINE_EVENT(mt7996_mcu_debug, mt7996_mcu_event,
++	TP_PROTO(struct mt7996_dev *dev, bool uni, u8 id, u8 ext_id,
++		 const void *data, size_t len),
++	TP_ARGS(dev, uni, id, ext_id, data, len)
++);
++
++TRACE_EVENT(mt7996_tx_prepare,
++	TP_PROTO(struct mt7996_dev *dev, struct mt76_wcid *wcid, enum mt76_txq_id qid,
++		 const void *txwi, const void *data, size_t len),
++	TP_ARGS(dev, wcid, qid, txwi, data, len),
++
++	TP_STRUCT__entry(
++		DEV_ENTRY
++		__field(u16, wcid)
++		__field(u8, qid)
++		__array(u8, txwi, MT_TXD_SIZE)
++		__field(size_t, len)
++		__dynamic_array(u8, data, len)
++	),
++
++	TP_fast_assign(
++		DEV_ASSIGN(dev->mt76.phys[wcid->phy_idx]->hw->wiphy);
++		__entry->wcid = wcid->idx;
++		__entry->qid = qid;
++		memcpy(__entry->txwi, txwi, MT_TXD_SIZE);
++		__entry->len = len;
++		memcpy(__get_dynamic_array(data), data, len);
++	),
++
++	TP_printk(
++		DEV_PR_FMT " wcid: %u, qid: %u, len: %zu",
++		DEV_PR_ARG, __entry->wcid, __entry->qid, __entry->len
++	)
++);
++
++TRACE_EVENT(mt7996_fill_rx,
++	TP_PROTO(struct mt7996_phy *phy, const void *data, size_t len),
++	TP_ARGS(phy, data, len),
++
++	TP_STRUCT__entry(
++		DEV_ENTRY
++		__field(size_t, len)
++		__dynamic_array(u8, data, len)
++	),
++
++	TP_fast_assign(
++		DEV_ASSIGN(phy->mt76->hw->wiphy);
++		__entry->len = len;
++		memcpy(__get_dynamic_array(data), data, len);
++	),
++
++	TP_printk(
++		DEV_PR_FMT " len: %zu",
++		DEV_PR_ARG, __entry->len
++	)
++);
++
++TRACE_EVENT(mt7996_fill_rx_done,
++	TP_PROTO(struct mt7996_phy *phy, u16 seqno, u16 hdr_gap),
++	TP_ARGS(phy, seqno, hdr_gap),
++
++	TP_STRUCT__entry(
++		DEV_ENTRY
++		__field(u16, seqno)
++		__field(u16, hdr_gap)
++	),
++
++	TP_fast_assign(
++		DEV_ASSIGN(phy->mt76->hw->wiphy);
++		__entry->seqno = seqno;
++		__entry->hdr_gap = hdr_gap;
++	),
++
++	TP_printk(
++		DEV_PR_FMT " seqno: %u, hdr_gap: %u",
++		DEV_PR_ARG, __entry->seqno, __entry->hdr_gap
++	)
++);
++
++#endif
++
++#undef TRACE_INCLUDE_PATH
++#define TRACE_INCLUDE_PATH ./mt7996
++#undef TRACE_INCLUDE_FILE
++#define TRACE_INCLUDE_FILE mt7996_trace
++
++#include <trace/define_trace.h>
+diff --git a/mt7996/trace.c b/mt7996/trace.c
+new file mode 100644
+index 00000000..ba36f79a
+--- /dev/null
++++ b/mt7996/trace.c
+@@ -0,0 +1,12 @@
++/* SPDX-License-Identifier: ISC */
++/*
++ * Copyright (C) 2022 MediaTek Inc.
++ */
++
++#include <linux/module.h>
++
++#ifndef __CHECKER__
++#define CREATE_TRACE_POINTS
++#include "mt7996_trace.h"
++
++#endif
+diff --git a/trace.h b/trace.h
+index c3d0ef8e..57c94c6b 100644
+--- a/trace.h
++++ b/trace.h
+@@ -101,6 +101,64 @@ DEFINE_EVENT(dev_txid_evt, mac_txdone,
+ 	TP_ARGS(dev, wcid, pktid)
+ );
+ 
++TRACE_EVENT(mt76_rx_complete,
++	TP_PROTO(struct mt76_dev *dev, struct mt76_rx_status *status, bool sub),
++	TP_ARGS(dev, status, sub),
++
++	TP_STRUCT__entry(
++		DEV_ENTRY
++		__field(u16, seqno)
++		__field(u16, wcid)
++		__field(u8, first_amsdu)
++		__field(bool, sub)
++	),
++
++	TP_fast_assign(
++		strlcpy(__entry->wiphy_name,
++			wiphy_name(mt76_dev_phy(dev, status->phy_idx)->hw->wiphy),
++			MAXNAME);
++		__entry->seqno = status->seqno;
++		__entry->wcid = status->wcid ? status->wcid->idx : 0;
++		__entry->first_amsdu = status->first_amsdu;
++		__entry->sub = sub;
++	),
++
++	TP_printk(
++		DEV_PR_FMT " seqno: %u, wcid: %u, first_amsdu: %x, sub: %d",
++		DEV_PR_ARG, __entry->seqno, __entry->wcid, __entry->first_amsdu,
++		__entry->sub
++	)
++);
++
++TRACE_EVENT(mt76_rx_aggr_reorder,
++	TP_PROTO(struct mt76_dev *dev, struct mt76_wcid *wcid, u16 _head, u16 seqno, bool sn_less),
++	TP_ARGS(dev, wcid, _head, seqno, sn_less),
++
++	TP_STRUCT__entry(
++		DEV_ENTRY
++		__field(u16, wcid)
++		__field(u16, _head)
++		__field(u16, seqno)
++		__field(bool, sn_less)
++	),
++
++	TP_fast_assign(
++		strlcpy(__entry->wiphy_name,
++			wiphy_name(dev->phys[wcid->phy_idx]->hw->wiphy),
++			MAXNAME);
++		__entry->wcid = wcid->idx;
++		__entry->_head = _head;
++		__entry->seqno = seqno;
++		__entry->sn_less = sn_less;
++	),
++
++	TP_printk(
++		DEV_PR_FMT " wcid: %u, head: %u, seqno: %u, sn_less: %d",
++		DEV_PR_ARG, __entry->wcid, __entry->_head, __entry->seqno,
++		__entry->sn_less
++	)
++);
++
+ #endif
+ 
+ #undef TRACE_INCLUDE_PATH
+-- 
+2.18.0
+