Commit 264b7b19 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7663s: rely on mt76_queue in mt7663s_tx_run_queue signature

This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc for mt7915
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent afc2b59c
...@@ -458,7 +458,7 @@ struct mt76_sdio { ...@@ -458,7 +458,7 @@ struct mt76_sdio {
struct work_struct stat_work; struct work_struct stat_work;
u8 *xmit_buf[MT_TXQ_MCU_WA]; u8 *xmit_buf[IEEE80211_NUM_ACS + 2];
struct sdio_func *func; struct sdio_func *func;
void *intr_data; void *intr_data;
......
...@@ -166,14 +166,14 @@ static int mt7663s_rx_handler(struct mt76_dev *dev) ...@@ -166,14 +166,14 @@ static int mt7663s_rx_handler(struct mt76_dev *dev)
return nframes; return nframes;
} }
static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, bool mcu, int buf_sz,
int buf_sz, int *pse_size, int *ple_size) int *pse_size, int *ple_size)
{ {
int pse_sz; int pse_sz;
pse_sz = DIV_ROUND_UP(buf_sz + sdio->sched.deficit, MT_PSE_PAGE_SZ); pse_sz = DIV_ROUND_UP(buf_sz + sdio->sched.deficit, MT_PSE_PAGE_SZ);
if (qid == MT_TXQ_MCU) { if (mcu) {
if (sdio->sched.pse_mcu_quota < *pse_size + pse_sz) if (sdio->sched.pse_mcu_quota < *pse_size + pse_sz)
return -EBUSY; return -EBUSY;
} else { } else {
...@@ -188,10 +188,10 @@ static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, ...@@ -188,10 +188,10 @@ static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid,
return 0; return 0;
} }
static void mt7663s_tx_update_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, static void mt7663s_tx_update_quota(struct mt76_sdio *sdio, bool mcu,
int pse_size, int ple_size) int pse_size, int ple_size)
{ {
if (qid == MT_TXQ_MCU) { if (mcu) {
sdio->sched.pse_mcu_quota -= pse_size; sdio->sched.pse_mcu_quota -= pse_size;
} else { } else {
sdio->sched.pse_data_quota -= pse_size; sdio->sched.pse_data_quota -= pse_size;
...@@ -214,12 +214,13 @@ static int __mt7663s_xmit_queue(struct mt76_dev *dev, u8 *data, int len) ...@@ -214,12 +214,13 @@ static int __mt7663s_xmit_queue(struct mt76_dev *dev, u8 *data, int len)
return err; return err;
} }
static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)
{ {
int err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0; int qid, err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0;
struct mt76_queue *q = dev->q_tx[qid]; bool mcu = q == dev->q_tx[MT_TXQ_MCU];
struct mt76_sdio *sdio = &dev->sdio; struct mt76_sdio *sdio = &dev->sdio;
qid = mcu ? ARRAY_SIZE(sdio->xmit_buf) - 1 : q->qid;
while (q->first != q->head) { while (q->first != q->head) {
struct mt76_queue_entry *e = &q->entry[q->first]; struct mt76_queue_entry *e = &q->entry[q->first];
struct sk_buff *iter; struct sk_buff *iter;
...@@ -237,7 +238,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) ...@@ -237,7 +238,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid)
if (len + e->skb->len + 4 > MT76S_XMIT_BUF_SZ) if (len + e->skb->len + 4 > MT76S_XMIT_BUF_SZ)
break; break;
if (mt7663s_tx_pick_quota(sdio, qid, e->buf_sz, &pse_sz, if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz,
&ple_sz)) &ple_sz))
break; break;
...@@ -263,7 +264,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) ...@@ -263,7 +264,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid)
if (err) if (err)
return err; return err;
} }
mt7663s_tx_update_quota(sdio, qid, pse_sz, ple_sz); mt7663s_tx_update_quota(sdio, mcu, pse_sz, ple_sz);
mt76_worker_schedule(&sdio->status_worker); mt76_worker_schedule(&sdio->status_worker);
...@@ -286,7 +287,7 @@ void mt7663s_txrx_worker(struct mt76_worker *w) ...@@ -286,7 +287,7 @@ void mt7663s_txrx_worker(struct mt76_worker *w)
/* tx */ /* tx */
for (i = 0; i < MT_TXQ_MCU_WA; i++) { for (i = 0; i < MT_TXQ_MCU_WA; i++) {
ret = mt7663s_tx_run_queue(dev, i); ret = mt7663s_tx_run_queue(dev, dev->q_tx[i]);
if (ret > 0) if (ret > 0)
nframes += ret; nframes += ret;
} }
......
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