From patchwork Wed Apr 15 16:11:29 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: 221158 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.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 9BA16C38A2B for ; Wed, 15 Apr 2020 16:12:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 73A6C206F9 for ; Wed, 15 Apr 2020 16:12:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="kWfXi4xg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410237AbgDOQMc (ORCPT ); Wed, 15 Apr 2020 12:12:32 -0400 Received: from mail-eopbgr700077.outbound.protection.outlook.com ([40.107.70.77]:38433 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1415192AbgDOQMT (ORCPT ); Wed, 15 Apr 2020 12:12:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FeinoMT7uEA8YyflQJhJy5jRcWOwow6j728t737yiX6KhDs4YW3G9IEQJeEHqE9Fq7CGtamd7DbbvTIlBfvGsoi7tJ1d9QbJIPaE0CrbqxlkgudGHnJxMyxWu0RBQ78FrfWEJsRpijyyLY+2cDV+03yVzybfkC455UIDTyhE8InqHkJSv8TSMWJhw6iz0b0JsdIUlj36ry1RfCkqPtrweTsM/znpk7mxvQqeGjhR1TXOLPLQ/XIID7Mfb5axDqlrtFIggiisFEBe1dBVDGRjpo4OhXLZQ1kS4J1/OfiU4aODT/X/sGVMMuc4s+TYeLWNyukN6biVZVdyk7Vub284PA== 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=g62HYkkGU/coH6qCoMkXIzdcdD18sCGRgbclU1snP4E=; b=R3huz/zR8+bt1jCzYNbGyjkX2ep+5RJWqUhQ0fgFPujPIwhZirzBzdfbF4U72ZRopVlPlYiberqv6kfW4vwb8bZDwIj/SZiXKuYzaNlW1WRxxVTKoUPav0JcGOLSKtX7RhUcli0QlB23U8tCquLYpcombDYwRDtrEWfFuMBVNJt2adFZkbnx+WEXtGGUWrgyeRtRmluYU9owDivgtTaw31FN8dOiF4CSCFHcp60nYja30iWb1o8uevViQMfS0laFtuPYxYHPlVLgVXHDRjbkKh7XO9Yzb6N2cqNXHmJGYEUwkAP0o7fXRHV1sn0XXgtjy+7KXiUOoDkg8YiCVv5ZDw== 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=g62HYkkGU/coH6qCoMkXIzdcdD18sCGRgbclU1snP4E=; b=kWfXi4xgvHLsaLYQF63etnGpdAzIpLWW5z5sETSj8/B1cn/ZaUMZQ6Kdje1LyzGALUI/Xhyj2uFqLNLUqC45fqv2lyKfoJ/7RlPyWl2vkwqEER2LRTG6Pe1jZO8oZ22nhEg99UGsnnksCa44SatIU2M7J1GOkw1Qu2DH+BFHXuQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1408.namprd11.prod.outlook.com (2603:10b6:300:24::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25; Wed, 15 Apr 2020 16:12:15 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe%10]) with mapi id 15.20.2921.024; Wed, 15 Apr 2020 16:12:15 +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 02/20] staging: wfx: simplify wfx_update_filtering() Date: Wed, 15 Apr 2020 18:11:29 +0200 Message-Id: <20200415161147.69738-3-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200415161147.69738-1-Jerome.Pouiller@silabs.com> References: <20200415161147.69738-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR1PR01CA0027.eurprd01.prod.exchangelabs.com (2603:10a6:102::40) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.home (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by PR1PR01CA0027.eurprd01.prod.exchangelabs.com (2603:10a6:102::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Wed, 15 Apr 2020 16:12:13 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca8e450f-87b0-45cb-34a3-08d7e157c301 X-MS-TrafficTypeDiagnostic: MWHPR11MB1408: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:221; X-Forefront-PRVS: 0374433C81 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(136003)(396003)(376002)(346002)(39850400004)(366004)(8886007)(8936002)(5660300002)(2906002)(6666004)(86362001)(8676002)(478600001)(81156014)(66574012)(1076003)(4326008)(52116002)(316002)(54906003)(107886003)(186003)(16526019)(66556008)(66476007)(36756003)(2616005)(6512007)(6486002)(6506007)(66946007); DIR:OUT; SFP:1101; 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: F3kt4/H7pIyA2iGASpp2DVAa0k/DJJGBSVIhuyltXOl0JfomK90OmK4hydVoZ1LFyUPkJUxlrT4O58LomOgiF9xSfvCp/jkDdQhsRCU0YpSQ8oiJNzIVqzfJCLgwFsCuJL3lM5ErtEN0gD0OAFHD1ovgQgdX69S/zNQSx7GlJgIVsOwD+EjfO06I16EPC0+sFaHxD7eaWmyVjz2FfgLFAhYgI6604Nf401ut0SeRgsZiDbBh346PpyHiJALZMS3KM9D2c8xhTrDuPl9K7/nCY10BfHwsxvaCs83yYK3GgIUE+4TPsFDNAuEl0hs7crIMR+B5ULsV0QbmjUeXKHiRYNtJRmQRqM2aaH83oLFB90KrirzoS/rfB7OIPCjOpdyLmfwOp7GuwOlcfSKuvE7IY1xR5LNTkF+XbdTX1FhzTtRDSqhyG8SBGtU+ZVOaEgVY X-MS-Exchange-AntiSpam-MessageData: KHDp3y6EJb3akgI8kZ8HqZ9nnwcvfXCkt2BS23bHgcS5UdAUjQugEOgVDvraYTbpBfi5DwsWK95ffygiTov7BLpC5H+DBAm3bZa6HXbXP8iNgJIS7SgbNHKeap445Is/gxx+yi6FO9DlnTvS12oNeMhy3Hdp1+EVOLc9PB3fyggifzhSrXE594t2YtfJSTm9ocqkZXSpDTz4JOyTT3t7ig== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca8e450f-87b0-45cb-34a3-08d7e157c301 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2020 16:12:14.9203 (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: uLXjjrwHfbA3dAVwjRdka7hiBSD+Ms3LZxSit0kWr/HTDr7kIPFpmB/Vmkhkuk2N2kUson6lfGuRdfLoAdUKUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1408 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller Inline wfx_set_mcast_filter() into wfx_update_filtering() and remove useless intermediate variables. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 69 ++++++++++++++------------------------- 1 file changed, 25 insertions(+), 44 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index cb9d14471745..14e2f106b042 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -120,34 +120,9 @@ int wfx_fwd_probe_req(struct wfx_vif *wvif, bool enable) wvif->fwd_probe_req); } -static int wfx_set_mcast_filter(struct wfx_vif *wvif, - struct wfx_grp_addr_table *fp) -{ - int i; - - // Temporary workaround for filters - return hif_set_data_filtering(wvif, false, true); - - if (!fp->enable) - return hif_set_data_filtering(wvif, false, true); - - for (i = 0; i < fp->num_addresses; i++) - hif_set_mac_addr_condition(wvif, i, fp->address_list[i]); - hif_set_uc_mc_bc_condition(wvif, 0, - HIF_FILTER_UNICAST | HIF_FILTER_BROADCAST); - hif_set_config_data_filter(wvif, true, 0, BIT(1), - BIT(fp->num_addresses) - 1); - hif_set_data_filtering(wvif, true, true); - - return 0; -} - void wfx_update_filtering(struct wfx_vif *wvif) { - int ret; - int bf_enable; - int bf_count; - int n_filter_ies; + int i; const struct hif_ie_table_entry filter_ies[] = { { .ie_id = WLAN_EID_VENDOR_SPECIFIC, @@ -168,29 +143,35 @@ void wfx_update_filtering(struct wfx_vif *wvif) } }; + hif_set_rx_filter(wvif, wvif->filter_bssid, wvif->fwd_probe_req); if (wvif->disable_beacon_filter) { - bf_enable = 0; - bf_count = 1; - n_filter_ies = 0; + hif_set_beacon_filter_table(wvif, 0, NULL); + hif_beacon_filter_control(wvif, 0, 1); } else if (wvif->vif->type != NL80211_IFTYPE_STATION) { - bf_enable = HIF_BEACON_FILTER_ENABLE | HIF_BEACON_FILTER_AUTO_ERP; - bf_count = 0; - n_filter_ies = 2; + hif_set_beacon_filter_table(wvif, 2, filter_ies); + hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE | + HIF_BEACON_FILTER_AUTO_ERP, 0); } else { - bf_enable = HIF_BEACON_FILTER_ENABLE; - bf_count = 0; - n_filter_ies = 3; + hif_set_beacon_filter_table(wvif, 3, filter_ies); + hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0); } - ret = hif_set_rx_filter(wvif, wvif->filter_bssid, wvif->fwd_probe_req); - if (!ret) - ret = hif_set_beacon_filter_table(wvif, n_filter_ies, filter_ies); - if (!ret) - ret = hif_beacon_filter_control(wvif, bf_enable, bf_count); - if (!ret) - ret = wfx_set_mcast_filter(wvif, &wvif->mcast_filter); - if (ret) - dev_err(wvif->wdev->dev, "update filtering failed: %d\n", ret); + // Temporary workaround for filters + hif_set_data_filtering(wvif, false, true); + return; + + if (!wvif->mcast_filter.enable) { + hif_set_data_filtering(wvif, false, true); + return; + } + for (i = 0; i < wvif->mcast_filter.num_addresses; i++) + hif_set_mac_addr_condition(wvif, i, + wvif->mcast_filter.address_list[i]); + hif_set_uc_mc_bc_condition(wvif, 0, + HIF_FILTER_UNICAST | HIF_FILTER_BROADCAST); + hif_set_config_data_filter(wvif, true, 0, BIT(1), + BIT(wvif->mcast_filter.num_addresses) - 1); + hif_set_data_filtering(wvif, true, true); } static void wfx_update_filtering_work(struct work_struct *work)