From patchwork Tue Sep 1 06:32:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11747455 X-Patchwork-Delegate: kvalo@adurom.com 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 9BF87722 for ; Tue, 1 Sep 2020 06:32:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D09B2098B for ; Tue, 1 Sep 2020 06:32:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="WfaoZXBz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbgIAGcy (ORCPT ); Tue, 1 Sep 2020 02:32:54 -0400 Received: from mail-bn8nam11on2136.outbound.protection.outlook.com ([40.107.236.136]:32243 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726044AbgIAGcx (ORCPT ); Tue, 1 Sep 2020 02:32:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+ghoBoff/fNgTJfg75Uda8MkoWgy5Bf4OB5Vw2AjCoNPgJCCnzATFY4FgRCTr8uOVuC2R9Z0Xqai1pWpNPOwUwP4udGbcCdrW88nXRIWHFla4x6EdLFEmWFQPfIKPDuzLYanPskD/LhyBjjqrzxVSNmp3cD5RYBT3HuFrkT6HqZWwYo/sk2Qr+hgt4Meq4bjfY0ni1SxJOoFwfDGmZq00/1f1Y6p3Q9Wr7UvGHDbIumfWeIxioXJLslTgMPYvc9UB6tE3l+lyf22e1snp5c+RnmA+7dtpksYK6+IgdZmR66JXI10lyy/T5F2hN85P6+yxZHJJDUbbm/rYfJV9ov0w== 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=9MpGiPjnDLF9HprRDVXneZSIuoI0foKR0ud2KcWljy8=; b=LF6ApP8rQYVFv6mcYo5FXETRTM/eD9/GLj33F20v6xD4usdh6pTrDQOGcxF40QgCfrO65YOGihBeSs678GCf1nP6cN/2Vx4qdKQuGwve3HEjOZ0+AAAGUiAW1ZOTuRWJdpA5ZadCPRANqN4uAkOuxdBf4jL+dtGcPkOZpeTsa/r73L3dNvJHUD9sqaUspFQHT4gRWRKc/Le0byWBLARUaH09cFzE9hRGG0uLIBl72Zpr+BOQXun4o1wYVVU3hgmjyY2Y3yNqh4PVgePlUIKfzsnbpxJ5MGX8NvI5F2VrxwqelBiCPVrMEQApck9/OUeGDySaTbwnr31ZTL14ropYWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9MpGiPjnDLF9HprRDVXneZSIuoI0foKR0ud2KcWljy8=; b=WfaoZXBzb+HIpxkMUA9jVz6KCD6S2umv9oY4aZ9nhccADvXYH14EJ6WIyOTH3dUwbGp+1/Bjaoy1LBkogu+eA6OOjnfQcd8oS/zEA3d8Ia/TXptmKFTr0Nd8qBHn6buXhreS+iRTar9UkOQQRSdty/3U9Tf4G0GmWTFSQr+xi0w= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=cypress.com; Received: from BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) by BN6PR06MB2867.namprd06.prod.outlook.com (2603:10b6:404:114::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.21; Tue, 1 Sep 2020 06:32:50 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 06:32:50 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , chi-hsien.lin@cypress.com Subject: [PATCH 1/4] brcmfmac: add change_bss to support AP isolation Date: Tue, 1 Sep 2020 01:32:34 -0500 Message-Id: <20200901063237.15549-2-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200901063237.15549-1-wright.feng@cypress.com> References: <20200901063237.15549-1-wright.feng@cypress.com> X-ClientProxiedBy: MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 06:32:49 +0000 X-Mailer: git-send-email 2.25.0 X-Originating-IP: [157.95.12.33] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: af61b1d3-b035-44fc-cb9b-08d84e40d915 X-MS-TrafficTypeDiagnostic: BN6PR06MB2867: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AqHqDmL9vNM/28vvvcUe7xROuKaQEc+4BhH2/R7Bcu5WlIVVCY2imSv4KFwAAQfYHPw600Og2nTNixHjSnaQItk5zpysBi3frhFIwqVQSvzaMupQjSRvLBqaBmxkStJqTcV5sIXkdcVC/TtbPymIIeAqx/eAH8bggVqGjtRuc7eJaSUhlp+zfiaddG5gQeALzvhNj9+11PNAYQSPfZNHHIl7AvUChe5qlDoD6m4CmvECBbsSCWgSYfs0VzVi5cTfRdmkhvqxhHebWKa43fYS4OCg/6+uEQohmDRY0U6eCo4bsorys4IIBoAnMMuNUKly X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR06MB5889.namprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(54906003)(478600001)(5660300002)(66476007)(66946007)(52116002)(26005)(66556008)(107886003)(4326008)(6486002)(16576012)(316002)(186003)(36756003)(86362001)(1076003)(44832011)(6916009)(2906002)(6666004)(8676002)(8936002)(956004)(83380400001)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Y1BdfyGOC1u4E+XS6p32CwWM6D3fXvI+AmXSpKjdCoQUqJ5lp1fIyBC8/uCvoOARwh8MJXSBF0KgqkG7QDy4+nr6o1jQBLQ6EJlsl1PjrpPs+12WzI6gw13tMGhtLJW5uyQu6jFgqztWTkqVafxu9MJkLki38whFRU2K2HtxQz/+ARC2lEwzcaLntWEsj4tjpAhSGApjcuIHAGFUwwijiEeYSjr3K7RJz0V+3zIul8eFMZelvw1PEWWAOO2wRG4a5K+5gtjU81cvBpkRpFB97zKDjC+PMOJ1CGZRqtNif4DKjCExLEC0atqp7e7BI74J7PpMlHIbbfXaoCnpH3TToDPse3tEB93+VqLHq0qs4Eqancs8BUr1D9s2w7eM0/yLc51V+ruNhNNYt1iq/zSMfU0BRgRObKJjnMCXRoYBJuX+N9ZbUu3CwFm+dU+X2Hi8ynnOpmiwohKthHBmM7qtYT6lmUrGGktJsLscpqRajhPK5rx5OZ4DlfyD6Ifc+4qnOP0rl+ydzFamPLrH8Y4lyB4qFEAxkgCiOkgAaXW4QcH7LHI6BrSCQvKYFbM3Gp6hhB+C+yzTaTzcAZ0YvfGir5ZwejuIZQhUy2gRxzMxO4D5NMls1SwxUSy5z0FGAOboZhX7VoXxysK5uy99l/HTfQ== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: af61b1d3-b035-44fc-cb9b-08d84e40d915 X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 06:32:50.3760 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 66N9F0eP+lIuBxZTj02ZU59daRFuY9z5uNN14itBF3nEMZj/DUXUE240dj1oMG98uBj0AtAVgQlBYzXtpIXIwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2867 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hostap has a parameter "ap_isolate" which is used to prevent low-level bridging of frames between associated stations in the BSS. Regarding driver side, we add cfg80211 ops method change_bss to support setting AP isolation if firmware has ap_isolate feature. Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 23 +++++++++++++++++++ .../broadcom/brcm80211/brcmfmac/feature.c | 1 + .../broadcom/brcm80211/brcmfmac/feature.h | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 5d99771c3f64..7ef93cd66b2c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5425,6 +5425,26 @@ static int brcmf_cfg80211_del_pmk(struct wiphy *wiphy, struct net_device *dev, return brcmf_set_pmk(ifp, NULL, 0); } +static int +brcmf_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, + struct bss_parameters *params) +{ + struct brcmf_if *ifp; + int ret = 0; + u32 ap_isolate; + + brcmf_dbg(TRACE, "Enter\n"); + ifp = netdev_priv(dev); + if (params->ap_isolate >= 0) { + ap_isolate = (u32)params->ap_isolate; + ret = brcmf_fil_iovar_int_set(ifp, "ap_isolate", ap_isolate); + if (ret < 0) + brcmf_err("ap_isolate iovar failed: ret=%d\n", ret); + } + + return ret; +} + static struct cfg80211_ops brcmf_cfg80211_ops = { .add_virtual_intf = brcmf_cfg80211_add_iface, .del_virtual_intf = brcmf_cfg80211_del_iface, @@ -7492,6 +7512,9 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; #endif + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_AP_ISOLATE)) + ops->change_bss = brcmf_cfg80211_change_bss; + err = wiphy_register(wiphy); if (err < 0) { bphy_err(drvr, "Could not register wiphy device (%d)\n", err); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index 0dcefbd0c000..1ffa9742612d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -278,6 +278,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode"); brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable"); brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp"); + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_AP_ISOLATE, "ap_isolate"); pfn_mac.version = BRCMF_PFN_MACADDR_CFG_VER; err = brcmf_fil_iovar_data_get(ifp, "pfn_macaddr", &pfn_mac, diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h index cda3fc1bab7f..243d9afddb8c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h @@ -49,7 +49,8 @@ BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \ BRCMF_FEAT_DEF(DOT11H) \ - BRCMF_FEAT_DEF(SAE) + BRCMF_FEAT_DEF(SAE) \ + BRCMF_FEAT_DEF(AP_ISOLATE) /* * Quirks: From patchwork Tue Sep 1 06:32:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11747459 X-Patchwork-Delegate: kvalo@adurom.com 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 A017D1575 for ; Tue, 1 Sep 2020 06:33:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 837502098B for ; Tue, 1 Sep 2020 06:33:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="hiRWMPHG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726724AbgIAGdI (ORCPT ); Tue, 1 Sep 2020 02:33:08 -0400 Received: from mail-bn8nam11on2136.outbound.protection.outlook.com ([40.107.236.136]:32243 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726586AbgIAGdH (ORCPT ); Tue, 1 Sep 2020 02:33:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dx+VFkX6wlsD79eur9bc3aRcqX0ha6XtWdCBI1M+Jv4jU9qDCV280h82zofBgtSMUwX1X2Xnl717ZEjfOO0RJx1RiS65gU7xG7iV4s1k0sgXDgvLoAQIaq9OKZTDXoqDp5QB2MLgo7SRIuZiC3RLKy9b8UKtDrFocIecxlzjjFcRXp7gGk38kuV9gxdjpDFuOJH3j2yLctLqM5dFkeyrbYf4bNRf3Vv5HirDhfKaAIKuAzbn+LGql66OtGN+2USWCJbe7xRIJh2deeuOK9T33TDLS4JeJ73ut/0xnU7diJivriv5UTzhE5S92qjyG22lQLD+IlqFb7BoXsw+MS9idA== 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=R74FJNe0wB0ngb/sp/5B1pYwCUew++USVnbW8gawy0A=; b=g6uTHt52yTROwHJYpwQ3WACiaDeRqTNdwKuSWjy/Hq4M/aKD1ddmiSS59MESlNLzqG/5LflN3xBusQzPEZeD5H8IwbLn1zpffEkmtXuVUNzJC4RmKnHK73sRExBN+qhLyMU9CiouV0SCqsca5IDV4A3m5TBd2hAtK3SitobCZcJSHGdXlivHFcG6TAzh7pJKcHSQjgHTfsrfg2+artk+t5hre+Om00CxdEBGzjXN/P/m741VuEU/ShulgowHl9l3rs5PgSdx8/YpIVw0uiJhZvlHE/jFHagEng4axXL/UYdqoMLuCmi8EggECBiaMo96k+epPtp9THL8HtyrN61/NA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R74FJNe0wB0ngb/sp/5B1pYwCUew++USVnbW8gawy0A=; b=hiRWMPHGoieTdl3CqlMhaOhMFdjRp4mUDa22Pu2NW4QlDGhsLvyOOnXyw+n66VJAuB+MQvkpo587Nu+JVyCoyX9EyNdqWNwyiN4AHEWPaz7/572OB4B08xUILcp3WbB7ntIn/zHEAKL6uatDEc85UZ4g4kWg94MkChvDSyjjMBw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=cypress.com; Received: from BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) by BN6PR06MB2867.namprd06.prod.outlook.com (2603:10b6:404:114::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.21; Tue, 1 Sep 2020 06:32:53 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 06:32:53 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , chi-hsien.lin@cypress.com, Ting-Ying Li Subject: [PATCH 2/4] brcmfmac: don't allow arp/nd offload to be enabled if ap mode exists Date: Tue, 1 Sep 2020 01:32:35 -0500 Message-Id: <20200901063237.15549-3-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200901063237.15549-1-wright.feng@cypress.com> References: <20200901063237.15549-1-wright.feng@cypress.com> X-ClientProxiedBy: MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 06:32:52 +0000 X-Mailer: git-send-email 2.25.0 X-Originating-IP: [157.95.12.33] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c09c09ce-19ee-491b-b737-08d84e40daca X-MS-TrafficTypeDiagnostic: BN6PR06MB2867: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bNGfMQVBKL58VXmvQHycghpGWFIepyruXc2O1806XRq3Ac1bdVudio0l5W/Jy8lhjkYhm/SmEe/NlOda72q7tMwy5woNUSWtjh0x/EK5Z6+SJLMMeIB8LIBquY8oYzGMrmtPnhe+rabxpf0uaVcVUC0sC5E7KMw8UVMh7PbzlilNprxPKdbto2WaPWBys84Kn42u7QrL20xvHZcP+kiSOBZXSq6Ar7IRXsdYWNWASyrgPTlxHXshKFmOKZcP3Jana5X4u/h2vz87XeKcpoGNvlnZ7Ii5mVWO4eRvUDWAQ/xj0pLhpJKW3B2LyH6XbIvMDbr1KvgPtoG9Z53bcIk07Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR06MB5889.namprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(54906003)(478600001)(5660300002)(66476007)(66946007)(52116002)(26005)(66556008)(107886003)(4326008)(6486002)(16576012)(316002)(186003)(36756003)(86362001)(1076003)(44832011)(6916009)(2906002)(6666004)(8676002)(8936002)(956004)(83380400001)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ZVb0jYU4DreEkgwMa3V2u4yLAZRn9m322FPBR6kAl2aWB5fFgVxYOyrINua+uFvqMEkzpiqgvPG80x0JsMpqG2YWucgKJG0BHmtOr7/6ve3iXfekp0JM3FZbud53oUJRl/dEJIbOihHMaDS+K5DGfjxNVSLDnAxCBzzlPPDVVd555HcFSZzoyFrG3G3FTIF31nN1moKKHFTyEmQ1NSjmZsTHAcR51nrZrR0XSbtjwVvYCLsqZl5Ru2QOGuB07MdPcrJ/6M32xAm4l3+80fWLPFIcm2XfLosyOe2ltWkU/WxEQdUHq6z6dXn8dG7jvIkiicWm77ltxfHVU86vAQgV6k+GKjdUtooahmY7liwBHEqBCTl0wPnrFOjJOdgZ6ZEi+qnC5UtApKPX5tOD5isTG2Tr31eAm/wIDH6OXg9iP+nbjmzrpmYntihdSWTucARs8oEFxtxd8Sc/RYgqlG8BkEokyv+rcE4ARvjLEScZPh3E/kgJ2ZYlC0lIwl6G1ZBQZuOPOvHrQ9P0r621WzT9pJxHaQ3Z1A6Z3NC4XhrjgAaIYytTnk9AtO/hLGbc48zy2fZzk2NnYMIZ+WyWv0WTfC8EY4Mcxf9OeuGXSCLXHWb95WxqFwMu/P/wG4siwNdibYVOJ5nfJc9SEUt4XKaiiA== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: c09c09ce-19ee-491b-b737-08d84e40daca X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 06:32:53.3554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9oCKoEVgrL3DVvCZDFmiA5T9RW22CvoqzBSu+VGXz9j/xOOX9aVcMd3EK6Q/HvLj3TYbTyjFjuufc8TvvPsk/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2867 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ting-Ying Li Add a condition to determine whether arp/nd offload enabling request is allowed. If there is any interface acts as ap mode and is operating, then reject the request of arp oflload enabling from cfg80211. Signed-off-by: Ting-Ying Li --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 17 ++++++++++++++++- .../broadcom/brcm80211/brcmfmac/cfg80211.h | 1 + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 7ef93cd66b2c..d6972420d426 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -766,6 +766,21 @@ void brcmf_set_mpc(struct brcmf_if *ifp, int mpc) } } +bool brcmf_is_apmode_operating(struct wiphy *wiphy) +{ + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_cfg80211_vif *vif; + bool ret = false; + + list_for_each_entry(vif, &cfg->vif_list, list) { + if (brcmf_is_apmode(vif) && + test_bit(BRCMF_VIF_STATUS_AP_CREATED, &vif->sme_state)) + ret = true; + } + + return ret; +} + s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, bool aborted, bool fw_abort) @@ -4949,8 +4964,8 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) bphy_err(drvr, "bss_enable config failed %d\n", err); } brcmf_set_mpc(ifp, 1); - brcmf_configure_arp_nd_offload(ifp, true); clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); + brcmf_configure_arp_nd_offload(ifp, true); brcmf_net_setcarrier(ifp, false); return err; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h index 333fdf394f95..8c14d00c6d0e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h @@ -447,5 +447,6 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, void brcmf_set_mpc(struct brcmf_if *ndev, int mpc); void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); void brcmf_cfg80211_free_netdev(struct net_device *ndev); +bool brcmf_is_apmode_operating(struct wiphy *wiphy); #endif /* BRCMFMAC_CFG80211_H */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index f89010a81ffb..20c510dca601 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -96,6 +96,11 @@ void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) s32 err; u32 mode; + if (enable && brcmf_is_apmode_operating(ifp->drvr->wiphy)) { + brcmf_dbg(TRACE, "Skip ARP/ND offload enable when soft AP is running\n"); + return; + } + if (enable) mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; else From patchwork Tue Sep 1 06:32:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11747461 X-Patchwork-Delegate: kvalo@adurom.com 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 A7D0C1575 for ; Tue, 1 Sep 2020 06:33:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B01E2098B for ; Tue, 1 Sep 2020 06:33:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="XudUduQo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726733AbgIAGdK (ORCPT ); Tue, 1 Sep 2020 02:33:10 -0400 Received: from mail-bn8nam11on2136.outbound.protection.outlook.com ([40.107.236.136]:32243 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726044AbgIAGdJ (ORCPT ); Tue, 1 Sep 2020 02:33:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rhs27fxYwBL5A5tYc/Xqffk9OPA0CxnkRkaLbSgJweunpTPxgZ4Ibz8FpCSSJOgMKpJVb7oJsKETDRiOL5LlXB1uFASlt6VzuQFt2cBdBH2IRDJuqN1YhFtfh2sM1i5Obuf1c2yTgs1U1dsF3ijtB5RlIb0K4Biqf5EM1fIL/tzWeqCS9byTPZH//sLDLrXcACwOBIlqXPrlmYt3l9t+T9T8sQmkb0BIbOrXvFxc6BFUvfzgnK60YuCPkATHXAetp4Bq5SByYR8OEGS3qxf3RkOdXXEYeQO2qgjcKksbTBqmBpUHeTnmYUyG8C0zkVquqNml2WCgpxlmn1fu5PyiYw== 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=krM8iekJjyXH0Z22AFemtJNFgcGZkGTd91pUGGBaUnE=; b=VOvPdmjpwALZGyf5ECG/OUhPocpLM1mjJCxGUQnjN/hip1ZIExon7FzMOyfweNoebW+IwbZxL0MxWihnhXHO5u2eMZZHq3C/HAj4GdcURfNEBoG/A85gxHaxViqXUUKjlTlj6D/274Bd7RFJaNfxqX0dDCQBB01owlpHnI4CGSYi5SXHCmGuI9P8VPo/cyc07zR4aOZc7tXtoBAtMINxHTJ69Wk3Rt9UrKi9BL0/N5xhSvg3Bh9uZnbaLB4E+Y2zcoyWvjUzcs2DWQhTbUMTnF4eECvPzEI0xQefdSQ125EpD2iwXfzDWX1ucCQvPOw6GrX+2oUc2y33SDTVX2onWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=krM8iekJjyXH0Z22AFemtJNFgcGZkGTd91pUGGBaUnE=; b=XudUduQoeaLCXuOFAdNFz5B457PVmoSLnCBukYh02Elhm9q/G548lpIpGjZ5ozBMYDPGr+OKfKJo2fDk9itSadbnueSm4b/qR/b8CadyDWttr4T73zsSHzeQ8gr4T9B+GYDiKRD5Ywnsu2ZWPvsyNC2xYUVCEepI90JZXoLfXVc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=cypress.com; Received: from BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) by BN6PR06MB2867.namprd06.prod.outlook.com (2603:10b6:404:114::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.21; Tue, 1 Sep 2020 06:32:57 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 06:32:57 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , chi-hsien.lin@cypress.com, Jia-Shyr Chuang , Ting-Ying Li Subject: [PATCH 3/4] brcmfmac: support the forwarding packet Date: Tue, 1 Sep 2020 01:32:36 -0500 Message-Id: <20200901063237.15549-4-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200901063237.15549-1-wright.feng@cypress.com> References: <20200901063237.15549-1-wright.feng@cypress.com> X-ClientProxiedBy: MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 06:32:56 +0000 X-Mailer: git-send-email 2.25.0 X-Originating-IP: [157.95.12.33] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fd0f08fc-e56a-4d4d-7c01-08d84e40dd3f X-MS-TrafficTypeDiagnostic: BN6PR06MB2867: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7H0Ns1tPSADKnYXFkCWXntIdZ3LMk1GwKUH9d2JSojkS5xutNE8dw3nDlPV9KCEua+bR1igfPK+HZo36kKctsM7APXCuLo7JxDdCeHq/PrROw+qgEKfv1r+BjcrmpCe458xRtxYAhyCzoBXamGaGmWwH7C6nQopDT+ip4Ba+Ncll0pxKgMOPJKrbW4sj42uhBONpmUiRWZ2XsKoyVRjLIg1KGVT20ONGFzlMFAMPWCPI4bH3SiBnmfNETuc6GlKoeRjiikEtcCHGyumtrrOS0P0rhEh06O1+qrFfzaHLTPBShe45IQwnqu33IzhWBrhBukA/DHnGoiFPBIzJEU9m4A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR06MB5889.namprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(54906003)(478600001)(5660300002)(66476007)(66946007)(52116002)(26005)(66556008)(107886003)(4326008)(6486002)(16576012)(316002)(186003)(36756003)(86362001)(1076003)(44832011)(6916009)(2906002)(6666004)(8676002)(8936002)(956004)(83380400001)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: tyCaB4qBBDQ040o9tDzRia3SYZkx1g50ToNcLCp7BUmmgHo+5u7i64HzMr3y/CvzrHM8OOirJwa2qko2fJsJdIk2j9GbcHj+L5vR8iEbNSNlmKbM7rMWOGk/Sd8OJzUsOB9y/7bIWS8AT5ITuG26SxcaQ5/2Le85LM9tgT1tjLCsJK35UCkNXq8GQ7Mmbpw+ZpSuOfHd8CtukQ0E/YhjCjoBp2d4qnqYf7Jc0D356TaPQ7qcfpcRBUijqf4lwgcgSfdh1aYaEfHd5PIMZ0EXxuIyhfc/dPp90RKsIML9PxwAXRsB32NIrDyKn7npF6G2qwHfmhQN9+v6sY1N7ILf4gH4pLKz7jAZWfzqFJiYaQcx7bSDDw2N5hXxM/WEwzpeVlVzwXkAkg0Nm+9kq7N8N2ZugAMh4wyNbiZ8VJbeYVX0JAEvo6q3/a2zKDF+aC0yoHpbjMxjcTlqPr27aoZwp5K2yLqOCC+jm1JhwxK+4RUZkWJhSQumCT+v+wC5kYJugWmth9pq9swmzNIyj/SJRWs0bfHIcRy94Ly7bRHNIO9NNz0QDZeCMb6RDiAYkXvWKqHZwM52E0cQAU7FQ4jKQsdVwh14ArDftfFvRMbmbSOZBJc9DkJsDK+9IhcF4pcXnqOH20eAD6tkEHyHogsM1w== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd0f08fc-e56a-4d4d-7c01-08d84e40dd3f X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 06:32:57.5500 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jmiuvo4ZPzo4h8/bl0A+LvLn544p/ENKd+DSaM8zwg2Y0P5IuMzXSXsHk3YY/NMPE9bVuQTkSoyCa27wRIMkRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2867 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jia-Shyr Chuang Support packet forwarding mechanism for some special usages on PCIE, and fix BE/VI priority issue when pumping iperf. Signed-off-by: Jia-Shyr Chuang Signed-off-by: Ting-Ying Li Signed-off-by: Chi-hsien Lin Reported-by: kernel test robot --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++- .../broadcom/brcm80211/brcmfmac/core.c | 100 +++++++++++++++++- .../broadcom/brcm80211/brcmfmac/core.h | 18 +++- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 31 +++++- 4 files changed, 157 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index d6972420d426..8c7941f85715 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -4799,7 +4799,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err = -EINVAL; goto exit; } - + ifp->isap = false; /* Interface specific setup */ if (dev_role == NL80211_IFTYPE_AP) { if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss)) @@ -4860,7 +4860,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err); goto exit; } - + ifp->isap = true; brcmf_dbg(TRACE, "AP mode configuration complete\n"); } else if (dev_role == NL80211_IFTYPE_P2P_GO) { err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); @@ -4892,6 +4892,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, goto exit; } + ifp->isap = true; brcmf_dbg(TRACE, "GO mode configuration complete\n"); } else { WARN_ON(1); @@ -6045,6 +6046,14 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, } if (brcmf_is_apmode(ifp->vif)) { + if (e->event_code == BRCMF_E_ASSOC_IND || + e->event_code == BRCMF_E_REASSOC_IND) { + brcmf_findadd_sta(ifp, e->addr); + } else if ((e->event_code == BRCMF_E_DISASSOC_IND) || + (e->event_code == BRCMF_E_DEAUTH_IND) || + (e->event_code == BRCMF_E_DEAUTH)) { + brcmf_del_sta(ifp, e->addr); + } err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); } else if (brcmf_is_linkup(ifp->vif, e)) { brcmf_dbg(CONN, "Linkup\n"); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 20c510dca601..3257b784e019 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -62,6 +62,14 @@ struct wlc_d11rxhdr { s8 rxpwr[4]; } __packed; +#define BRCMF_IF_STA_LIST_LOCK_INIT(ifp) spin_lock_init(&(ifp)->sta_list_lock) +#define BRCMF_IF_STA_LIST_LOCK(ifp, flags) \ + spin_lock_irqsave(&(ifp)->sta_list_lock, (flags)) +#define BRCMF_IF_STA_LIST_UNLOCK(ifp, flags) \ + spin_unlock_irqrestore(&(ifp)->sta_list_lock, (flags)) + +#define BRCMF_STA_NULL ((struct brcmf_sta *)NULL) + char *brcmf_ifname(struct brcmf_if *ifp) { if (!ifp) @@ -899,7 +907,9 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, init_waitqueue_head(&ifp->pend_8021x_wait); spin_lock_init(&ifp->netif_stop_lock); - + BRCMF_IF_STA_LIST_LOCK_INIT(ifp); + /* Initialize STA info list */ + INIT_LIST_HEAD(&ifp->sta_list); if (mac_addr != NULL) memcpy(ifp->mac_addr, mac_addr, ETH_ALEN); @@ -1557,3 +1567,91 @@ void __exit brcmf_core_exit(void) #endif } +/** Find STA with MAC address ea in an interface's STA list. */ +struct brcmf_sta * +brcmf_find_sta(struct brcmf_if *ifp, const u8 *ea) +{ + struct brcmf_sta *sta; + unsigned long flags; + + BRCMF_IF_STA_LIST_LOCK(ifp, flags); + list_for_each_entry(sta, &ifp->sta_list, list) { + if (!memcmp(sta->ea.octet, ea, ETH_ALEN)) { + brcmf_dbg(INFO, "Found STA: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x into sta list\n", + sta->ea.octet[0], sta->ea.octet[1], + sta->ea.octet[2], sta->ea.octet[3], + sta->ea.octet[4], sta->ea.octet[5]); + BRCMF_IF_STA_LIST_UNLOCK(ifp, flags); + return sta; + } + } + BRCMF_IF_STA_LIST_UNLOCK(ifp, flags); + + return BRCMF_STA_NULL; +} + +/** Add STA into the interface's STA list. */ +struct brcmf_sta * +brcmf_add_sta(struct brcmf_if *ifp, const u8 *ea) +{ + struct brcmf_sta *sta; + unsigned long flags; + + sta = kzalloc(sizeof(*sta), GFP_KERNEL); + if (sta == BRCMF_STA_NULL) { + brcmf_err("Alloc failed\n"); + return BRCMF_STA_NULL; + } + memcpy(sta->ea.octet, ea, ETH_ALEN); + brcmf_dbg(INFO, "Add STA: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x into sta list\n", + sta->ea.octet[0], sta->ea.octet[1], + sta->ea.octet[2], sta->ea.octet[3], + sta->ea.octet[4], sta->ea.octet[5]); + + /* link the sta and the dhd interface */ + sta->ifp = ifp; + INIT_LIST_HEAD(&sta->list); + + BRCMF_IF_STA_LIST_LOCK(ifp, flags); + + list_add_tail(&sta->list, &ifp->sta_list); + + BRCMF_IF_STA_LIST_UNLOCK(ifp, flags); + return sta; +} + +/** Delete STA from the interface's STA list. */ +void +brcmf_del_sta(struct brcmf_if *ifp, const u8 *ea) +{ + struct brcmf_sta *sta, *next; + unsigned long flags; + + BRCMF_IF_STA_LIST_LOCK(ifp, flags); + list_for_each_entry_safe(sta, next, &ifp->sta_list, list) { + if (!memcmp(sta->ea.octet, ea, ETH_ALEN)) { + brcmf_dbg(INFO, "del STA: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x from sta list\n", + ea[0], ea[1], ea[2], ea[3], + ea[4], ea[5]); + list_del(&sta->list); + kfree(sta); + } + } + + BRCMF_IF_STA_LIST_UNLOCK(ifp, flags); +} + +/** Add STA if it doesn't exist. Not reentrant. */ +struct brcmf_sta* +brcmf_findadd_sta(struct brcmf_if *ifp, const u8 *ea) +{ + struct brcmf_sta *sta = NULL; + + sta = brcmf_find_sta(ifp, ea); + + if (!sta) { + /* Add entry */ + sta = brcmf_add_sta(ifp, ea); + } + return sta; +} diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h index 33b2ab3b54b0..3cf0b8c8d7b1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -185,6 +185,7 @@ struct brcmf_if { struct brcmf_fws_mac_descriptor *fws_desc; int ifidx; s32 bsscfgidx; + bool isap; u8 mac_addr[ETH_ALEN]; u8 netif_stop; spinlock_t netif_stop_lock; @@ -193,6 +194,19 @@ struct brcmf_if { struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES]; u8 ipv6addr_idx; bool fwil_fwerr; + struct list_head sta_list; /* sll of associated stations */ + spinlock_t sta_list_lock; +}; + +struct ether_addr { + u8 octet[ETH_ALEN]; +}; + +/** Per STA params. A list of dhd_sta objects are managed in dhd_if */ +struct brcmf_sta { + void *ifp; /* associated brcm_if */ + struct ether_addr ea; /* stations ethernet mac address */ + struct list_head list; /* link into brcmf_if::sta_list */ }; int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp); @@ -215,5 +229,7 @@ int brcmf_net_mon_attach(struct brcmf_if *ifp); void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on); int __init brcmf_core_init(void); void __exit brcmf_core_exit(void); - +void brcmf_del_sta(struct brcmf_if *ifp, const u8 *ea); +struct brcmf_sta *brcmf_find_sta(struct brcmf_if *ifp, const u8 *ea); +struct brcmf_sta *brcmf_findadd_sta(struct brcmf_if *ifp, const u8 *ea); #endif /* BRCMFMAC_CORE_H */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index f1a20db8daab..c53c3cf96f92 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -1140,7 +1140,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) { struct brcmf_pub *drvr = msgbuf->drvr; struct msgbuf_rx_complete *rx_complete; - struct sk_buff *skb; + struct sk_buff *skb, *cpskb = NULL; + struct ethhdr *eh; u16 data_offset; u16 buflen; u16 flags; @@ -1189,6 +1190,34 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) return; } + eh = (struct ethhdr *)(skb->data); + if (ifp->isap) { + skb_set_network_header(skb, sizeof(struct ethhdr)); + skb->protocol = eh->h_proto; + skb->priority = cfg80211_classify8021d(skb, NULL); + if (is_unicast_ether_addr(eh->h_dest)) { + if (brcmf_find_sta(ifp, eh->h_dest)) { + /* determine the priority */ + if (skb->priority == 0 || skb->priority > 7) { + skb->priority = + cfg80211_classify8021d(skb, + NULL); + } + brcmf_proto_tx_queue_data(ifp->drvr, + ifp->ifidx, skb); + return; + } + } else { + cpskb = pskb_copy(skb, GFP_ATOMIC); + if (cpskb) { + brcmf_proto_tx_queue_data(ifp->drvr, + ifp->ifidx, + cpskb); + } else { + brcmf_err("Unable to do skb copy\n"); + } + } + } skb->protocol = eth_type_trans(skb, ifp->ndev); brcmf_netif_rx(ifp, skb); } From patchwork Tue Sep 1 06:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11747457 X-Patchwork-Delegate: kvalo@adurom.com 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 6570E722 for ; Tue, 1 Sep 2020 06:33:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49AD42098B for ; Tue, 1 Sep 2020 06:33:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="PsDsZbDB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726657AbgIAGdG (ORCPT ); Tue, 1 Sep 2020 02:33:06 -0400 Received: from mail-eopbgr770138.outbound.protection.outlook.com ([40.107.77.138]:31540 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726044AbgIAGdF (ORCPT ); Tue, 1 Sep 2020 02:33:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJ1s6zCdkkMRattZmIgNbthBZ5JQBk+JAvoTL3VqIdJpYutxohzf5uLLgUkfIK6hWL8lyFhOVGV3W2kFPkkwaRrzLeoPcvTDqNLOpeIMS/IaP4DHHh8PEEGTTDDWt+yHicO8QK5jUVyr5cZy2RrzDzLwUCvzhVxfeZeVKNyODXIceYj1VDh7m3mcTXe14iUuxzYfDYC1lC8azn3FDTgkHjyEIEsbnM+uOnE4yWuDMKD02puiNf46Tfk1g01Yfr39hq3sbz5upqlIe4hzwh0cu3NhDVEG7F42HLKHjoLemE/79IwzYU5o0QtXnaJm02OOaIQRd9c1/DbCJbCtFZ3FWA== 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=ElzIp0heVVNd7qk4UbjQ2bmDUtDQerDq+LKT/4y23Qc=; b=E6BBi5klMvqWFrKtOnPy4inGU4d9M6kk+qqwAwhubQCvu4bPKYvUulNYGHnmfjtFBTaqHNKhpjyegRBOItSVmJj9paIoKz26k0T6l1eqGQPTP2wZlr3zvSLH53qalO76eYrfWc5VMmMjJzzJAU5T9MAHkJTQJs55J8bNbhJScGY91Oj/JLPqDb7U9uBD9nPP/UMDpNtru3sHktjHTbRouPPGBornTrKNVOgw9mNH5SkLCvucO9DUsbKBT4ZldfKH67i476kqSPKi4IFy7p6s0flbHXukXAzJBL/KQWVJu1WfCLnX31jgFPFHbT2o8vpSm7REFfRHAQT7t+bVv+InkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ElzIp0heVVNd7qk4UbjQ2bmDUtDQerDq+LKT/4y23Qc=; b=PsDsZbDB8/XUfSElEWK9ClQsBbIcdAj158OtBLUyCbcNqwPxWMaGIvMJiqoM7Gpj1495/MNUvnCI3DZ+D8L08M4RE5/pru1liNNlmtEqwRdeUyuaCHXLQpbmwdqEh2o4DNG6buadUg/QweIyvw4gm5dZd2jvyob7rluYirgLRNM= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=cypress.com; Received: from BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) by BN6PR06MB3155.namprd06.prod.outlook.com (2603:10b6:405:3d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.23; Tue, 1 Sep 2020 06:33:01 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::d82b:5f42:b7a8:d819%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 06:33:00 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , chi-hsien.lin@cypress.com, Ting-Ying Li Subject: [PATCH 4/4] brcmfmac: add a variable for packet forwarding condition Date: Tue, 1 Sep 2020 01:32:37 -0500 Message-Id: <20200901063237.15549-5-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200901063237.15549-1-wright.feng@cypress.com> References: <20200901063237.15549-1-wright.feng@cypress.com> X-ClientProxiedBy: MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by MN2PR06CA0028.namprd06.prod.outlook.com (2603:10b6:208:23d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 06:32:59 +0000 X-Mailer: git-send-email 2.25.0 X-Originating-IP: [157.95.12.33] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c738bc93-ac5c-4fb8-89db-08d84e40df3c X-MS-TrafficTypeDiagnostic: BN6PR06MB3155: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:352; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UHp4l/cgyOR7nx5mFd7bGVbOQmNMAwOMoM7n1VG1jtAkjfj8933LKynv4Y9RDhdauR9d7h+cc7OdIhuLOODmlG+M0WyPbtURiJ/W7uPY43EjzOaki7M0L+zhoQ5GorN4UQUy5k4ySR00kDQxBH5zySODshLECLBsRnQtVjTM6dzaaUHShXISIlGPkROBtqVFF0LqB0WuugIa1rLEg2n4Aop1RQONu4+Gp3KyVv5NFYakv5d4pSBHRNl9U/AVHMvvZlA1KZml8vy7RyxvcchtT4ThtMBut6YqxdFraT3nca9v0Pgz6UsvOPJ1oxfk3AQs X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR06MB5889.namprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(39860400002)(376002)(346002)(366004)(956004)(26005)(6916009)(52116002)(66946007)(5660300002)(36756003)(6666004)(54906003)(4326008)(86362001)(316002)(16576012)(2906002)(66556008)(44832011)(83380400001)(2616005)(66476007)(107886003)(1076003)(8936002)(6486002)(478600001)(186003)(8676002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: na6Psu6RdzJj+MmPZ3GtG2dn/4rp3Bink16v3Fvv541YshTWyf2S9TUYbtJFZfxweGtOgsqsVzZHdmaHuFzG5cxcTCPWiMpGnuJ9r4ica/U0z6Y1U9RtjwLwZ+HDqXr6OeWjtgmURfjYVUHlaMP0MQZPmmWem9XmxQ3RSiZfyWURZDrjOfsGfPsVNx6ZVAFsXx+ymfY7Y4y+DWicQA97wLfm0LvPuBcaY0wlEWFKvk/E8VyDzEjqpTaD4nPYeK7yvY1ZooEdkYjFl+OKRcxHT116oFRYXc16ud57VRsE7RcuVKqfb8boFUv7oDvEjSUte/0TmmOBi2YyN3U1xCipcTRmvb6ZsHfy3KTw4oPHJ/vPw7dW6bxuCsqCejhLHP1HOamc10Nj3gAudoZzveeY3z9BpW/qooNRNCVtiCPw6YziHpIh2CkvOqbwKfP2QF7/3nnZmL1S5bsLkB/OILZYcUMldWR5Or7EEyVNrbT1/Vfq6sH4wCOcJwl3TbCieJhkaSFG1nKCPIxLEp43Aanuir1we831gbsL3GsmX7oEM+8WGt7HqzoFNXMEN0onG1NsmgF1zo78G4bhhnIFUSploO6a/rSMedtbQezDHtX9A/VdAx7lrvBaMIuRVbMehdlXnTjJYrNN+0BrcDFzbcquew== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: c738bc93-ac5c-4fb8-89db-08d84e40df3c X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 06:33:00.7392 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bzoA457NeEA7RnP8LYfZvnSYgW6CeIZ8I6tKQvWg0wHszHIj14R7/Xl/72iYv1a0A0A8hT9uAkZuexZB1HhV3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB3155 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ting-Ying Li When the "ap_isolate" function is not set by the host, host-based packet forwarding will be enabled if the packet forwarding mechanism is not offloaded to the lower layer. Signed-off-by: Ting-Ying Li Signed-off-by: Chi-hsien Lin --- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++++++++++++- .../net/wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 8c7941f85715..ac0095989e43 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5447,7 +5447,7 @@ brcmf_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, { struct brcmf_if *ifp; int ret = 0; - u32 ap_isolate; + u32 ap_isolate, val; brcmf_dbg(TRACE, "Enter\n"); ifp = netdev_priv(dev); @@ -5458,6 +5458,17 @@ brcmf_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev, brcmf_err("ap_isolate iovar failed: ret=%d\n", ret); } + /* Get ap_isolate value from firmware to detemine whether fmac */ + /* driver supports packet forwarding. */ + if (brcmf_fil_iovar_int_get(ifp, "ap_isolate", &val) == 0) { + ifp->fmac_pkt_fwd_en = + ((params->ap_isolate == 0) && (val == 1)) ? + true : false; + } else { + brcmf_err("get ap_isolate iovar failed: ret=%d\n", ret); + ifp->fmac_pkt_fwd_en = false; + } + return ret; } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h index 3cf0b8c8d7b1..d5745f48e003 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -196,6 +196,7 @@ struct brcmf_if { bool fwil_fwerr; struct list_head sta_list; /* sll of associated stations */ spinlock_t sta_list_lock; + bool fmac_pkt_fwd_en; }; struct ether_addr { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index c53c3cf96f92..1c109257aefc 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -1190,8 +1190,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) return; } - eh = (struct ethhdr *)(skb->data); - if (ifp->isap) { + if (ifp->isap && ifp->fmac_pkt_fwd_en) { + eh = (struct ethhdr *)(skb->data); skb_set_network_header(skb, sizeof(struct ethhdr)); skb->protocol = eh->h_proto; skb->priority = cfg80211_classify8021d(skb, NULL);