wifi: mt76: add WED RX support to mt76_dma_rx_fill
Introduce the capability to refill WED RX buffers in mt76_dma_rx_fill utility routine. Tested-by: Daniel Golle <daniel@makrotopia.org> Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com> Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
cd372b8c99
commit
c601baaf5c
@ -550,14 +550,26 @@ free_skb:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct page_frag_cache *
|
||||||
|
mt76_dma_rx_get_frag_cache(struct mt76_dev *dev, struct mt76_queue *q)
|
||||||
|
{
|
||||||
|
struct page_frag_cache *rx_page = &q->rx_page;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
|
||||||
|
if ((q->flags & MT_QFLAG_WED) &&
|
||||||
|
FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX)
|
||||||
|
rx_page = &dev->mmio.wed.rx_buf_ring.rx_page;
|
||||||
|
#endif
|
||||||
|
return rx_page;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
|
mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
|
||||||
{
|
{
|
||||||
dma_addr_t addr;
|
struct page_frag_cache *rx_page = mt76_dma_rx_get_frag_cache(dev, q);
|
||||||
void *buf;
|
|
||||||
int frames = 0;
|
|
||||||
int len = SKB_WITH_OVERHEAD(q->buf_size);
|
int len = SKB_WITH_OVERHEAD(q->buf_size);
|
||||||
int offset = q->buf_offset;
|
int frames = 0, offset = q->buf_offset;
|
||||||
|
dma_addr_t addr;
|
||||||
|
|
||||||
if (!q->ndesc)
|
if (!q->ndesc)
|
||||||
return 0;
|
return 0;
|
||||||
@ -565,9 +577,18 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
|
|||||||
spin_lock_bh(&q->lock);
|
spin_lock_bh(&q->lock);
|
||||||
|
|
||||||
while (q->queued < q->ndesc - 1) {
|
while (q->queued < q->ndesc - 1) {
|
||||||
|
struct mt76_txwi_cache *t = NULL;
|
||||||
struct mt76_queue_buf qbuf;
|
struct mt76_queue_buf qbuf;
|
||||||
|
void *buf = NULL;
|
||||||
|
|
||||||
buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC);
|
if ((q->flags & MT_QFLAG_WED) &&
|
||||||
|
FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
|
||||||
|
t = mt76_get_rxwi(dev);
|
||||||
|
if (!t)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = page_frag_alloc(rx_page, q->buf_size, GFP_ATOMIC);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -580,7 +601,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
|
|||||||
qbuf.addr = addr + offset;
|
qbuf.addr = addr + offset;
|
||||||
qbuf.len = len - offset;
|
qbuf.len = len - offset;
|
||||||
qbuf.skip_unmap = false;
|
qbuf.skip_unmap = false;
|
||||||
mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, NULL);
|
mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t);
|
||||||
frames++;
|
frames++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user