summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBitterblue Smith <rtl8821cerfe2@gmail.com>2024-05-03 13:53:28 +0300
committerPing-Ke Shih <pkshih@realtek.com>2024-05-09 14:20:09 +0800
commita892f6ffbec7a1a25c639534bee62200418242f9 (patch)
treeae63b8267693fdb935788aa3bc2b5cbfd531292f
parentd0bcb10e7b94861c714ab1e62c98bf8abaa37527 (diff)
wifi: rtw88: usb: Simplify rtw_usb_write_data
The skb created in this function always has the same headroom, the chip's TX descriptor size. (pkt_info->offset is set by rtw_usb_write_data_rsvd_page() to chip->tx_pkt_desc_sz.) Use chip->tx_pkt_desc_sz directly. Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://msgid.link/2479507e-3946-492f-857e-83e54969aad2@gmail.com
-rw-r--r--drivers/net/wireless/realtek/rtw88/usb.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
index a0188511099a..90afeefe002f 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.c
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
@@ -433,23 +433,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);
if (unlikely(!skb))
return -ENOMEM;
- skb_reserve(skb, headsize);
+ skb_reserve(skb, chip->tx_pkt_desc_sz);
skb_put_data(skb, buf, size);
- skb_push(skb, headsize);
- memset(skb->data, 0, headsize);
+ skb_push(skb, chip->tx_pkt_desc_sz);
+ memset(skb->data, 0, chip->tx_pkt_desc_sz);
rtw_tx_fill_tx_desc(pkt_info, skb);
rtw_tx_fill_txdesc_checksum(rtwdev, pkt_info, skb->data);