Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1988691rwb; Wed, 30 Nov 2022 00:16:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6T5j077LuecuVE1FxKo/44y3L5cC69Gh22tKvehCm08FzaZcL0BeNg2fLiPV3BvF6wmxZ8 X-Received: by 2002:a63:1b08:0:b0:476:db6f:e77b with SMTP id b8-20020a631b08000000b00476db6fe77bmr35406682pgb.373.1669796194641; Wed, 30 Nov 2022 00:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669796194; cv=none; d=google.com; s=arc-20160816; b=pumt6Dq7H8BlXcajL7zVXSpIPPfSTVUGYVawJ88fThGwsAGTrlVEmTI36tCMdZ8PH4 9+5sloKzbEFPUCOKS6Xiplmfux8D7DI7CuoMzaWXuczaWnjSdkVopYY1cQqDpLl6IYH7 tYsl7vkl7x/XvU/zXEvsItUatEJNebSly6m9/NVoeGIwPQ8L9hgGnaadYrrhO0Syt5QQ wPj2Z1AQ++THa7pIwTjJNhqxlIMPkhIe2bg1Wzd3NkycLdyS0QWnm6KbcJwyAPxVmFp0 s3vNTBgD2Cqh5X6p3XSpWgIN0BpOrV3wVL7OZxYAXkkcRN2oxS4MUT43bVI9vrNOaon8 IcjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Cs1Ldfc5gdjR3XSBW9OwJ8d73T6GMajHgLmzWlh9aH0=; b=A6YGrWi255L+zuvPCqzMAdjy6ulo/DQFysqWMnX0GR/fM4mUq0/9wfbCD7bRsQx/qx sRtFvbAvXWxkoZi6+S+5qHERBjBhy+D0vHmr0lbHSzxwFAr/S0C5oci7Gl+poEUF+Yh7 uKMwAMEYH6fJaXxmuBmNcTwjrF47zxCXqZIMG9eB/W5Z3IaiSs14BUhtFAC70Ku+8pKj lm5nZGz5HRT2Dz1Vzs/6yXfIzicR7u+yg68HDcxzT9vTE8p1jfNiO5tm7SXFSSGNInG8 isOQ1EcoUeGbs0DOirU7ekIVUdxP+58If2EsDhv3bJfan+qawMV5eWWVct7TqYR61riu OY6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a170902cf0600b001868277386dsi660824plg.192.2022.11.30.00.16.23; Wed, 30 Nov 2022 00:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234430AbiK3INh convert rfc822-to-8bit (ORCPT + 67 others); Wed, 30 Nov 2022 03:13:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233470AbiK3INe (ORCPT ); Wed, 30 Nov 2022 03:13:34 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56914FF9D for ; Wed, 30 Nov 2022 00:13:33 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p0IDe-0008Il-7F; Wed, 30 Nov 2022 09:13:26 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1p0IDb-000671-Bb; Wed, 30 Nov 2022 09:13:23 +0100 Date: Wed, 30 Nov 2022 09:13:23 +0100 From: Sascha Hauer To: Ping-Ke Shih Cc: "linux-wireless@vger.kernel.org" , Neo Jou , Hans Ulli Kroll , Yan-Hsuan Chuang , Kalle Valo , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Martin Blumenstingl , "kernel@pengutronix.de" , Johannes Berg , Alexander Hochbaum , Da Xue , Bernie Huang , Viktor Petrenko , neo_jou Subject: Re: [PATCH v4 07/11] wifi: rtw88: Add common USB chip support Message-ID: <20221130081323.GE29728@pengutronix.de> References: <20221129100754.2753237-1-s.hauer@pengutronix.de> <20221129100754.2753237-8-s.hauer@pengutronix.de> <4eee82341ef84d4aa063edeb6f23a70d@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <4eee82341ef84d4aa063edeb6f23a70d@realtek.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, Nov 30, 2022 at 01:40:36AM +0000, Ping-Ke Shih wrote: > > > > -----Original Message----- > > From: Sascha Hauer > > Sent: Tuesday, November 29, 2022 6:08 PM > > To: linux-wireless@vger.kernel.org > > Cc: Neo Jou ; Hans Ulli Kroll ; Ping-Ke Shih ; > > Yan-Hsuan Chuang ; Kalle Valo ; netdev@vger.kernel.org; > > linux-kernel@vger.kernel.org; Martin Blumenstingl ; > > kernel@pengutronix.de; Johannes Berg ; Alexander Hochbaum ; > > Da Xue ; Bernie Huang ; Viktor Petrenko ; > > Sascha Hauer ; neo_jou > > 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 > > Signed-off-by: Hans Ulli Kroll > > Signed-off-by: Sascha Hauer > > --- > > > +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? My first reaction here was to call skb_queue_purge(), but that is implemented as: while ((skb = skb_dequeue(list)) != NULL) kfree_skb(skb); So basically it brings us into the same endless loop we are trying to break out here. If it was me I would just remove this check. *txcb is allocated once in rtw_usb_tx_agg_skb(), &txcb->tx_ack_queue is added the number of skbs that fit into RTW_USB_MAX_XMITBUF_SZ and here we dequeue these skbs again. No other code even has the pointer to add skbs to this queue concurrently. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |