From patchwork Mon Aug 7 15:05:40 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: 132231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1565541vqr; Mon, 7 Aug 2023 09:29:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHji7JJiECluaCGGj3WeYMbsMTSbs9oCtwxFGlHcx/jwR/OTEvNN3AYvA6Ir8aVHbzDBUdW X-Received: by 2002:a05:6a00:b43:b0:686:b5c9:c527 with SMTP id p3-20020a056a000b4300b00686b5c9c527mr9349875pfo.17.1691425781133; Mon, 07 Aug 2023 09:29:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691425781; cv=pass; d=google.com; s=arc-20160816; b=WNg+MumkGomY2mb5uax5ZDDZ7zz0k53prwy8dqDB7/40oeygfencINw0XaPyie07HD kVrAUq6H0NwfaUEdTLbd/hDSeVK4SCHgPjQsgrydIytcDJXwoXdAuhKu+tNQ2zROwvZp C3lSZvtQHAizXbnKa/7yeTMDDQRcMU12iBliiJbmhl70FBDPiuQ6S8sdkVX/3VLdi6mk 3jlZQA0je51/ZCZIetetT1yKADRuVbUTBxUXfWvqFAqmeekbF8/cSmfGFoYaHPCnSZN/ vdZAbIAazUydSixcW4FIWjTwfHSNql9nA+MI4MMpN2imIy3bfs5xIjpW+Ngf7JP31WYP HuGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dp9W8JpkBsJI+8roWiTaciR4U5Smckb0Rvxk9abqBoo=; fh=JxyQ9cOxFJCXit3b6bV33e45OVX7DLo5Wt+gwsJ5HK0=; b=yma5V0qxU+tW2pcq2L62mjKh87xmsAd4aBcvo29wIsWdY4rew24dJ8nolZnsxDr0kM NPoynGnGfxTqdqdQffHT814Enf8mcA7+YDmLDpK4UeMXHRYg12S+TsEcnCwdalj0ls7J vyG1f3AeRIqaIKv4dkbJT/zjn+6udhQej233E00t4/JKZeuAHRznU7yIgCn5UaZYd8pI imGwwMwOPoEjwiazUWaUvwIQc089r859xJeh4s5qeJPSQAFe5rxGjfMBFe5w4qHlyBBb LAE+Y3SuDK1eey9kbL7mYmH9vzsFPSWTynPNNr37ptNI+qZTo9c3/BpbVekl7Qz1bCOJ Q+nA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b=HM77YneN; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=silabs.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu12-20020a056a00410c00b00682399fa4f9si5845149pfb.300.2023.08.07.09.29.28; Mon, 07 Aug 2023 09:29:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b=HM77YneN; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=silabs.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbjHGPGe (ORCPT + 99 others); Mon, 7 Aug 2023 11:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjHGPGO (ORCPT ); Mon, 7 Aug 2023 11:06:14 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2081.outbound.protection.outlook.com [40.107.223.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BA910F6; Mon, 7 Aug 2023 08:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ml5IPmXPU/x0fxeOfkqN5XV3LE2vn3V4GawZDCFixg+0c3rGM9w04ZPdNjfkNNwMXPTYGH9pAIlnTy/VAaz/bf2Ehtamj15/KvYyHfdmkOAqRciBCqlDJflAN5BdS9a5VfFUrYgZEzEgd83ZyZHIxA5RiCtBZChGfSgi3TJLlS4JH127urUFr/cmhluShgztFz0q99y+bcLwkNyJX975dGxANyTYEeBv2Fhje997Xavkm3Uee8H5L7ooVyKeOJ2CxyqN/SnPPzG5fzzmwC5nLmZQH8J+5QtgcUGMS4GTWH4sezAkyLKCYc62LjRkW4eS/QfkPNWEHXgxsGA8SXOEJw== 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=dp9W8JpkBsJI+8roWiTaciR4U5Smckb0Rvxk9abqBoo=; b=V0vn/SYIFS1Ro2+E4v54zW+Pgio1dSoJ97w3bL5UCKErKRpQNUVkNE9+ySikwoE+OpIr9BiMg0oHlz/3lECgHi3RA+vC5k9jqIDh113Nw1X1/IymMyyDHmf8zQJVekeMLFIEnCtulZN1CeFQ+8dUgF/EZMFMo9N8XSy+WIRsvzfLp/WgmuGsMBTdqWKfnhIqUm8bTs1immg2sdAYmE07mulOTCmksOlJ+aobM0mq+syCHPbtJ1nVCKYdRvKTIxCTgPt39qsDyJYejbc8m8NpyqFyNq/LhF4bKZGIIUG1dxH2kWRS4Z9xM3KQ5b2Lll9JSvLqiA+HG0lZ5Zov+VkO4w== 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=dp9W8JpkBsJI+8roWiTaciR4U5Smckb0Rvxk9abqBoo=; b=HM77YneNxRHJVvWdwdO73WZVSAy4WysNB6EFj/q9IF4QrqkCYHguWlggvs2rEmA4Obcfqm15/krNPHW9R8Fdk7TosOZhfH+4niaMaavXQQZbEOlqfOvz4//h1kffzOY7v5TJ9Jg3D7jIE2iyC9tLJpAE9mLSq7XFqaXzY6NRQfA= 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 SN7PR11MB7590.namprd11.prod.outlook.com (2603:10b6:806:348::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Mon, 7 Aug 2023 15:06:10 +0000 Received: from IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::14b1:be6e:19a3:2eca]) by IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::14b1:be6e:19a3:2eca%6]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 15:06:09 +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 7/9] wifi: wfx: allow to send frames during ROC Date: Mon, 7 Aug 2023 17:05:40 +0200 Message-Id: <20230807150542.247801-8-jerome.pouiller@silabs.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230807150542.247801-1-jerome.pouiller@silabs.com> References: <20230807150542.247801-1-jerome.pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0252.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100::24) To IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB7773:EE_|SN7PR11MB7590:EE_ X-MS-Office365-Filtering-Correlation-Id: 3df57d7a-3f72-4bc0-502a-08db9757d525 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oQMGDUUR9IbmZhkmvvnI3EWmW22Rh67IQUjtE6XW9LBWBuGn9qoYwMBf6+dQaePrqU9aSvfpiOPXx+L7FtQCczgpWEOWfvzO3pGxnVRUA3rMbMrNPO9+Z3qhrdQDfkVwBm/6ctJIV20PR6gArWPSIDYKm8RxfqcYcNC7pzPoMUh8qtJi7NeFLf+8a3tU/9Bw5j70q1fRGjS9kXv6JQRdjCu3NTTOKPHDce3m/Zjnr1vBRDYPzaLzCH8NvnAiyTJmOQCX+9jVtfzGvDGQK6HChtabTc4VvmjsrHzfnfTfNUnMnRk54/n90VnaDEJZr+zXOF+v8JaxmExD1ozFxzgUNGwXKE35X/EgRDf0rdc3TJwGioEuuF2N2pYUr9UCSxPDfD+EG6j2hZGBicoU+gI0OXCeg4fiIXLyeLR59hR2fhpL77SB/RXPCtT2u2IPrpVpd9n7ARBtuktPpw0PohVsZJ0cUoksi3QXIZFI+uuCpCAWgZ9/SWm3NZaG6KI+kTwwwk6ReO8TbBHOYsfYpTCPBugl7LkO9GthdDIi29SR6OUbxXldn1jyOoQZCux4u52Ymavrrpfi3sp/RhgSL+6HZwVwNAF2hGmFM0O3D4/dY84t9d3ymm9wDrVjVZiX3Okj 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:(13230028)(136003)(39850400004)(376002)(346002)(396003)(366004)(451199021)(1800799003)(186006)(2906002)(4326008)(6916009)(66556008)(66476007)(66946007)(6486002)(52116002)(6666004)(66574015)(83380400001)(5660300002)(41300700001)(8936002)(316002)(8676002)(30864003)(38350700002)(38100700002)(2616005)(478600001)(36756003)(107886003)(26005)(6506007)(1076003)(86362001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?uanR8lOmhu7P8ZY435YZLdRYYNle?= =?utf-8?q?uNGBJAVO3MAHyIDTF76sIZWlSZy5tHeqAUCTsG69AxCTX0Ull6aAH65WCFQKdehx8?= =?utf-8?q?kYVgKS2D+w2lxs0+5n5H+rciF2Hj7bwwnITyyuuuh/Rp2sDimk25pUl0eCMzI0A34?= =?utf-8?q?kBw8tOHEwhaY5SaB/PQinYZAnWMjCDleQJGScFQcJgh2kJAmW0VODWD4vrtZUCR5Z?= =?utf-8?q?S6tpb5/jtKVzuqcigUOdvXDK8aGnPbe6C0bNKHc7rm4P8PnjXqZ58hONYoOA4tXW/?= =?utf-8?q?PqxXzjv5HZoZ3kWGjO4/IiW2CZxt+MmobxJhtiEQGFBnQ3UG3zMhHU5kibDejkRzs?= =?utf-8?q?qNTENocQ7Ym+U8/m9qY0IOZxsV+nqSSIL/pvcTC/WpRSlp0YCy1hhjRSOYEdhI2Yl?= =?utf-8?q?NlD+p2683jcAZ5vEfMq2cNjYOh5FPHSILAC17Im4Nu6DRicNBNRXdaygmB7FEsRxQ?= =?utf-8?q?dVrLaIuhGlafVZ9/ZGAb1wM8FEUTZXYP9TXCQXkUABVRbqUH/rxZiNPllZd6frv8q?= =?utf-8?q?hQhxW++8+sdJsvwo7fGxOQ2Qp3McwD1can7EVFhgQhRGk04iDj8t+gd4TP9jSPbZ/?= =?utf-8?q?xQquKcJmFbClkfxED2PXQKvZK5JuE37hMuNMlTTyBy1zRdXljIsjBR9gSGkeGHlPl?= =?utf-8?q?OjaT3YGMeb+G+7qOPddf6p+YnJZz6kzQzXceIz6WH9yYefgNobSDMosMTlpLFwen8?= =?utf-8?q?oQ6RgxAxhq94fnWW67PaldDPyHBKTzmOk6N050bBxg1jSh7PkeQj9lnRvc/qWeaUI?= =?utf-8?q?qYA8lF9hT9xCdOYr2vfGdrWaC1D/YESnFf6T+iCQJK/XfcB4SnhtRSTHfmVxPVylF?= =?utf-8?q?Y4Wtojo1PxFq+JhhtNXXEfkZAqcA5s6aiD2lBwsbvb1qZaaLGceBDflQHmWFGhJVk?= =?utf-8?q?MnOU/cE3a4JcRegVIvycuRhjXPaw4dOUsMAV3MboLgCcDiFEKnyvwbjLSMHSysJpP?= =?utf-8?q?/kwtrfAFH618xq6Rs4GweOALMoRq6PDM4ESe4UDBZ50xY/QlU36ldArgmF4MmXLQe?= =?utf-8?q?yQUh0Bw1pdG5K3l48yZo1S6pRQBuigB8+91gKKqnmTzUgZQthnvinh1+hgVADPUtF?= =?utf-8?q?ozGql0YzTFPDgZEp7dkFkl6As7bTsImV7vIgIrbY7QbCVg0J4AXLTswu5qsxphqOD?= =?utf-8?q?Vm6EW0wxQgXgy5bS1rJ+reO6v9zpo+E2pCyIC9TYasn3mfw3Y9+1h7hYT2ZLjitem?= =?utf-8?q?SwYxr7XW6X5ZtfuT2SDc6naC+BMYmmGdQDXLrv4f4Tm9B05BAHUPbjwEfu0bHWn7c?= =?utf-8?q?fm/tapXbbLjjgq24SSzziweKLVb1yrvvtCgwtpTge+e16Jjxt/+I2WSqZpA1Di1/x?= =?utf-8?q?rbkSrxtRQJ0zYsCZOQjqjy50k2qnDkl7efcWGJPHH1fCNtxumDDe/LRgQbA5UvWIn?= =?utf-8?q?n+ZHEiQrJOq+HAL5upWXKoAL6E0OH8PTlSzGWkybCwSNaumba/+OxGs0Ls50gLAhy?= =?utf-8?q?jivOPyPopeqnVQsgq3eYtoTirzsiKx4CNXNXxwSCOGIorDMBcSbDlS4rYmVXKhk2N?= =?utf-8?q?6YcOy0uTQkVc?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3df57d7a-3f72-4bc0-502a-08db9757d525 X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB7773.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 15:06:09.8545 (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: EvZelWq9GO//d4OoOVIiG34b10X8uDvKFpGeWGeymz2IrSi5CAIQ+OPAnGkpRPQafckjytU9o6JKrLeB4Fd+QA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7590 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_NONE autolearn=no 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773588479513616023 X-GMAIL-MSGID: 1773588479513616023 Until now, all the traffic was blocked during Remain On Channel (ROC). This patch allows 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,