From patchwork Wed Apr 15 16:11:30 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: 221149 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 708C0C3815B for ; Wed, 15 Apr 2020 16:15:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 457C920656 for ; Wed, 15 Apr 2020 16:15:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="abQmF4Ft" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410325AbgDOQPo (ORCPT ); Wed, 15 Apr 2020 12:15:44 -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 S1415208AbgDOQMW (ORCPT ); Wed, 15 Apr 2020 12:12:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Iv+v3roAq2CxG1em9YkenbvLrO1QCzl4VM2GbhKrxGxOeywNYmw5H8qD+aTfcCzIPFT+oA4TgAu6gdRu4kO0FFktVRu5RSnxnOTHQtomjiFoZkRAqjhyX+jueh5bdXJmUeoCrwHXzDKyS6jUX3nauM3JRocJwFhQgHWBNA/h7YawkBTejDQ3zjXhRnWG4Hy+Neg2gJp1a0NTPpSMWO309OyE1AWQxy5P11OQMJqWfNqYLDwvh0bzlRql9/RLxfumetIfSrCZ5B+sGAyNm9CYBfOYFKAwzvsxIey1dtnMfwqmbcsla7q0K3yjETUu/fjtJxA4JBbN8jl4nSQvkpoNaw== 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=bxulB34wil+80Clk2MTntwTOBSVESVKF8em79hHSyRA=; b=gjZRvSx1v7V0nInKsou2kLFcV/JTLwolWQSdGac8lplL0W6a3Yk3a3/RYJZWcTMZD8d+cUSukiOKTes0CBR+UYU+visAVl5oFk35jgYtZojCyNB+7qgJDDC3Na19Vzt6pgdn1he3jZHuf+tXSOBl5ZuMoIcJNvJbJq1LBM0PdufTfZSBbscjfxREDwlvbUfoT1F1jg85OpLet14SMVP7aOIyFrSYqvQHjIstpocMbVXJb+rIcEMmDfGCYmeBLreTN+ac9qwGeCZF+16L/BICEYYFn6vQm0pujhESQoSmb1h0PsfBCK+MHYE7t5sCWqsVHN+JgtRrjxgOmIfu83CsUg== 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=bxulB34wil+80Clk2MTntwTOBSVESVKF8em79hHSyRA=; b=abQmF4FtVdGncQt0iJsAhKuVkXbzRpMQPg3xUWYUymKzd1ib+MX6/Ln2v0AbRPmi06Jz19eJmHl09a+QaMl3uJu+gvufyCJmovbMiYb52m81ht4/3vcg0ZRzUvtOYOQ9VnQM8dRpjQwEVi691anxMVdRM3s5L7aHzUnX3oxJgiE= 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:18 +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:18 +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 03/20] staging: wfx: rework wfx_configure_filter() Date: Wed, 15 Apr 2020 18:11:30 +0200 Message-Id: <20200415161147.69738-4-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:15 +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: 8bcf12df-12b1-474e-2b9d-08d7e157c529 X-MS-TrafficTypeDiagnostic: MWHPR11MB1408: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:873; 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: 3jW8jBz2bc3zjS7i30fOOJKmxbe40tKGxhDT2INm46/CvzL5hmlh3Yi31lNhJDTrRit3eqTRitWjBZLvNbc2/uCWxRsXKLuQ9MGp1RDpLbSme6WpRuBX9Um/9yPCchZIaIwUWopNd0SmC3SyAlP+A0mFiYJDxbIC9sth/aDzgwmrQnS8DdnkfS42nKfgNx25p6IExMpC9FFSwlggduz0mf4gv+SbjFgjD8Efel2C+EVdYJoepRnLPkGEzi0FtWa0gkP9ZTI+Pwclc0G/CnDNewNUqMtO2cH4gBWDbtJ4bszDOQjANINS4rprxJUAtQS2oaQeSD+pLPC3n2r5/eHKjbMBGlxqFY2VtwmXSkpIwVrngXE9OPoJL3l3RZx6669hV92clr8uLI4uV3/OS/XnCxj/cTA4wlcFVKuQskPkwxmH5O10WUBrGh/QlZnROzFV X-MS-Exchange-AntiSpam-MessageData: mnGDHs53Gvntec9HGDU3dQuM+0jYy/8e9t/LV/vkTlOieokFL1aTkxYdxQJj249JrSL3Q3TV8S06qe5IfEg9SWh+GgCIPKzlIOCKzKIEya3bqO0e73vACN6+to1mW0VQ98xtShBJC/gNiglCe6AnaahdDqw89yzkdjGkZeuHBmAEkCRNHmcp0hex+V9by5PeVkFQeJuBblwjDR4RW4grRA== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bcf12df-12b1-474e-2b9d-08d7e157c529 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2020 16:12:18.6646 (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: eCeFJX0oHHdaL95xgoQMdEovtvEBtEiOh22nJrHM8bQsjQb+6JgyUb4No4b6qduGD721s5nAW2HUAAybLCGp7Q== 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 wfx_configure_filter() lacks of coherency. In add, some corner cases seems to not been handled properly. Rework the whole function(). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 41 +++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 14e2f106b042..ec949ce0b256 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -203,7 +203,6 @@ u64 wfx_prepare_multicast(struct ieee80211_hw *hw, ha->addr); i++; } - wvif->mcast_filter.enable = true; wvif->mcast_filter.num_addresses = count; } @@ -218,16 +217,46 @@ void wfx_configure_filter(struct ieee80211_hw *hw, struct wfx_vif *wvif = NULL; struct wfx_dev *wdev = hw->priv; - *total_flags &= FIF_OTHER_BSS | FIF_FCSFAIL | FIF_PROBE_REQ; + // Notes: + // - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered + // - PS-Poll (FIF_PSPOLL) are never filtered + // - RTS, CTS and Ack (FIF_CONTROL) are always filtered + // - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered + // - Firmware does (yet) allow to forward unicast traffic sent to + // other stations (aka. promiscuous mode) + *total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS | + FIF_PROBE_REQ | FIF_PSPOLL; mutex_lock(&wdev->conf_mutex); while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { mutex_lock(&wvif->scan_lock); - wvif->filter_bssid = (*total_flags & - (FIF_OTHER_BSS | FIF_PROBE_REQ)) ? 0 : 1; - wvif->disable_beacon_filter = !(*total_flags & FIF_PROBE_REQ); - wfx_fwd_probe_req(wvif, true); + + // Note: FIF_BCN_PRBRESP_PROMISC covers probe response and + // beacons from other BSS + if (*total_flags & FIF_BCN_PRBRESP_PROMISC) + wvif->disable_beacon_filter = true; + else + wvif->disable_beacon_filter = false; + + if (*total_flags & FIF_ALLMULTI) { + wvif->mcast_filter.enable = false; + } else if (!wvif->mcast_filter.num_addresses) { + dev_dbg(wdev->dev, "disabling unconfigured multicast filter"); + wvif->mcast_filter.enable = false; + } else { + wvif->mcast_filter.enable = true; + } wfx_update_filtering(wvif); + + if (*total_flags & FIF_OTHER_BSS) + wvif->filter_bssid = false; + else + wvif->filter_bssid = true; + + if (*total_flags & FIF_PROBE_REQ) + wfx_fwd_probe_req(wvif, true); + else + wfx_fwd_probe_req(wvif, false); mutex_unlock(&wvif->scan_lock); } mutex_unlock(&wdev->conf_mutex);