linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Neo Jou <neojou@gmail.com>, Hans Ulli Kroll <linux@ulli-kroll.de>,
	Yan-Hsuan Chuang <tony0620emma@gmail.com>,
	Kalle Valo <kvalo@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Johannes Berg <johannes@sipsolutions.net>,
	Alexander Hochbaum <alex@appudo.com>, Da Xue <da@libre.computer>,
	"Bernie Huang" <phhuang@realtek.com>,
	Viktor Petrenko <g0000ga@gmail.com>,
	neo_jou <neo_jou@realtek.com>
Subject: RE: [PATCH v4 07/11] wifi: rtw88: Add common USB chip support
Date: Wed, 30 Nov 2022 01:40:36 +0000	[thread overview]
Message-ID: <4eee82341ef84d4aa063edeb6f23a70d@realtek.com> (raw)
In-Reply-To: <20221129100754.2753237-8-s.hauer@pengutronix.de>



> -----Original Message-----
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Sent: Tuesday, November 29, 2022 6:08 PM
> To: linux-wireless@vger.kernel.org
> Cc: Neo Jou <neojou@gmail.com>; Hans Ulli Kroll <linux@ulli-kroll.de>; Ping-Ke Shih <pkshih@realtek.com>;
> Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org; Martin Blumenstingl <martin.blumenstingl@googlemail.com>;
> kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>;
> Da Xue <da@libre.computer>; Bernie Huang <phhuang@realtek.com>; Viktor Petrenko <g0000ga@gmail.com>;
> Sascha Hauer <s.hauer@pengutronix.de>; neo_jou <neo_jou@realtek.com>
> Subject: [PATCH v4 07/11] wifi: rtw88: Add common USB chip support
> 
> Add the common bits and pieces to add USB support to the RTW88 driver.
> This is based on https://github.com/ulli-kroll/rtw88-usb.git which
> itself is first written by Neo Jou.
> 
> Signed-off-by: neo_jou <neo_jou@realtek.com>
> Signed-off-by: Hans Ulli Kroll <linux@ulli-kroll.de>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 
> Notes:
>     Changes since v3:
>     - Add sanity break out of potentially endless loop
>     - Do not interleave PCI and USB support in Makefile
>     - fix rtwusb->usb_data_index locking
>     - make data_ptr variable in rtw_usb_tx_agg_skb() unnecessary
>     - Some coding style fixup
>     - drop set-but-unused variable in rtw_usb_write_data()
>     - Increase RTW_USB_MAX_RXQ_LEN to 512. I've seen "failed to get rx_queue, overflow\n"
>       trigger otherwise
> 
>     Changes since v2:
>     - Fix buffer length for aggregated tx packets
>     - Increase maximum transmit buffer size to 20KiB as found in downstream drivers
>     - Change register write functions to synchronous accesses instead of just firing
>       a URB without waiting for its completion
>     - requeue rx URBs directly in completion handler rather than having a workqueue
>       for it.
> 
>     Changes since v1:
>     - Make checkpatch.pl clean
>     - Drop WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL flag
>     - Use 'ret' as variable name for return values
>     - Sort variable declarations in reverse Xmas tree order
>     - Change potentially endless loop to a limited loop
>     - Change locking to be more obviously correct
>     - drop unnecessary check for !rtwdev
>     - make sure the refill workqueue is not restarted again after we have
>       cancelled it
> 
>  drivers/net/wireless/realtek/rtw88/Kconfig  |   3 +
>  drivers/net/wireless/realtek/rtw88/Makefile |   3 +
>  drivers/net/wireless/realtek/rtw88/mac.c    |   3 +
>  drivers/net/wireless/realtek/rtw88/main.c   |   4 +
>  drivers/net/wireless/realtek/rtw88/main.h   |   4 +
>  drivers/net/wireless/realtek/rtw88/reg.h    |   1 +
>  drivers/net/wireless/realtek/rtw88/tx.h     |  31 +
>  drivers/net/wireless/realtek/rtw88/usb.c    | 917 ++++++++++++++++++++
>  drivers/net/wireless/realtek/rtw88/usb.h    | 107 +++
>  9 files changed, 1073 insertions(+)
>  create mode 100644 drivers/net/wireless/realtek/rtw88/usb.c
>  create mode 100644 drivers/net/wireless/realtek/rtw88/usb.h
> 

