From patchwork Wed Jan 15 13:54:48 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: 216625 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 CB247C33CB1 for ; Wed, 15 Jan 2020 14:00:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 879BC2467C for ; Wed, 15 Jan 2020 14:00:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="bjXSpV+P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729765AbgAONzV (ORCPT ); Wed, 15 Jan 2020 08:55:21 -0500 Received: from mail-eopbgr770084.outbound.protection.outlook.com ([40.107.77.84]:58049 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729406AbgAONzU (ORCPT ); Wed, 15 Jan 2020 08:55:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BzzccLf8qHj2zxB5YJAfKk3THBcNExTSOuPO0SVlDT9ShBZ36Cbcp3BWhfpdVGOT+AoyJ6BqA+vmMcqig89tWOFevZFP+pdlXebOyIXYdmMWqsVTKst3inaQPimWjJztzpUdOh9EI9HojS1/wQBvFXk3d+VCqGNdORsEJF6FC0R9+U+G9KU8TL+Su6sspc2RXmrxvI7ZJB7+RyzhgftmqDTtXa9GbgmmbJIBlN1Er/So1F9n1W9GbvjmaWScA5yOU+LU5NRTuPs5mkp9p8sSOJgudBUJ2We47yY2kxdJcXeJtTWvJ9gy5uQDq00lTS0a7NsfF8CUl83Hq3hu/e1SZQ== 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=t7WXVyk7UNsnby0BTFvK7nM6kwOYLUjSDsqtkvRlZTw=; b=B76B0bDQpmhgPj5bUdh5iQ9XwxJZZuK2FVOekty7PHQr/jaNR2oc6lCiFp7iukHO6NGHKL8DfslGp+zD6n7buBouJ3IMbsGcxZM+XbJ8rjUHDlb6o8Axr3lZ3q4wJFZ/EKRvAXNaLLZcCvy0s0hFv5/F6FOkyQbAvM3NJ6pHXLD6z1Av90tBQCfr6RpyMEZX7QImw6Jh2JU9kUlFkuo033UC6W4XLxo7V96wdn+LTK81KGfH/JzC9+KbUEBl/7cZixaY1X9Lu5eFxetVQpoeTALc+W+Dzq+DzGGaxj0n1N0ozF5y7R7TNHIK3K7jtrmZgghd4h9+DxzBdt9dVHJwTQ== 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=t7WXVyk7UNsnby0BTFvK7nM6kwOYLUjSDsqtkvRlZTw=; b=bjXSpV+PiB5pRif2fRvNEY86liMKisdSa4Pcv3WF7cY3BolYHRvAblUU4NqL7Q0kUmKiQPl5wRI8AT74HfYJHkZ2SFZnx7Dza1DmNPZbd3Q1hWSknIUZN89wvrI1CRhdqBXvUSoCMwqZqxJqGuQqiN9UYtXhmaFb9AvaiLcwh1Q= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3661.namprd11.prod.outlook.com (20.178.252.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Wed, 15 Jan 2020 13:55:17 +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 13:55:17 +0000 Received: from pc-42.home (2a01:e35:8bf5:66a0:3dbe:4cb5:6059:a948) by PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) 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 13:54:47 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH v2 31/65] staging: wfx: simplify hif_set_uc_mc_bc_condition() Thread-Topic: [PATCH v2 31/65] staging: wfx: simplify hif_set_uc_mc_bc_condition() Thread-Index: AQHVy6tZfV6OMRg3xkujGLdYN50CKw== Date: Wed, 15 Jan 2020 13:54:48 +0000 Message-ID: <20200115135338.14374-32-Jerome.Pouiller@silabs.com> References: <20200115135338.14374-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115135338.14374-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) 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: [2a01:e35:8bf5:66a0:3dbe:4cb5:6059:a948] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6b9d42bb-7508-4a19-ccd2-08d799c27c37 x-ms-traffictypediagnostic: MN2PR11MB3661: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3968; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(396003)(136003)(346002)(366004)(199004)(189003)(8886007)(6486002)(316002)(54906003)(71200400001)(36756003)(6506007)(66476007)(66446008)(66946007)(110136005)(8676002)(81166006)(81156014)(478600001)(86362001)(2616005)(4326008)(66574012)(2906002)(107886003)(1076003)(16526019)(186003)(85202003)(5660300002)(6512007)(52116002)(64756008)(66556008)(85182001)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3661; 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: negmMEw4i6Jq1gWvn1FPRcnjXwlH4izv4qnumnY6INLNrVtNSPIgKhA5y4NNrWF/FERtoM8o5bUlG6lJ+WOy2jlomt2MmKF9tsTpghTvX67kaNI/YMCtFmTBkUPvIoTrgbSmGRL77nyDKzY49FkgVZ+Je6FoVRgLJedRp/SYmVvd6f84jysJc5dT/iF6gXsXZPn7TBqmkmtiD+8KYrwysFu/rj3wiR5Iw4ixqjRuda/EPacVjGxz10cON6giLJsrHopiosHtT6vz8mM4SHiJgSclW3HUM/9s/6uPJLpCIfN/v80KMpwQfcRCEUR9zicOVrgyCTI7nqgpMkxOALaS6PS90e6FdLZLsDYh6I0wTxBcrTfc7+6YCbjmc3zNVv6CXiJDgaUPxwbTfxNWlFHkvjOHQEbQEWYDkYr1cdqvpDwj7gsKEiHexi5f/Lkso5d2 Content-ID: <853FF0B7B01C864C9319ABC0F7678133@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b9d42bb-7508-4a19-ccd2-08d799c27c37 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 13:54:48.4630 (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: mCTDeaaLj2qtHfSrns4pIk3heSPgYQu81dFk+Vwjih8s/g2/e4dMA/MFiweN9MGYrXww+UFt7VLKqkfGQxLJBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3661 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_uc_mc_bc_data_frame_condition come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_set_uc_mc_bc_condition() 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 | 14 +++++++++++--- drivers/staging/wfx/sta.c | 6 +----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index eec6f4157e60..4d171e6cfc9a 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -246,12 +246,20 @@ static inline int hif_set_mac_addr_condition(struct wfx_vif *wvif, arg, sizeof(*arg)); } -static inline int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif, - struct hif_mib_uc_mc_bc_data_frame_condition *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) { + 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, + }; + return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_UC_MC_BC_DATAFRAME_CONDITION, - arg, sizeof(*arg)); + &val, sizeof(val)); } static inline int hif_set_config_data_filter(struct wfx_vif *wvif, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 9030681858bb..79285927c7bf 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -120,7 +120,6 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif, 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 = { }; - struct hif_mib_uc_mc_bc_data_frame_condition filter_addr_type = { }; // Temporary workaround for filters return hif_set_data_filtering(wvif, &filter_data); @@ -144,10 +143,7 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif, } // Accept unicast and broadcast - filter_addr_type.condition_idx = 0; - filter_addr_type.param.bits.type_unicast = 1; - filter_addr_type.param.bits.type_broadcast = 1; - ret = hif_set_uc_mc_bc_condition(wvif, &filter_addr_type); + ret = hif_set_uc_mc_bc_condition(wvif, 0, true, false, true); if (ret) return ret;