Skip to content

Commit

Permalink
mt76: mt7915: rely on mt76_connac_mcu_sta_ba
Browse files Browse the repository at this point in the history
Rely on mt76_connac_mcu_sta_ba routine in mt7915 and remove duplicated
code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
LorenzoBianconi authored and nbd168 committed Dec 29, 2021
1 parent 4728939 commit e3ae182
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 52 deletions.
3 changes: 2 additions & 1 deletion mt7615/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,8 @@ mt7615_mcu_uni_tx_ba(struct mt7615_dev *dev,
struct mt7615_sta *sta = (struct mt7615_sta *)params->sta->drv_priv;

return mt76_connac_mcu_sta_ba(&dev->mt76, &sta->vif->mt76, params,
enable, true);
MCU_UNI_CMD(STA_REC_UPDATE), enable,
true);
}

static int
Expand Down
8 changes: 3 additions & 5 deletions mt76_connac_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba_tlv);

int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
struct ieee80211_ampdu_params *params,
bool enable, bool tx)
int cmd, bool enable, bool tx)
{
struct mt76_wcid *wcid = (struct mt76_wcid *)params->sta->drv_priv;
struct wtbl_req_hdr *wtbl_hdr;
Expand All @@ -1171,8 +1171,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
mt76_connac_mcu_wtbl_ba_tlv(dev, skb, params, enable, tx, sta_wtbl,
wtbl_hdr);

ret = mt76_mcu_skb_send_msg(dev, skb,
MCU_UNI_CMD(STA_REC_UPDATE), true);
ret = mt76_mcu_skb_send_msg(dev, skb, cmd, true);
if (ret)
return ret;

Expand All @@ -1182,8 +1181,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,

mt76_connac_mcu_sta_ba_tlv(skb, params, enable, tx);

return mt76_mcu_skb_send_msg(dev, skb,
MCU_UNI_CMD(STA_REC_UPDATE), true);
return mt76_mcu_skb_send_msg(dev, skb, cmd, true);
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba);

Expand Down
2 changes: 1 addition & 1 deletion mt76_connac_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
bool enable);
int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
struct ieee80211_ampdu_params *params,
bool enable, bool tx);
int cmd, bool enable, bool tx);
int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
struct ieee80211_vif *vif,
struct mt76_wcid *wcid,
Expand Down
58 changes: 13 additions & 45 deletions mt7915/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,63 +742,31 @@ int mt7915_mcu_add_bss_info(struct mt7915_phy *phy,
}

/** starec & wtbl **/
static int
mt7915_mcu_sta_ba(struct mt7915_dev *dev,
struct ieee80211_ampdu_params *params,
bool enable, bool tx)
int mt7915_mcu_add_tx_ba(struct mt7915_dev *dev,
struct ieee80211_ampdu_params *params,
bool enable)
{
struct mt7915_sta *msta = (struct mt7915_sta *)params->sta->drv_priv;
struct mt7915_vif *mvif = msta->vif;
struct wtbl_req_hdr *wtbl_hdr;
struct tlv *sta_wtbl;
struct sk_buff *skb;
int ret;

if (enable && tx && !params->amsdu)
if (enable && !params->amsdu)
msta->wcid.amsdu = false;

skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
&msta->wcid);
if (IS_ERR(skb))
return PTR_ERR(skb);

sta_wtbl = mt76_connac_mcu_add_tlv(skb, STA_REC_WTBL,
sizeof(struct tlv));
wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid,
WTBL_SET, sta_wtbl, &skb);
if (IS_ERR(wtbl_hdr))
return PTR_ERR(wtbl_hdr);

mt76_connac_mcu_wtbl_ba_tlv(&dev->mt76, skb, params, enable, tx,
sta_wtbl, wtbl_hdr);
ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD(STA_REC_UPDATE), true);
if (ret)
return ret;

skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
&msta->wcid);
if (IS_ERR(skb))
return PTR_ERR(skb);

mt76_connac_mcu_sta_ba_tlv(skb, params, enable, tx);

return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD(STA_REC_UPDATE), true);
}

int mt7915_mcu_add_tx_ba(struct mt7915_dev *dev,
struct ieee80211_ampdu_params *params,
bool enable)
{
return mt7915_mcu_sta_ba(dev, params, enable, true);
return mt76_connac_mcu_sta_ba(&dev->mt76, &mvif->mt76, params,
MCU_EXT_CMD(STA_REC_UPDATE),
enable, true);
}

int mt7915_mcu_add_rx_ba(struct mt7915_dev *dev,
struct ieee80211_ampdu_params *params,
bool enable)
{
return mt7915_mcu_sta_ba(dev, params, enable, false);
struct mt7915_sta *msta = (struct mt7915_sta *)params->sta->drv_priv;
struct mt7915_vif *mvif = msta->vif;

return mt76_connac_mcu_sta_ba(&dev->mt76, &mvif->mt76, params,
MCU_EXT_CMD(STA_REC_UPDATE),
enable, false);
}

static void
Expand Down
2 changes: 2 additions & 0 deletions mt7921/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev,
msta->wcid.amsdu = false;

return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->mt76, params,
MCU_UNI_CMD(STA_REC_UPDATE),
enable, true);
}

Expand All @@ -439,6 +440,7 @@ int mt7921_mcu_uni_rx_ba(struct mt7921_dev *dev,
struct mt7921_sta *msta = (struct mt7921_sta *)params->sta->drv_priv;

return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->mt76, params,
MCU_UNI_CMD(STA_REC_UPDATE),
enable, false);
}

Expand Down

0 comments on commit e3ae182

Please sign in to comment.