summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/sdio_txrx.c
diff options
context:
space:
mode:
authorSean Wang <sean.wang@mediatek.com>2022-01-15 07:56:32 +0800
committerFelix Fietkau <nbd@nbd.name>2022-02-03 13:58:00 +0100
commitbf08d58543415f5e31a0e7a6401abcdd76826847 (patch)
tree493320e057ecfd1a2fd1d63a77ce643861e742bf /drivers/net/wireless/mediatek/mt76/sdio_txrx.c
parentc41d2a075206fcbdc89695b874a6ac06160b4f1a (diff)
mt76: sdio: honor the largest Tx buffer the hardware can support
We don't have to create a separate sdio.xmit_buf buffer for each queue. Instead, we just need to create one, reuse it across all queues to reduce memory consumption further. And then we should take it into account the actual the host and the device MMC capability to determine what the appropriate xmit_buf_size can be. Both MT7921S and MT7663 can support up to Tx FIFO size of 0x3fe00 which means the device can receive 511 blocks of block size 512 in a row from the host. So if the driver aggregates the frames as many as possible the the device can support, we can merge multiple MMC requests into a single one to get rid of the overhead of the handling and synchronizing in those unnecessary MMC requests and reduce the SDIO lock contention with the Bluetooth concurrent traffic and finally to have the higher bus utilization with less idle cycle. With the patch, it is helpful for WiFi to have steady throughput performance especially while running Bluetooth concurrently. Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/sdio_txrx.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/sdio_txrx.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/sdio_txrx.c
index 488ad7734d85..9fcf507e09bd 100644
--- a/drivers/net/wireless/mediatek/mt76/sdio_txrx.c
+++ b/drivers/net/wireless/mediatek/mt76/sdio_txrx.c
@@ -229,12 +229,11 @@ static int __mt76s_xmit_queue(struct mt76_dev *dev, u8 *data, int len)
static int mt76s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)
{
- int qid, err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0;
+ int err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0;
bool mcu = q == dev->q_mcu[MT_MCUQ_WM];
struct mt76_sdio *sdio = &dev->sdio;
u8 pad;
- qid = mcu ? ARRAY_SIZE(sdio->xmit_buf) - 1 : q->qid;
while (q->first != q->head) {
struct mt76_queue_entry *e = &q->entry[q->first];
struct sk_buff *iter;
@@ -255,27 +254,25 @@ static int mt76s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)
}
pad = roundup(e->skb->len, 4) - e->skb->len;
- if (len + e->skb->len + pad + 4 > MT76S_XMIT_BUF_SZ)
+ if (len + e->skb->len + pad + 4 > dev->sdio.xmit_buf_sz)
break;
if (mt76s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz,
&ple_sz))
break;
- memcpy(sdio->xmit_buf[qid] + len, e->skb->data,
- skb_headlen(e->skb));
+ memcpy(sdio->xmit_buf + len, e->skb->data, skb_headlen(e->skb));
len += skb_headlen(e->skb);
nframes++;
skb_walk_frags(e->skb, iter) {
- memcpy(sdio->xmit_buf[qid] + len, iter->data,
- iter->len);
+ memcpy(sdio->xmit_buf + len, iter->data, iter->len);
len += iter->len;
nframes++;
}
if (unlikely(pad)) {
- memset(sdio->xmit_buf[qid] + len, 0, pad);
+ memset(sdio->xmit_buf + len, 0, pad);
len += pad;
}
next:
@@ -284,8 +281,8 @@ next:
}
if (nframes) {
- memset(sdio->xmit_buf[qid] + len, 0, 4);
- err = __mt76s_xmit_queue(dev, sdio->xmit_buf[qid], len + 4);
+ memset(sdio->xmit_buf + len, 0, 4);
+ err = __mt76s_xmit_queue(dev, sdio->xmit_buf, len + 4);
if (err)
return err;
}