From patchwork Wed Sep 27 16:32:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 13401366 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD038E82CB0 for ; Wed, 27 Sep 2023 16:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232040AbjI0Qdp (ORCPT ); Wed, 27 Sep 2023 12:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231991AbjI0Qdl (ORCPT ); Wed, 27 Sep 2023 12:33:41 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2088.outbound.protection.outlook.com [40.107.237.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54B5F12A; Wed, 27 Sep 2023 09:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UuZz5+pn/0pmsBDsJfjOiaHQGV/AFp2xVuJXfj4TJrivqfikQzDOY5zrOtnm6T+0Li5qrfO7trytRu89/icdrG1jwMQc7N/DM955/dNO2LvCicEQ1c1sDFH38mq//PVqVjUc9DwaKoovCEW0jLVig9/0wzlw6+nOJZKU2Zw7hjXhjwl3hHJozzhsEQQc5sVA/kmuzsgPDJpNXHKWdJpCwi5951G/Gb2rqOMk+cftd8u/bN/hoDEWoSzyTn5ocMlSFxTAqP7Iwd7Ja6e2dDhJnyinaJBFX9Oztq9fcLXrOYVwNWYw95788ct7GExdCtQNknH2P1FvIAFcw57PKywRxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mmMx7g757frUoJqf1Hvr6WQSffZEn9STezwVQ6/pcuU=; b=kOqV6KSueCUhaxYUgG6V3zKg32PcVh1aSA5zdIQipkrXD/r4aubc0u4DO9I3HOuVhXFuIctESZoIXsG8eZKkeQCR7RczrGSDAL/GndXKNrb0KUsX5atFMPJ7JJSQjmnBdox2KNgwW66EMPx+rVKx9JWFeAGzyvd6Xw2gIRn0iM4XZzoc2eifkHmQ4F5NTUGaNRoUK1t+myH0djs6n9VVCJSlIgPEIEAyTsjjHM8eIt8J8Kx24K3LIusUwGZ0o89Ahy7yPqLb90lAUzXrpuKSj5qrCeGbM/BhkfCZpfb7zElQTPRVtNYHe/9mpusYeODxiYpgBqSh2cQqdb+J3NR/Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mmMx7g757frUoJqf1Hvr6WQSffZEn9STezwVQ6/pcuU=; b=N00L7h6E4F0xmWo4x7Lihhr7IFSLfAoovl+tSOm0y2nvXNWbMDrS6mgTkuJrUH7InHCtu6lh9IoifVX5lmiFdTGFHKfS/gw4PUU02fYGy8XWlcgWmqDFxF8f+f0IMPrKbhVUMqtCn8eOqgo6purqA1egAcmwoThh86fDEUjz8l0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) by CO1PR11MB5041.namprd11.prod.outlook.com (2603:10b6:303:90::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Wed, 27 Sep 2023 16:33:26 +0000 Received: from IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::d6c8:4cb6:2594:d8f3]) by IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::d6c8:4cb6:2594:d8f3%4]) with mapi id 15.20.6813.027; Wed, 27 Sep 2023 16:33:26 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= To: Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 7/9] wifi: wfx: allow to send frames during ROC Date: Wed, 27 Sep 2023 18:32:55 +0200 Message-Id: <20230927163257.568496-8-jerome.pouiller@silabs.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927163257.568496-1-jerome.pouiller@silabs.com> References: <20230927163257.568496-1-jerome.pouiller@silabs.com> X-ClientProxiedBy: DS7PR06CA0052.namprd06.prod.outlook.com (2603:10b6:8:54::30) To IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB7773:EE_|CO1PR11MB5041:EE_ X-MS-Office365-Filtering-Correlation-Id: 43ec9c46-2c9e-4315-55f0-08dbbf777974 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OWOZlvOf4J170INfhduFB5XxSpYZL0BEWwl9zkKmvHHwCqp6gNk9GoRjUKY9PrIclz00C1uRb9lSwE+Y1GLnsldD7CH0ppfCfclCoaSIprAodovNwXWbdbM1EVz39eycGNLQrUNMcNiIFV9CQfk/EDhzk+DAqLHIuZP0Sgo72M67B3aCfHYTwiMQTiTxK154HHriH5BeSc9ev18++KB0Q4+FFrkjwVPbHCUvBTsMOa4vGLHY/xA/Y/eP7N1+l8aEB3FcHkJ9lyU3lIWnkqXQC67AP36W64Uoo3Vzj79l9fg9TWKVKdMxkWmjCg1P6OI+Frk0LQwopi5rS0uLjSagdxRMFOezDW0EEiESyFr/xjh+7u/fzjUutkCglyHrUXlsTzng8GFlb+Q9E9e/WKypuH3Yt3Fpz6gAbyWJiouhWXf6wekTjMV0qPaLJ113oCcEIMAWRl64vBIIW4mn8tM7fkEc2b8/fVeR9Pnq3b9F/ifX+EudQU7AMnylkHMDJ7HnW+b/re9h0nkgXOcgcdRV9EdCh1pYzeCzn0eS8c5Aj0+sPiGp/0EzVIeITCWHTPuA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR11MB7773.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(136003)(346002)(39850400004)(396003)(366004)(230922051799003)(1800799009)(186009)(451199024)(6506007)(107886003)(66574015)(66556008)(66476007)(6666004)(1076003)(86362001)(6486002)(52116002)(6512007)(478600001)(38100700002)(2906002)(83380400001)(5660300002)(316002)(6916009)(36756003)(8936002)(8676002)(2616005)(66946007)(4326008)(30864003)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ugBw9dnXYp0xlqOtxJEZwyZJoHay?= =?utf-8?q?68JO/HtMR96n7eI7RwG9MvgzCoGPfKfwvQA7AZZxKu04RjL3f3VHg4C2/rsp7S8tl?= =?utf-8?q?l01nGvje/Dqei5HrTqHCRtTKlB5INrXQd5/LUnTbTMz4jRYSwYRdEEpQBHXotbX+0?= =?utf-8?q?s0iomwjvVJ0Tz08Yhshk+TfwKgt4XRSazyu1JvF0alTvXMDaPiAYCB9ZSjGa5BxNO?= =?utf-8?q?kkICwdpEPLAr8nkWGfbH9shceHXIoxaLgFELx2WrJZhos9uOUwSvXfilMtYjoqdT8?= =?utf-8?q?GwVOnNWaoe8/sE4fV/3ntJueLW2G4FKspNk1zjZlYGrCX9L25H6fTXF3SO1JoPLPm?= =?utf-8?q?bloN0Xoy8P8ei5MTBeNeSNEHE0f/e3WuMgJQQRIedwvxADWGkLsUQqB60aco7WZyL?= =?utf-8?q?2ear3bZdGLROH/ajabFnCfBAhWaUG5ztpOcF5veEo97k+GLiaa+NVODm5lmKef9Vu?= =?utf-8?q?PY+lIs7RXSNezv7duE1wxjmpCI1R01ahD+pXYfNxvKZAwm2nZb0pdFdsghfiyuMyy?= =?utf-8?q?+I4rhNuzpLMcOg4ShAyCfG9zWMGyrFyob2a21XMP2MQpEBM7H0IkVWqnFm3TBowHC?= =?utf-8?q?aAf/TTtYE2xj3/6AKosWzj1/ELRQnUp/Q7+lc6XDnJ2SmWpD7kv1ofwcQhGF3pc3/?= =?utf-8?q?rnDFpxXACB6hburpjrWgOcUckIrDmRHTPN9rGQQhu4GMVvyYwUY0XRh/WObU7gU9x?= =?utf-8?q?WSwbCZK+VDegRsM6iB6bm6QLd4+kaIVKzuWzgxKKg3XHsCOp+pUYUJTxqJfgX0MmJ?= =?utf-8?q?KyiwEkzP5U0umWZ+IQo1Tm5scuY6shhQgApx3HwWmLLV1S/f+g58GMaJQ2z3xO2vy?= =?utf-8?q?mdWAzUgLH2X3JdnQLDDKvbgjy/7eAXBz2IQ8cvqeY43f8BD0ccEtIaVNElq7yfh8S?= =?utf-8?q?bid9edutCoKz3Uvx2kKI/RmhNIv8C5tC/WskU8Kyab0ibyrvWmg8JtGXDUAxiUBCP?= =?utf-8?q?BB1bggnDPYw49RgtDBSar4EmSQJoIh/iA0EkShX+HhwJ2Z3TRlcKpHFGHrqdJJ2r3?= =?utf-8?q?lzsJ+jSeSbKDp4M8oSvOOwSvx2ryAyZ2WP3biuXcaEN1E1os5Jjk8MGRsupslv59j?= =?utf-8?q?QbQXK3tvbBi6lBYb7KZa24P3KrHRc6xWjG88KnVTGYsy2jSgReBapOuzY97/f0ayu?= =?utf-8?q?4UmuhtH8LlGKlLsTgameZ34/V6SVFf8yO1HD7/dR6vmeAXJX/Xp8YnYSqX31MPDpc?= =?utf-8?q?EEKD9GUuiQ/q+2HhcaN8rly8/jjEq7Ezv/kp+QTPpirve7A0n1IQAFjn9tSJLazRa?= =?utf-8?q?cJjxFkNN6c6jSFmfN4eie049ts9IB2g2nGlY/nJT8Eeivdw1gPJtpSKfk1JJhGsCM?= =?utf-8?q?MQ67wrFkELB6I13GLdTLUZr2qpPjgclnzgBzZ1I9QDJiHZ3ey83xzwy1c307G26du?= =?utf-8?q?Clvb3+7V5EvepQFM7J4/MajXT10mk+1O1UqZqtMsPGntWBnsYVhuAWpHpEXbCRVqr?= =?utf-8?q?jqVDT8K1tbJhQLm5hDhbqpPsELMuJhYTS91SgesYp8zi9EroaFSYjJf4GxIhgoMPe?= =?utf-8?q?Zduq9aB+uLsnOB6vLK2Rx0p+ovj8+ez2mYuIEiFqmHljyjwd351+nfa8lBTspZWUO?= =?utf-8?q?Dr2j2v/jU2u?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43ec9c46-2c9e-4315-55f0-08dbbf777974 X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB7773.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 16:33:26.5205 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: u4CjXRwCfhFR6QBKPjmfaPMi5KtLLNfmawyMM4Aysuq4fEsBmhMB0R0ietJwkFi8i2CCy6aj7qQcUJxrDWX+kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5041 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Until now, all the traffic was blocked during Remain On Channel (ROC). This patch allow to handle IEEE80211_TX_CTL_TX_OFFCHAN frames. These frames need to be sent on the virtual interface #2. Until now, this interface was only used by the device for internal purpose. But since API 3.9, it can be used to send data during scan operation (we hijack the scan process to implement ROC). Thus, we need to change a bit the way we match the frames with the interface. Fortunately, the frames received during the scan are marked with the correct interface number. So there is no change to do on this part. Signed-off-by: Jérôme Pouiller --- drivers/net/wireless/silabs/wfx/data_tx.c | 36 +++++++++++++++----- drivers/net/wireless/silabs/wfx/data_tx.h | 2 ++ drivers/net/wireless/silabs/wfx/queue.c | 40 +++++++++++++++++++---- drivers/net/wireless/silabs/wfx/queue.h | 1 + drivers/net/wireless/silabs/wfx/scan.c | 4 +-- 5 files changed, 66 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/silabs/wfx/data_tx.c b/drivers/net/wireless/silabs/wfx/data_tx.c index ce2b5dcfd8d89..e8b6d41f55196 100644 --- a/drivers/net/wireless/silabs/wfx/data_tx.c +++ b/drivers/net/wireless/silabs/wfx/data_tx.c @@ -226,6 +226,18 @@ struct wfx_hif_req_tx *wfx_skb_txreq(struct sk_buff *skb) return req; } +struct wfx_vif *wfx_skb_wvif(struct wfx_dev *wdev, struct sk_buff *skb) +{ + struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb); + struct wfx_hif_msg *hif = (struct wfx_hif_msg *)skb->data; + + if (tx_priv->vif_id != hif->interface && hif->interface != 2) { + dev_err(wdev->dev, "corrupted skb"); + return wdev_to_wvif(wdev, hif->interface); + } + return wdev_to_wvif(wdev, tx_priv->vif_id); +} + static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct ieee80211_hdr *hdr) { @@ -352,6 +364,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct /* Fill tx_priv */ tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data; tx_priv->icv_size = wfx_tx_get_icv_len(hw_key); + tx_priv->vif_id = wvif->id; /* Fill hif_msg */ WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb"); @@ -362,7 +375,10 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct hif_msg = (struct wfx_hif_msg *)skb->data; hif_msg->len = cpu_to_le16(skb->len); hif_msg->id = HIF_REQ_ID_TX; - hif_msg->interface = wvif->id; + if (tx_info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) + hif_msg->interface = 2; + else + hif_msg->interface = wvif->id; if (skb->len > le16_to_cpu(wvif->wdev->hw_caps.size_inp_ch_buf)) { dev_warn(wvif->wdev->dev, "requested frame size (%d) is larger than maximum supported (%d)\n", @@ -383,9 +399,15 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct req->fc_offset = offset; /* Queue index are inverted between firmware and Linux */ req->queue_id = 3 - queue_id; - req->peer_sta_id = wfx_tx_get_link_id(wvif, sta, hdr); - req->retry_policy_index = wfx_tx_get_retry_policy_id(wvif, tx_info); - req->frame_format = wfx_tx_get_frame_format(tx_info); + if (tx_info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { + req->peer_sta_id = HIF_LINK_ID_NOT_ASSOCIATED; + req->retry_policy_index = HIF_TX_RETRY_POLICY_INVALID; + req->frame_format = HIF_FRAME_FORMAT_NON_HT; + } else { + req->peer_sta_id = wfx_tx_get_link_id(wvif, sta, hdr); + req->retry_policy_index = wfx_tx_get_retry_policy_id(wvif, tx_info); + req->frame_format = wfx_tx_get_frame_format(tx_info); + } if (tx_info->driver_rates[0].flags & IEEE80211_TX_RC_SHORT_GI) req->short_gi = 1; if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) @@ -501,7 +523,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) } tx_info = IEEE80211_SKB_CB(skb); tx_priv = wfx_skb_tx_priv(skb); - wvif = wdev_to_wvif(wdev, ((struct wfx_hif_msg *)skb->data)->interface); + wvif = wfx_skb_wvif(wdev, skb); WARN_ON(!wvif); if (!wvif) return; @@ -563,7 +585,6 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, b struct wfx_dev *wdev = hw->priv; struct sk_buff_head dropped; struct wfx_vif *wvif; - struct wfx_hif_msg *hif; struct sk_buff *skb; skb_queue_head_init(&dropped); @@ -579,8 +600,7 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, b if (wdev->chip_frozen) wfx_pending_drop(wdev, &dropped); while ((skb = skb_dequeue(&dropped)) != NULL) { - hif = (struct wfx_hif_msg *)skb->data; - wvif = wdev_to_wvif(wdev, hif->interface); + wvif = wfx_skb_wvif(wdev, skb); ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); wfx_skb_dtor(wvif, skb); } diff --git a/drivers/net/wireless/silabs/wfx/data_tx.h b/drivers/net/wireless/silabs/wfx/data_tx.h index a5b80eacce39a..0621b82103bef 100644 --- a/drivers/net/wireless/silabs/wfx/data_tx.h +++ b/drivers/net/wireless/silabs/wfx/data_tx.h @@ -36,6 +36,7 @@ struct wfx_tx_policy_cache { struct wfx_tx_priv { ktime_t xmit_timestamp; unsigned char icv_size; + unsigned char vif_id; }; void wfx_tx_policy_init(struct wfx_vif *wvif); @@ -47,5 +48,6 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, b struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb); struct wfx_hif_req_tx *wfx_skb_txreq(struct sk_buff *skb); +struct wfx_vif *wfx_skb_wvif(struct wfx_dev *wdev, struct sk_buff *skb); #endif diff --git a/drivers/net/wireless/silabs/wfx/queue.c b/drivers/net/wireless/silabs/wfx/queue.c index 37f492e5d3bea..b5975d18f09b4 100644 --- a/drivers/net/wireless/silabs/wfx/queue.c +++ b/drivers/net/wireless/silabs/wfx/queue.c @@ -68,13 +68,16 @@ void wfx_tx_queues_init(struct wfx_vif *wvif) for (i = 0; i < IEEE80211_NUM_ACS; ++i) { skb_queue_head_init(&wvif->tx_queue[i].normal); skb_queue_head_init(&wvif->tx_queue[i].cab); + skb_queue_head_init(&wvif->tx_queue[i].offchan); wvif->tx_queue[i].priority = priorities[i]; } } bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue) { - return skb_queue_empty_lockless(&queue->normal) && skb_queue_empty_lockless(&queue->cab); + return skb_queue_empty_lockless(&queue->normal) && + skb_queue_empty_lockless(&queue->cab) && + skb_queue_empty_lockless(&queue->offchan); } void wfx_tx_queues_check_empty(struct wfx_vif *wvif) @@ -103,8 +106,9 @@ static void __wfx_tx_queue_drop(struct wfx_vif *wvif, void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, struct sk_buff_head *dropped) { - __wfx_tx_queue_drop(wvif, &queue->cab, dropped); __wfx_tx_queue_drop(wvif, &queue->normal, dropped); + __wfx_tx_queue_drop(wvif, &queue->cab, dropped); + __wfx_tx_queue_drop(wvif, &queue->offchan, dropped); wake_up(&wvif->wdev->tx_dequeue); } @@ -113,7 +117,9 @@ void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb) struct wfx_queue *queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) + if (tx_info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) + skb_queue_tail(&queue->offchan, skb); + else if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) skb_queue_tail(&queue->cab, skb); else skb_queue_tail(&queue->normal, skb); @@ -123,13 +129,11 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) { struct wfx_queue *queue; struct wfx_vif *wvif; - struct wfx_hif_msg *hif; struct sk_buff *skb; WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", __func__); while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { - hif = (struct wfx_hif_msg *)skb->data; - wvif = wdev_to_wvif(wdev, hif->interface); + wvif = wfx_skb_wvif(wdev, skb); if (wvif) { queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; WARN_ON(skb_get_queue_mapping(skb) > 3); @@ -155,7 +159,7 @@ struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) if (req->packet_id != packet_id) continue; spin_unlock_bh(&wdev->tx_pending.lock); - wvif = wdev_to_wvif(wdev, hif->interface); + wvif = wfx_skb_wvif(wdev, skb); if (wvif) { queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; WARN_ON(skb_get_queue_mapping(skb) > 3); @@ -246,6 +250,28 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) } } + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + for (i = 0; i < num_queues; i++) { + skb = skb_dequeue(&queues[i]->offchan); + if (!skb) + continue; + hif = (struct wfx_hif_msg *)skb->data; + /* Offchan frames are assigned to a special interface. + * The only interface allowed to send data during scan. + */ + WARN_ON(hif->interface != 2); + atomic_inc(&queues[i]->pending_frames); + trace_queues_stats(wdev, queues[i]); + return skb; + } + } + + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + if (mutex_is_locked(&wvif->scan_lock)) + return NULL; + wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { if (!wvif->after_dtim_tx_allowed) diff --git a/drivers/net/wireless/silabs/wfx/queue.h b/drivers/net/wireless/silabs/wfx/queue.h index 4731debca93d2..6857fbd60fbad 100644 --- a/drivers/net/wireless/silabs/wfx/queue.h +++ b/drivers/net/wireless/silabs/wfx/queue.h @@ -17,6 +17,7 @@ struct wfx_vif; struct wfx_queue { struct sk_buff_head normal; struct sk_buff_head cab; /* Content After (DTIM) Beacon */ + struct sk_buff_head offchan; atomic_t pending_frames; int priority; }; diff --git a/drivers/net/wireless/silabs/wfx/scan.c b/drivers/net/wireless/silabs/wfx/scan.c index 57a2d63dd2a62..817eeb3aa8bff 100644 --- a/drivers/net/wireless/silabs/wfx/scan.c +++ b/drivers/net/wireless/silabs/wfx/scan.c @@ -160,7 +160,7 @@ void wfx_remain_on_channel_work(struct work_struct *work) dev_info(wvif->wdev->dev, "abort in-progress REQ_JOIN"); wfx_reset(wvif); } - wfx_tx_lock_flush(wvif->wdev); + wfx_tx_flush(wvif->wdev); reinit_completion(&wvif->scan_complete); ret = wfx_hif_scan_uniq(wvif, chan, duration); @@ -178,9 +178,9 @@ void wfx_remain_on_channel_work(struct work_struct *work) dev_err(wvif->wdev->dev, "roc didn't stop\n"); ieee80211_remain_on_channel_expired(wvif->wdev->hw); end: - wfx_tx_unlock(wvif->wdev); mutex_unlock(&wvif->scan_lock); mutex_unlock(&wvif->wdev->conf_mutex); + wfx_bh_request_tx(wvif->wdev); } int wfx_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif,