Commit 18fced20 authored by MeiChia Chiu's avatar MeiChia Chiu Committed by Felix Fietkau
Browse files

mt76: mt7915: update the maximum size of beacon offload



Since an in-band discovery frame is offloaded by MCU,
here we enlarge the command size to accommodate the additional content.

Reviewed-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarMoney Wang <Money.Wang@mediatek.com>
Signed-off-by: default avatarMeiChia Chiu <MeiChia.Chiu@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 1858e4fc
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1938,6 +1938,12 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
	len = sizeof(*discov) + MT_TXD_SIZE + skb->len;
	len = (len & 0x3) ? ((len | 0x3) + 1) : len;

	if (len > (MT7915_MAX_BSS_OFFLOAD_SIZE - rskb->len)) {
		dev_err(dev->mt76.dev, "inband discovery size limit exceed\n");
		dev_kfree_skb(skb);
		return;
	}

	tlv = mt7915_mcu_add_nested_subtlv(rskb, BSS_INFO_BCN_DISCOV,
					   len, &bcn->sub_ntlv, &bcn->len);
	discov = (struct bss_info_inband_discovery *)tlv;
@@ -1960,7 +1966,6 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
			  int en, u32 changed)
{
#define MAX_BEACON_SIZE 512
	struct mt7915_dev *dev = mt7915_hw_dev(hw);
	struct mt7915_phy *phy = mt7915_hw_phy(hw);
	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
@@ -1969,7 +1974,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
	struct sk_buff *skb, *rskb;
	struct tlv *tlv;
	struct bss_info_bcn *bcn;
	int len = MT7915_BEACON_UPDATE_SIZE + MAX_BEACON_SIZE;
	int len = MT7915_MAX_BSS_OFFLOAD_SIZE;
	bool ext_phy = phy != &dev->phy;

	if (vif->bss_conf.nontransmitted)
@@ -1991,7 +1996,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
	if (!skb)
		return -EINVAL;

	if (skb->len > MAX_BEACON_SIZE - MT_TXD_SIZE) {
	if (skb->len > MT7915_MAX_BEACON_SIZE - MT_TXD_SIZE) {
		dev_err(dev->mt76.dev, "Bcn size limit exceed\n");
		dev_kfree_skb(skb);
		return -EINVAL;
+6 −0
Original line number Diff line number Diff line
@@ -452,6 +452,12 @@ enum {
	SER_RECOVER
};

#define MT7915_MAX_BEACON_SIZE		512
#define MT7915_MAX_INBAND_FRAME_SIZE	256
#define MT7915_MAX_BSS_OFFLOAD_SIZE	(MT7915_MAX_BEACON_SIZE +	  \
					 MT7915_MAX_INBAND_FRAME_SIZE +	  \
					 MT7915_BEACON_UPDATE_SIZE)

#define MT7915_BSS_UPDATE_MAX_SIZE	(sizeof(struct sta_req_hdr) +	\
					 sizeof(struct bss_info_omac) +	\
					 sizeof(struct bss_info_basic) +\