From patchwork Tue Dec 17 16:15:20 2019 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: 11298133 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3702E6C1 for ; Tue, 17 Dec 2019 16:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 096E424679 for ; Tue, 17 Dec 2019 16:18:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="qGXjKH2a" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729040AbfLQQPy (ORCPT ); Tue, 17 Dec 2019 11:15:54 -0500 Received: from mail-bn7nam10on2081.outbound.protection.outlook.com ([40.107.92.81]:6496 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728993AbfLQQPv (ORCPT ); Tue, 17 Dec 2019 11:15:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KokckUPELIkdJuN/VS/I1Hl82Sv6elSjn1iSG3oExz9J3PKMIqX1wc4/ZaAoKXKYAy+3EKYLyiVOOMjgVR5p3DOjrz9ycWNUVSa4lo1FOeHon+aamWXq/+dxicYi2kYgsXfhZ6GzAXbcMnD+Mt4P89oiBZApjx6DlXghT5tcSnl+uEfOrPT5h5FatQdGtXrJG6BIsr7LCMAD/9S1lDGXxUPJvtOmnP/bz8iC7kFDAwYEL1jsYA7bZeXInIRAtQK248GMODHy/1YLldzd6pu/iJKGsTJFfIXOjI+FbCKwhMMMXVlE4tMfUfqKFcAUv98A+4BWmb6m289Zy10JvTuvmw== 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=AKxfHIn3UfcP8BiheuajfFFSvjD3njr1+SQofPKu/sU=; b=J44TFIusLBGUO2ROUKvCRgHNaZVyZUz0EbIuyaGTRyDL8xPVDMHGXPDausW+6Je4SAOnlKdMW37xFs0+XCvdsg3rTOCMSTthBqNTQ/Kg8HUUxUJOThFDqfvpAVzZp2qCmT+WPizZee65VK4gjtyLV48XEhogy2z13Vq/1dkHX2yy0SAkQ2fM1yashmDyvxqMWPYBe6AHqUS8MtN+OudUgGbNts4aJArFM/9JjIaGZozZLZwknv/BOm4uM3g7JuiEULLu1rEf3CEPf9zt/fMakOKa3it1J8R5RGWJMmKiouOCMziqTDG3YS6Bp6M4uV0VP5LgeXVFm+h9ATedtzUNKA== 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=AKxfHIn3UfcP8BiheuajfFFSvjD3njr1+SQofPKu/sU=; b=qGXjKH2aIlvqlQLPCe0fB+01SVzHB2vIfGWrJ62fg05B1bNSttWvLZXljxcc45lyFGxUvBw6lpeVvz/Lfi84zYy3a7J7zOrgINBddOhKFaaleicWvzxGaWoKaFuFXXTES8zM24cW1QNSVHHeQFi9UAz0NQvFE8+Qm61pamFzeoY= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4208.namprd11.prod.outlook.com (52.135.36.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.20; Tue, 17 Dec 2019 16:15:44 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf%4]) with mapi id 15.20.2538.019; Tue, 17 Dec 2019 16:15:44 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= 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 v2 38/55] staging: wfx: prefer a bitmask instead of an array of boolean Thread-Topic: [PATCH v2 38/55] staging: wfx: prefer a bitmask instead of an array of boolean Thread-Index: AQHVtPUt4iwFHdNV4UmHD5bdoL1eVQ== Date: Tue, 17 Dec 2019 16:15:20 +0000 Message-ID: <20191217161318.31402-39-Jerome.Pouiller@silabs.com> References: <20191217161318.31402-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20191217161318.31402-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR0P264CA0174.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::18) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.24.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 27d00fd2-14c1-4dde-4f31-08d7830c501c x-ms-traffictypediagnostic: MN2PR11MB4208: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1060; x-forefront-prvs: 02543CD7CD x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(396003)(366004)(136003)(376002)(346002)(199004)(189003)(5660300002)(316002)(6506007)(85182001)(478600001)(71200400001)(2906002)(36756003)(186003)(26005)(81166006)(54906003)(1076003)(110136005)(66574012)(4326008)(8676002)(86362001)(6486002)(6666004)(52116002)(6512007)(64756008)(85202003)(66946007)(66476007)(66446008)(66556008)(8936002)(107886003)(2616005)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4208;H:MN2PR11MB4063.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NKT1oiInPTPtQP3NYIYiPMgBhXQutcCJ6DDSfiOkPoE34U4c13cN9JISEmVtO8GwMd8lc76FM4dV/FNGRLvM++zULlg1NzUsTdKweNk0j9PT4s8oLmCtkl+ml2T1EXxwdfRfWSzJLuXjw8b0sw4ox8Huu4IyKxx56vT0nwr1vUOUtVhYfGDkxje+dHChHOpVBjSQb1ldGWIiiT34rNnQP99zWEew3tYDdi27Yt0/GYm4prVcSfEx3Teyrh+b2yKUBoXTuPrCKoOvjXNi2upyagNqDeVIWlmgsoFDxsj5HBxGrUTgCTBnq64jWVAcweCVDi9c3LvyGZGueOT/1TcvK5zpDyELJ82TbIwQBma5OdDUZap04gy+2AKnRVvO2fiX2f2yedMYcQBVZNa2JhwnV9yXJqMm7S4UhTviPRyY0Kw57kDdzslnJOSrFdNaQXtV Content-ID: <43A6274CC90D97468DC7CC6E65370619@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27d00fd2-14c1-4dde-4f31-08d7830c501c X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2019 16:15:20.4802 (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: 6etrvSAvei9DvkuDsGH36pN4HBE6U/JmtFKZ0LagiqcYqH5/vpJE9kScnwC1gTY1pXszvibLHsmdPXM2cwIdvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4208 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller It is easier to manipulate a int than an array of booleans. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 17 +++++++---------- drivers/staging/wfx/sta.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 045d3916ada8..e59560f499ea 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -119,22 +119,22 @@ static int wfx_set_uapsd_param(struct wfx_vif *wvif, * VO [0,3], VI [1, 2], BE [2, 1], BK [3, 0] */ - if (arg->uapsd_enable[IEEE80211_AC_VO]) + if (arg->uapsd_mask & BIT(IEEE80211_AC_VO)) wvif->uapsd_info.trig_voice = 1; else wvif->uapsd_info.trig_voice = 0; - if (arg->uapsd_enable[IEEE80211_AC_VI]) + if (arg->uapsd_mask & BIT(IEEE80211_AC_VI)) wvif->uapsd_info.trig_video = 1; else wvif->uapsd_info.trig_video = 0; - if (arg->uapsd_enable[IEEE80211_AC_BE]) + if (arg->uapsd_mask & BIT(IEEE80211_AC_BE)) wvif->uapsd_info.trig_be = 1; else wvif->uapsd_info.trig_be = 0; - if (arg->uapsd_enable[IEEE80211_AC_BK]) + if (arg->uapsd_mask & BIT(IEEE80211_AC_BK)) wvif->uapsd_info.trig_bckgrnd = 1; else wvif->uapsd_info.trig_bckgrnd = 0; @@ -330,7 +330,6 @@ static int wfx_update_pm(struct wfx_vif *wvif) { struct ieee80211_conf *conf = &wvif->wdev->hw->conf; struct hif_req_set_pm_mode pm; - u16 uapsd_flags; if (wvif->state != WFX_STATE_STA || !wvif->bss_params.aid) return 0; @@ -345,9 +344,7 @@ static int wfx_update_pm(struct wfx_vif *wvif) pm.pm_mode.fast_psm = 1; } - memcpy(&uapsd_flags, &wvif->uapsd_info, sizeof(uapsd_flags)); - - if (uapsd_flags != 0) + if (wvif->edca.uapsd_mask) pm.pm_mode.fast_psm = 0; // Kernel disable PowerSave when multiple vifs are in use. In contrary, @@ -375,7 +372,7 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, WARN_ON(queue >= hw->queues); mutex_lock(&wdev->conf_mutex); - wvif->edca.uapsd_enable[queue] = params->uapsd; + assign_bit(queue, &wvif->edca.uapsd_mask, params->uapsd); edca = &wvif->edca.params[queue]; edca->aifsn = params->aifs; edca->cw_min = params->cw_min; @@ -1552,9 +1549,9 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) for (i = 0; i < IEEE80211_NUM_ACS; i++) { memcpy(&wvif->edca.params[i], &default_edca_params[i], sizeof(default_edca_params[i])); - wvif->edca.uapsd_enable[i] = false; hif_set_edca_queue_params(wvif, &wvif->edca.params[i]); } + wvif->edca.uapsd_mask = 0; wfx_set_uapsd_param(wvif, &wvif->edca); wfx_tx_policy_init(wvif); diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 4719807bc25a..74755f6fa030 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -37,7 +37,7 @@ struct wfx_hif_event { struct wfx_edca_params { /* NOTE: index is a linux queue id. */ struct hif_req_edca_queue_params params[IEEE80211_NUM_ACS]; - bool uapsd_enable[IEEE80211_NUM_ACS]; + unsigned long uapsd_mask; }; struct wfx_grp_addr_table {