From: Ping-Ke Shih <pkshih@realtek.com>
To: "luka.gejak@linux.dev" <luka.gejak@linux.dev>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Michael Straube" <straube.linux@gmail.com>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>,
Peter Robinson <pbrobinson@gmail.com>,
"Hans de Goede" <johannes.goede@oss.qualcomm.com>
Subject: RE: [PATCH v9 4/6] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS
Date: Sun, 6 Sep 2026 02:22:40 +0000 [thread overview]
Message-ID: <d4a8b1203ee0402483269a31ad4d6dd2@realtek.com> (raw)
In-Reply-To: <20260831061144.18631-5-luka.gejak@linux.dev>
luka.gejak@linux.dev <luka.gejak@linux.dev> wrote:
>
> Transfers also have to be padded up to the SDIO block size for this
> chip rather than using the generic alignment, so size the write
> separately from the frame and zero the padding with __skb_pad(), which
> also reallocates a cloned skb instead of writing into a buffer a clone
> still shares.
If the __skb_padd() is necessary for original (generic) part, please
add another patch to fix it. (see below comment)
[...]
> +/*
> + * The free page check, the output queue wait and the accounting after the
> + * transfer have to be one unit, or two writers can both pass the checks and
> + * claim the same pages and output queue entry.
> + */
In this patchset, you add many comments. Please review them across whole
patchset to see if they actually need. Like this one, do you think the code
can't explain itself?
> +static int rtw_sdio_write_port_8723bs(struct rtw_dev *rtwdev,
> + struct sk_buff *skb,
> + enum rtw_tx_queue_type queue)
> +{
> + struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv;
> + unsigned int pages;
> + size_t write_size;
> + size_t txsize;
> + u32 txaddr;
> + int ret;
> +
> + txaddr = rtw_sdio_get_tx_addr(rtwdev, skb->len, queue);
> + if (!txaddr)
> + return -EINVAL;
> +
> + txsize = round_up(skb->len, 4);
> + write_size = txsize > RTW_SDIO_BLOCK_SIZE ?
> + round_up(txsize, RTW_SDIO_BLOCK_SIZE) : txsize;
As we have sdio_set_block_size(sdio_func, RTW_SDIO_BLOCK_SIZE),
can here use sdio_align_size() to get the writ_size?
> +
> + if (write_size > skb->len) {
> + size_t pad_size = write_size - skb->len;
I think write_size must be large or equal to skb->len, right?
Therefore, declare size_t pad_size at top of function, and then
write_size = ...
pad_size = write_size - skb->len;
if (pad_size > 0) {
...
__skb_pad( ... pad_size ...);
}
I think this is easier to read.
> +
> + /*
> + * __skb_pad() must not free the skb on failure: both callers
> + * still own it, one requeues it and the other frees it.
> + */
> + ret = __skb_pad(skb, pad_size, false);
Why doesn't rtw_sdio_write_port_generic() need __skb_pad() as well?
Is there an existing problem by original?
> + if (ret)
> + return ret;
> + }
> +
> + guard(mutex)(&rtwsdio->tx_credit_lock);
> +
> + ret = rtw_sdio_check_free_txpg(rtwdev, queue, txsize);
> + if (ret)
> + return ret;
> +
> + ret = rtw_sdio_8723bs_wait_tx_oqt(rtwdev);
> + if (ret)
> + return ret;
> +
> + ret = rtw_sdio_write_to_port(rtwdev, skb, queue, txaddr, write_size);
> + if (ret) {
> + /* nothing was queued, so hand the output queue entry back */
> + atomic_inc(&rtwsdio->tx_oqt_free);
> + return ret;
> + }
> +
> + pages = DIV_ROUND_UP(txsize, rtwdev->chip->page_size);
> + rtw_sdio_8723bs_consume_txpg(rtwdev, queue, pages);
> +
> + return 0;
> +}
> +
next prev parent reply other threads:[~2026-09-06 2:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 6:11 [PATCH v9 0/6] wifi: rtw88: preparations for RTL8723B/RTL8723BS luka.gejak
2026-08-31 6:11 ` [PATCH v9 1/6] wifi: rtw88: add the RTL8723B chip type and SDIO helper luka.gejak
2026-08-31 6:11 ` [PATCH v9 2/6] wifi: rtw88: rx: mark zero length packets on RTL8723BS luka.gejak
2026-08-31 6:11 ` [PATCH v9 3/6] wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS luka.gejak
2026-08-31 6:11 ` [PATCH v9 4/6] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS luka.gejak
2026-09-06 2:22 ` Ping-Ke Shih [this message]
2026-09-08 12:56 ` Luka Gejak
2026-09-09 5:36 ` Ping-Ke Shih
2026-09-09 8:04 ` Luka Gejak
2026-08-31 6:11 ` [PATCH v9 5/6] wifi: rtw88: sdio: set up RX aggregation and interrupts " luka.gejak
2026-08-31 6:11 ` [PATCH v9 6/6] wifi: rtw88: sdio: add TX back-pressure and retry on page starvation luka.gejak
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=d4a8b1203ee0402483269a31ad4d6dd2@realtek.com \
--to=pkshih@realtek.com \
--cc=johannes.goede@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luka.gejak@linux.dev \
--cc=pbrobinson@gmail.com \
--cc=rtl8821cerfe2@gmail.com \
--cc=straube.linux@gmail.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: 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