From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> To: sean.wang@mediatek.com Cc: nbd@nbd.name, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 2/3] mt76: mt7663s: make all of packets 4-bytes aligned in sdio tx aggregation Date: Thu, 4 Mar 2021 14:38:33 +0100 [thread overview] Message-ID: <YEDi2VvIBEe7DRuY@lore-desk> (raw) In-Reply-To: <8f6807d6161efbed6d585a2ca041d4b126b30451.1614863741.git.objelf@gmail.com> [-- Attachment #1: Type: text/plain, Size: 1929 bytes --] > From: Sean Wang <sean.wang@mediatek.com> > > Each packet should be padded with the additional zero to become 4-bytes > alignment in sdio tx aggregation. > > Fixes: 1522ff731f84 ("mt76: mt7663s: introduce sdio tx aggregation") > Signed-off-by: Sean Wang <sean.wang@mediatek.com> > --- > drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c > index 9fb506f2ace6..2d3b7d1e2c92 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c > @@ -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; > 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) { > @@ -234,7 +235,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) > 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; > > if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz, > @@ -252,6 +254,9 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) > len += iter->len; > nframes++; > } > + > + memset(sdio->xmit_buf[qid] + len, 0, pad); > + len += pad; maybe it is better to do something like: if (unlikely(pad)) { memset(sdio->xmit_buf[qid] + len, 0, pad); len += pad; } Regards, Lorenzo > next: > q->first = (q->first + 1) % q->ndesc; > e->done = true; > -- > 2.25.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> To: sean.wang@mediatek.com Cc: nbd@nbd.name, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 2/3] mt76: mt7663s: make all of packets 4-bytes aligned in sdio tx aggregation Date: Thu, 4 Mar 2021 14:38:33 +0100 [thread overview] Message-ID: <YEDi2VvIBEe7DRuY@lore-desk> (raw) In-Reply-To: <8f6807d6161efbed6d585a2ca041d4b126b30451.1614863741.git.objelf@gmail.com> [-- Attachment #1.1: Type: text/plain, Size: 1929 bytes --] > From: Sean Wang <sean.wang@mediatek.com> > > Each packet should be padded with the additional zero to become 4-bytes > alignment in sdio tx aggregation. > > Fixes: 1522ff731f84 ("mt76: mt7663s: introduce sdio tx aggregation") > Signed-off-by: Sean Wang <sean.wang@mediatek.com> > --- > drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c > index 9fb506f2ace6..2d3b7d1e2c92 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c > @@ -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; > 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) { > @@ -234,7 +235,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) > 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; > > if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz, > @@ -252,6 +254,9 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) > len += iter->len; > nframes++; > } > + > + memset(sdio->xmit_buf[qid] + len, 0, pad); > + len += pad; maybe it is better to do something like: if (unlikely(pad)) { memset(sdio->xmit_buf[qid] + len, 0, pad); len += pad; } Regards, Lorenzo > next: > q->first = (q->first + 1) % q->ndesc; > e->done = true; > -- > 2.25.1 [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-03-04 13:41 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-04 13:25 [PATCH 1/3] mt76: mt7663: fix when beacon filter is being applied sean.wang 2021-03-04 13:25 ` sean.wang 2021-03-04 13:25 ` [PATCH 2/3] mt76: mt7663s: make all of packets 4-bytes aligned in sdio tx aggregation sean.wang 2021-03-04 13:25 ` sean.wang 2021-03-04 13:38 ` Lorenzo Bianconi [this message] 2021-03-04 13:38 ` Lorenzo Bianconi 2021-03-04 13:25 ` [PATCH 3/3] mt76: mt7663s: fix the possible device hang in high traffic sean.wang 2021-03-04 13:25 ` sean.wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YEDi2VvIBEe7DRuY@lore-desk \ --to=lorenzo.bianconi@redhat.com \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=nbd@nbd.name \ --cc=sean.wang@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.