mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7925: fix NAN NDP STA record role index
The NDP STA record role_idx must carry the NAN BSS band0 index
rather than the mac80211 BSS index, otherwise the firmware maps the
NDP peer to the wrong role. Use the fixed NAN_BSS_INDEX_BAND0 value.
While at it, drop the inline peer-schedule setup in
mt792x_nan_map_sta_rec(): the peer schedule is already driven by the
upper layer through the peer_sched_changed callback
(mt792x_nan_set_peer_schedule()), so the redundant call and the
now-unused local variables are removed.
Fixes: 0f3605e4f8de ("wifi: mt76: mt7925: wire up NAN operations")
Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Stella Liu <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
33ef303d08
commit
d905a72527
+1
-32
@@ -984,21 +984,17 @@ int mt792x_nan_map_sta_rec(struct mt76_dev *mdev,
|
|||||||
struct mt7925_nan_common_hdr *hdr;
|
struct mt7925_nan_common_hdr *hdr;
|
||||||
struct ieee80211_sta *nmi_sta;
|
struct ieee80211_sta *nmi_sta;
|
||||||
struct mt792x_sta *nmi_msta;
|
struct mt792x_sta *nmi_msta;
|
||||||
struct mt792x_vif *mvif;
|
|
||||||
struct mt792x_sta *msta;
|
struct mt792x_sta *msta;
|
||||||
u8 nmi_addr[ETH_ALEN];
|
u8 nmi_addr[ETH_ALEN];
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
int ndp_ctx_id = 0;
|
int ndp_ctx_id = 0;
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
struct mt792x_dev *dev;
|
|
||||||
struct tlv *tlv;
|
struct tlv *tlv;
|
||||||
|
|
||||||
if (!mdev || !vif || !sta)
|
if (!mdev || !vif || !sta)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
dev = container_of(mdev, struct mt792x_dev, mt76);
|
|
||||||
msta = (struct mt792x_sta *)sta->drv_priv;
|
msta = (struct mt792x_sta *)sta->drv_priv;
|
||||||
mvif = (struct mt792x_vif *)vif->drv_priv;
|
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
nmi_sta = rcu_dereference(sta->nmi);
|
nmi_sta = rcu_dereference(sta->nmi);
|
||||||
@@ -1012,33 +1008,6 @@ int mt792x_nan_map_sta_rec(struct mt76_dev *mdev,
|
|||||||
memcpy(nmi_addr, nmi_sta->addr, ETH_ALEN);
|
memcpy(nmi_addr, nmi_sta->addr, ETH_ALEN);
|
||||||
nmi_msta = (struct mt792x_sta *)nmi_sta->drv_priv;
|
nmi_msta = (struct mt792x_sta *)nmi_sta->drv_priv;
|
||||||
|
|
||||||
if (!nmi_msta->nan_sched.idx_assigned) {
|
|
||||||
if (!nmi_sta->nan_sched) {
|
|
||||||
rcu_read_unlock();
|
|
||||||
dev_err(mdev->dev,
|
|
||||||
"NAN: peer schedule missing for NDI sta %pM\n",
|
|
||||||
sta->addr);
|
|
||||||
return -EAGAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
rcu_read_unlock();
|
|
||||||
ret = mt792x_nan_set_peer_schedule(dev, nmi_sta);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
nmi_sta = rcu_dereference(sta->nmi);
|
|
||||||
if (!nmi_sta) {
|
|
||||||
rcu_read_unlock();
|
|
||||||
dev_err(mdev->dev,
|
|
||||||
"NAN: NMI sta not found for NDI sta %pM\n",
|
|
||||||
sta->addr);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nmi_msta = (struct mt792x_sta *)nmi_sta->drv_priv;
|
|
||||||
}
|
|
||||||
|
|
||||||
ndp_ctx_id = find_first_zero_bit(&nmi_msta->nan_sched.ndp_ctx_bitmap,
|
ndp_ctx_id = find_first_zero_bit(&nmi_msta->nan_sched.ndp_ctx_bitmap,
|
||||||
NAN_MAX_NDP_CXT);
|
NAN_MAX_NDP_CXT);
|
||||||
if (ndp_ctx_id >= NAN_MAX_NDP_CXT) {
|
if (ndp_ctx_id >= NAN_MAX_NDP_CXT) {
|
||||||
@@ -1073,7 +1042,7 @@ int mt792x_nan_map_sta_rec(struct mt76_dev *mdev,
|
|||||||
memcpy(map_tlv->nmi_addr, nmi_addr, ETH_ALEN);
|
memcpy(map_tlv->nmi_addr, nmi_addr, ETH_ALEN);
|
||||||
map_tlv->sta_rec_idx = msta->deflink.wcid.idx;
|
map_tlv->sta_rec_idx = msta->deflink.wcid.idx;
|
||||||
map_tlv->ndp_ctx_id = ndp_ctx_id;
|
map_tlv->ndp_ctx_id = ndp_ctx_id;
|
||||||
map_tlv->role_idx = cpu_to_le32(mvif->bss_conf.mt76.idx);
|
map_tlv->role_idx = cpu_to_le32(NAN_BSS_INDEX_BAND0);
|
||||||
memcpy(map_tlv->ndi_addr, vif->addr, ETH_ALEN);
|
memcpy(map_tlv->ndi_addr, vif->addr, ETH_ALEN);
|
||||||
|
|
||||||
ret = mt76_mcu_skb_send_msg(mdev, skb,
|
ret = mt76_mcu_skb_send_msg(mdev, skb,
|
||||||
|
|||||||
@@ -65,6 +65,8 @@
|
|||||||
#define UNII3_LOWER_BOUND 149
|
#define UNII3_LOWER_BOUND 149
|
||||||
#define UNII3_UPPER_BOUND 165
|
#define UNII3_UPPER_BOUND 165
|
||||||
|
|
||||||
|
#define NAN_BSS_INDEX_BAND0 0
|
||||||
|
|
||||||
enum nan_uni_cmd_tag {
|
enum nan_uni_cmd_tag {
|
||||||
NAN_UNI_CMD_SET_MASTER_PREFERENCE = 0,
|
NAN_UNI_CMD_SET_MASTER_PREFERENCE = 0,
|
||||||
NAN_UNI_CMD_ENABLE_REQUEST = 7,
|
NAN_UNI_CMD_ENABLE_REQUEST = 7,
|
||||||
|
|||||||
Reference in New Issue
Block a user