Commit 455ae5aa authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

mt76: mt7663s: make all of packets 4-bytes aligned in sdio tx aggregation

Each packet should be padded with the additional zero to become 4-bytes
alignment in sdio tx aggregation.

Fixes: 1522ff73 ("mt76: mt7663s: introduce sdio tx aggregation")
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 4bec61d9
...@@ -218,6 +218,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -218,6 +218,7 @@ static int mt7663s_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 qid, err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0;
bool mcu = q == dev->q_mcu[MT_MCUQ_WM]; bool mcu = q == dev->q_mcu[MT_MCUQ_WM];
struct mt76_sdio *sdio = &dev->sdio; struct mt76_sdio *sdio = &dev->sdio;
u8 pad;
qid = mcu ? ARRAY_SIZE(sdio->xmit_buf) - 1 : q->qid; qid = mcu ? ARRAY_SIZE(sdio->xmit_buf) - 1 : q->qid;
while (q->first != q->head) { while (q->first != q->head) {
...@@ -234,7 +235,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -234,7 +235,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)
goto next; goto next;
} }
if (len + e->skb->len + 4 > MT76S_XMIT_BUF_SZ) pad = roundup(e->skb->len, 4) - e->skb->len;
if (len + e->skb->len + pad + 4 > MT76S_XMIT_BUF_SZ)
break; break;
if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz, if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz,
...@@ -252,6 +254,11 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -252,6 +254,11 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)
len += iter->len; len += iter->len;
nframes++; nframes++;
} }
if (unlikely(pad)) {
memset(sdio->xmit_buf[qid] + len, 0, pad);
len += pad;
}
next: next:
q->first = (q->first + 1) % q->ndesc; q->first = (q->first + 1) % q->ndesc;
e->done = true; e->done = true;
......
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