Linux wireless drivers development
 help / color / mirror / Atom feed
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 v8 4/6] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS
Date: Fri, 28 Aug 2026 09:23:26 +0000	[thread overview]
Message-ID: <068b8747563444869e19399fbfa78654@realtek.com> (raw)
In-Reply-To: <20260825163314.1590-5-luka.gejak@linux.dev>

luka.gejak@linux.dev <luka.gejak@linux.dev> wrote:
[...]

> +static int rtw_sdio_write_port(struct rtw_dev *rtwdev, struct sk_buff *skb,
> +                              enum rtw_tx_queue_type queue)
> +{
> +       struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv;
> +       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;
> +
> +       if (!rtw_is_8723bs(rtwdev)) {
> +               txsize = sdio_align_size(rtwsdio->sdio_func, skb->len);
> +
> +               ret = rtw_sdio_check_free_txpg(rtwdev, queue, txsize);
> +               if (ret)
> +                       return ret;
> +
> +               if (!IS_ALIGNED((unsigned long)skb->data,
> +                               RTW_SDIO_DATA_PTR_ALIGN))
> +                       rtw_warn(rtwdev,
> +                                "Got unaligned SKB in %s() for queue %u\n",
> +                                __func__, queue);
> +
> +               return rtw_sdio_write_to_port(rtwdev, skb, txaddr, txsize);

Since you have two branches for RTL8723BS and others, let's implement them
by individual functions. Here can just dispatch, like

int rtw_sdio_write_port()
{
    if (rtw_is_8723bs(rtwdev))
        return rtw_sdio_write_port_8723bs();
    else
        return rtw_sdio_write_port_common(); 
}

> +       }
> +
> +       txsize = round_up(skb->len, 4);
> +       write_size = txsize > RTW_SDIO_BLOCK_SIZE ?
> +                    round_up(txsize, RTW_SDIO_BLOCK_SIZE) : txsize;
> +
> +       if (write_size > skb->len) {
> +               size_t pad_size = write_size - skb->len;
> +
> +               /*
> +                * __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);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       guard(mutex)(&rtwsdio->tx_credit_lock);
> +
> +       return rtw_sdio_8723bs_write_port(rtwdev, skb, queue, txaddr, txsize,
> +                                         write_size);
> +}
> +


  reply	other threads:[~2026-08-28  9:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 16:33 [PATCH v8 0/6] wifi: rtw88: preparations for RTL8723B/RTL8723BS luka.gejak
2026-08-25 16:33 ` [PATCH v8 1/6] wifi: rtw88: add the RTL8723B chip type and SDIO helper luka.gejak
2026-08-25 16:33 ` [PATCH v8 2/6] wifi: rtw88: rx: mark zero length packets on RTL8723BS luka.gejak
2026-08-25 16:33 ` [PATCH v8 3/6] wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS luka.gejak
2026-08-25 16:33 ` [PATCH v8 4/6] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS luka.gejak
2026-08-28  9:23   ` Ping-Ke Shih [this message]
2026-08-28  9:40     ` Luka Gejak
2026-08-25 16:33 ` [PATCH v8 5/6] wifi: rtw88: sdio: set up RX aggregation and interrupts " luka.gejak
2026-08-25 16:33 ` [PATCH v8 6/6] wifi: rtw88: sdio: add TX back-pressure and retry on page starvation luka.gejak
2026-08-28  9:29   ` Ping-Ke Shih
2026-08-28  9:47     ` Luka Gejak
2026-08-26 17:53 ` [PATCH v8 0/6] wifi: rtw88: preparations for RTL8723B/RTL8723BS 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=068b8747563444869e19399fbfa78654@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