wifi: rtw88: usb: don't report the aggregation buffer as a frame
PATCH v2 1/1 wifi: rtw88: usb: don't report the aggregation buffer as a frame
When rtw_usb_tx_agg_skb() has more than one frame queued, it copies them into a new buffer. That buffer was also handed to mac80211, as one additional TX completion.
Report TX status only for the original frames, and free the aggregate buffer without passing it to mac80211.
--- drivers/net/wireless/realtek/rtw88/usb.c | 9 +++++++++ drivers/net/wireless/realtek/rtw88/usb.h | 1 + 2 files changed, 10 insertions(+)
drivers/net/wireless/realtek/rtw88/usb.c +9 -0
@@ -342,6 +342,11 @@ static void rtw_usb_write_port_tx_complete(struct urb *urb)skb_pull (skb, rtwdev->chip->tx_pkt_desc_sz); +if (tx_data->drv_frame) { +dev_kfree_skb_any (skb); +continue ; + } +/* enqueue to wait for tx report */ if (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS ) {rtw_tx_report_enqueue (rtwdev, skb, tx_data->sn);
@@ -431,6 +436,9 @@ static bool rtw_usb_tx_agg_skb(struct rtw_usb *rtwusb, struct sk_buff_head *list goto queue; } +/* report TX status only for the original frames */ +rtw_usb_get_tx_data (skb_head)->drv_frame = true; +while (skb_iter) {unsigned long flags;
@@ -655,6 +663,7 @@ static int rtw_usb_tx_write(struct rtw_dev *rtwdev,rtw_tx_fill_txdesc_checksum (rtwdev, pkt_info, skb->data); tx_data =rtw_usb_get_tx_data (skb); tx_data->sn = pkt_info->sn; + tx_data->drv_frame = false;skb_queue_tail (&rtwusb->tx_queue[ep], skb);
drivers/net/wireless/realtek/rtw88/usb.h +1 -0
@@ -59,6 +59,7 @@ struct rx_usb_ctrl_block {struct rtw_usb_tx_data {u8 sn; +bool drv_frame; };struct rtw_usb {
base-commit: 9b0be45d4d52fd223994e151f169743a97abd290
Signature · 1 line
2.55.0
Hi Jie Feng,
Thanks for the v2. The fix looks right to me, just one small comment below.
drivers/net/wireless/realtek/rtw88/usb.c static void rtw_usb_write_port_tx_complete(struct urb *urb) · line 349
Quoted 13 lines · Ho Jie Feng
drivers/net/wireless/realtek/rtw88/usb.c +5
-0@@ -342,6 +342,11 @@ static void rtw_usb_write_port_tx_complete(struct urb *urb)skb_pull (skb, rtwdev->chip->tx_pkt_desc_sz); +if (tx_data->drv_frame) { +dev_kfree_skb_any (skb); +continue ; + } +
As far as I can see this is the normal TX completion of the aggregate buffer, so I think dev_consume_skb_any() fits better here. dev_kfree_skb_any() frees it with SKB_DROP_REASON_NOT_SPECIFIED, so each aggregated transfer would now show up as a drop in the skb:kfree_skb tracepoint and in drop monitor.
Before this patch the buffer went through mac80211, which in the usual case freed it with dev_kfree_skb(), and that is consume_skb().
Best regards,
Luka Gejak