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

mt7615: mcu: unify __mt7615_mcu_set_dev_info and mt7615_mcu_set_dev_info

Unify mt7615_mcu_set_dev_info and __mt7615_mcu_set_dev_info since the
latter is run just by mt7615_mcu_set_dev_info
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 893369b7
...@@ -633,68 +633,49 @@ int mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int enter) ...@@ -633,68 +633,49 @@ int mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int enter)
return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_PM_STATE_CTRL); return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_PM_STATE_CTRL);
} }
static int __mt7615_mcu_set_dev_info(struct mt7615_dev *dev, int mt7615_mcu_set_dev_info(struct mt7615_dev *dev,
struct dev_info *dev_info) struct ieee80211_vif *vif, bool enable)
{ {
struct req_hdr { struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
u8 omac_idx; struct {
u8 band_idx; struct req_hdr {
__le16 tlv_num; u8 omac_idx;
u8 is_tlv_append; u8 band_idx;
u8 rsv[3]; __le16 tlv_num;
} __packed req_hdr = {0}; u8 is_tlv_append;
struct req_tlv { u8 rsv[3];
__le16 tag; } __packed hdr;
__le16 len; struct req_tlv {
u8 active; __le16 tag;
u8 band_idx; __le16 len;
u8 omac_addr[ETH_ALEN]; u8 active;
} __packed; u8 band_idx;
struct sk_buff *skb; u8 omac_addr[ETH_ALEN];
u16 tlv_num = 0; } __packed tlv;
} data = {
skb = mt7615_mcu_msg_alloc(NULL, sizeof(req_hdr) + .hdr = {
sizeof(struct req_tlv)); .omac_idx = mvif->omac_idx,
skb_reserve(skb, sizeof(req_hdr)); .band_idx = mvif->band_idx,
.tlv_num = cpu_to_le16(1),
if (dev_info->feature & BIT(DEV_INFO_ACTIVE)) { .is_tlv_append = 1,
struct req_tlv req_tlv = { },
.tlv = {
.tag = cpu_to_le16(DEV_INFO_ACTIVE), .tag = cpu_to_le16(DEV_INFO_ACTIVE),
.len = cpu_to_le16(sizeof(req_tlv)), .len = cpu_to_le16(sizeof(struct req_tlv)),
.active = dev_info->enable, .active = enable,
.band_idx = dev_info->band_idx, .band_idx = mvif->band_idx,
}; },
memcpy(req_tlv.omac_addr, dev_info->omac_addr, ETH_ALEN); };
memcpy(skb_put(skb, sizeof(req_tlv)), &req_tlv, struct sk_buff *skb;
sizeof(req_tlv));
tlv_num++;
}
req_hdr.omac_idx = dev_info->omac_idx;
req_hdr.band_idx = dev_info->band_idx;
req_hdr.tlv_num = cpu_to_le16(tlv_num);
req_hdr.is_tlv_append = tlv_num ? 1 : 0;
memcpy(skb_push(skb, sizeof(req_hdr)), &req_hdr, sizeof(req_hdr)); memcpy(data.tlv.omac_addr, vif->addr, ETH_ALEN);
skb = mt7615_mcu_msg_alloc(&data, sizeof(data));
if (!skb)
return -ENOMEM;
return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_DEV_INFO_UPDATE); return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_DEV_INFO_UPDATE);
} }
int mt7615_mcu_set_dev_info(struct mt7615_dev *dev, struct ieee80211_vif *vif,
int en)
{
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
struct dev_info dev_info = {0};
dev_info.omac_idx = mvif->omac_idx;
memcpy(dev_info.omac_addr, vif->addr, ETH_ALEN);
dev_info.band_idx = mvif->band_idx;
dev_info.enable = en;
dev_info.feature = BIT(DEV_INFO_ACTIVE);
return __mt7615_mcu_set_dev_info(dev, &dev_info);
}
static void bss_info_omac_handler (struct mt7615_dev *dev, static void bss_info_omac_handler (struct mt7615_dev *dev,
struct bss_info *bss_info, struct bss_info *bss_info,
struct sk_buff *skb) struct sk_buff *skb)
......
...@@ -108,8 +108,8 @@ int mt7615_eeprom_init(struct mt7615_dev *dev); ...@@ -108,8 +108,8 @@ int mt7615_eeprom_init(struct mt7615_dev *dev);
int mt7615_dma_init(struct mt7615_dev *dev); int mt7615_dma_init(struct mt7615_dev *dev);
void mt7615_dma_cleanup(struct mt7615_dev *dev); void mt7615_dma_cleanup(struct mt7615_dev *dev);
int mt7615_mcu_init(struct mt7615_dev *dev); int mt7615_mcu_init(struct mt7615_dev *dev);
int mt7615_mcu_set_dev_info(struct mt7615_dev *dev, struct ieee80211_vif *vif, int mt7615_mcu_set_dev_info(struct mt7615_dev *dev,
int en); struct ieee80211_vif *vif, bool enable);
int mt7615_mcu_set_bss_info(struct mt7615_dev *dev, struct ieee80211_vif *vif, int mt7615_mcu_set_bss_info(struct mt7615_dev *dev, struct ieee80211_vif *vif,
int en); int en);
int mt7615_mcu_set_wtbl_key(struct mt7615_dev *dev, int wcid, int mt7615_mcu_set_wtbl_key(struct mt7615_dev *dev, int wcid,
......
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