[...]

> +static void rtw_usb_write_port_tx_complete(struct urb *urb)
> +{
> +	struct rtw_usb_txcb *txcb = urb->context;
> +	struct rtw_dev *rtwdev = txcb->rtwdev;
> +	struct ieee80211_hw *hw = rtwdev->hw;
> +	int max_iter = RTW_USB_MAX_XMITBUF_SZ;
> +
> +	while (true) {
> +		struct sk_buff *skb = skb_dequeue(&txcb->tx_ack_queue);
> +		struct ieee80211_tx_info *info;
> +		struct rtw_usb_tx_data *tx_data;
> +
> +		if (!skb)
> +			break;
> +
> +		if (!--max_iter) {

Don't you need to free 'skb'? or you should not dequeue skb in this situation?

> +			rtw_err(rtwdev, "failed to empty TX ack queue\n");
> +			break;
> +		}
> +
> +		info = IEEE80211_SKB_CB(skb);
> +		tx_data = rtw_usb_get_tx_data(skb);
> +
> +		/* enqueue to wait for tx report */
> +		if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
> +			rtw_tx_report_enqueue(rtwdev, skb, tx_data->sn);
> +			continue;
> +		}
> +
> +		/* always ACK for others, then they won't be marked as drop */
> +		ieee80211_tx_info_clear_status(info);
> +		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
> +			info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
> +		else
> +			info->flags |= IEEE80211_TX_STAT_ACK;
> +
> +		ieee80211_tx_status_irqsafe(hw, skb);
> +	}
> +
> +	kfree(txcb);
> +}
> +

[...]

I have reviewed patchset v4, and only one comment.

--
Ping-Ke


  reply	other threads:[~2022-11-30  1:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 10:07 [PATCH v4 00/11] RTW88: Add support for USB variants Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 01/11] wifi: rtw88: print firmware type in info message Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 02/11] wifi: rtw88: Call rtw_fw_beacon_filter_config() with rtwdev->mutex held Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 03/11] wifi: rtw88: Drop rf_lock Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 04/11] wifi: rtw88: Drop h2c.lock Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 05/11] wifi: rtw88: Drop coex mutex Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 06/11] wifi: rtw88: iterate over vif/sta list non-atomically Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 07/11] wifi: rtw88: Add common USB chip support Sascha Hauer
2022-11-30  1:40   ` Ping-Ke Shih [this message]
2022-11-30  8:13     ` Sascha Hauer
2022-11-30  8:35       ` Ping-Ke Shih
2022-11-29 10:07 ` [PATCH v4 08/11] wifi: rtw88: Add rtw8821cu chipset support Sascha Hauer
2022-11-29 16:17   ` Jakub Kicinski
2022-11-29 16:59     ` Larry Finger
2022-12-08 14:21       ` Kalle Valo
2022-12-09  3:17         ` Ping-Ke Shih
2022-12-02  8:09     ` Sascha Hauer
2022-12-02 12:36       ` Kalle Valo
2022-11-29 10:07 ` [PATCH v4 09/11] wifi: rtw88: Add rtw8822bu " Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 10/11] wifi: rtw88: Add rtw8822cu " Sascha Hauer
2022-11-29 10:07 ` [PATCH v4 11/11] wifi: rtw88: Add rtw8723du " Sascha Hauer

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=4eee82341ef84d4aa063edeb6f23a70d@realtek.com \
    --to=pkshih@realtek.com \
    --cc=alex@appudo.com \
    --cc=da@libre.computer \
    --cc=g0000ga@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kernel@pengutronix.de \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux@ulli-kroll.de \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neo_jou@realtek.com \
    --cc=neojou@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=phhuang@realtek.com \
    --cc=s.hauer@pengutronix.de \
    --cc=tony0620emma@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;
as well as URLs for NNTP newsgroup(s).