Re: [PATCH 2/2] wifi: rtw88: usb: Fix urbs with size multiple of bulkout_size

From: Simon Horman
Date: Fri Feb 10 2023 - 08:21:15 EST


On Fri, Feb 10, 2023 at 10:26:42AM +0100, Sascha Hauer wrote:
> The hardware can't handle urbs with a data size of multiple of
> bulkout_size. With such a packet the endpoint gets stuck and only
> replugging the hardware helps.
>
> Fix this by moving the header eight bytes down, thus making the packet
> eight bytes bigger. The same is done in rtw_usb_write_data_rsvd_page()
> already, but not yet for the tx data.
>
> Fixes: a82dfd33d1237 ("wifi: rtw88: Add common USB chip support")
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
> drivers/net/wireless/realtek/rtw88/tx.h | 2 ++
> drivers/net/wireless/realtek/rtw88/usb.c | 34 +++++++++++++++---------
> 2 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/tx.h b/drivers/net/wireless/realtek/rtw88/tx.h
> index a2f3ac326041b..38ce9c7ae62ed 100644
> --- a/drivers/net/wireless/realtek/rtw88/tx.h
> +++ b/drivers/net/wireless/realtek/rtw88/tx.h
> @@ -75,6 +75,8 @@
> le32p_replace_bits((__le32 *)(txdesc) + 0x07, value, GENMASK(15, 0))
> #define SET_TX_DESC_DMA_TXAGG_NUM(txdesc, value) \
> le32p_replace_bits((__le32 *)(txdesc) + 0x07, value, GENMASK(31, 24))
> +#define GET_TX_DESC_OFFSET(txdesc) \
> + le32_get_bits(*((__le32 *)(txdesc) + 0x00), GENMASK(23, 16))
> #define GET_TX_DESC_PKT_OFFSET(txdesc) \
> le32_get_bits(*((__le32 *)(txdesc) + 0x01), GENMASK(28, 24))
> #define GET_TX_DESC_QSEL(txdesc) \
> diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
> index d9e995544e405..08cd480958b6b 100644
> --- a/drivers/net/wireless/realtek/rtw88/usb.c
> +++ b/drivers/net/wireless/realtek/rtw88/usb.c
> @@ -281,6 +281,7 @@ static int rtw_usb_write_port(struct rtw_dev *rtwdev, u8 qsel, struct sk_buff *s
> static bool rtw_usb_tx_agg_skb(struct rtw_usb *rtwusb, struct sk_buff_head *list)
> {
> struct rtw_dev *rtwdev = rtwusb->rtwdev;
> + const struct rtw_chip_info *chip = rtwdev->chip;

nit: Local variable should be sorted from longest line to shortest line,
aka reverse xmas tree.

As you've said you will post a v2 I feel better about pointing this out -
it's not worth a respin in it's own right.