Commit 3e384828 authored by Felix Fietkau's avatar Felix Fietkau
Browse files

mt7615: replace sta_state callback with sta_add/sta_remove



The MT7615 firmware needs to know the association id at creation time,
which is unavailable during the transition from notexist to none in
.sta_state.
This can cause a number of issues, probably also breaking powersave
support.

Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent c3c25d09
Loading
Loading
Loading
Loading
+24 −14
Original line number Diff line number Diff line
@@ -434,7 +434,7 @@ mt7615_channel_switch_beacon(struct ieee80211_hw *hw,
	mutex_unlock(&dev->mt76.mutex);
}

int mt7615_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
		       struct ieee80211_sta *sta)
{
	struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
@@ -457,20 +457,13 @@ int mt7615_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,

	mt7615_mcu_add_wtbl(dev, vif, sta);
	mt7615_mcu_set_sta_rec(dev, vif, sta, 1);

	return 0;
}

void mt7615_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
		      struct ieee80211_sta *sta)
{
	struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);

	if (sta->ht_cap.ht_supported)
		mt7615_mcu_set_ht_cap(dev, vif, sta);

	return 0;
}

void mt7615_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
			   struct ieee80211_sta *sta)
{
	struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
@@ -607,6 +600,22 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
	return ret;
}

static int
mt7615_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
	       struct ieee80211_sta *sta)
{
    return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST,
			  IEEE80211_STA_NONE);
}

static int
mt7615_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		  struct ieee80211_sta *sta)
{
    return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NONE,
			  IEEE80211_STA_NOTEXIST);
}

const struct ieee80211_ops mt7615_ops = {
	.tx = mt7615_tx,
	.start = mt7615_start,
@@ -617,7 +626,8 @@ const struct ieee80211_ops mt7615_ops = {
	.conf_tx = mt7615_conf_tx,
	.configure_filter = mt7615_configure_filter,
	.bss_info_changed = mt7615_bss_info_changed,
	.sta_state = mt76_sta_state,
	.sta_add = mt7615_sta_add,
	.sta_remove = mt7615_sta_remove,
	.set_key = mt7615_set_key,
	.ampdu_action = mt7615_ampdu_action,
	.set_rts_threshold = mt7615_set_rts_threshold,
+3 −5
Original line number Diff line number Diff line
@@ -313,11 +313,9 @@ void mt7615_tx_complete_skb(struct mt76_dev *mdev, enum mt76_txq_id qid,
void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
			 struct sk_buff *skb);
void mt7615_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
int mt7615_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
		       struct ieee80211_sta *sta);
void mt7615_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
		      struct ieee80211_sta *sta);
void mt7615_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
			   struct ieee80211_sta *sta);
void mt7615_mac_work(struct work_struct *work);
void mt7615_txp_skb_unmap(struct mt76_dev *dev,
+2 −3
Original line number Diff line number Diff line
@@ -81,9 +81,8 @@ static int mt7615_pci_probe(struct pci_dev *pdev,
		.rx_skb = mt7615_queue_rx_skb,
		.rx_poll_complete = mt7615_rx_poll_complete,
		.sta_ps = mt7615_sta_ps,
		.sta_add = mt7615_sta_add,
		.sta_assoc = mt7615_sta_assoc,
		.sta_remove = mt7615_sta_remove,
		.sta_add = mt7615_mac_sta_add,
		.sta_remove = mt7615_mac_sta_remove,
		.update_survey = mt7615_update_channel,
	};
	struct mt7615_dev *dev;