From patchwork Wed Jan 15 12:12:54 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: 11333971 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 1651F139A for ; Wed, 15 Jan 2020 12:16:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEAC424679 for ; Wed, 15 Jan 2020 12:16:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="k+I/s/OX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731368AbgAOMNd (ORCPT ); Wed, 15 Jan 2020 07:13:33 -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 S1731168AbgAOMN3 (ORCPT ); Wed, 15 Jan 2020 07:13:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aFK9ROY0PS+SvG7EqAqp758RS6nVR2ki8BOAz7JjGQ8iWFqEcp4erBvPjXhEQFbkx6cNpoiZNY0VfBlFLRUpckNz2Rhzhm81po+tSyN2/+64kWCDSY5pyrJy7+Gfcg6At+iexqi7CmrU+9lKHQJowFr3CKMBKwUqPwcFyAKo6q7BzBbvbYwtR+SuMVOTEYD47aMszRYa3CyGZ+c4MTiZPZ+eFsXvbkt8PRiFcDNg0089TzWFFXrXntJCLfCLG/j/HF3bVZNS3GrgAw5aEXJqtZY8uNIyCYY/fWYk0l0OowNLX0WWS/bsx+R/Vpj4eo4X/acgcqzVB2o9vGAZyDPOqA== 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=XJqXurW4/VAnWUE+JXZ5tJhNqqZRExJP6P/RNttxtCI=; b=KM9ZuhHzVcjsbyyyjYXdlsa84udx8dAqjwcjYURwueCQ9ANnblDN8puAhu0uibKuE6Sk04t4QFehLpjZS0oeXQOD2gmsOWvGy+3OkJvDhNPEi2dGPkAIsNnZSEc66ikcC7uKKs6hx1518xRdl6zJjaChlj04j4gj3T4eHZT92cVWz5880sfgN7h7Peb/VDCp+ITT1hih0L49WsBDPapp7HeIeSR6yUw7VEisUke0HS+2eH6DkrAjgGQOFuU6O5gGMluFYlzrj74J93YXnDiT810D9XqanxGy2jLi7ztp0ysxlT+/tpF++nM2ZlWX8u1nJyetLJNUxg1pP2mIcftisg== 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=XJqXurW4/VAnWUE+JXZ5tJhNqqZRExJP6P/RNttxtCI=; b=k+I/s/OXgFSduMWtpN3G/hM1gmaKbMzvbPlCgGBYnFpNUwJe9NxgQzwuCWuKTV3xYE5Wig+PHE4r7x9c0y9SmtGu3rUnSfUyNUIWAcW4A291tggO5Mec1GGOHjm0cWOrwIPO4Itsd5z5o1vp0hceITUGx3BXlEI/YHsfWRg5d78= 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:22 +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:22 +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:53 +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 34/65] staging: wfx: simplify hif_set_data_filtering() Thread-Topic: [PATCH 34/65] staging: wfx: simplify hif_set_data_filtering() Thread-Index: AQHVy50dtm/2WXbjVk+wIXdMzUynWQ== Date: Wed, 15 Jan 2020 12:12:54 +0000 Message-ID: <20200115121041.10863-35-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: 697bbd7f-0ea5-435c-2cfd-08d799b44002 x-ms-traffictypediagnostic: MN2PR11MB4096: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; 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)(66574012)(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: O/mPZ3zGSbBvzozCU1+zOucP5TPNcdi9FL92jAlusUnj8FWuiq5Yfyqun6XzztkwvAhoNGMKQOrg7PVLXJdgIvkOrn3Uz1RQ2eEZIQKv/xw3HFXbVLfVXeyOapm5/9dGcqRomEr3GaCcQiO8ueoQF30jPmW5aZ768v0Owr7P7/gaEq8Tbsqngsw4oJ6xpuTY1l46DrFyVm5JehZ6sQHhhZ6h/bhOAB6/Rp054Qyo7yemXSdvhVrjfNkODP3JQYXwfGcKI6EQ/UKBty1dALQxzoGjlZVDotLPJC3A1XAg4vMSjG9DMPYipeQK0tk8STFC8Ol8v2uzylOEwjIywBCq0tUhVL01F7Qp48pzHA5zlVYT+p49JYKcAHo1GG5gWrs5jXkbgrZ4pcU7qYEYCSHfPJxSdG7a72mifE5vyRKn3V3drz1Rh2f9Ql9ypjlil5/r Content-ID: <5460FBAB1ECD934A8B0A172B9051A55D@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 697bbd7f-0ea5-435c-2cfd-08d799b44002 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:54.4950 (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: KZP+shmyT5vyf/6x1Fnx/dkC9fMuz3Rn+2y8tPaVmgWcF5dH5WKB5OQ5aYUYEEgoAsa0b6T+q14+gxtd3tLbxg== 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 structure hif_mib_set_data_filtering come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_set_data_filtering() is too dumb. It should pack data with hardware representation instead of leaving all work to the caller. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx_mib.h | 9 +++++++-- drivers/staging/wfx/sta.c | 13 ++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 6e8b050cbc25..ee22c7169fab 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -267,10 +267,15 @@ static inline int hif_set_config_data_filter(struct wfx_vif *wvif, } static inline int hif_set_data_filtering(struct wfx_vif *wvif, - struct hif_mib_set_data_filtering *arg) + bool enable, bool invert) { + struct hif_mib_set_data_filtering val = { + .enable = enable, + .invert_matching = invert, + }; + return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_DATA_FILTERING, arg, sizeof(*arg)); + HIF_MIB_ID_SET_DATA_FILTERING, &val, sizeof(val)); } static inline int hif_keep_alive_period(struct wfx_vif *wvif, int period) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 27248ea62aea..588094486a7a 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -118,16 +118,13 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif, { int i, ret; struct hif_mib_config_data_filter config = { }; - struct hif_mib_set_data_filtering filter_data = { }; struct hif_mib_mac_addr_data_frame_condition filter_addr_val = { }; // Temporary workaround for filters - return hif_set_data_filtering(wvif, &filter_data); + return hif_set_data_filtering(wvif, false, true); - if (!fp->enable) { - filter_data.enable = 0; - return hif_set_data_filtering(wvif, &filter_data); - } + if (!fp->enable) + return hif_set_data_filtering(wvif, false, true); // A1 Address match on list for (i = 0; i < fp->num_addresses; i++) { @@ -154,9 +151,7 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif, if (ret) return ret; - filter_data.enable = 1; - filter_data.invert_matching = 1; // discard all but matching frames - ret = hif_set_data_filtering(wvif, &filter_data); + ret = hif_set_data_filtering(wvif, true, true); return ret; }