Skip to content

Commit

Permalink
mt76: mt7615: introduce set_ba uni command
Browse files Browse the repository at this point in the history
Introduce mt7615_mcu_uni_set_ba routine in order to add support
for mt7663e driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
Lorenzo Bianconi authored and Felix Fietkau committed Mar 17, 2020
1 parent 1388606 commit c686a35
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,88 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
&req, sizeof(req), true);
}

static int
mt7615_mcu_uni_tx_ba(struct mt7615_dev *dev,
struct ieee80211_ampdu_params *params,
bool enable)
{
struct mt7615_sta *msta = (struct mt7615_sta *)params->sta->drv_priv;
struct mt7615_vif *mvif = msta->vif;
struct wtbl_req_hdr *wtbl_hdr;
struct tlv *sta_wtbl;
struct sk_buff *skb;
int err;

skb = mt7615_mcu_alloc_sta_req(mvif, msta);
if (IS_ERR(skb))
return PTR_ERR(skb);

sta_wtbl = mt7615_mcu_add_tlv(skb, STA_REC_WTBL,
sizeof(struct sta_rec_wtbl));

wtbl_hdr = mt7615_mcu_alloc_wtbl_req(msta, WTBL_SET, sta_wtbl, &skb);
if (IS_ERR(wtbl_hdr))
return PTR_ERR(wtbl_hdr);

mt7615_mcu_wtbl_ba_tlv(skb, params, enable, true, sta_wtbl,
wtbl_hdr);

err = __mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true);
if (err < 0)
return err;

skb = mt7615_mcu_alloc_sta_req(mvif, msta);
if (IS_ERR(skb))
return PTR_ERR(skb);

mt7615_mcu_sta_ba_tlv(skb, params, enable, true);

return __mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true);
}

static int
mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev,
struct ieee80211_ampdu_params *params,
bool enable)
{
struct mt7615_sta *msta = (struct mt7615_sta *)params->sta->drv_priv;
struct mt7615_vif *mvif = msta->vif;
struct wtbl_req_hdr *wtbl_hdr;
struct tlv *sta_wtbl;
struct sk_buff *skb;
int err;

skb = mt7615_mcu_alloc_sta_req(mvif, msta);
if (IS_ERR(skb))
return PTR_ERR(skb);

mt7615_mcu_sta_ba_tlv(skb, params, enable, false);

err = __mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true);
if (err < 0 || !enable)
return err;

skb = mt7615_mcu_alloc_sta_req(mvif, msta);
if (IS_ERR(skb))
return PTR_ERR(skb);

sta_wtbl = mt7615_mcu_add_tlv(skb, STA_REC_WTBL,
sizeof(struct sta_rec_wtbl));

wtbl_hdr = mt7615_mcu_alloc_wtbl_req(msta, WTBL_SET, sta_wtbl, &skb);
if (IS_ERR(wtbl_hdr))
return PTR_ERR(wtbl_hdr);

mt7615_mcu_wtbl_ba_tlv(skb, params, enable, false, sta_wtbl,
wtbl_hdr);

return __mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true);
}

static int
mt7615_mcu_uni_add_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable)
Expand All @@ -1327,6 +1409,8 @@ static const struct mt7615_mcu_ops uni_update_ops = {
.set_pm_state = mt7615_mcu_uni_ctrl_pm_state,
.add_dev_info = mt7615_mcu_uni_add_dev,
.add_bss_info = mt7615_mcu_uni_add_bss,
.add_tx_ba = mt7615_mcu_uni_tx_ba,
.add_rx_ba = mt7615_mcu_uni_rx_ba,
.sta_add = mt7615_mcu_uni_add_sta,
};

Expand Down

0 comments on commit c686a35

Please sign in to comment.