Skip to content

Commit

Permalink
mt76: remove struct mt76_sw_queue
Browse files Browse the repository at this point in the history
All members except for the struct mt76_queue pointer have been removed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Aug 24, 2020
1 parent e861cb0 commit 3218b91
Show file tree
Hide file tree
Showing 22 changed files with 86 additions and 114 deletions.
2 changes: 1 addition & 1 deletion debugfs.c
Expand Up @@ -31,7 +31,7 @@ int mt76_queues_read(struct seq_file *s, void *data)
int i;

for (i = 0; i < ARRAY_SIZE(dev->q_tx); i++) {
struct mt76_queue *q = dev->q_tx[i].q;
struct mt76_queue *q = dev->q_tx[i];

if (!q)
continue;
Expand Down
7 changes: 3 additions & 4 deletions dma.c
Expand Up @@ -150,8 +150,7 @@ mt76_dma_kick_queue(struct mt76_dev *dev, struct mt76_queue *q)
static void
mt76_dma_tx_cleanup(struct mt76_dev *dev, enum mt76_txq_id qid, bool flush)
{
struct mt76_sw_queue *sq = &dev->q_tx[qid];
struct mt76_queue *q = sq->q;
struct mt76_queue *q = dev->q_tx[qid];
struct mt76_queue_entry entry;
bool wake = false;
int last;
Expand Down Expand Up @@ -249,7 +248,7 @@ static int
mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid,
struct sk_buff *skb, u32 tx_info)
{
struct mt76_queue *q = dev->q_tx[qid].q;
struct mt76_queue *q = dev->q_tx[qid];
struct mt76_queue_buf buf;
dma_addr_t addr;

Expand Down Expand Up @@ -281,7 +280,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
struct sk_buff *skb, struct mt76_wcid *wcid,
struct ieee80211_sta *sta)
{
struct mt76_queue *q = dev->q_tx[qid].q;
struct mt76_queue *q = dev->q_tx[qid];
struct mt76_tx_info tx_info = {
.skb = skb,
};
Expand Down
2 changes: 1 addition & 1 deletion mac80211.c
Expand Up @@ -552,7 +552,7 @@ bool mt76_has_tx_pending(struct mt76_phy *phy)
offset = __MT_TXQ_MAX * (phy != &dev->phy);

for (i = 0; i < __MT_TXQ_MAX; i++) {
q = dev->q_tx[offset + i].q;
q = dev->q_tx[offset + i];
if (q && q->queued)
return true;
}
Expand Down
8 changes: 2 additions & 6 deletions mt76.h
Expand Up @@ -139,10 +139,6 @@ struct mt76_queue {
struct page_frag_cache rx_page;
};

struct mt76_sw_queue {
struct mt76_queue *q;
};

struct mt76_mcu_ops {
u32 headroom;
u32 tailroom;
Expand Down Expand Up @@ -230,7 +226,7 @@ struct mt76_wcid {
};

struct mt76_txq {
struct mt76_sw_queue *swq;
struct mt76_queue *q;
struct mt76_wcid *wcid;

struct sk_buff_head retry_q;
Expand Down Expand Up @@ -606,7 +602,7 @@ struct mt76_dev {
struct sk_buff_head rx_skb[__MT_RXQ_MAX];

struct list_head txwi_cache;
struct mt76_sw_queue q_tx[2 * __MT_TXQ_MAX];
struct mt76_queue *q_tx[2 * __MT_TXQ_MAX];
struct mt76_queue q_rx[__MT_RXQ_MAX];
const struct mt76_queue_ops *queue_ops;
int tx_dma_idx[4];
Expand Down
8 changes: 4 additions & 4 deletions mt7603/beacon.c
Expand Up @@ -29,7 +29,7 @@ mt7603_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
mt76_wr(dev, MT_DMA_FQCR0, MT_DMA_FQCR0_BUSY |
FIELD_PREP(MT_DMA_FQCR0_TARGET_WCID, mvif->sta.wcid.idx) |
FIELD_PREP(MT_DMA_FQCR0_TARGET_QID,
dev->mt76.q_tx[MT_TXQ_CAB].q->hw_idx) |
dev->mt76.q_tx[MT_TXQ_CAB]->hw_idx) |
FIELD_PREP(MT_DMA_FQCR0_DEST_PORT_ID, 3) |
FIELD_PREP(MT_DMA_FQCR0_DEST_QUEUE_ID, 8));

Expand Down Expand Up @@ -78,7 +78,7 @@ void mt7603_pre_tbtt_tasklet(unsigned long arg)
data.dev = dev;
__skb_queue_head_init(&data.q);

q = dev->mt76.q_tx[MT_TXQ_BEACON].q;
q = dev->mt76.q_tx[MT_TXQ_BEACON];
spin_lock_bh(&q->lock);
ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
IEEE80211_IFACE_ITER_RESUME_ALL,
Expand All @@ -95,7 +95,7 @@ void mt7603_pre_tbtt_tasklet(unsigned long arg)
if (dev->mt76.csa_complete)
goto out;

q = dev->mt76.q_tx[MT_TXQ_CAB].q;
q = dev->mt76.q_tx[MT_TXQ_CAB];
do {
nframes = skb_queue_len(&data.q);
ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
Expand Down Expand Up @@ -136,7 +136,7 @@ void mt7603_pre_tbtt_tasklet(unsigned long arg)

out:
mt76_queue_tx_cleanup(dev, MT_TXQ_BEACON, false);
if (dev->mt76.q_tx[MT_TXQ_BEACON].q->queued >
if (dev->mt76.q_tx[MT_TXQ_BEACON]->queued >
hweight8(dev->mt76.beacon_mask))
dev->beacon_check++;
}
Expand Down
16 changes: 7 additions & 9 deletions mt7603/dma.c
Expand Up @@ -5,8 +5,7 @@
#include "../dma.h"

static int
mt7603_init_tx_queue(struct mt7603_dev *dev, struct mt76_sw_queue *q,
int idx, int n_desc)
mt7603_init_tx_queue(struct mt7603_dev *dev, int qid, int idx, int n_desc)
{
struct mt76_queue *hwq;
int err;
Expand All @@ -19,7 +18,7 @@ mt7603_init_tx_queue(struct mt7603_dev *dev, struct mt76_sw_queue *q,
if (err < 0)
return err;

q->q = hwq;
dev->mt76.q_tx[qid] = hwq;

mt7603_irq_enable(dev, MT_INT_TX_DONE(idx));

Expand Down Expand Up @@ -192,29 +191,28 @@ int mt7603_dma_init(struct mt7603_dev *dev)
mt7603_pse_client_reset(dev);

for (i = 0; i < ARRAY_SIZE(wmm_queue_map); i++) {
ret = mt7603_init_tx_queue(dev, &dev->mt76.q_tx[i],
wmm_queue_map[i],
ret = mt7603_init_tx_queue(dev, i, wmm_queue_map[i],
MT_TX_RING_SIZE);
if (ret)
return ret;
}

ret = mt7603_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_PSD],
ret = mt7603_init_tx_queue(dev, MT_TXQ_PSD,
MT_TX_HW_QUEUE_MGMT, MT_TX_RING_SIZE);
if (ret)
return ret;

ret = mt7603_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_MCU],
ret = mt7603_init_tx_queue(dev, MT_TXQ_MCU,
MT_TX_HW_QUEUE_MCU, MT_MCU_RING_SIZE);
if (ret)
return ret;

ret = mt7603_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_BEACON],
ret = mt7603_init_tx_queue(dev, MT_TXQ_BEACON,
MT_TX_HW_QUEUE_BCN, MT_MCU_RING_SIZE);
if (ret)
return ret;

ret = mt7603_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_CAB],
ret = mt7603_init_tx_queue(dev, MT_TXQ_CAB,
MT_TX_HW_QUEUE_BMC, MT_MCU_RING_SIZE);
if (ret)
return ret;
Expand Down
6 changes: 3 additions & 3 deletions mt7603/mac.c
Expand Up @@ -445,7 +445,7 @@ void mt7603_mac_sta_poll(struct mt7603_dev *dev)

sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
for (i = 0; i < 4; i++) {
struct mt76_queue *q = dev->mt76.q_tx[i].q;
struct mt76_queue *q = dev->mt76.q_tx[i];
u8 qidx = q->hw_idx;
u8 tid = ac_to_tid[i];
u32 txtime = airtime[qidx];
Expand Down Expand Up @@ -896,7 +896,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data;
struct ieee80211_vif *vif = info->control.vif;
struct mt76_queue *q = dev->mt76.q_tx[qid].q;
struct mt76_queue *q = dev->mt76.q_tx[qid];
struct mt7603_vif *mvif;
int wlan_idx;
int hdr_len = ieee80211_get_hdrlen_from_skb(skb);
Expand Down Expand Up @@ -1514,7 +1514,7 @@ static bool mt7603_tx_hang(struct mt7603_dev *dev)
int i;

for (i = 0; i < 4; i++) {
q = dev->mt76.q_tx[i].q;
q = dev->mt76.q_tx[i];

if (!q->queued)
continue;
Expand Down
2 changes: 1 addition & 1 deletion mt7603/main.c
Expand Up @@ -514,7 +514,7 @@ mt7603_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
u16 cw_max = (1 << 10) - 1;
u32 val;

queue = dev->mt76.q_tx[queue].q->hw_idx;
queue = dev->mt76.q_tx[queue]->hw_idx;

if (params->cw_min)
cw_min = params->cw_min;
Expand Down
8 changes: 4 additions & 4 deletions mt7615/debugfs.c
Expand Up @@ -339,15 +339,15 @@ mt7615_queues_read(struct seq_file *s, void *data)
int i;

for (i = 0; i < ARRAY_SIZE(queue_map); i++) {
struct mt76_sw_queue *q = &dev->mt76.q_tx[queue_map[i].id];
struct mt76_queue *q = dev->mt76.q_tx[queue_map[i].id];

if (!q->q)
if (!q)
continue;

seq_printf(s,
"%s: queued=%d head=%d tail=%d\n",
queue_map[i].queue, q->q->queued, q->q->head,
q->q->tail);
queue_map[i].queue, q->queued, q->head,
q->tail);
}

return 0;
Expand Down
27 changes: 10 additions & 17 deletions mt7615/dma.c
Expand Up @@ -12,8 +12,7 @@
#include "mac.h"

static int
mt7615_init_tx_queue(struct mt7615_dev *dev, struct mt76_sw_queue *q,
int idx, int n_desc)
mt7615_init_tx_queue(struct mt7615_dev *dev, int qid, int idx, int n_desc)
{
struct mt76_queue *hwq;
int err;
Expand All @@ -26,7 +25,7 @@ mt7615_init_tx_queue(struct mt7615_dev *dev, struct mt76_sw_queue *q,
if (err < 0)
return err;

q->q = hwq;
dev->mt76.q_tx[qid] = hwq;

return 0;
}
Expand All @@ -44,30 +43,28 @@ mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
int i;

for (i = 0; i < ARRAY_SIZE(wmm_queue_map); i++) {
ret = mt7615_init_tx_queue(dev, &dev->mt76.q_tx[i],
wmm_queue_map[i],
ret = mt7615_init_tx_queue(dev, i, wmm_queue_map[i],
MT7615_TX_RING_SIZE / 2);
if (ret)
return ret;
}

ret = mt7615_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_PSD],
ret = mt7615_init_tx_queue(dev, MT_TXQ_PSD,
MT7622_TXQ_MGMT, MT7615_TX_MGMT_RING_SIZE);
if (ret)
return ret;

ret = mt7615_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_MCU],
ret = mt7615_init_tx_queue(dev, MT_TXQ_MCU,
MT7622_TXQ_MCU, MT7615_TX_MCU_RING_SIZE);
return ret;
}

static int
mt7615_init_tx_queues(struct mt7615_dev *dev)
{
struct mt76_sw_queue *q;
int ret, i;

ret = mt7615_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_FWDL],
ret = mt7615_init_tx_queue(dev, MT_TXQ_FWDL,
MT7615_TXQ_FWDL,
MT7615_TX_FWDL_RING_SIZE);
if (ret)
Expand All @@ -76,18 +73,14 @@ mt7615_init_tx_queues(struct mt7615_dev *dev)
if (!is_mt7615(&dev->mt76))
return mt7622_init_tx_queues_multi(dev);

ret = mt7615_init_tx_queue(dev, &dev->mt76.q_tx[0], 0,
MT7615_TX_RING_SIZE);
ret = mt7615_init_tx_queue(dev, 0, 0, MT7615_TX_RING_SIZE);
if (ret)
return ret;

for (i = 1; i < MT_TXQ_MCU; i++) {
q = &dev->mt76.q_tx[i];
q->q = dev->mt76.q_tx[0].q;
}
for (i = 1; i < MT_TXQ_MCU; i++)
dev->mt76.q_tx[i] = dev->mt76.q_tx[0];

ret = mt7615_init_tx_queue(dev, &dev->mt76.q_tx[MT_TXQ_MCU],
MT7615_TXQ_MCU,
ret = mt7615_init_tx_queue(dev, MT_TXQ_MCU, MT7615_TXQ_MCU,
MT7615_TX_MCU_RING_SIZE);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion mt7615/mt7615.h
Expand Up @@ -542,7 +542,7 @@ static inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac)

static inline u32 mt7615_tx_mcu_int_mask(struct mt7615_dev *dev)
{
return MT_INT_TX_DONE(dev->mt76.q_tx[MT_TXQ_MCU].q->hw_idx);
return MT_INT_TX_DONE(dev->mt76.q_tx[MT_TXQ_MCU]->hw_idx);
}

void mt7615_dma_reset(struct mt7615_dev *dev);
Expand Down
2 changes: 1 addition & 1 deletion mt7615/sdio_mcu.c
Expand Up @@ -53,7 +53,7 @@ mt7663s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
if (ret)
goto out;

mt76_queue_kick(dev, mdev->q_tx[MT_TXQ_MCU].q);
mt76_queue_kick(dev, mdev->q_tx[MT_TXQ_MCU]);
if (wait_resp)
ret = mt7615_mcu_wait_response(dev, cmd, seq);

Expand Down
4 changes: 2 additions & 2 deletions mt7615/sdio_txrx.c
Expand Up @@ -162,7 +162,7 @@ static int mt7663s_tx_update_sched(struct mt76_dev *dev,

static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)
{
bool mcu = q == dev->q_tx[MT_TXQ_MCU].q;
bool mcu = q == dev->q_tx[MT_TXQ_MCU];
struct mt76_sdio *sdio = &dev->sdio;
int nframes = 0;

Expand Down Expand Up @@ -204,7 +204,7 @@ void mt7663s_tx_work(struct work_struct *work)
for (i = 0; i < MT_TXQ_MCU_WA; i++) {
int ret;

ret = mt7663s_tx_run_queue(dev, dev->q_tx[i].q);
ret = mt7663s_tx_run_queue(dev, dev->q_tx[i]);
if (ret < 0)
break;

Expand Down

0 comments on commit 3218b91

Please sign in to comment.