From patchwork Fri Feb 11 16:26:58 2022 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: 542072 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 83F1FC433F5 for ; Fri, 11 Feb 2022 16:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344627AbiBKQ1d (ORCPT ); Fri, 11 Feb 2022 11:27:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244685AbiBKQ1a (ORCPT ); Fri, 11 Feb 2022 11:27:30 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061.outbound.protection.outlook.com [40.107.93.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA5B3B0; Fri, 11 Feb 2022 08:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MsBd9tEfyQ9RBevuljecYHaL60YkWDGRLS1d+/k5z64GPw8+gGadtmW7VrHboL274S4dFJw2lYOUfr8fzaO0cxI4BY0YPEYGpzc7sLd8MtsPTxgtw/Lvr+O4B8RpWbpyya6BsPPEWSL0ENmr1E8SA3juiUP/lmqfKdzki6jYEJEtFgZQRXl1vh0odl+nYBsgOnOT5Zsi6aB+vYqfRPkAn/rZjY13OJfX6lLezWS8soclA1KV9niP5PMgDpohLUyXqER6wxSdQP/LQNc4+sBEG3VNr/3F+RJFVM8n9gK7RfbV6hcHVt3O3ykB6wHej//reLPWVyTLeHO2YOfe1jbFsQ== 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=E29EQU/4o7BCp/2H38+YLXVSDBSxcJY/BaocP9NI1vY=; b=Co0jUoKtuGKqIFc5zozwbRfmWKsaQxK0r4OS4a74ovzDoO1/bBDkJZrqfzId6YJGtrMTIUcI62dptaudsOlGqkFti/2J/r9vQbTJ1gYB+kZl+reipwO3EDQhWbm09bEFSCBNm4pLyg133ZbIXr/xGzFg2aznMb425x/RpwMzsAFCTPrdMXsG/CyQTtx/jGDjNZ1IHiLlzJ6KM+biKrnU6nweKnXWeNjEaXVwWFN0gTaaQoJRyGCDxpckAhrLOqxN348kQP7ZLvEAfNLurTFYZy3Rmfxc7Nc6jl4cpYMaiCMmGv/G4DfbLKn6ZyDyTRRAh/u449QWeQVDjlegecEQug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=E29EQU/4o7BCp/2H38+YLXVSDBSxcJY/BaocP9NI1vY=; b=cl/KyfTlKD7lOnCin+E35cR36Mi69gdwWmCpMm5orBXLS85zgM9npqxxwJD+z4qBC23y2t4wZmjFrM1F84JyC5zcu1Zx0GApK4BN9j85lquVkd5IqARe6yfyZUPhrMc9P8cclusQHjSOl/1Wk5dv9AYx8Tff/LVyiL9z4SSJAeA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by BN6PR1101MB2196.namprd11.prod.outlook.com (2603:10b6:405:52::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Fri, 11 Feb 2022 16:27:27 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::1b3:e483:7396:1f98]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::1b3:e483:7396:1f98%3]) with mapi id 15.20.4975.014; Fri, 11 Feb 2022 16:27:26 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 1/2] staging: wfx: allow new PDS format Date: Fri, 11 Feb 2022 17:26:58 +0100 Message-Id: <20220211162659.528333-2-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211162659.528333-1-Jerome.Pouiller@silabs.com> References: <20220211162659.528333-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR1P264CA0011.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19e::16) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2740a1e2-0bde-400b-4f1a-08d9ed7b63ef X-MS-TrafficTypeDiagnostic: BN6PR1101MB2196:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GT11tUA8llhitGfbWKgzWYOzQYrkWh3bvrjGTVHFoRdw2sIUq5f8Eo19N+I3X+je6NCEVoRf/8BybZlVcxTR+aN+UghvpTOCg+Mi07UrCjyFt/ZCYhp3bPam5r7tCNpqERZt3GvqWKl/qo2K1OMIiw/+Ok6euLrujg10qwJ9jdpOAHmUZ3Ffpx1NB17LvenkRz2kbt1iM6BWdhZ82Rbi/xhzWwsijdFAy7ZWaX6PRScOJd8mIVFpbgqTfbjMk4eHgfNM6urnXZoPJL5lckppUrxa45ZzHEb3Mw44KmaaYcW+/8SbZ/KPYYKCexGi4yqYEOd6OtdCvjGo01ihdTWjvEN7wAyXCeDRQ/PRb5/tW6JwKFh0tEKCIlzByWoB3CGQGIAaE4gJncRTVqAvPUMK0rSZUtHvkj+MdstwIx9FR56Io4sh93VLmBAre2k6owNIlhPKWkmrC391cUhW065zUf+Bd5IXZEq3c+ZrAtg/yb/B6WEoNt9OaTrG7MzucWYAAKVtfTqOXkpe2+spGxRXx6+r7PzVUQGK17TSOYkVjR8Jn0/OTtEjHhF9yGmrlXHKrpl2BuzYEi4D0E6dBMSCGlDckKeT00riQ7uaSzys9vluLIUqwdbcj7tl4h6PShy52+6N29Df1sH7VASFPXO9zbTN88Pfvy0YoGPxCo3RWc8Q65YilMu0Au/t3W6yUfwGUPgy/m58X24Ge2rlokf+7U8p9pGif/Oe9Hwy/HChug/gKUQITYRhWjwdqmU352+UCJ9BdELRw6RB8bRXu8oErdkO2V1bOIDus3ECskf1dDU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5657.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(186003)(26005)(86362001)(4326008)(36756003)(84970400001)(66476007)(83380400001)(508600001)(8936002)(66946007)(8676002)(66556008)(1076003)(2616005)(38100700002)(54906003)(38350700002)(966005)(6512007)(316002)(5660300002)(66574015)(52116002)(2906002)(6666004)(6506007)(6486002)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+mdaiTthcwI/DWVQhLEsKN3kWtE6?= =?utf-8?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5OwkndQLQx3WDDjPbf/9MNfKE+wBPTnXOl?= =?utf-8?q?0wtKlKr0HsPyUUosqWjZDaSPkMordO9am6R84NEhKcqc2ChrjBeHJXVSH3HiPFfBu?= =?utf-8?q?bzrec6fBDgiOhYAwcGSOw8BuI24MXXaso8j3J/YTBkxVZ35dblif95/KS80f7Aq5G?= =?utf-8?q?M1nMsfXt5nuamEG8AWMsV2/Fot++8ElKiORNxjAyfyUiM/f54csYpCzGDGCfCCQ8l?= =?utf-8?q?FMsywGg8jzwz7j5nYpQN/Nip85GTAkqtiAt8ErHwkgnX5WXgp34LdenwpgtBWXAX6?= =?utf-8?q?X/0iz3vsUVbxKhJKe8iaBeZ/xE7M0bB1Y43KCMapbLiuIxgGseGfFVuBkDq2/tPkP?= =?utf-8?q?F69xaHr2GyXJfKDs5+BlRb0s0XhtwWDtYbmPIy9UiOZ1QoPgCMZ8g2x4R4W0RHMDf?= =?utf-8?q?j1S1braxszXF6DI3vggJGRtlzmW/zD1yoyh+RH2xCu8JB37Nsayr21b6+X9YNUubw?= =?utf-8?q?x9HLB6G4s68ABegEwV3hEiRgqYp2zX6t0j925T6bd84ChVHPVgQMyEycU+MMuh0gO?= =?utf-8?q?Jvy/av8dxTS9kD/YQRRRyjmlAJHb9frP3TG8Wf3T2l+qWYRTLXX32ta1cjVFHS0Dd?= =?utf-8?q?tmXEqHpryEto/WSaVaGXLCuikuPaCaAolYo5ktYIuOf7lsY0jjne6bk=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2740a1e2-0bde-400b-4f1a-08d9ed7b63ef X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 16:27:26.5054 (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: z2MAxIBJXBtIefiyQ+DFxoyjDtuc6aUr36eqH9WOGmqtV68m6kIHLU7AmVzB3hJ/znt7armGUZ7KAerL9GKZaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2196 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The device needs data about the antenna configuration. This information in provided by PDS (Platform Data Set, this is the wording used in WF200 documentation) files. Until now, the driver had to parse the PDS file before to send it. This solution was not acceptable for the vanilla kernel. We have slightly changed the PDS format so it is now an array of Type-Length-Value. This patch allows to support new format and keep compatibility with legacy format. probe: allow new PDS format Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 74 +++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 8be9100847a7..a0f5e09c3c3f 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -33,7 +33,8 @@ #include "hif_tx_mib.h" #include "hif_api_cmd.h" -#define WFX_PDS_MAX_SIZE 1500 +#define WFX_PDS_TLV_TYPE 0x4450 // "PD" (Platform Data) in ascii little-endian +#define WFX_PDS_MAX_CHUNK_SIZE 1500 MODULE_DESCRIPTION("Silicon Labs 802.11 Wireless LAN driver for WF200"); MODULE_AUTHOR("Jérôme Pouiller "); @@ -162,29 +163,18 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* The device needs data about the antenna configuration. This information in provided by PDS - * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware - * integrators, the full process to create PDS files is described here: - * https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md - * - * So this function aims to send PDS to the device. However, the PDS file is often bigger than Rx - * buffers of the chip, so it has to be sent in multiple parts. +/* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent + * in multiple parts. * * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split * between root nodes. */ -int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) { int ret; - int start, brace_level, i; + int start = 0, brace_level = 0, i; - start = 0; - brace_level = 0; - if (buf[0] != '{') { - dev_err(wdev->dev, "valid PDS start with '{'. Did you forget to compress it?\n"); - return -EINVAL; - } for (i = 1; i < len - 1; i++) { if (buf[i] == '{') brace_level++; @@ -192,7 +182,7 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) brace_level--; if (buf[i] == '}' && !brace_level) { i++; - if (i - start + 1 > WFX_PDS_MAX_SIZE) + if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) return -EFBIG; buf[start] = '{'; buf[i] = 0; @@ -222,6 +212,56 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) return 0; } +/* The device needs data about the antenna configuration. This information in provided by PDS + * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware + * integrators, the full process to create PDS files is described here: + * https://github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md + * + * The PDS file is an array of Time-Length-Value structs. + */ + int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +{ + int ret, chunk_type, chunk_len, chunk_num = 0; + + if (*buf == '{') + return wfx_send_pds_legacy(wdev, buf, len); + while (len > 0) { + chunk_type = get_unaligned_le16(buf + 0); + chunk_len = get_unaligned_le16(buf + 2); + if (chunk_len > len) { + dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num); + return -EINVAL; + } + if (chunk_type != WFX_PDS_TLV_TYPE) { + dev_info(wdev->dev, "PDS:%d: skip unknown data\n", chunk_num); + goto next; + } + if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE) + dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n", chunk_num); + if (buf[4] != '{' || buf[chunk_len - 1] != '}') + dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num); + + ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4); + if (ret > 0) { + dev_err(wdev->dev, "PDS:%d: invalid data (unsupported options?)\n", chunk_num); + return -EINVAL; + } + if (ret == -ETIMEDOUT) { + dev_err(wdev->dev, "PDS:%d: chip didn't reply (corrupted file?)\n", chunk_num); + return ret; + } + if (ret) { + dev_err(wdev->dev, "PDS:%d: chip returned an unknown error\n", chunk_num); + return -EIO; + } +next: + chunk_num++; + len -= chunk_len; + buf += chunk_len; + } + return 0; +} + static int wfx_send_pdata_pds(struct wfx_dev *wdev) { int ret = 0; From patchwork Fri Feb 11 16:26:59 2022 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: 542502 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 D3FEAC433EF for ; Fri, 11 Feb 2022 16:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351480AbiBKQ1e (ORCPT ); Fri, 11 Feb 2022 11:27:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244754AbiBKQ1b (ORCPT ); Fri, 11 Feb 2022 11:27:31 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061.outbound.protection.outlook.com [40.107.93.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E81673AD; Fri, 11 Feb 2022 08:27:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XuWw+/G/4GRpJqsdnzqDYNq/8Xtb5VV6/KbBccK4Fo/UwaJPWmSDNtYSoN2MQDcEb9cdu8WO9hf/lOn+6X2vFNIvgyXkvpC1BYEZphp6Gu0fzNu2feuDYAcPydwDARP9je2r86xXkB6BWTTs5pXm4lf58ISS+iuwBwdb+GpCPizz6sk4xL785IjQ2lsniCVclJIrQMcJh1ct7Q3F+GjprRdzDrPKB6NaR/qD9zUZO8KHVrmVCwCwnKp7ToILC/kgr04MbM9TgVZ0cRJW3dCNAkQ1d6f+dhCIeDhJbdV4XuD7ghWXaYb/v5PaTDnCxL6kEkdYj2pQ0RZq4RHO81T5xQ== 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=ibk/kM2hv1xuMO3ECky+UxpNOgQUtmLFvrvHG3f0dCg=; b=OHhKuCenpvoqsqzttOpL6zmdYbrVfhCjxG82oECW7+5f5QJK2kF2oa32z3mhjhYNDdDYPqrCb246/3Ttm1mXPTgIEzYnWg+edFkxJuVW42Juey85WmoUD0QOnpjSN4slkcViZ5u8D78KrsAIGvulS7yuAK7jdiL7yAOm5wgpAoJrwIItvxZbUDK7+NtOOaG2aDJMOhs+v+b+mA1S3kUXNuyvA6kakANvltuHNNPsa+hjtlAr+Hl9ILhNAmgZvCVUcD4m9JZGPcaJeY/1On6aa9XncVhnm2uWEdDrFMLAS/FPDCJT3cOiwwnVIqIogGgZgfB0xOqc/+fZR0YDlItrAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=ibk/kM2hv1xuMO3ECky+UxpNOgQUtmLFvrvHG3f0dCg=; b=fw4R1OMoPJn/2m4XCidfRhzAcgq2l+eEnsbLiGOctJxZVANrTSiBRkc8G2u2ZhzUN/cu1OEg5Ul4tKoVglqa+B7Tr7vrXDDQ0C8yw9ZzCKYnxC/ZyaMrBFakAeJsWMBx1g9VI2Ki4mQGJU89ego6+SEWTZXEyZJmeilHbyYvwf8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by BN6PR1101MB2196.namprd11.prod.outlook.com (2603:10b6:405:52::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Fri, 11 Feb 2022 16:27:28 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::1b3:e483:7396:1f98]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::1b3:e483:7396:1f98%3]) with mapi id 15.20.4975.014; Fri, 11 Feb 2022 16:27:28 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 2/2] staging: wfx: remove support for legacy PDS format Date: Fri, 11 Feb 2022 17:26:59 +0100 Message-Id: <20220211162659.528333-3-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211162659.528333-1-Jerome.Pouiller@silabs.com> References: <20220211162659.528333-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR1P264CA0011.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19e::16) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9038d393-6fb5-46a9-6538-08d9ed7b6525 X-MS-TrafficTypeDiagnostic: BN6PR1101MB2196:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xwuPgnub1sbs/eSyF2/8lPk1N0GARHJwAxpQaWk32uU0T19WHU6thjFxO2nmd6ZAq4Th4Onq4yYYrnEfwgBZ6vUMUzByCJ8tx6VSMzai6lz1Dt2hTEKqmzXi6Ysd/8WyYzDQ5H5kBu+PEyoBDquPSicTTlTuRPg8xswytnhIe3bbCOfsvdYCts4ucXaQSqU9dOymehvb5up5qYprZac62KCzdJMSTCl+hieansbt0xhctkRDXN8vaqliEup+0a0ZCMe8Ejeor7ph4SRdu8d37BYHmrWO4nSINX/WKb+YRxyeYBQzb82OjsaF4BveODAt2YTy9qR7/mUoiZbHSDH+MWOyMMeb4aVN0YIhlTb8SZGC9QSuqqjXqGCSsZlUFpGmCJH4YnzOH372w+NrLR4RE4FN23C/a/ntoCTgbgT7i9MKp8m9KhUho6XXRU+544uodaq8Y2pCVN0YIvFQIVUgqn37EsH4D0XeXZdb84ifsADo1x4ruKsj61MFU64UWt36n7qVGTJ4Wp3ahGDU6ywWODREy9m3quYVeUKRI4WKAeEdrDhKZwNB4AqZDk83siNDFFLELyrgawrWBxjennUxN8vhIZHWqq+cBL2F9Hmu8aRr0/ryrSEzTzdQkox2PkMKxtZaGJmLtTLVqdEgiKtBvGVY7Nov1dcDBVUGTyzkXdrJlBqoR7tEOPaYcjkQj62sVNOCaeoy+09NzxMnsJdseA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5657.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(186003)(26005)(86362001)(4326008)(36756003)(66476007)(83380400001)(508600001)(8936002)(66946007)(8676002)(66556008)(1076003)(2616005)(38100700002)(54906003)(38350700002)(6512007)(316002)(5660300002)(66574015)(52116002)(2906002)(6666004)(6506007)(6486002)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?00g4PBPJD/BFSA48L98AasshszNV?= =?utf-8?q?cldM4KjhFj8g+9/hnRnvszbmoTfmy13pX+tSNl31QY8SYsEGcdo54bih4dmCbdb9i?= =?utf-8?q?dmiO2O1XJy2ZROu/NyZE44W2gyd3cUpmwyhrma2rjrawdRgHAQyq7QxZ3kKgNCZBH?= =?utf-8?q?lwt3AoX6poRyGGk9DXzhAwkl2DaKTrUtfwTwxRA+DhZuPJOkSW4Hf1caAmBNIY8RK?= =?utf-8?q?0/OAreu5rQz+rT1y3ps25mYeU3ox/12Fc0Z2Nkv5fz4m7zqu5aFU6NbiU3R3dOpq7?= =?utf-8?q?M0NKvNQwVX2hXcAzDVpJ/FVt4q4imGVEMOUbgwb5bH5idYoSGwji1DHdD/HK2cqAE?= =?utf-8?q?49H8qEe9gU8DwsOpRP6WBcBic6BpaI4rFr0k4ckMmkaBx/gXVmyEQAwe/d5TvSmwV?= =?utf-8?q?8aoijrGTdLC5RY4v41/s6+DHMhw5xC6/m91UEK9nt9WA8Gvj6Tlr92I79FHf9ouX0?= =?utf-8?q?e4CWAd03CctiKsWh6s6sPmcFUl+lc5VzSpNAu/S8L+I1TRDWrOf7sUY2jNopY+Ehd?= =?utf-8?q?LFFHrWsgswBjBY1OKcPrzofGDx7V0gq5qa7pbPc+iEU0gYTm3dCqLJXHVdu9Gi7t9?= =?utf-8?q?CUFAKBNtUrlvF21ogqFkICxczUM2kJ1WfO8e7/EReorESC3GhJlGgKHKbidLNecSO?= =?utf-8?q?6uxD9t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q?O3zInlsca26ivQ2PR2fc8UeGWugP1aj7DXEfvjE4KXzmzMtIyaKvN6o=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9038d393-6fb5-46a9-6538-08d9ed7b6525 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 16:27:28.4751 (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: gKhEV0/cV+66CfpABHmU1cGhzInqhpzZrAMVEaUspZVzJ/Hr+UfMBpoBscH4qe5DsQxD0Ckjzgsa1cq81Esscg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2196 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller We don't want to support legacy PDS format. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 55 +++----------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index a0f5e09c3c3f..0ddc67b56589 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -163,55 +163,6 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent - * in multiple parts. - * - * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are - * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split - * between root nodes. - */ -int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) -{ - int ret; - int start = 0, brace_level = 0, i; - - for (i = 1; i < len - 1; i++) { - if (buf[i] == '{') - brace_level++; - if (buf[i] == '}') - brace_level--; - if (buf[i] == '}' && !brace_level) { - i++; - if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) - return -EFBIG; - buf[start] = '{'; - buf[i] = 0; - dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); - buf[i] = '}'; - ret = wfx_hif_configuration(wdev, buf + start, - i - start + 1); - if (ret > 0) { - dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", - start, i); - return -EINVAL; - } - if (ret == -ETIMEDOUT) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip didn't reply (corrupted file?)\n", - start, i); - return ret; - } - if (ret) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip returned an unknown error\n", - start, i); - return -EIO; - } - buf[i] = ','; - start = i; - } - } - return 0; -} - /* The device needs data about the antenna configuration. This information in provided by PDS * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware * integrators, the full process to create PDS files is described here: @@ -223,8 +174,10 @@ int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) { int ret, chunk_type, chunk_len, chunk_num = 0; - if (*buf == '{') - return wfx_send_pds_legacy(wdev, buf, len); + if (*buf == '{') { + dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n"); + return -EINVAL; + } while (len > 0) { chunk_type = get_unaligned_le16(buf + 0); chunk_len = get_unaligned_le16(buf + 2);