From patchwork Wed Jan 15 12:12:51 2020 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: 11333915 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 178DE138D for ; Wed, 15 Jan 2020 12:13:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFC0122522 for ; Wed, 15 Jan 2020 12:13:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="kjCQ4RsG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731211AbgAOMN1 (ORCPT ); Wed, 15 Jan 2020 07:13:27 -0500 Received: from mail-bn7nam10on2048.outbound.protection.outlook.com ([40.107.92.48]:31808 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731112AbgAOMN0 (ORCPT ); Wed, 15 Jan 2020 07:13:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DyYhSTvdnekMJuF5ZCvhk7WitoLpoaO2HnGXjtmL7gGVXXYOZ/MFkDvQ93EAKWP8XniId7ybCiaSK6X/AAY4ArtIxQZEy3hH+D9J12/DlGxWKUhp27WzBgadHGHMbCEKRiYDguSYo90L2t9CS17rLak8Yo7+H+S3+WcmLMQp52KlqlcWbhcyN4O44NGId8fPZqofxqMv9zJCfRRfwON0nuZt0x2Tpr7lOwBSlQkFiNHauNi3rrTPEdktwilzVnXeRyEit2SmB07a9fIi3rKmQIN9tcBHZEo02N38daz0FAXzajXY2kFKZGFgt5R+MVIEowrDafm9SLU2jVIfoivAOQ== 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=ld8qSg592xPJar90gdpyQ+05JoxcTxmYOxSxOuYqNVc=; b=avu3Q0QioLjspWFV5ggQmuG4OupHSiZ260EM8HPXtDwi1eYm2/0TDNxwb+YPno1DeOUUbBb/RIYkjMATou7O4thbAJmVbauHpWdQm3sFUwq1LeW1zEW8o7bYqDIB+lmG9ffqD833Ze+xOBKQuwqSpX0COg7blLlM8Yv42HHOkiPI7bA/0/GFQWEJ3hQXyNBEp3qo0fPRVCtwe03vIfy/f37gFwuv/Zf+i4Z92htECOw8Rkhh2duBLu5BlUgPuIYA5dY62cHbYWz0BEZTg+51NqS30aU7suMXRFUmahTaT/xLtiPf2InMdWXDe/f9lzW/89ztAXJNzv7uJjc5CrxrCw== 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=ld8qSg592xPJar90gdpyQ+05JoxcTxmYOxSxOuYqNVc=; b=kjCQ4RsGAznGIibmTV7lCm0UvYFqXJsAs92IBAVyg8aPSjLum1L5q2JFfYIpNzwA/u8zUdq1w/RFLZbstcvhTor4ZBZBJPdl1MqgGLT36Hsr9FjpxVu9VjfjtwuuvTCNGhw7yM23vW8lNJuJhbANX1BoEDRgdKhMCuBT6ltC8b0= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4096.namprd11.prod.outlook.com (20.179.150.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Wed, 15 Jan 2020 12:13:20 +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.2623.018; Wed, 15 Jan 2020 12:13:20 +0000 Received: from pc-42.silabs.com (37.71.187.125) by PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Wed, 15 Jan 2020 12:12:50 +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 32/65] staging: wfx: simplify hif_mib_uc_mc_bc_data_frame_condition Thread-Topic: [PATCH 32/65] staging: wfx: simplify hif_mib_uc_mc_bc_data_frame_condition Thread-Index: AQHVy50cmuDmA1KnS0eIgGEIxVm8ZA== Date: Wed, 15 Jan 2020 12:12:51 +0000 Message-ID: <20200115121041.10863-33-Jerome.Pouiller@silabs.com> References: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) 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.25.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 692cab7d-cfcf-4c7f-5eee-08d799b43e75 x-ms-traffictypediagnostic: MN2PR11MB4096: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:843; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(346002)(39860400002)(366004)(376002)(136003)(199004)(189003)(85202003)(66946007)(66446008)(66476007)(2906002)(107886003)(66556008)(1076003)(64756008)(5660300002)(8936002)(6486002)(186003)(26005)(8676002)(316002)(81156014)(36756003)(52116002)(2616005)(7696005)(478600001)(16526019)(956004)(54906003)(110136005)(86362001)(71200400001)(85182001)(4326008)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4096;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: M1PIrSe9+DUy3G0KP8tGnSTeZEWCSW5JzRiSio96udWMkj25qkR5Q9uHvdZJQNWh4LQmXYN6n2jMXry6DExT/UxRd9Ez/AC4XkY74cR5wZx8Vodx1FGLkzLr6zfknp+t03k697z3QamK910AwaoM1YUUrY1cMuyVr4q8+kmWjivoM+FX8w6c5E8Sx31snQkESuihh/wcyfgBHUozGG42dtB4tU+h6Bb3gSRfIksrZ5bzsXFDInjhQoOPulsaRcKnzqhJK3GOtp/oSuFZx9lYgm9Gg1AieWP3B7KVQtf/K/ZriQnZkeG0LYJbxsn302AD4bLeLGaaR1WEhmKj1i/LE1U26t/i4abH5WSUzP5+wksPfGE3iGsyEWFSvKE0ogMjIYTfum/SouR2+ADaoeSKx631pc+XuKAHbtKqMdMQ6wUdbUfRCB7VvZNNH1WiyEX7 Content-ID: <2BC6496AC88B394E9866E9042B56764D@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 692cab7d-cfcf-4c7f-5eee-08d799b43e75 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:51.8895 (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: PqWLFjCEoesWBCprIo8wd7dEMrbHGaeKSEXvXsC5lfiDa6yKME9wqiNHKG3oa//T9er+isx0/qp9hQ7M7nYRkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4096 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The current API defines bitfields. It is not very convenient. Prefer to use bitmasks. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_api_mib.h | 14 ++++---------- drivers/staging/wfx/hif_tx_mib.h | 9 +++------ drivers/staging/wfx/sta.c | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h index 1603b3074bf7..e0ef0337e01c 100644 --- a/drivers/staging/wfx/hif_api_mib.h +++ b/drivers/staging/wfx/hif_api_mib.h @@ -181,19 +181,13 @@ struct hif_mib_ipv6_addr_data_frame_condition { u8 i_pv6_address[HIF_API_IPV6_ADDRESS_SIZE]; } __packed; -union hif_addr_type { - u8 value; - struct { - u8 type_unicast:1; - u8 type_multicast:1; - u8 type_broadcast:1; - u8 reserved:5; - } bits; -}; +#define HIF_FILTER_UNICAST 0x1 +#define HIF_FILTER_MULTICAST 0x2 +#define HIF_FILTER_BROADCAST 0x4 struct hif_mib_uc_mc_bc_data_frame_condition { u8 condition_idx; - union hif_addr_type param; + u8 allowed_frames; u8 reserved[2]; } __packed; diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 4d171e6cfc9a..6e8b050cbc25 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -246,15 +246,12 @@ static inline int hif_set_mac_addr_condition(struct wfx_vif *wvif, arg, sizeof(*arg)); } -// FIXME: use a bitfield instead of 3 boolean values -static inline int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif, int idx, - bool unic, bool multic, bool broadc) +static inline int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif, + int idx, u8 allowed_frames) { struct hif_mib_uc_mc_bc_data_frame_condition val = { .condition_idx = idx, - .param.bits.type_unicast = unic, - .param.bits.type_multicast = multic, - .param.bits.type_broadcast = broadc, + .allowed_frames = allowed_frames, }; return hif_write_mib(wvif->wdev, wvif->id, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 79285927c7bf..1c1b5a6c2474 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -142,8 +142,8 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif, config.mac_cond |= 1 << i; } - // Accept unicast and broadcast - ret = hif_set_uc_mc_bc_condition(wvif, 0, true, false, true); + ret = hif_set_uc_mc_bc_condition(wvif, 0, HIF_FILTER_UNICAST | + HIF_FILTER_BROADCAST); if (ret) return ret;