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

mt76: mt76_connac: move pm data struct in mt76_connac.h

Move pm mt7663 data structure in mt76_connac.h introducing
mt76_connac_pm data struct. This is a preliminary patch to share pm code
between mt7663 and mt7921
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 55d4c19c
...@@ -1875,16 +1875,14 @@ void mt7615_pm_wake_work(struct work_struct *work) ...@@ -1875,16 +1875,14 @@ void mt7615_pm_wake_work(struct work_struct *work)
spin_lock_bh(&dev->pm.txq_lock); spin_lock_bh(&dev->pm.txq_lock);
for (i = 0; i < IEEE80211_NUM_ACS; i++) { for (i = 0; i < IEEE80211_NUM_ACS; i++) {
struct mt7615_sta *msta = dev->pm.tx_q[i].msta; struct mt76_wcid *wcid = dev->pm.tx_q[i].wcid;
struct ieee80211_sta *sta = NULL; struct ieee80211_sta *sta = NULL;
struct mt76_wcid *wcid;
if (!dev->pm.tx_q[i].skb) if (!dev->pm.tx_q[i].skb)
continue; continue;
wcid = msta ? &msta->wcid : &dev->mt76.global_wcid; if (wcid && wcid->sta)
if (msta && wcid->sta) sta = container_of((void *)wcid, struct ieee80211_sta,
sta = container_of((void *)msta, struct ieee80211_sta,
drv_priv); drv_priv);
mt76_tx(mphy, sta, wcid, dev->pm.tx_q[i].skb); mt76_tx(mphy, sta, wcid, dev->pm.tx_q[i].skb);
......
...@@ -31,7 +31,7 @@ static void mt7615_free_pending_tx_skbs(struct mt7615_dev *dev, ...@@ -31,7 +31,7 @@ static void mt7615_free_pending_tx_skbs(struct mt7615_dev *dev,
spin_lock_bh(&dev->pm.txq_lock); spin_lock_bh(&dev->pm.txq_lock);
for (i = 0; i < IEEE80211_NUM_ACS; i++) { for (i = 0; i < IEEE80211_NUM_ACS; i++) {
if (msta && dev->pm.tx_q[i].msta != msta) if (msta && dev->pm.tx_q[i].wcid != &msta->wcid)
continue; continue;
dev_kfree_skb(dev->pm.tx_q[i].skb); dev_kfree_skb(dev->pm.tx_q[i].skb);
...@@ -726,7 +726,7 @@ static void mt7615_tx(struct ieee80211_hw *hw, ...@@ -726,7 +726,7 @@ static void mt7615_tx(struct ieee80211_hw *hw,
spin_lock_bh(&dev->pm.txq_lock); spin_lock_bh(&dev->pm.txq_lock);
if (!dev->pm.tx_q[qid].skb) { if (!dev->pm.tx_q[qid].skb) {
ieee80211_stop_queues(hw); ieee80211_stop_queues(hw);
dev->pm.tx_q[qid].msta = msta; dev->pm.tx_q[qid].wcid = wcid;
dev->pm.tx_q[qid].skb = skb; dev->pm.tx_q[qid].skb = skb;
queue_work(dev->mt76.wq, &dev->pm.wake_work); queue_work(dev->mt76.wq, &dev->pm.wake_work);
} else { } else {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include "../mt76.h" #include "../mt76_connac.h"
#include "regs.h" #include "regs.h"
#define MT7615_MAX_INTERFACES 16 #define MT7615_MAX_INTERFACES 16
...@@ -276,22 +276,7 @@ struct mt7615_dev { ...@@ -276,22 +276,7 @@ struct mt7615_dev {
u32 muar_mask; u32 muar_mask;
struct { struct mt76_connac_pm pm;
bool enable;
spinlock_t txq_lock;
struct {
struct mt7615_sta *msta;
struct sk_buff *skb;
} tx_q[IEEE80211_NUM_ACS];
struct work_struct wake_work;
struct completion wake_cmpl;
struct delayed_work ps_work;
unsigned long last_activity;
unsigned long idle_timeout;
} pm;
}; };
enum tx_pkt_queue_idx { enum tx_pkt_queue_idx {
......
/* SPDX-License-Identifier: ISC */
/* Copyright (C) 2020 MediaTek Inc. */
#ifndef __MT76_CONNAC_H
#define __MT76_CONNAC_H
#include "mt76.h"
#define MT76_CONNAC_SCAN_IE_LEN 600
#define MT76_CONNAC_MAX_SCHED_SCAN_INTERVAL 10
#define MT76_CONNAC_MAX_SCHED_SCAN_SSID 10
#define MT76_CONNAC_MAX_SCAN_MATCH 16
enum {
CMD_CBW_20MHZ = IEEE80211_STA_RX_BW_20,
CMD_CBW_40MHZ = IEEE80211_STA_RX_BW_40,
CMD_CBW_80MHZ = IEEE80211_STA_RX_BW_80,
CMD_CBW_160MHZ = IEEE80211_STA_RX_BW_160,
CMD_CBW_10MHZ,
CMD_CBW_5MHZ,
CMD_CBW_8080MHZ,
CMD_HE_MCS_BW80 = 0,
CMD_HE_MCS_BW160,
CMD_HE_MCS_BW8080,
CMD_HE_MCS_BW_NUM
};
enum {
HW_BSSID_0 = 0x0,
HW_BSSID_1,
HW_BSSID_2,
HW_BSSID_3,
HW_BSSID_MAX = HW_BSSID_3,
EXT_BSSID_START = 0x10,
EXT_BSSID_1,
EXT_BSSID_15 = 0x1f,
EXT_BSSID_MAX = EXT_BSSID_15,
REPEATER_BSSID_START = 0x20,
REPEATER_BSSID_MAX = 0x3f,
};
struct mt76_connac_pm {
bool enable;
spinlock_t txq_lock;
struct {
struct mt76_wcid *wcid;
struct sk_buff *skb;
} tx_q[IEEE80211_NUM_ACS];
struct work_struct wake_work;
struct completion wake_cmpl;
struct delayed_work ps_work;
unsigned long last_activity;
unsigned long idle_timeout;
};
extern const struct wiphy_wowlan_support mt76_connac_wowlan_support;
#endif /* __MT76_CONNAC_H */
...@@ -4,41 +4,7 @@ ...@@ -4,41 +4,7 @@
#ifndef __MT76_CONNAC_MCU_H #ifndef __MT76_CONNAC_MCU_H
#define __MT76_CONNAC_MCU_H #define __MT76_CONNAC_MCU_H
#include "mt76.h" #include "mt76_connac.h"
#define MT76_CONNAC_SCAN_IE_LEN 600
#define MT76_CONNAC_MAX_SCHED_SCAN_INTERVAL 10
#define MT76_CONNAC_MAX_SCHED_SCAN_SSID 10
#define MT76_CONNAC_MAX_SCAN_MATCH 16
enum {
CMD_CBW_20MHZ = IEEE80211_STA_RX_BW_20,
CMD_CBW_40MHZ = IEEE80211_STA_RX_BW_40,
CMD_CBW_80MHZ = IEEE80211_STA_RX_BW_80,
CMD_CBW_160MHZ = IEEE80211_STA_RX_BW_160,
CMD_CBW_10MHZ,
CMD_CBW_5MHZ,
CMD_CBW_8080MHZ,
CMD_HE_MCS_BW80 = 0,
CMD_HE_MCS_BW160,
CMD_HE_MCS_BW8080,
CMD_HE_MCS_BW_NUM
};
enum {
HW_BSSID_0 = 0x0,
HW_BSSID_1,
HW_BSSID_2,
HW_BSSID_3,
HW_BSSID_MAX = HW_BSSID_3,
EXT_BSSID_START = 0x10,
EXT_BSSID_1,
EXT_BSSID_15 = 0x1f,
EXT_BSSID_MAX = EXT_BSSID_15,
REPEATER_BSSID_START = 0x20,
REPEATER_BSSID_MAX = 0x3f,
};
struct tlv { struct tlv {
__le16 tag; __le16 tag;
...@@ -905,8 +871,6 @@ struct mt76_connac_suspend_tlv { ...@@ -905,8 +871,6 @@ struct mt76_connac_suspend_tlv {
u8 pad[5]; u8 pad[5];
} __packed; } __packed;
extern const struct wiphy_wowlan_support mt76_connac_wowlan_support;
struct sk_buff * struct sk_buff *
mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif, mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif,
struct mt76_wcid *wcid); struct mt76_wcid *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