From patchwork Wed Oct 4 17:28:42 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: 13409099 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 54E9BE7C4E9 for ; Wed, 4 Oct 2023 17:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243694AbjJDR3R (ORCPT ); Wed, 4 Oct 2023 13:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243717AbjJDR3P (ORCPT ); Wed, 4 Oct 2023 13:29:15 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FE12D8; Wed, 4 Oct 2023 10:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N6XObVHPr0iIOryizxE/4YHBxHulrT5+uD3spZs6bmhWUvOgZVLXg/RTn22QBbG5PvvbjBsehl/o0wjqYDZT7xfX5XHttI0aPF19y1gX6WGfLp18s9s4K+Dxd/3dCsENG9wUInV/K8IWqosxGTSOjRzBxHHUFUgL1ZdIJoqWwVdWNiGTBRmvP/oDmMFORyzkmGFR6MMupp+IwRQ1aUDvjmfYUfieT5xlOUB3DamZ6PqQ7Uu1t/7BSwvyM9a0keZgR5eP++qqpzlPP1CpbCtrgQicJL6G52/t/Wr/DqDj1IB3IXEj5sYVdRD/+05zTPYKz43iUlviHDdrArGMfHTK7g== 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=1rh/r9E/A/YRjMbzISXno2bQizEoygFOyKpFAaeFchk=; b=Qk1ZOrv0f7kwoTHPKshgPVIpWxX20xAac6JnHoLNKTg61sWhjo6vUAmvrD4XeMXi7LRSuYX4lzYpt5wFbWJNzK9+N1vurpdUnxEKyUUwmAQb+hxt1wBN2gNV7FP2BAv//dwAA/NzCmhLtnzKMPCnaxuLamGWbs3gFNkUgH39OhcD9hOKiF17fWyGCKHxmkA0ZIR0oT1mKC9+ATxH4WmGFnTwfzhO2p3VVQYPlcbD15hbQw5P7WfKi0hJvCwmoWTV4fUO0rkmqL3GlWyeMtxhOkQfQCR8Y1WckRADMj6JSrwA6Cr9v21iPGyaGyeqZSz9zKtE5/wdTfEUrq1jah+LDw== 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=1rh/r9E/A/YRjMbzISXno2bQizEoygFOyKpFAaeFchk=; b=MknrLeFf0WGY8vhd3jAM36U3shS0+KkdkDIZd/4udp4Z+wohpfNKLsOtzeL/IxTg7e7m7MK0PjoBZJMG0zOPascE0rm95+z8yCu52aK4D0xnY9w5iPKSEWipCgOjzLOtgyJd/bohn/SNzuLPAeVzD8MP2p7ul/98Ec/E6LYgPHo= 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 PH7PR11MB5982.namprd11.prod.outlook.com (2603:10b6:510:1e1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.34; Wed, 4 Oct 2023 17:29:05 +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.6838.030; Wed, 4 Oct 2023 17:29:05 +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 v3 7/8] wifi: wfx: allow to send frames during ROC Date: Wed, 4 Oct 2023 19:28:42 +0200 Message-Id: <20231004172843.195332-8-jerome.pouiller@silabs.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231004172843.195332-1-jerome.pouiller@silabs.com> References: <20231004172843.195332-1-jerome.pouiller@silabs.com> X-ClientProxiedBy: DS7PR03CA0305.namprd03.prod.outlook.com (2603:10b6:8:2b::25) To IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB7773:EE_|PH7PR11MB5982:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fb6a10d-5f25-40e7-31f9-08dbc4ff682d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kyPQaPDFMKUfLOvajBe+egQxBSL1uLMbLoAvfh8xeD5pPhH9pveGfoQHDCygGXUE2mvaYO6KJJPwuVv6wTbNVbkhJwjbli/6+pc/TAbHUlL9Plu9LThxZ3wgi/zpc73LWCyqkvZrhcHWFhefv+pqJc7kKwduB3SZY5ndiUg/ZIbKvKz4Opc9UEtZ0tAP3ybsc/01xtIMCUooBd+G5kxBFp5o4KG5S2GRMgyIA2Vy17CL9EIaI5PeOaNaQmxxnkSV9Xwk2fFA4ahYA8QjT9+JyEPW6i1FBGfe3jaojYVuTVCwaZVGA2F3CrAX9x8OVSCROgVplfyy134byrAnnvgsP7mEon8r6D9nHu15rMLFyJJgBsQ3Y2r3ta0C7KJQhV/iDti9WW0r5Z37vQanuxTMoUvNEBg0DrF2eWZow05oZ7C+qA3Ez73slMHPeT/5KBW0GgrGUZpK/eLALpWaV7QbnlPrwAGEevtanCI5YvupCRdPtQTcCDaAq3SwtBsHJmt9TQjroEkmXh477Ld32Ej60I2zgYJlkNMVoPXMmAuN7P6uCZK4R13o7KmdOb4O5jhs 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)(366004)(346002)(39850400004)(396003)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(6486002)(36756003)(6512007)(38100700002)(6666004)(52116002)(86362001)(478600001)(6506007)(66556008)(66946007)(66476007)(316002)(6916009)(41300700001)(2616005)(107886003)(1076003)(8936002)(4326008)(8676002)(66574015)(5660300002)(83380400001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?e/INkg8/q+qPAa/hBCGKgQKplRI7?= =?utf-8?q?N8VKPT16rzS/GuxcNnrvVJP+GCZ0hIGuXEfPvUnsO3qnLlAOT5dkCZinRg+quC2TA?= =?utf-8?q?ggWr7u2SHQVCYOFhq9VKeHbAAodr3pQeCYKdFYlo7AbPQ1fCUKch6aS9yHSg1gTJ0?= =?utf-8?q?QUcP6g2rkX/d7MBUTJxU+ufxgnClC17BpUdnUAtxzVmdlSdepWLDgatJ2wJZka170?= =?utf-8?q?+38AuaHrRHcP8LufbJXMUJJ1ilEmMl/jmKjokNzDkZil6RvmaCeyffVsLbWeHLlsQ?= =?utf-8?q?EK44l9lk5rfiofMUv62AxIRHEtK5Vm+RrhBa6z9a2zn1MhuCwdHK95R6Q81y9wgJK?= =?utf-8?q?+jMa02936n4x/fN+1raOUPx8VkiuXzypak7ULMajmSCdOR4x39hymDF30LS5XUL04?= =?utf-8?q?H7bgAsOpF5V8KYHTvgi6VwVGJ2tJ08Fk4e33RigTySD89fK5kZYQvTzdbwkuN3jsl?= =?utf-8?q?bEfKXQQeZGhkR/kHFXCx7A6S1Kw5ZHIMLkL8+3x1lmwNzQMYcPlW0WrL5iycs4wEg?= =?utf-8?q?l+K0csXuE7wJT54E/osTlvFAbZU0Uy5voygSnm9hw8ZegdIx5bbOIAu7Tnry7sW5J?= =?utf-8?q?t3vqWyySetML/B//Mc1GZs6EPAnfSfON+iK2v9LxNQs0T8nuBJ56TJy9AX1dozg3Q?= =?utf-8?q?ac4QPcvCEfQPQsvWykRM5DWUztqZDpbGu2kWsWc/qgEhDsqA/HoEl4nc2RUC2ujhQ?= =?utf-8?q?xXDN6lq4c/ouoywzi8HTPLHZfp5rYV8Ki8qRBmAnHbYXyskzSD4eyqkl2JRm5VEq8?= =?utf-8?q?VhdH9tBArxkG5EmlQ2arnUZH3FipM6Yw+xTYrUP+PXncAJ+/r4yPzc89uJFO7IwMv?= =?utf-8?q?5CpEtUayVxPQyxpV820AhvyYvPqKs5Nvp8PhUz7+LA2KIUBXQ4IQOGlOxsxnxbXzP?= =?utf-8?q?tRyHWl4BJZciRdrrR5TMvo4l/D6MoCSq14867HZIqTiLHQLbzz2h6w0kKUe79MR8c?= =?utf-8?q?YYxLy+EsW0SWuQu028QwIueOVj+qmdKX/WRcV7nOShTHExpKeurlgIlmXbIvsSbfq?= =?utf-8?q?wLOEPjtB07vCb3y+sPckjiYCUBXQmylvrseY0Jw/iCdtL/SIXSknUaVQ0mskJQ4ei?= =?utf-8?q?LLGPSzLc7Lb25oPVMeomEKhYRd26P1kC+cewVwkZgrV1CbzZI8+wLTvAfKLagBNNx?= =?utf-8?q?/fLoW4W9P+jTPRE5tAnwyS4RDxGPpvgsMclbwSzmOS/Mivg0OXj0IJ0ABdnZSLO/O?= =?utf-8?q?8L6BYmQfPYJR4CoIjzCGHspXhaYDIAVg9Sd1Pkh6odjlPAvIV9JIAZwIlilJg6gU3?= =?utf-8?q?338spP4mLaTPUMDUGz2LUnf38WMmACzkcMuR1w1EmgTcLwLP0uzZ8Av2W27j7CG1f?= =?utf-8?q?etzFsRCmp7P7e0IpoJPaaYTxiqKVDXQZ4hcD2J66snUY+qm9jXT1KTz2Krgl2wlNx?= =?utf-8?q?61ezgSY5T2gpUXDMiBrEjM8ALfkg+VXPoiKjvZmmyLJwSd9d0n0bYs3XPwZqOVFbh?= =?utf-8?q?h6r46DoKG6/qTNoQZfzWMynH7z0E8/QIBFRN2K/qh4biJP3R+uyBvmIcG88Syhu7S?= =?utf-8?q?Z4Acl4USwL3THzxof8c9uB/OiAKpohsHTfuqZCDARASArA8hkaNrzIqmPMhYln2rD?= =?utf-8?q?91tV1hFP2YG?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fb6a10d-5f25-40e7-31f9-08dbc4ff682d X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB7773.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 17:29:04.8518 (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: FtF1Yl9CzIFNQItwMP0uWItK6/68l9ITl5glGfq05BOG/I6OHf6QpkWVIE7PmODgDBgalGnRE7CXliKPOjlEOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5982 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Until now, all the traffic was blocked during scan operation. However, scan operation is going to be used to implement Remain On Channel (ROC). In this case, special frames (marked with IEEE80211_TX_CTL_TX_OFFCHAN) must be sent during the operation. 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 | 38 ++++++++++++++++++----- drivers/net/wireless/silabs/wfx/queue.h | 1 + 4 files changed, 62 insertions(+), 15 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..e61b86f211e53 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,26 @@ 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; + } + } + + if (mutex_is_locked(&wdev->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; };