mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
move wcid and txq struct to mt76.h in preparation for making tx scheduling code more generic
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -86,6 +86,27 @@ struct mt76_queue_ops {
|
||||
void (*kick)(struct mt76_dev *dev, struct mt76_queue *q);
|
||||
};
|
||||
|
||||
struct mt76_wcid {
|
||||
u8 idx;
|
||||
u8 hw_key_idx;
|
||||
|
||||
__le16 tx_rate;
|
||||
bool tx_rate_set;
|
||||
u8 tx_rate_nss;
|
||||
};
|
||||
|
||||
struct mt76_txq {
|
||||
struct list_head list;
|
||||
struct mt76_queue *hwq;
|
||||
struct mt76_wcid *wcid;
|
||||
|
||||
struct sk_buff_head retry_q;
|
||||
|
||||
u16 agg_ssn;
|
||||
bool send_bar;
|
||||
bool aggr;
|
||||
};
|
||||
|
||||
enum {
|
||||
MT76_STATE_INITIALIZED,
|
||||
MT76_STATE_RUNNING,
|
||||
|
||||
@@ -84,15 +84,6 @@ struct mt76x2_calibration {
|
||||
bool channel_cal_done;
|
||||
};
|
||||
|
||||
struct mt76x2_wcid {
|
||||
u8 idx;
|
||||
u8 hw_key_idx;
|
||||
|
||||
__le16 tx_rate;
|
||||
bool tx_rate_set;
|
||||
u8 tx_rate_nss;
|
||||
};
|
||||
|
||||
struct mt76x2_rate_power {
|
||||
union {
|
||||
struct {
|
||||
@@ -139,7 +130,7 @@ struct mt76x2_dev {
|
||||
|
||||
u32 aggr_stats[32];
|
||||
|
||||
struct mt76x2_wcid __rcu *wcid[254 - 8];
|
||||
struct mt76_wcid __rcu *wcid[254 - 8];
|
||||
|
||||
spinlock_t lock;
|
||||
spinlock_t irq_lock;
|
||||
@@ -168,28 +159,17 @@ struct mt76x2_dev {
|
||||
struct mt76x2_vif {
|
||||
u8 idx;
|
||||
|
||||
struct mt76x2_wcid group_wcid;
|
||||
struct mt76_wcid group_wcid;
|
||||
};
|
||||
|
||||
struct mt76x2_sta {
|
||||
struct mt76x2_wcid wcid;
|
||||
struct mt76_wcid wcid;
|
||||
|
||||
struct mt76x2_tx_status status;
|
||||
int n_frames;
|
||||
bool sleeping;
|
||||
};
|
||||
|
||||
struct mt76x2_txq {
|
||||
struct list_head list;
|
||||
struct mt76_queue *hwq;
|
||||
|
||||
struct sk_buff_head retry_q;
|
||||
|
||||
u16 agg_ssn;
|
||||
bool send_bar;
|
||||
bool aggr;
|
||||
};
|
||||
|
||||
struct mt76x2_reg_pair {
|
||||
u32 reg;
|
||||
u32 value;
|
||||
@@ -216,7 +196,7 @@ static inline void mt76x2_irq_disable(struct mt76x2_dev *dev, u32 mask)
|
||||
}
|
||||
|
||||
static inline struct ieee80211_txq *
|
||||
mtxq_to_txq(struct mt76x2_txq *mtxq)
|
||||
mtxq_to_txq(struct mt76_txq *mtxq)
|
||||
{
|
||||
void *ptr = mtxq;
|
||||
return container_of(ptr, struct ieee80211_txq, drv_priv);
|
||||
@@ -258,7 +238,7 @@ void mt76x2_cleanup(struct mt76x2_dev *dev);
|
||||
void mt76x2_rx(struct mt76x2_dev *dev, struct sk_buff *skb);
|
||||
|
||||
int mt76x2_tx_queue_skb(struct mt76x2_dev *dev, struct mt76_queue *q,
|
||||
struct sk_buff *skb, struct mt76x2_wcid *wcid,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta);
|
||||
int mt76x2_tx_queue_mcu(struct mt76x2_dev *dev, enum mt76x2_txq_id qid,
|
||||
struct sk_buff *skb, int cmd, int seq);
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ mt76x2_tx_queue_mcu(struct mt76x2_dev *dev, enum mt76x2_txq_id qid,
|
||||
|
||||
int
|
||||
mt76x2_tx_queue_skb(struct mt76x2_dev *dev, struct mt76_queue *q,
|
||||
struct sk_buff *skb, struct mt76x2_wcid *wcid,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
+1
-1
@@ -633,7 +633,7 @@ int mt76x2_register_device(struct mt76x2_dev *dev)
|
||||
|
||||
hw->sta_data_size = sizeof(struct mt76x2_sta);
|
||||
hw->vif_data_size = sizeof(struct mt76x2_vif);
|
||||
hw->txq_data_size = sizeof(struct mt76x2_txq);
|
||||
hw->txq_data_size = sizeof(struct mt76_txq);
|
||||
|
||||
dev->macaddr[0] &= ~BIT(1);
|
||||
SET_IEEE80211_PERM_ADDR(hw, dev->macaddr);
|
||||
|
||||
+4
-4
@@ -142,7 +142,7 @@ mt76x2_mac_tx_rate_val(struct mt76x2_dev *dev, const struct ieee80211_tx_rate *r
|
||||
return cpu_to_le16(rateval);
|
||||
}
|
||||
|
||||
void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76x2_wcid *wcid,
|
||||
void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76_wcid *wcid,
|
||||
const struct ieee80211_tx_rate *rate)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -154,7 +154,7 @@ void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76x2_wcid *wcid,
|
||||
}
|
||||
|
||||
void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76_txwi *txwi,
|
||||
struct sk_buff *skb, struct mt76x2_wcid *wcid,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
@@ -349,7 +349,7 @@ mt76x2_send_tx_status(struct mt76x2_dev *dev, struct mt76x2_tx_status *stat,
|
||||
{
|
||||
struct ieee80211_tx_info info = {};
|
||||
struct ieee80211_sta *sta = NULL;
|
||||
struct mt76x2_wcid *wcid = NULL;
|
||||
struct mt76_wcid *wcid = NULL;
|
||||
struct mt76x2_sta *msta = NULL;
|
||||
|
||||
rcu_read_lock();
|
||||
@@ -492,7 +492,7 @@ mt76x2_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data)
|
||||
|
||||
void mt76x2_mac_wcid_setup(struct mt76x2_dev *dev, u8 idx, u8 vif_idx, u8 *mac)
|
||||
{
|
||||
struct mt76x2_wcid_addr addr = {};
|
||||
struct mt76_wcid_addr addr = {};
|
||||
u32 attr;
|
||||
|
||||
attr = MT76_SET(MT_WCID_ATTR_BSS_IDX, vif_idx & 7) |
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
struct mt76x2_dev;
|
||||
struct mt76x2_sta;
|
||||
struct mt76x2_vif;
|
||||
struct mt76x2_wcid;
|
||||
struct mt76_wcid;
|
||||
|
||||
struct mt76_txwi;
|
||||
struct mt76_queue;
|
||||
@@ -162,12 +162,12 @@ void mt76x2_mac_set_bssid(struct mt76x2_dev *dev, u8 idx, const u8 *addr);
|
||||
|
||||
int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb, void *rxwi);
|
||||
void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76_txwi *txwi,
|
||||
struct sk_buff *skb, struct mt76x2_wcid *wcid,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta);
|
||||
void mt76x2_mac_wcid_setup(struct mt76x2_dev *dev, u8 idx, u8 vif_idx, u8 *mac);
|
||||
int mt76x2_mac_wcid_set_key(struct mt76x2_dev *dev, u8 idx,
|
||||
struct ieee80211_key_conf *key);
|
||||
void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76x2_wcid *wcid,
|
||||
void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76_wcid *wcid,
|
||||
const struct ieee80211_tx_rate *rate);
|
||||
|
||||
int mt76x2_mac_shared_key_setup(struct mt76x2_dev *dev, u8 vif_idx, u8 key_idx,
|
||||
|
||||
+4
-4
@@ -189,7 +189,7 @@ mt76x2_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
}
|
||||
|
||||
static int
|
||||
mt76x2_wcid_alloc(struct mt76x2_dev *dev)
|
||||
mt76_wcid_alloc(struct mt76x2_dev *dev)
|
||||
{
|
||||
int i, idx = 0;
|
||||
|
||||
@@ -223,7 +223,7 @@ mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
idx = mt76x2_wcid_alloc(dev);
|
||||
idx = mt76_wcid_alloc(dev);
|
||||
if (idx < 0) {
|
||||
ret = -ENOSPC;
|
||||
goto out;
|
||||
@@ -294,7 +294,7 @@ mt76x2_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
||||
struct mt76x2_dev *dev = hw->priv;
|
||||
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
|
||||
struct mt76x2_sta *msta = sta ? (struct mt76x2_sta *) sta->drv_priv : NULL;
|
||||
struct mt76x2_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid;
|
||||
struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid;
|
||||
int idx = key->keyidx;
|
||||
int ret;
|
||||
|
||||
@@ -405,7 +405,7 @@ mt76x2_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
struct mt76x2_dev *dev = hw->priv;
|
||||
struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
|
||||
struct ieee80211_txq *txq = sta->txq[tid];
|
||||
struct mt76x2_txq *mtxq = (struct mt76x2_txq *) txq->drv_priv;
|
||||
struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
|
||||
|
||||
if (!txq)
|
||||
return -EINVAL;
|
||||
|
||||
+2
-2
@@ -505,12 +505,12 @@
|
||||
#define MT_TEMP_SENSOR 0x1d000
|
||||
#define MT_TEMP_SENSOR_VAL GENMASK(6, 0)
|
||||
|
||||
struct mt76x2_wcid_addr {
|
||||
struct mt76_wcid_addr {
|
||||
u8 macaddr[6];
|
||||
__le16 ba_mask;
|
||||
} __packed __aligned(4);
|
||||
|
||||
struct mt76x2_wcid_key {
|
||||
struct mt76_wcid_key {
|
||||
u8 key[16];
|
||||
u8 tx_mic[8];
|
||||
u8 rx_mic[8];
|
||||
|
||||
+24
-24
@@ -27,7 +27,7 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
|
||||
struct ieee80211_vif *vif = info->control.vif;
|
||||
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
|
||||
struct mt76x2_sta *msta = NULL;
|
||||
struct mt76x2_wcid *wcid = &mvif->group_wcid;
|
||||
struct mt76_wcid *wcid = &mvif->group_wcid;
|
||||
struct mt76_queue *q;
|
||||
int qid = skb_get_queue_mapping(skb);
|
||||
|
||||
@@ -184,7 +184,7 @@ mt76x2_txq_get_qid(struct ieee80211_txq *txq)
|
||||
}
|
||||
|
||||
static struct sk_buff *
|
||||
mt76x2_txq_dequeue(struct mt76x2_dev *dev, struct mt76x2_txq *mtxq, bool ps)
|
||||
mt76x2_txq_dequeue(struct mt76x2_dev *dev, struct mt76_txq *mtxq, bool ps)
|
||||
{
|
||||
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
|
||||
struct sk_buff *skb;
|
||||
@@ -207,7 +207,7 @@ mt76x2_txq_dequeue(struct mt76x2_dev *dev, struct mt76x2_txq *mtxq, bool ps)
|
||||
}
|
||||
|
||||
static void
|
||||
mt76x2_check_agg_ssn(struct mt76x2_txq *mtxq, struct sk_buff *skb)
|
||||
mt76x2_check_agg_ssn(struct mt76_txq *mtxq, struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
|
||||
@@ -224,7 +224,7 @@ mt76x2_queue_ps_skb(struct mt76x2_dev *dev, struct ieee80211_sta *sta,
|
||||
struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct mt76_queue *hwq = &dev->q_tx[MT_TXQ_PSD];
|
||||
struct mt76x2_wcid *wcid = &msta->wcid;
|
||||
struct mt76_wcid *wcid = &msta->wcid;
|
||||
|
||||
info->control.flags |= IEEE80211_TX_CTRL_PS_RESPONSE;
|
||||
if (last)
|
||||
@@ -247,7 +247,7 @@ mt76x2_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *st
|
||||
|
||||
for (i = 0; tids && nframes; i++, tids >>= 1) {
|
||||
struct ieee80211_txq *txq = sta->txq[i];
|
||||
struct mt76x2_txq *mtxq = (struct mt76x2_txq *) txq->drv_priv;
|
||||
struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (!(tids & 1))
|
||||
@@ -278,11 +278,11 @@ mt76x2_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *st
|
||||
|
||||
static int
|
||||
mt76x2_txq_send_burst(struct mt76x2_dev *dev, struct mt76_queue *hwq,
|
||||
struct mt76x2_txq *mtxq, bool *empty)
|
||||
struct mt76_txq *mtxq, bool *empty)
|
||||
{
|
||||
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
|
||||
struct ieee80211_tx_info *info;
|
||||
struct mt76x2_wcid *wcid;
|
||||
struct mt76_wcid *wcid = mtxq->wcid;
|
||||
struct sk_buff *skb = NULL;
|
||||
int n_frames = 1, limit;
|
||||
struct ieee80211_tx_rate tx_rate;
|
||||
@@ -290,14 +290,6 @@ mt76x2_txq_send_burst(struct mt76x2_dev *dev, struct mt76_queue *hwq,
|
||||
bool probe;
|
||||
int idx;
|
||||
|
||||
if (txq->sta) {
|
||||
struct mt76x2_sta *sta = (struct mt76x2_sta *) txq->sta->drv_priv;
|
||||
wcid = &sta->wcid;
|
||||
} else {
|
||||
struct mt76x2_vif *mvif = (struct mt76x2_vif *) txq->vif->drv_priv;
|
||||
wcid = &mvif->group_wcid;
|
||||
}
|
||||
|
||||
skb = mt76x2_txq_dequeue(dev, mtxq, false);
|
||||
if (!skb) {
|
||||
*empty = true;
|
||||
@@ -368,16 +360,16 @@ mt76x2_txq_send_burst(struct mt76x2_dev *dev, struct mt76_queue *hwq,
|
||||
static int
|
||||
mt76x2_txq_schedule_list(struct mt76x2_dev *dev, struct mt76_queue *hwq)
|
||||
{
|
||||
struct mt76x2_txq *mtxq, *mtxq_last;
|
||||
struct mt76_txq *mtxq, *mtxq_last;
|
||||
int len = 0;
|
||||
|
||||
restart:
|
||||
mtxq_last = list_last_entry(&hwq->swq, struct mt76x2_txq, list);
|
||||
mtxq_last = list_last_entry(&hwq->swq, struct mt76_txq, list);
|
||||
while (!list_empty(&hwq->swq)) {
|
||||
bool empty = false;
|
||||
int cur;
|
||||
|
||||
mtxq = list_first_entry(&hwq->swq, struct mt76x2_txq, list);
|
||||
mtxq = list_first_entry(&hwq->swq, struct mt76_txq, list);
|
||||
if (mtxq->send_bar && mtxq->aggr) {
|
||||
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
|
||||
struct ieee80211_sta *sta = txq->sta;
|
||||
@@ -424,16 +416,24 @@ void mt76x2_txq_schedule(struct mt76x2_dev *dev, struct mt76_queue *hwq)
|
||||
|
||||
void mt76x2_txq_init(struct mt76x2_dev *dev, struct ieee80211_txq *txq)
|
||||
{
|
||||
struct mt76x2_txq *mtxq;
|
||||
struct mt76_txq *mtxq;
|
||||
|
||||
if (!txq)
|
||||
return;
|
||||
|
||||
mtxq = (struct mt76x2_txq *) txq->drv_priv;
|
||||
mtxq = (struct mt76_txq *) txq->drv_priv;
|
||||
INIT_LIST_HEAD(&mtxq->list);
|
||||
skb_queue_head_init(&mtxq->retry_q);
|
||||
|
||||
mtxq->hwq = &dev->q_tx[mt76x2_txq_get_qid(txq)];
|
||||
|
||||
if (txq->sta) {
|
||||
struct mt76x2_sta *sta = (struct mt76x2_sta *) txq->sta->drv_priv;
|
||||
mtxq->wcid = &sta->wcid;
|
||||
} else {
|
||||
struct mt76x2_vif *mvif = (struct mt76x2_vif *) txq->vif->drv_priv;
|
||||
mtxq->wcid = &mvif->group_wcid;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -443,7 +443,7 @@ mt76x2_stop_tx_queues(struct mt76x2_dev *dev, struct ieee80211_sta *sta)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
|
||||
struct ieee80211_txq *txq = sta->txq[i];
|
||||
struct mt76x2_txq *mtxq = (struct mt76x2_txq *) txq->drv_priv;
|
||||
struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
|
||||
|
||||
spin_lock_bh(&mtxq->hwq->lock);
|
||||
mtxq->send_bar = mtxq->aggr;
|
||||
@@ -456,7 +456,7 @@ mt76x2_stop_tx_queues(struct mt76x2_dev *dev, struct ieee80211_sta *sta)
|
||||
void mt76x2_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
|
||||
{
|
||||
struct mt76x2_dev *dev = hw->priv;
|
||||
struct mt76x2_txq *mtxq = (struct mt76x2_txq *) txq->drv_priv;
|
||||
struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
|
||||
struct mt76_queue *hwq = mtxq->hwq;
|
||||
|
||||
spin_lock_bh(&hwq->lock);
|
||||
@@ -468,14 +468,14 @@ void mt76x2_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
|
||||
|
||||
void mt76x2_txq_remove(struct mt76x2_dev *dev, struct ieee80211_txq *txq)
|
||||
{
|
||||
struct mt76x2_txq *mtxq;
|
||||
struct mt76_txq *mtxq;
|
||||
struct mt76_queue *hwq;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (!txq)
|
||||
return;
|
||||
|
||||
mtxq = (struct mt76x2_txq *) txq->drv_priv;
|
||||
mtxq = (struct mt76_txq *) txq->drv_priv;
|
||||
hwq = mtxq->hwq;
|
||||
|
||||
spin_lock_bh(&hwq->lock);
|
||||
|
||||
Reference in New Issue
Block a user