From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: Georgios Karantzas <gck.kara@gmail.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Georgios Karantzas <gck.kara@gmail.com>
Subject: Re: [PATCH v2] wifi: ath9k_htc: bound TX aggregation to MAX_TX_BUF_SIZE
Date: Thu, 10 Sep 2026 20:25:19 +0200 [thread overview]
Message-ID: <874ifxdkvk.fsf@toke.dk> (raw)
In-Reply-To: <20260909185921.1757-1-gck.kara@gmail.com>
Georgios Karantzas <gck.kara@gmail.com> writes:
> Bound the TX batch by cumulative byte length, not just record count.
>
> Fixes: fb9987d0f748c983 ("ath9k_htc: Support for AR9271 chipset.")
> Signed-off-by: Georgios Karantzas <gck.kara@gmail.com>
> ---
> v2:
> - 72-col wrap + Fixes: tag.
You seem to have dropped the commit message instead of just wrapping it.
Wrap does not mean "truncate", it just means "make sure each line stays
below 72 characters". The explanation in the commit message of v1 was
fine, the lines were just too long :)
> - Accounting kept: deferred len += offset never fires on early break.
Ah, right. Please explain this in the commit message. Also, see below:
> - (!i) guard dropped per review.
>
> drivers/net/wireless/ath/ath9k/hif_usb.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 0a3d2190b..533e74565 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -328,11 +328,14 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev)
> tx_skb_cnt = min_t(u16, hif_dev->tx.tx_skb_cnt, MAX_TX_AGGR_NUM);
>
> for (i = 0; i < tx_skb_cnt; i++) {
> - nskb = __skb_dequeue(&hif_dev->tx.tx_skb_queue);
> + nskb = skb_peek(&hif_dev->tx.tx_skb_queue);
> + if (!nskb)
> + break;
>
> - /* Should never be NULL */
> - BUG_ON(!nskb);
> + if (tx_buf->offset + nskb->len + 4 > MAX_TX_BUF_SIZE)
> + break;
>
> + nskb = __skb_dequeue(&hif_dev->tx.tx_skb_queue);
> hif_dev->tx.tx_skb_cnt--;
>
> buf = tx_buf->buf;
> @@ -342,13 +345,8 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev)
> *hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG);
> buf += 4;
> memcpy(buf, nskb->data, nskb->len);
> - tx_buf->len = nskb->len + 4;
> -
> - if (i < (tx_skb_cnt - 1))
> - tx_buf->offset += (((tx_buf->len - 1) / 4) + 1) * 4;
> -
> - if (i == (tx_skb_cnt - 1))
> - tx_buf->len += tx_buf->offset;
> + tx_buf->len = tx_buf->offset + nskb->len + 4;
> + tx_buf->offset += (((nskb->len + 3) / 4) + 1) * 4;
While we're fixing this, let's make it readable as well - this could be
(with an #include <linux/math.h>):
tx_buf->offset += round_up(nskb->len + 4, 4);
-Toke
next prev parent reply other threads:[~2026-09-10 18:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 17:39 [PATCH] " Georgios Karantzas
2026-09-09 11:49 ` Toke Høiland-Jørgensen
2026-09-09 18:59 ` [PATCH v2] " Georgios Karantzas
2026-09-10 18:25 ` Toke Høiland-Jørgensen [this message]
2026-09-11 0:11 ` [PATCH v3] " Georgios Karantzas
2026-09-11 10:20 ` Toke Høiland-Jørgensen
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=874ifxdkvk.fsf@toke.dk \
--to=toke@toke.dk \
--cc=gck.kara@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®