Larry Finger <larry.finger@xxxxxxxxx> wrote: > > On 5/2/24 4:23 PM, Bitterblue Smith wrote: > > The skb created in this function always has the same headroom, > > the chip's TX descriptor size. Use chip->tx_pkt_desc_sz directly. > > > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > > --- > > This is the patch I promised earlier: > > https://lore.kernel.org/linux-wireless/cae2d330-a4fb-4570-9dde-09684af23ffd@xxxxxxxxx/ > > --- > > drivers/net/wireless/realtek/rtw88/usb.c | 14 +++++--------- > > 1 file changed, 5 insertions(+), 9 deletions(-) > > > > diff --git a/usb.c b/usb.c > > index 1dfe7c6ae4ba..ff57976b9d3b 100644 > > --- a/usb.c > > +++ b/usb.c > > @@ -440,23 +440,21 @@ static int rtw_usb_write_data(struct rtw_dev *rtwdev, > > { > > const struct rtw_chip_info *chip = rtwdev->chip; > > struct sk_buff *skb; > > - unsigned int desclen, headsize, size; > > + unsigned int size; > > u8 qsel; > > int ret = 0; > > > > size =pkt_info->tx_pkt_size; > > qsel = pkt_info->qsel; > > - desclen = chip->tx_pkt_desc_sz; > > - headsize = pkt_info->offset ? pkt_info->offset : desclen; > > > > - skb = dev_alloc_skb(headsize + size); > > + skb = dev_alloc_skb(chip->tx_pkt_desc_sz + size); > > When I added code to test if chip->tx_pkt_desc_sz was equal to > pkt_info->tx_pkt_size at entry, it reported that there was a difference. This patch didn't touch pkt_info->tx_pkt_size. Instead, I expected pkt_info->offset was equal to chip->tx_pkt_desc_sz or 0. (I replied the reason why it doesn't work by another mail in the same thread.)