Commit 4690da34 authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau
Browse files

mt76: mt7615: switch mt7615_mcu_set_tx_ba to v2 format



To adapt new firmware version.

Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Tested-by: default avatarShayne Chen <shayne.chen@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 184dd9a1
Loading
Loading
Loading
Loading
+33 −27
Original line number Original line Diff line number Diff line
@@ -1695,28 +1695,11 @@ int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev,
{
{
	struct mt7615_sta *msta = (struct mt7615_sta *)params->sta->drv_priv;
	struct mt7615_sta *msta = (struct mt7615_sta *)params->sta->drv_priv;
	struct mt7615_vif *mvif = msta->vif;
	struct mt7615_vif *mvif = msta->vif;
	struct {
		struct wtbl_req_hdr hdr;
		struct wtbl_ba ba;
	} wtbl_req = {
		.hdr = {
			.wlan_idx = msta->wcid.idx,
			.operation = WTBL_SET,
			.tlv_num = cpu_to_le16(1),
		},
		.ba = {
			.tag = cpu_to_le16(WTBL_BA),
			.len = cpu_to_le16(sizeof(struct wtbl_ba)),
			.tid = params->tid,
			.ba_type = MT_BA_TYPE_ORIGINATOR,
			.sn = add ? cpu_to_le16(params->ssn) : 0,
			.ba_en = add,
		},
	};
	struct {
	struct {
		struct sta_req_hdr hdr;
		struct sta_req_hdr hdr;
		struct sta_rec_ba ba;
		struct sta_rec_ba ba;
	} sta_req = {
		u8 buf[MT7615_WTBL_UPDATE_MAX_SIZE];
	} __packed req = {
		.hdr = {
		.hdr = {
			.bss_idx = mvif->idx,
			.bss_idx = mvif->idx,
			.wlan_idx = msta->wcid.idx,
			.wlan_idx = msta->wcid.idx,
@@ -1735,7 +1718,32 @@ int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev,
			.winsize = cpu_to_le16(params->buf_size),
			.winsize = cpu_to_le16(params->buf_size),
		},
		},
	};
	};
	int ret;
	struct sta_rec_wtbl *wtbl = NULL;
	struct wtbl_req_hdr *wtbl_hdr;
	struct wtbl_ba *wtbl_ba;
	u8 *buf = req.buf;

	if (dev->fw_ver > MT7615_FIRMWARE_V1) {
		req.hdr.tlv_num = cpu_to_le16(2);
		wtbl = (struct sta_rec_wtbl *)buf;
		wtbl->tag = cpu_to_le16(STA_REC_WTBL);
		buf += sizeof(*wtbl);
	}

	wtbl_hdr = (struct wtbl_req_hdr *)buf;
	buf += sizeof(*wtbl_hdr);
	wtbl_hdr->wlan_idx = msta->wcid.idx;
	wtbl_hdr->operation = WTBL_SET;
	wtbl_hdr->tlv_num = cpu_to_le16(1);

	wtbl_ba = (struct wtbl_ba *)buf;
	buf += sizeof(*wtbl_ba);
	wtbl_ba->tag = cpu_to_le16(WTBL_BA);
	wtbl_ba->len = cpu_to_le16(sizeof(*wtbl_ba));
	wtbl_ba->tid = params->tid;
	wtbl_ba->ba_type = MT_BA_TYPE_ORIGINATOR;
	wtbl_ba->sn = add ? cpu_to_le16(params->ssn) : 0;
	wtbl_ba->ba_en = add;


	if (add) {
	if (add) {
		u8 idx, ba_range[] = { 4, 8, 12, 24, 36, 48, 54, 64 };
		u8 idx, ba_range[] = { 4, 8, 12, 24, 36, 48, 54, 64 };
@@ -1745,16 +1753,14 @@ int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev,
				break;
				break;
		}
		}


		wtbl_req.ba.ba_winsize_idx = idx;
		wtbl_ba->ba_winsize_idx = idx;
	}
	}


	ret = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE,
	if (wtbl)
				  &wtbl_req, sizeof(wtbl_req), true);
		wtbl->len = cpu_to_le16(buf - (u8 *)wtbl_hdr);
	if (ret)
		return ret;


	return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_STA_REC_UPDATE,
	return mt7615_mcu_send_sta_rec(dev, (u8 *)&req, (u8 *)wtbl_hdr,
				   &sta_req, sizeof(sta_req), true);
				       buf - (u8 *)wtbl_hdr, true);
}
}


int mt7615_mcu_set_rx_ba(struct mt7615_dev *dev,
int mt7615_mcu_set_rx_ba(struct mt7615_dev *dev,