Commit 4bada9b0 authored by Ming Yen Hsieh's avatar Ming Yen Hsieh Committed by Felix Fietkau
Browse files

wifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is present



When the p2p device and MLO station are running concurrently, the p2p device
will occupy the wrong link_idx when the MLO secondary link is added.

Fixes: 9e4c3a00 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO")
Cc: stable@vger.kernel.org
Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Tested-by: default avatarCaleb Jorden <cjorden@gmail.com>
Signed-off-by: default avatarMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-2-sean.wang@kernel.org


Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 766ea2cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -769,6 +769,7 @@ struct mt76_testmode_data {

struct mt76_vif_link {
	u8 idx;
	u8 link_idx;
	u8 omac_idx;
	u8 band_idx;
	u8 wmm_idx;
+2 −2
Original line number Diff line number Diff line
@@ -1168,7 +1168,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
			.tag = cpu_to_le16(DEV_INFO_ACTIVE),
			.len = cpu_to_le16(sizeof(struct req_tlv)),
			.active = enable,
			.link_idx = mvif->idx,
			.link_idx = mvif->link_idx,
		},
	};
	struct {
@@ -1191,7 +1191,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
			.bmc_tx_wlan_idx = cpu_to_le16(wcid->idx),
			.sta_idx = cpu_to_le16(wcid->idx),
			.conn_state = 1,
			.link_idx = mvif->idx,
			.link_idx = mvif->link_idx,
		},
	};
	int err, idx, cmd, len;
+10 −4
Original line number Diff line number Diff line
@@ -360,17 +360,23 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
	struct mt76_txq *mtxq;
	int idx, ret = 0;

	if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
		mconf->mt76.idx = MT792x_MAX_INTERFACES;
	} else {
		mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask);

		if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) {
			ret = -ENOSPC;
			goto out;
		}
	}

	mconf->mt76.omac_idx = ieee80211_vif_is_mld(vif) ?
			       0 : mconf->mt76.idx;
	mconf->mt76.band_idx = 0xff;
	mconf->mt76.wmm_idx = ieee80211_vif_is_mld(vif) ?
			      0 : mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
	mconf->mt76.link_idx = hweight16(mvif->valid_links);

	if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ)
		mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4;