Commit 54722402 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: connac: introduce MCU_UNI_CMD macro

Similar to MCU_EXT_CMD, introduce MCU_UNI_CMD for unified commands
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 7159eb82
...@@ -103,7 +103,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, ...@@ -103,7 +103,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
if (wait_seq) if (wait_seq)
*wait_seq = seq; *wait_seq = seq;
txd_len = cmd & MCU_UNI_PREFIX ? sizeof(*uni_txd) : sizeof(*mcu_txd); txd_len = cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_txd);
txd = (__le32 *)skb_push(skb, txd_len); txd = (__le32 *)skb_push(skb, txd_len);
if (cmd != MCU_CMD_FW_SCATTER) { if (cmd != MCU_CMD_FW_SCATTER) {
...@@ -124,7 +124,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, ...@@ -124,7 +124,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
FIELD_PREP(MT_TXD1_PKT_FMT, pkt_fmt); FIELD_PREP(MT_TXD1_PKT_FMT, pkt_fmt);
txd[1] = cpu_to_le32(val); txd[1] = cpu_to_le32(val);
if (cmd & MCU_UNI_PREFIX) { if (cmd & __MCU_CMD_FIELD_UNI) {
uni_txd = (struct mt7615_uni_txd *)txd; uni_txd = (struct mt7615_uni_txd *)txd;
uni_txd->len = cpu_to_le16(skb->len - sizeof(uni_txd->txd)); uni_txd->len = cpu_to_le16(skb->len - sizeof(uni_txd->txd));
uni_txd->option = MCU_CMD_UNI_EXT_ACK; uni_txd->option = MCU_CMD_UNI_EXT_ACK;
...@@ -182,12 +182,12 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd, ...@@ -182,12 +182,12 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd,
} else if (cmd == MCU_EXT_QUERY(RF_REG_ACCESS)) { } else if (cmd == MCU_EXT_QUERY(RF_REG_ACCESS)) {
skb_pull(skb, sizeof(*rxd)); skb_pull(skb, sizeof(*rxd));
ret = le32_to_cpu(*(__le32 *)&skb->data[8]); ret = le32_to_cpu(*(__le32 *)&skb->data[8]);
} else if (cmd == MCU_UNI_CMD_DEV_INFO_UPDATE || } else if (cmd == MCU_UNI_CMD(DEV_INFO_UPDATE) ||
cmd == MCU_UNI_CMD_BSS_INFO_UPDATE || cmd == MCU_UNI_CMD(BSS_INFO_UPDATE) ||
cmd == MCU_UNI_CMD_STA_REC_UPDATE || cmd == MCU_UNI_CMD(STA_REC_UPDATE) ||
cmd == MCU_UNI_CMD_HIF_CTRL || cmd == MCU_UNI_CMD(HIF_CTRL) ||
cmd == MCU_UNI_CMD_OFFLOAD || cmd == MCU_UNI_CMD(OFFLOAD) ||
cmd == MCU_UNI_CMD_SUSPEND) { cmd == MCU_UNI_CMD(SUSPEND)) {
struct mt7615_mcu_uni_event *event; struct mt7615_mcu_uni_event *event;
skb_pull(skb, sizeof(*rxd)); skb_pull(skb, sizeof(*rxd));
...@@ -1263,7 +1263,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev, ...@@ -1263,7 +1263,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
dev_kfree_skb(skb); dev_kfree_skb(skb);
out: out:
return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE),
&req, sizeof(req), true); &req, sizeof(req), true);
} }
...@@ -1292,7 +1292,7 @@ mt7615_mcu_uni_add_sta(struct mt7615_phy *phy, struct ieee80211_vif *vif, ...@@ -1292,7 +1292,7 @@ mt7615_mcu_uni_add_sta(struct mt7615_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable) struct ieee80211_sta *sta, bool enable)
{ {
return __mt7615_mcu_add_sta(phy->mt76, vif, sta, enable, return __mt7615_mcu_add_sta(phy->mt76, vif, sta, enable,
MCU_UNI_CMD_STA_REC_UPDATE, true); MCU_UNI_CMD(STA_REC_UPDATE), true);
} }
static int static int
...@@ -1326,7 +1326,7 @@ mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev, ...@@ -1326,7 +1326,7 @@ mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev,
mt76_connac_mcu_sta_ba_tlv(skb, params, enable, false); mt76_connac_mcu_sta_ba_tlv(skb, params, enable, false);
err = mt76_mcu_skb_send_msg(&dev->mt76, skb, err = mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true); MCU_UNI_CMD(STA_REC_UPDATE), true);
if (err < 0 || !enable) if (err < 0 || !enable)
return err; return err;
...@@ -1347,7 +1347,7 @@ mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev, ...@@ -1347,7 +1347,7 @@ mt7615_mcu_uni_rx_ba(struct mt7615_dev *dev,
sta_wtbl, wtbl_hdr); sta_wtbl, wtbl_hdr);
return mt76_mcu_skb_send_msg(&dev->mt76, skb, return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true); MCU_UNI_CMD(STA_REC_UPDATE), true);
} }
static int static int
...@@ -1359,7 +1359,7 @@ mt7615_mcu_sta_uni_update_hdr_trans(struct mt7615_dev *dev, ...@@ -1359,7 +1359,7 @@ mt7615_mcu_sta_uni_update_hdr_trans(struct mt7615_dev *dev,
return mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, return mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76,
vif, &msta->wcid, vif, &msta->wcid,
MCU_UNI_CMD_STA_REC_UPDATE); MCU_UNI_CMD(STA_REC_UPDATE));
} }
static const struct mt7615_mcu_ops uni_update_ops = { static const struct mt7615_mcu_ops uni_update_ops = {
......
...@@ -1071,7 +1071,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, ...@@ -1071,7 +1071,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN);
cmd = enable ? MCU_UNI_CMD_DEV_INFO_UPDATE : MCU_UNI_CMD_BSS_INFO_UPDATE; cmd = enable ? MCU_UNI_CMD(DEV_INFO_UPDATE) : MCU_UNI_CMD(BSS_INFO_UPDATE);
data = enable ? (void *)&dev_req : (void *)&basic_req; data = enable ? (void *)&dev_req : (void *)&basic_req;
len = enable ? sizeof(dev_req) : sizeof(basic_req); len = enable ? sizeof(dev_req) : sizeof(basic_req);
...@@ -1079,7 +1079,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, ...@@ -1079,7 +1079,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
if (err < 0) if (err < 0)
return err; return err;
cmd = enable ? MCU_UNI_CMD_BSS_INFO_UPDATE : MCU_UNI_CMD_DEV_INFO_UPDATE; cmd = enable ? MCU_UNI_CMD(BSS_INFO_UPDATE) : MCU_UNI_CMD(DEV_INFO_UPDATE);
data = enable ? (void *)&basic_req : (void *)&dev_req; data = enable ? (void *)&basic_req : (void *)&dev_req;
len = enable ? sizeof(basic_req) : sizeof(dev_req); len = enable ? sizeof(basic_req) : sizeof(dev_req);
...@@ -1131,7 +1131,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, ...@@ -1131,7 +1131,8 @@ 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, mt76_connac_mcu_wtbl_ba_tlv(dev, skb, params, enable, tx, sta_wtbl,
wtbl_hdr); 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,
MCU_UNI_CMD(STA_REC_UPDATE), true);
if (ret) if (ret)
return ret; return ret;
...@@ -1141,8 +1142,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, ...@@ -1141,8 +1142,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
mt76_connac_mcu_sta_ba_tlv(skb, params, enable, tx); mt76_connac_mcu_sta_ba_tlv(skb, params, enable, tx);
return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_STA_REC_UPDATE, return mt76_mcu_skb_send_msg(dev, skb,
true); MCU_UNI_CMD(STA_REC_UPDATE), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba); EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba);
...@@ -1348,7 +1349,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, ...@@ -1348,7 +1349,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
basic_req.basic.sta_idx = cpu_to_le16(wcid->idx); basic_req.basic.sta_idx = cpu_to_le16(wcid->idx);
basic_req.basic.conn_state = !enable; basic_req.basic.conn_state = !enable;
err = mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, &basic_req, err = mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &basic_req,
sizeof(basic_req), true); sizeof(basic_req), true);
if (err < 0) if (err < 0)
return err; return err;
...@@ -1386,7 +1387,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, ...@@ -1386,7 +1387,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
mt76_connac_mcu_uni_bss_he_tlv(phy, vif, mt76_connac_mcu_uni_bss_he_tlv(phy, vif,
(struct tlv *)&he_req.he); (struct tlv *)&he_req.he);
err = mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, err = mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE),
&he_req, sizeof(he_req), true); &he_req, sizeof(he_req), true);
if (err < 0) if (err < 0)
return err; return err;
...@@ -1424,7 +1425,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, ...@@ -1424,7 +1425,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
else if (rlm_req.rlm.control_channel > rlm_req.rlm.center_chan) else if (rlm_req.rlm.control_channel > rlm_req.rlm.center_chan)
rlm_req.rlm.sco = 3; /* SCB */ rlm_req.rlm.sco = 3; /* SCB */
return mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, &rlm_req, return mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &rlm_req,
sizeof(rlm_req), true); sizeof(rlm_req), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_uni_add_bss); EXPORT_SYMBOL_GPL(mt76_connac_mcu_uni_add_bss);
...@@ -2114,7 +2115,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev, ...@@ -2114,7 +2115,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
memcpy(addr, &info->arp_addr_list[i], sizeof(__be32)); memcpy(addr, &info->arp_addr_list[i], sizeof(__be32));
} }
return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_OFFLOAD, true); return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_update_arp_filter); EXPORT_SYMBOL_GPL(mt76_connac_mcu_update_arp_filter);
...@@ -2220,7 +2221,8 @@ int mt76_connac_mcu_update_gtk_rekey(struct ieee80211_hw *hw, ...@@ -2220,7 +2221,8 @@ int mt76_connac_mcu_update_gtk_rekey(struct ieee80211_hw *hw,
memcpy(gtk_tlv->kck, key->kck, NL80211_KCK_LEN); memcpy(gtk_tlv->kck, key->kck, NL80211_KCK_LEN);
memcpy(gtk_tlv->replay_ctr, key->replay_ctr, NL80211_REPLAY_CTR_LEN); memcpy(gtk_tlv->replay_ctr, key->replay_ctr, NL80211_REPLAY_CTR_LEN);
return mt76_mcu_skb_send_msg(phy->dev, skb, MCU_UNI_CMD_OFFLOAD, true); return mt76_mcu_skb_send_msg(phy->dev, skb,
MCU_UNI_CMD(OFFLOAD), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_update_gtk_rekey); EXPORT_SYMBOL_GPL(mt76_connac_mcu_update_gtk_rekey);
...@@ -2246,8 +2248,8 @@ mt76_connac_mcu_set_arp_filter(struct mt76_dev *dev, struct ieee80211_vif *vif, ...@@ -2246,8 +2248,8 @@ mt76_connac_mcu_set_arp_filter(struct mt76_dev *dev, struct ieee80211_vif *vif,
}, },
}; };
return mt76_mcu_send_msg(dev, MCU_UNI_CMD_OFFLOAD, &req, sizeof(req), return mt76_mcu_send_msg(dev, MCU_UNI_CMD(OFFLOAD), &req,
true); sizeof(req), true);
} }
static int static int
...@@ -2272,8 +2274,8 @@ mt76_connac_mcu_set_gtk_rekey(struct mt76_dev *dev, struct ieee80211_vif *vif, ...@@ -2272,8 +2274,8 @@ mt76_connac_mcu_set_gtk_rekey(struct mt76_dev *dev, struct ieee80211_vif *vif,
}, },
}; };
return mt76_mcu_send_msg(dev, MCU_UNI_CMD_OFFLOAD, &req, sizeof(req), return mt76_mcu_send_msg(dev, MCU_UNI_CMD(OFFLOAD), &req,
true); sizeof(req), true);
} }
static int static int
...@@ -2302,8 +2304,8 @@ mt76_connac_mcu_set_suspend_mode(struct mt76_dev *dev, ...@@ -2302,8 +2304,8 @@ mt76_connac_mcu_set_suspend_mode(struct mt76_dev *dev,
}, },
}; };
return mt76_mcu_send_msg(dev, MCU_UNI_CMD_SUSPEND, &req, sizeof(req), return mt76_mcu_send_msg(dev, MCU_UNI_CMD(SUSPEND), &req,
true); sizeof(req), true);
} }
static int static int
...@@ -2337,7 +2339,7 @@ mt76_connac_mcu_set_wow_pattern(struct mt76_dev *dev, ...@@ -2337,7 +2339,7 @@ mt76_connac_mcu_set_wow_pattern(struct mt76_dev *dev,
memcpy(ptlv->pattern, pattern->pattern, pattern->pattern_len); memcpy(ptlv->pattern, pattern->pattern, pattern->pattern_len);
memcpy(ptlv->mask, pattern->mask, DIV_ROUND_UP(pattern->pattern_len, 8)); memcpy(ptlv->mask, pattern->mask, DIV_ROUND_UP(pattern->pattern_len, 8));
return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_SUSPEND, true); return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(SUSPEND), true);
} }
static int static int
...@@ -2389,8 +2391,8 @@ mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif, ...@@ -2389,8 +2391,8 @@ mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif,
else if (mt76_is_sdio(dev)) else if (mt76_is_sdio(dev))
req.wow_ctrl_tlv.wakeup_hif = WOW_GPIO; req.wow_ctrl_tlv.wakeup_hif = WOW_GPIO;
return mt76_mcu_send_msg(dev, MCU_UNI_CMD_SUSPEND, &req, sizeof(req), return mt76_mcu_send_msg(dev, MCU_UNI_CMD(SUSPEND), &req,
true); sizeof(req), true);
} }
int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend) int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend)
...@@ -2423,8 +2425,8 @@ int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend) ...@@ -2423,8 +2425,8 @@ int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend)
else if (mt76_is_sdio(dev)) else if (mt76_is_sdio(dev))
req.hdr.hif_type = 0; req.hdr.hif_type = 0;
return mt76_mcu_send_msg(dev, MCU_UNI_CMD_HIF_CTRL, &req, sizeof(req), return mt76_mcu_send_msg(dev, MCU_UNI_CMD(HIF_CTRL), &req,
true); sizeof(req), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_hif_suspend); EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_hif_suspend);
......
...@@ -497,13 +497,13 @@ enum { ...@@ -497,13 +497,13 @@ enum {
#define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \ #define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \
MCU_CMD_QUERY) MCU_CMD_QUERY)
#define MCU_UNI_PREFIX BIT(30)
#define MCU_CE_PREFIX BIT(29) #define MCU_CE_PREFIX BIT(29)
#define MCU_CMD_MASK ~(MCU_UNI_PREFIX | MCU_CE_PREFIX) #define MCU_CMD_MASK ~(MCU_CE_PREFIX)
#define __MCU_CMD_FIELD_ID GENMASK(7, 0) #define __MCU_CMD_FIELD_ID GENMASK(7, 0)
#define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8) #define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8)
#define __MCU_CMD_FIELD_QUERY BIT(16) #define __MCU_CMD_FIELD_QUERY BIT(16)
#define __MCU_CMD_FIELD_UNI BIT(17)
#define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \ #define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \
MCU_CMD_##_t) MCU_CMD_##_t)
...@@ -511,6 +511,9 @@ enum { ...@@ -511,6 +511,9 @@ enum {
FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \ FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \
MCU_EXT_CMD_##_t)) MCU_EXT_CMD_##_t))
#define MCU_EXT_QUERY(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_QUERY) #define MCU_EXT_QUERY(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_QUERY)
#define MCU_UNI_CMD(_t) (__MCU_CMD_FIELD_UNI | \
FIELD_PREP(__MCU_CMD_FIELD_ID, \
MCU_UNI_CMD_##_t))
enum { enum {
MCU_EXT_CMD_EFUSE_ACCESS = 0x01, MCU_EXT_CMD_EFUSE_ACCESS = 0x01,
...@@ -563,12 +566,12 @@ enum { ...@@ -563,12 +566,12 @@ enum {
}; };
enum { enum {
MCU_UNI_CMD_DEV_INFO_UPDATE = MCU_UNI_PREFIX | 0x01, MCU_UNI_CMD_DEV_INFO_UPDATE = 0x01,
MCU_UNI_CMD_BSS_INFO_UPDATE = MCU_UNI_PREFIX | 0x02, MCU_UNI_CMD_BSS_INFO_UPDATE = 0x02,
MCU_UNI_CMD_STA_REC_UPDATE = MCU_UNI_PREFIX | 0x03, MCU_UNI_CMD_STA_REC_UPDATE = 0x03,
MCU_UNI_CMD_SUSPEND = MCU_UNI_PREFIX | 0x05, MCU_UNI_CMD_SUSPEND = 0x05,
MCU_UNI_CMD_OFFLOAD = MCU_UNI_PREFIX | 0x06, MCU_UNI_CMD_OFFLOAD = 0x06,
MCU_UNI_CMD_HIF_CTRL = MCU_UNI_PREFIX | 0x07, MCU_UNI_CMD_HIF_CTRL = 0x07,
}; };
enum { enum {
......
...@@ -1332,7 +1332,7 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, ...@@ -1332,7 +1332,7 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,
clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid,
MCU_UNI_CMD_STA_REC_UPDATE); MCU_UNI_CMD(STA_REC_UPDATE));
} }
static int mt7921_set_sar_specs(struct ieee80211_hw *hw, static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
......
...@@ -187,12 +187,12 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd, ...@@ -187,12 +187,12 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
ret = le32_to_cpu(*(__le32 *)skb->data); ret = le32_to_cpu(*(__le32 *)skb->data);
} else if (cmd == MCU_EXT_CMD(EFUSE_ACCESS)) { } else if (cmd == MCU_EXT_CMD(EFUSE_ACCESS)) {
ret = mt7921_mcu_parse_eeprom(mdev, skb); ret = mt7921_mcu_parse_eeprom(mdev, skb);
} else if (cmd == MCU_UNI_CMD_DEV_INFO_UPDATE || } else if (cmd == MCU_UNI_CMD(DEV_INFO_UPDATE) ||
cmd == MCU_UNI_CMD_BSS_INFO_UPDATE || cmd == MCU_UNI_CMD(BSS_INFO_UPDATE) ||
cmd == MCU_UNI_CMD_STA_REC_UPDATE || cmd == MCU_UNI_CMD(STA_REC_UPDATE) ||
cmd == MCU_UNI_CMD_HIF_CTRL || cmd == MCU_UNI_CMD(HIF_CTRL) ||
cmd == MCU_UNI_CMD_OFFLOAD || cmd == MCU_UNI_CMD(OFFLOAD) ||
cmd == MCU_UNI_CMD_SUSPEND) { cmd == MCU_UNI_CMD(SUSPEND)) {
struct mt7921_mcu_uni_event *event; struct mt7921_mcu_uni_event *event;
skb_pull(skb, sizeof(*rxd)); skb_pull(skb, sizeof(*rxd));
...@@ -226,16 +226,12 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -226,16 +226,12 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
u32 val; u32 val;
u8 seq; u8 seq;
switch (cmd) { if (cmd == MCU_UNI_CMD(HIF_CTRL) ||
case MCU_UNI_CMD_HIF_CTRL: cmd == MCU_UNI_CMD(SUSPEND) ||
case MCU_UNI_CMD_SUSPEND: cmd == MCU_UNI_CMD(OFFLOAD))
case MCU_UNI_CMD_OFFLOAD:
mdev->mcu.timeout = HZ / 3; mdev->mcu.timeout = HZ / 3;
break; else
default:
mdev->mcu.timeout = 3 * HZ; mdev->mcu.timeout = 3 * HZ;
break;
}
seq = ++dev->mt76.mcu.msg_seq & 0xf; seq = ++dev->mt76.mcu.msg_seq & 0xf;
if (!seq) if (!seq)
...@@ -244,7 +240,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -244,7 +240,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
if (cmd == MCU_CMD_FW_SCATTER) if (cmd == MCU_CMD_FW_SCATTER)
goto exit; goto exit;
txd_len = cmd & MCU_UNI_PREFIX ? sizeof(*uni_txd) : sizeof(*mcu_txd); txd_len = cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_txd);
txd = (__le32 *)skb_push(skb, txd_len); txd = (__le32 *)skb_push(skb, txd_len);
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len) | val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len) |
...@@ -256,7 +252,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -256,7 +252,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_CMD); FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_CMD);
txd[1] = cpu_to_le32(val); txd[1] = cpu_to_le32(val);
if (cmd & MCU_UNI_PREFIX) { if (cmd & __MCU_CMD_FIELD_UNI) {
uni_txd = (struct mt7921_uni_txd *)txd; uni_txd = (struct mt7921_uni_txd *)txd;
uni_txd->len = cpu_to_le16(skb->len - sizeof(uni_txd->txd)); uni_txd->len = cpu_to_le16(skb->len - sizeof(uni_txd->txd));
uni_txd->option = MCU_CMD_UNI_EXT_ACK; uni_txd->option = MCU_CMD_UNI_EXT_ACK;
...@@ -558,7 +554,7 @@ int mt7921_mcu_add_key(struct mt7921_dev *dev, struct ieee80211_vif *vif, ...@@ -558,7 +554,7 @@ int mt7921_mcu_add_key(struct mt7921_dev *dev, struct ieee80211_vif *vif,
return ret; return ret;
return mt76_mcu_skb_send_msg(&dev->mt76, skb, return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD_STA_REC_UPDATE, true); MCU_UNI_CMD(STA_REC_UPDATE), true);
} }
int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev, int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev,
...@@ -1157,7 +1153,7 @@ int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif) ...@@ -1157,7 +1153,7 @@ int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif)
if (vif->type != NL80211_IFTYPE_STATION) if (vif->type != NL80211_IFTYPE_STATION)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE),
&ps_req, sizeof(ps_req), true); &ps_req, sizeof(ps_req), true);
} }
...@@ -1193,7 +1189,7 @@ mt7921_mcu_uni_bss_bcnft(struct mt7921_dev *dev, struct ieee80211_vif *vif, ...@@ -1193,7 +1189,7 @@ mt7921_mcu_uni_bss_bcnft(struct mt7921_dev *dev, struct ieee80211_vif *vif,
if (vif->type != NL80211_IFTYPE_STATION) if (vif->type != NL80211_IFTYPE_STATION)
return 0; return 0;
return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(BSS_INFO_UPDATE),
&bcnft_req, sizeof(bcnft_req), true); &bcnft_req, sizeof(bcnft_req), true);
} }
...@@ -1248,7 +1244,7 @@ int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta, ...@@ -1248,7 +1244,7 @@ int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
.sta = sta, .sta = sta,
.vif = vif, .vif = vif,
.enable = enable, .enable = enable,
.cmd = MCU_UNI_CMD_STA_REC_UPDATE, .cmd = MCU_UNI_CMD(STA_REC_UPDATE),
.state = state, .state = state,
.offload_fw = true, .offload_fw = true,
.rcpi = to_rcpi(rssi), .rcpi = to_rcpi(rssi),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment