From patchwork Thu Jun 17 16:01:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viktor Barna X-Patchwork-Id: 12328771 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93174C2B9F4 for ; Thu, 17 Jun 2021 16:11:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74D5161429 for ; Thu, 17 Jun 2021 16:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233893AbhFQQN0 (ORCPT ); Thu, 17 Jun 2021 12:13:26 -0400 Received: from mail-eopbgr60069.outbound.protection.outlook.com ([40.107.6.69]:39392 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233814AbhFQQMH (ORCPT ); Thu, 17 Jun 2021 12:12:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M1VLWVzhoeWXZfDleFoJs9HYYrfkED57NWuxLP1CjVybBstkYo2upqNf42+pVECqnUzmKGpp0JuGxePk1WClcBf8sEjMx/QQkrzxft3uWGXsr0eygZ6PtGocXumySJGjofUrQlzk/wr4RR8gO2D4G9pLGKVaf0dM++M3byluMRZ8CPDCXglJsLBAVODJEavW9RGSCnF4OnV5+pkM+xBaI6bS0a+v9lA9N3WVYDnX6qGxvg65m4Mko/JnxpEVti3WDT+yVzaHqHfm93QbyNQRiUq7eEzN55zV2Pc9UiGr5aXz9UiOQEv0BPNOik7GxbuIk7v6KKCgDQOsEjGtuKKpxQ== 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-SenderADCheck; bh=dAZ2tLeVuYa3nVzqdpOgHTzVLJ5daeSYAqj+xEflJCA=; b=ULcO57WA+8gg6Tf83jTZoQ/Brf11PYBUFyzbxKXtrKdorGsT1ajP3fYjEZMkB9FKlCQG2QTnu8yCak9VhiwP7j5Nneh0NZcfLvc633JZfT75lYV16GBGCXN/MpVe1GG5IyBhDqZdnFgQqba6H6dXwwGRBExLqSh4pRgtI9PqCJ2CJJFBCcPzCzcvq8wHL+YYuzsafhP/3R5IsbWkE4z9v3P+lzypty56a/ep/zAraLsqUtQE3ajj8tFxWxzu+QqJPb948iqH8e8HL17m675iCjigkkQ9qMKLwV1kMAl6ALOnUqp3ZkmxuxuSGOzIxMUUV/fQAifnaGtEk2kLgADUEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=celeno.com; dmarc=pass action=none header.from=celeno.com; dkim=pass header.d=celeno.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=celeno.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dAZ2tLeVuYa3nVzqdpOgHTzVLJ5daeSYAqj+xEflJCA=; b=Rvy18IrMUe+ux+DoCEBT4wJ1RDtlKgT556GyS4/8v0BCBDhSEbclCKJUf5i3xbeKYezT+nxUAbPCNRMst2YmZirNYE77+KmIlbeJB4WyjsIi1CCz+87j5GavZURm2rp2NEQXgwtHGB5TjkCovpv4cau+OpxAA13TvBeUlUNj8E8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=celeno.com; Received: from AM9P192MB1412.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:38b::16) by AM8P192MB1075.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:1eb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.19; Thu, 17 Jun 2021 16:07:18 +0000 Received: from AM9P192MB1412.EURP192.PROD.OUTLOOK.COM ([fe80::1847:5583:4db7:102f]) by AM9P192MB1412.EURP192.PROD.OUTLOOK.COM ([fe80::1847:5583:4db7:102f%4]) with mapi id 15.20.4242.021; Thu, 17 Jun 2021 16:07:18 +0000 From: viktor.barna@celeno.com To: linux-wireless@vger.kernel.org Cc: Kalle Valo , "David S . Miller" , Jakub Kicinski , Aviad Brikman , Eliav Farber , Oleksandr Savchenko , Shay Bar , Viktor Barna Subject: [RFC v1 206/256] cl8k: add tx/bcmc_cfm.c Date: Thu, 17 Jun 2021 16:01:33 +0000 Message-Id: <20210617160223.160998-207-viktor.barna@celeno.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210617160223.160998-1-viktor.barna@celeno.com> References: <20210617160223.160998-1-viktor.barna@celeno.com> X-Originating-IP: [62.216.42.54] X-ClientProxiedBy: PR3PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:102:b7::23) To AM9P192MB1412.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:38b::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (62.216.42.54) by PR3PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:102:b7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18 via Frontend Transport; Thu, 17 Jun 2021 16:06:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b16006e-d5ae-4d5c-31a6-08d931a9d9ba X-MS-TrafficTypeDiagnostic: AM8P192MB1075: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 89PDlJx5Q9E/SVy5wz6X2PrXNIBKAeSeTHyaB/rAoUMhrqQuonyRUWH5R/EAOItEqi/iDmjGXHcT+sr1oQLU1NCVZm4hw6YnuDNARUB6smKo10GbP9i4xHTuZSJ5T4C6B/dB0Bb7ptd+9kQnqFlYJmsmsVvuDhhP/hhOPJTYB/wL4ld8QYOQ7/ncMFHsr81WuGnnQrNPfxZoT7T7epSyLu8YtjPmYavkMgV0ev2lkYTB5+qP7I+askOtQDR1ddKy0d1bQylJrASNmaLu6f+ZRsX3SGDngYqbZlku5Y7MICqNqRqCSopGntsDCWyv61jkI2xV+azXCfSkC5FNDVYJgcp8aqw6hHib6nqh9F3Efobb6FhUw2Um0/UKu7sQi5TvIj5WtgOKyiwjSrXIUyWYr7dZ8hM/O3ZYr/+//T4hHVseP6EjZ77ejr3kgttTu4YtGgCLtXsUXfc+ACpucDbbw2fXX13OCyYBBFNgfhtXxrWr7WRomQOZoGXzCnmtiMLsQ1LmRcfOvtqStGe5O9waES/W86CGCidXPV3dIT+X34fzF/53LlJhrw4pJ7Iuq9e5KYuMh2yOLzBEP7ixUr4gtWMA/HRTXmwXi1jbD16p39OGOdVbLoKzlrjGNajilrHJAx2FdjNPieRMioOvtq6aGicOuLrr5GP1koejb/rjSmu+yG7MDZEQ7vnGfkaIh1ywkTBKixHoT0JASFZauye40Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9P192MB1412.EURP192.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(396003)(136003)(39850400004)(376002)(366004)(346002)(66476007)(6512007)(8936002)(66556008)(38350700002)(6916009)(9686003)(66946007)(956004)(86362001)(26005)(5660300002)(2616005)(38100700002)(478600001)(8676002)(6506007)(6666004)(4326008)(1076003)(55236004)(186003)(316002)(2906002)(83380400001)(16526019)(54906003)(52116002)(36756003)(107886003)(6486002)(69590400013)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U1bitkcaqHgzPlflWAwottwzBduzS2MXLuHt8hlTrPDBs4+zfI9LLUE+xfb7LS0uRk72i4FScz0hmUj/fXfk8RFkLnxFoKPwZqh5YV3ybfXVevF+IJAzL/wQRVOhTVfUsesynW9h89RZTNw2YD1RSqDnngI06WhSfegTqIM/5OLAFe5jn4rm76y5biUToflNl7XdgDqkXj0xMUnlXU9DCMg5gaaOA7ixbiNWxp4dlWTpUTcd4itouQKYKwJ8TkWTR7x1PtTX/KGeIuzVvm7U1pwKH5A6au0SSZXK2u2mbXUhWfCODUd2/kIDMFI3o/ukzCKv113FK3UZtoJUPjbZmd8zDFMJnnImAqki95TuWP0Hxw2tW0KXmS7izwg8/hLZKeMhSnxisy2oXUs/uu6H8RMZY4CNYvcqiFSVjpHeXE+ctuZXJQCVRwSdx2hU3su98Ni9hRbV+re9PdBeEN1I8i1v0GOFOPS3Ik5lZSvazDWRDt4BHQqvpsJAkzsmZzbIf9PK846E4K0zAm34aJ5+dR5qvpK7u1BAnYhj0301ekB6hH082shGAR7d+tZz9761aUME5Evp/RejK+TKSoOwWn0wy6wfauHjs4+jNukzA+s0iltrJTa0tg4GRDaIh9hMtLnX3lV14GO4gz74E+HC6Va9U4FH5jWJNBf84CWlzGAl6NzKCluyjhZQHVHu3ENlX+/TmYVtvs1OxUMA7bL+3g7tjFyBv5IV3DgMC6r114ejmqxTW5CUZ+tfSMrERApGVTvxqDz2we0MuqIzDLWLXPzRBhLnqHMxmjycsMgGoHwn91r7RJ6P7xQbKhP1SmX1uca+VXBTZgAAkxKaquCukbIA7wXHOV/GrgIJYxDWiC+WIByznZfE/kBFMjVLGKc/gqElF+1nElPfEzdjofMrKpqsfI904c2pSbS8p35FIBIDzT6iUTxfvjtgB6wWQsJ/3klKlseJZISvUxu6wGuKUevSZ7ZVySqbi20mW3x6x7TYAywSd4lLYXc6eRlsUThFlEdwRbl0GFguW/Ixy2rwCeJAHTyxUfOyrvHP2U/+1SgS8lshJyoq/21T2/bw41GKJL3b/kQxqfaeKNepMsAIE5CBIFKkO83HBlC2f3gA4NFkzAosjrMp31LSo552AzpLcCOj1XBPD6a5gUMZ5TdJWuHGI0+pY2AKY9DSoWoDZTibaU176FPwBnHpPfGOg5RkMsknmElqlOZxIuVo7C77xPEnaaYxkX6b2E5wHMg2/v6ANL+EQgPCCLlt5PEeB4w4P4/XK8QAzBIpttJlK0hxEh4OszTPTdzw2HOL5RFtG2BYNxloUAHAAVhij4+MzBRX X-OriginatorOrg: celeno.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b16006e-d5ae-4d5c-31a6-08d931a9d9ba X-MS-Exchange-CrossTenant-AuthSource: AM9P192MB1412.EURP192.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 16:06:22.3052 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f313103b-4c9f-4fd3-b5cf-b97f91c4afa8 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a5OrvpeD/UxeOpHA8+bUe0hImjp1UtDa3a47MKNmQyrmdBkZ7s8X2GK7NFYPjtjZnzgkw528LEBID4qLVU8Lrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P192MB1075 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Viktor Barna (Part of the split. Please, take a look at the cover letter for more details). Signed-off-by: Viktor Barna --- .../net/wireless/celeno/cl8k/tx/bcmc_cfm.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 drivers/net/wireless/celeno/cl8k/tx/bcmc_cfm.c -- 2.30.0 diff --git a/drivers/net/wireless/celeno/cl8k/tx/bcmc_cfm.c b/drivers/net/wireless/celeno/cl8k/tx/bcmc_cfm.c new file mode 100644 index 000000000000..bc4bbdf40f54 --- /dev/null +++ b/drivers/net/wireless/celeno/cl8k/tx/bcmc_cfm.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: MIT +/* Copyright(c) 2019-2021, Celeno Communications Ltd. */ + +#include "tx/bcmc_cfm.h" +#include "chip.h" +#include "tx/sw_txhdr.h" + +/* + * cl_hw->bcmc_cfm_queue: + * This queue is used to keep pointers to already sent + * beacon skb's that are waiting for confirmation. + */ + +void cl_bcmc_cfm_init(struct cl_hw *cl_hw) +{ + INIT_LIST_HEAD(&cl_hw->bcmc_cfm_queue.head); +} + +void cl_bcmc_cfm_add(struct cl_hw *cl_hw, struct cl_sw_txhdr *sw_txhdr) +{ + list_add_tail(&sw_txhdr->cfm_list, &cl_hw->bcmc_cfm_queue.head); +} + +struct cl_sw_txhdr *cl_bcmc_cfm_find(struct cl_hw *cl_hw, dma_addr_t dma_addr, bool keep_in_list) +{ + struct cl_single_cfm_queue *cfm_queue = &cl_hw->bcmc_cfm_queue; + struct cl_sw_txhdr *sw_txhdr = NULL; + struct cl_sw_txhdr *tmp = NULL; + + list_for_each_entry_safe(sw_txhdr, tmp, &cfm_queue->head, cfm_list) { + if (le32_to_cpu(sw_txhdr->txdesc.umacdesc.packet_addr[0]) == dma_addr) { + if (!keep_in_list) + list_del(&sw_txhdr->cfm_list); + + return sw_txhdr; + } + } + + return NULL; +} + +void cl_bcmc_cfm_flush_queue(struct cl_hw *cl_hw) +{ + struct cl_single_cfm_queue *cfm_queue = &cl_hw->bcmc_cfm_queue; + struct cl_sw_txhdr *sw_txhdr = NULL; + struct sk_buff *skb = NULL; + struct ieee80211_tx_info *tx_info = NULL; + dma_addr_t dma_addr; + + while (!list_empty(&cfm_queue->head)) { + sw_txhdr = list_first_entry(&cfm_queue->head, struct cl_sw_txhdr, cfm_list); + dma_addr = le32_to_cpu(sw_txhdr->txdesc.umacdesc.packet_addr[0]); + skb = sw_txhdr->skb; + tx_info = IEEE80211_SKB_CB(skb); + + dma_unmap_single(cl_hw->chip->dev, dma_addr, sw_txhdr->map_len, DMA_TO_DEVICE); + dev_kfree_skb_irq(skb); + list_del(&sw_txhdr->cfm_list); + cl_sw_txhdr_free(cl_hw, sw_txhdr); + } + + /* Set fw_free_space back to maximum after flushing the queue */ + cl_hw->tx_queues.bcmc.fw_free_space = cl_hw->tx_queues.bcmc.fw_max_size; +}