From patchwork Tue Oct 20 02:28:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11845611 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 1B84414B7 for ; Tue, 20 Oct 2020 02:30:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC06D222E9 for ; Tue, 20 Oct 2020 02:30:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="polEDBTk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390593AbgJTC3w (ORCPT ); Mon, 19 Oct 2020 22:29:52 -0400 Received: from mail-eopbgr750098.outbound.protection.outlook.com ([40.107.75.98]:53075 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730463AbgJTC3w (ORCPT ); Mon, 19 Oct 2020 22:29:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nsxaVPFn/QsMfnhigUnBe7WBR7XNZJkMPZ7vQB5TE/JBJ9DpGjtQwchFbqoI3/IGEWsIil/xn4hC6k3cq3M92i9XBwHedXAuRCkGzT0ZSnKovGcco6VEpK/hjjN9ayNnZyMR6gX3dAElN/l5FeALmmatvW1eVVrLof58aqV0uQnYiVuJB5Ow3KnR87bPcwGvBGpWLz/3lHH9yI7eHr1LWyuhhQ8A8KZz+wt130F00apDRQ+JrVtDB/qcqTpujsOS7FAfPmWKlU2yE9LO2EdhysNcBTsCXiJZdaQpETITsYIyzhZbgWquAqQbLtHu3vgufECf922JvhmHFQJ61s7CdQ== 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=O9zG1x01E81IBitMIpvBbuBIcK1BZ5S+ABE3baWRw0M=; b=n0HcbVqNTKhlx8h5Gg3QRaUsoHqyVKzwD9TeiSQcgMf8NxdIJRi/HKC8dmQ7TXH9voXyup9hv9jBCvqSTDs2tIQ0Ck/z/7PZSVuq1rNgBMQ2SzanCtJC1K5oa/6dWvNk4dVQEZOUpoznYDzP8A2QyccBDP2lhWrA+ewS5YN8vlZW7kOOGeY9vAyzIOSJ7LpmidTjf99YsYdmCKE1858Dmx1MRXSomuzHi+nkbpmzXXEip9Ri/D5gW0UkCZ8RHWj1jEIiw2hnpNGZmn3myaMRvge1H/L7nsWp/oB4ES1U9iw0y0trvGVzTwRNTjWhHU+POZqNrFStjQhwTuWVHJXPQQ== 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=O9zG1x01E81IBitMIpvBbuBIcK1BZ5S+ABE3baWRw0M=; b=polEDBTkZ0uzapWF9OooquU1NZQP4hBH3IsHmaqK0+Q665qek7BqEBma1sY9dcPcIrVf7n0wKCNrE+GYFCApY+MmXp+bq86V/OTb7HA+2LTrjfm8QTWIMtdW5PIplnwF5JxwNCZvRJ8W5em14XVIgSinrCUVCVVfci7UVNtV28M= 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 BN6PR06MB3251.namprd06.prod.outlook.com (2603:10b6:405:3e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23; Tue, 20 Oct 2020 02:29:40 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843%5]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 02:29:40 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org, Arend van Spriel , Kalle Valo , chi-hsien.lin@cypress.com Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Franky Lin , Hante Meuleman Subject: [PATCH v2 1/4] brcmfmac: add change_bss to support AP isolation Date: Mon, 19 Oct 2020 21:28:09 -0500 Message-Id: <20201020022812.37064-2-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201020022812.37064-1-wright.feng@cypress.com> References: <20201020022812.37064-1-wright.feng@cypress.com> X-Originating-IP: [157.95.12.33] X-ClientProxiedBy: MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote06.aus.cypress.com (157.95.12.33) by MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 02:29:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 818be0e5-5a2e-437a-b308-08d8749ffefb X-MS-TrafficTypeDiagnostic: BN6PR06MB3251: X-LD-Processed: 011addfc-2c09-450d-8938-e0bbc2dd2376,ExtFwd 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: v7aWXeXLE3YXzyelW/ugfZ7IVbHU0Z3Ut9FjLczuPSuDt9YEkrGNrVyIKootqQsqtKsvzw3nmfZ0ctPTSKAfkm56ryYAe6nCneF3TJdWR3yIdaF1chdwU0QZUbwaPCZQ+JOdbX/JrT7GJwAnX7DmiZnxRw11cWa8I7epzRFAyBnG6Wc2cEahWZD/YztPYpz2ifQP/hF3sgI34kL9vtmGXj973ncv7856mr+FlxbQiYlEKSHxfEl1UNfeYq+DjgCZkhbqcIhPZ5+3qfUn4PlM/BL9vZXQZmXByHgMxRO68hMnVDepWol8ke8bzHD7E23j9bKhChneNii2TYo80Kbjvw== 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)(376002)(346002)(136003)(396003)(366004)(66946007)(66556008)(66476007)(7696005)(52116002)(6486002)(8676002)(186003)(16526019)(1076003)(316002)(44832011)(6666004)(478600001)(26005)(5660300002)(2906002)(86362001)(6636002)(54906003)(83380400001)(36756003)(8936002)(956004)(110136005)(2616005)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: m1Lm/fy8lY43fu61J88leboYCz8+o5DSWhzSkJYGxLquPIwq0feAS2FrY4Qc9kDzMLM8LrJNdQSnEoR+rDKQUC928h9z/96tCbv5ro3B5BKmyxs03WfFDNjuRkDVFI29JYPxKQdcXVcsKzKLJh6ARNoqS/LD7+qgX6S35InBJa7CYl5dDBdh+j42qOtBs4Z9EwNcvNVTu3N18/DMjSusXrYCZ4zlSOSYCL3KsqTyFP33R+udoN1BIuaFQJMXYFpdBE/wyJ6y6NlzZz87WQf5B0myoGTc6HqPuK32/lNe8q2W1Z4JLl+POpAQsLE5XUzVxC/SHB/TTB5T7Euy0xKpA6fEavPyfIGVgWtItXz5itaecgLhuIzv2mz5Pgyu8jfQXWzqHOXWrFxNgImWHHD8J2lW8AKGro5n5gGNsqz5aHi/RA+NfUMmb+9nWSrIhVQfBG7f4bNoJYg491Z+Ary6ibE8w82WF+gcS2viKRcrKMG04j3l3W5ijijjyvuHm8sMHZbuLOpUnqCe2qWSrd1MHurrbkGfS/GnAEpjUKLq0/pDOL7NNcEAkWQYAKjGk6Ng3camcht+krOaFk2OKHdjvhobTTFgAcHA4i2mew8BOwycv8nDwMbORag3VJm+H0AVA2IFNKDQhrt7MbWoXtXy+Q== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 818be0e5-5a2e-437a-b308-08d8749ffefb X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2020 02:29:40.3813 (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: OVN81/Fc/axwryUxioqP+BGU958KlVQ6W4Gd8hgBALDkVkoYCKrD/1FFjdnzQYu6fz3uR7cB2oz80VlzfB5cNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB3251 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 Reviewed-by: Arend van Spriel --- v2: Remove u32 cast --- .../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 a2dbbb977d0c..4d0447784426 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5466,6 +5466,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 = 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, @@ -7540,6 +7560,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 7c68d9849324..1118b291fb29 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -279,6 +279,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 d1f4257af696..cec5a9c4b18c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h @@ -51,7 +51,8 @@ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \ BRCMF_FEAT_DEF(DOT11H) \ BRCMF_FEAT_DEF(SAE) \ - BRCMF_FEAT_DEF(FWAUTH) + BRCMF_FEAT_DEF(FWAUTH) \ + BRCMF_FEAT_DEF(AP_ISOLATE) /* * Quirks: From patchwork Tue Oct 20 02:28:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11845613 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 4A9E761C for ; Tue, 20 Oct 2020 02:30:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28385222E9 for ; Tue, 20 Oct 2020 02:30:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="PGqYlon5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390595AbgJTC3y (ORCPT ); Mon, 19 Oct 2020 22:29:54 -0400 Received: from mail-eopbgr750098.outbound.protection.outlook.com ([40.107.75.98]:53075 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730463AbgJTC3x (ORCPT ); Mon, 19 Oct 2020 22:29:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QPPuqOrEyFkIARtxxiiaKl88umuNyoGKExELIa3H5AuyNuR5eEsgISMLqhNCS8cg8mvZYq/vnIeV5NWLuHVRiSKkD+F23qEE9Y3079FsCZKTGNn6iamBfQtAuZh8z+o/JoY0YWBcGgYGa6daLIqACLMruh5xqC2qD9cGvwqHLQYU7I/XJMZJkBdmudVzG4xvXNx6s7BpnfuvWatfuM/hly6stmqQUYP+/I9NqRtg8yFshbl5NIRp1zFK7yJ8ora/zfiU6pKYd8kRtJRSluAon59UEb+StAou0Zt4fNyq+hpccZBEgNKGsB1JW9Tj5putflyyrFkaGaqvz8i2o0Gx1w== 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=1gWFDXO0mNXa8fiviPYI8Adk+Q/GrWTvNRYblPi7kD0=; b=Tp/qmVRgXgazlcwPa4wRbjXn8xniSSTojoYzfrea4fWx/033YqYA0hlcsmzBnQ5+VicdXjAELQEhLw9m7KSPC6C9ZuZpyYdeBPs/WYI8zyNJ6zkW1/3de7UrAO6WJpoRf1KGe//mxTH/RvRddfKaR3y+mdE+DWGb3z59dGX2teLcxwsK3YqpeT28z6HX3ex8mMxq1WQd6srp+Fxpv+m05lNrgjagAf2qoX+Lo703lTF6pwPpL2nlTqizktiuiLypRcRDyhzR4K9TISa2lOP0Y/1qPyaCCzL2bRPmrCtYkxdf0uDUaZ9G+xxy1GDviRWwvi50h/k/w5ePq/A4wWmMPQ== 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=1gWFDXO0mNXa8fiviPYI8Adk+Q/GrWTvNRYblPi7kD0=; b=PGqYlon5mUA2KRNddRCNelI7iik+8mBhMaE2rIiK3E4glbETzr0WrwMzygLJE6sy+AMhZwrhnaB7VsyddDco6UvTR9lTzDvKePJb1VkUplP5mZSB+UtAtdsLlxD1hlM46/kQsC/6leS2MVqYcr/bnzpLgE7+vRMLQqdDzNf2V3w= 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 BN6PR06MB3251.namprd06.prod.outlook.com (2603:10b6:405:3e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23; Tue, 20 Oct 2020 02:29:43 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843%5]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 02:29:42 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org, Arend van Spriel , Kalle Valo , chi-hsien.lin@cypress.com Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Franky Lin , Hante Meuleman , Ting-Ying Li Subject: [PATCH v2 2/4] brcmfmac: don't allow arp/nd offload to be enabled if ap mode exists Date: Mon, 19 Oct 2020 21:28:10 -0500 Message-Id: <20201020022812.37064-3-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201020022812.37064-1-wright.feng@cypress.com> References: <20201020022812.37064-1-wright.feng@cypress.com> X-Originating-IP: [157.95.12.33] X-ClientProxiedBy: MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote06.aus.cypress.com (157.95.12.33) by MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 02:29:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 20aba77a-aa72-453b-447b-08d874a0005e X-MS-TrafficTypeDiagnostic: BN6PR06MB3251: X-LD-Processed: 011addfc-2c09-450d-8938-e0bbc2dd2376,ExtAddr,ExtFwd 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: EyzaU7SHUHYsaQI6nzji2B3aKGBHt/AsD2XmcEhwttCTEiIpkJV/DKWPhm1pNpOU1bhOf31sfWqAdMjjT1DJ2Y6NIi0OqUOO17CTX8vP7PrOcbHRoWj0z+Cmg3xbsBVXnakprufCa1FmKBUxflKGxWUenJZXcpdfVIQMgeEa99mqwYU3N5I+YkeBcG9QJnIKhOT+WVeVmpd0jCY9PVSCXzTzoVwgy35+TUnMl3TXbZZLwg2K1f9Zi8eQRegB4Y8Bn2S9bkkR0fUVJKjKx4Ui54hQpI2ScLWXvOrP0wKhaqRYmUE+FlyNBQ2AFH3wZj2G21PLLqc7gdHqAmQ0Pb4H1Q== 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)(376002)(346002)(136003)(396003)(366004)(66946007)(66556008)(66476007)(7696005)(52116002)(107886003)(6486002)(8676002)(186003)(16526019)(1076003)(316002)(44832011)(6666004)(478600001)(26005)(5660300002)(2906002)(86362001)(6636002)(54906003)(83380400001)(36756003)(8936002)(956004)(110136005)(2616005)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 05Rf/pEl9y10dNdfg8RVWjSUIBMzTgNpbCH5Sx+MGbIRGPjsEkmroFm0O176qqQWhSn7w8hIb1KBFbBLAN/ugcbBe+8yKATz1RuAjVMniPiE4PHRSQVVkSHJNbccUlI8lLmiNB+9WlfliwVxNXkK9FpDHaNr8xKliFEN0K9SMvpNlhJINvkDTVrVB4dKBz0N9PlR/zbuoHmB7y03FS0yxdeMkF01eh8zyPh2UZjkvLTHjtrWHXv7fbGDxlQ+t/PuqYHDbaLCheH8hjTBPg2fv8eHG0TJNpSNPVeacQEkWaYnI8L1bs8xed7vv8F3S1GBEvpMXlDwMAU2huBt7Q9toI3c50qkzoUmYIfrLaF9AFXH1O/clYFW6Kzgg2yuxwXSqOv6MuQbHYWp2yuqycuAbWlzaPfip6w/f0SRX20HGjwjw8/d9qCv18CKFfFZtBoJ2uAF2xtK1qpjMAl0ary2NJ217/S4mzJnCzfxIbRiF0cxQLup81viNotaQ2WuWg5Qt7CMIXDmO1RlG6UZQ7W5RPlB1iJaICROWr14qHJ4iDh3maiKPRfBXzf8ycC+KSi4TwmvImmCiPdLr611UVAdvvykqymgKD8ZyHrdAtot6mqsnKhL8AZtcvY0D3yAxDiUJhTmFvHYtN9VE+LeskxZKA== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20aba77a-aa72-453b-447b-08d874a0005e X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2020 02:29:42.7909 (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: x6RcfybOd1GmeSZoPxSFvaOLwvh+FlflGdLz8O0J4fcGNQ2fEusNh7Apnoj0IukqM0zi9Fsy7u2z3QfpijPA8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB3251 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 Signed-off-by: Wright Feng Reviewed-by: Arend van Spriel --- .../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 4d0447784426..2f24222eb59c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -769,6 +769,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) @@ -4990,8 +5005,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 17817cdb5de2..94996574c9c7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h @@ -461,5 +461,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 3dd28f5fef19..043c9cbc6394 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 Oct 20 02:28:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11845615 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 7B74B17EE for ; Tue, 20 Oct 2020 02:30:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A233222E9 for ; Tue, 20 Oct 2020 02:30:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="D+8xIijh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390598AbgJTC36 (ORCPT ); Mon, 19 Oct 2020 22:29:58 -0400 Received: from mail-eopbgr750098.outbound.protection.outlook.com ([40.107.75.98]:53075 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730463AbgJTC35 (ORCPT ); Mon, 19 Oct 2020 22:29:57 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKP+T/4pEEHYXX3kROsT+MQYFG/jU7I79Y82g5EVThS7S4SggTwsTnPTixxYHBYPPfFes52O83g/2QEQrKu/pca7kjgOD9OMbKnA2ExA8Bg7ClpNtCQjSGY5MvywDQEAgXXtQGdg7UtdxQEAGRWx0mUlQR2ebjh0SWi1peTCsNK1yfSBycYfEqZIRrhymxvn0POjtc3MXXbB5ZJr4kX6JdtP1n7qMb/pgWsG46ekLEM7UBOdxTzOXH2Qv/Hl1kCvSUggpHv7GJiu7GthgZpuwp0/mCQKcnMezkEFCLA3xPi5ucM6Yk03hw67Qb3abOfrO4LSlJ3b662OdDsSlBXgJQ== 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=h1BBtAba9PZjemipg8kZygGw6Pm0+1dzcrra9YM5htU=; b=A6n0DAKea8THR0WI2TD6UQgnwgmczoWWZlMO70VMxK4WhwLiVmsO3kZp1lo1WDUSUP8Sh+eaHjX75CX8AjC9ECPPxQwW48eSwomBuJ62MKzCL57JvJBxgbRYJiDqxIw1QXLkJxmYJB0Yl64iwN0NGJF3e1YGD8yB11PJMfRM0lj4kfCsowE+sKKcV+7V/FCzQWadaWRKQcPVRUxpgOh95q9Bc5UbIRiyluEI2ZiJw+P0La5MwMxqdm03+79Ggfme2Ui/nhhu6ZiMpOvtuCDbziM0TsiCVi2mAlxs11xFqk706+y2ySR/2Vm0L16luDaRnAuywjqs77nfPu0+6ncWtQ== 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=h1BBtAba9PZjemipg8kZygGw6Pm0+1dzcrra9YM5htU=; b=D+8xIijhyTqT0tnom7pOjKnYpR5tH/VJrEpGcqBN/t3LQ1Coyt23DbB6TZYaCSTOBA81aNhpCLBtES/epeqzjWj8JAycLjE3CnBZEKAmJ7rLGoKoSexXxI6C7dKCuyMGaAxtoR9vW/BtyTdw8axw336Wet65sfHlGdwz2xhhkpc= 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 BN6PR06MB3251.namprd06.prod.outlook.com (2603:10b6:405:3e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23; Tue, 20 Oct 2020 02:29:45 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843%5]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 02:29:45 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org, Arend van Spriel , Kalle Valo , chi-hsien.lin@cypress.com Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Franky Lin , Hante Meuleman , Jia-Shyr Chuang , Ting-Ying Li Subject: [PATCH v2 3/4] brcmfmac: support the forwarding packet Date: Mon, 19 Oct 2020 21:28:11 -0500 Message-Id: <20201020022812.37064-4-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201020022812.37064-1-wright.feng@cypress.com> References: <20201020022812.37064-1-wright.feng@cypress.com> X-Originating-IP: [157.95.12.33] X-ClientProxiedBy: MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote06.aus.cypress.com (157.95.12.33) by MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 02:29:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 54df91b1-59e2-44a3-3a56-08d874a001b7 X-MS-TrafficTypeDiagnostic: BN6PR06MB3251: X-LD-Processed: 011addfc-2c09-450d-8938-e0bbc2dd2376,ExtAddr,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XsiJPe5Z0SMXeykEXHOz0gUinZbzwK3K8J9H6miCuUFNWh1BDJyO9UhU8l8E+Yl6qyI1b+cFTRQX2d1btkvsdPmAQLysn7zPysiN5MVeIiq5Xl/EGPqIVkFsa0MK8tIu9RPL1COGqTOOp5aJnri/7y3Si2bO9XLc1XvYaEEuM37wXwgOK556f3FEiL1ZK9c2xHsJQognAxi3EAg4+vgL5smwL7emjhTDEhg51Aa7L3mcAu+L4btx/K2lYZ+zYcx8HynVq8Q+89uQ7Ojr3h1gnejRcRe2m9uq2boepjPFNDGsKnXE1emOk/JzuvmGoYKSNuF+st8ixgNHKAAOrCQwoA== 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)(376002)(346002)(136003)(396003)(366004)(66946007)(66556008)(66476007)(7696005)(52116002)(107886003)(6486002)(8676002)(186003)(16526019)(1076003)(316002)(44832011)(6666004)(478600001)(26005)(5660300002)(2906002)(86362001)(6636002)(54906003)(83380400001)(36756003)(8936002)(956004)(110136005)(2616005)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: McKlRWz/OWsUraK76Gq4337hnXXdspc8EZtuiDa+c35e9rAIm8ur+p6PTQEW6pikXknlzfF0hP857/JRxCNyU9UFSc+jxmnkGiq4THV+SBM6IIzrc5xMlI+uvPOVdReXdUY05vihYTDHM55NowGC2FmT4MkdIjXEYxvZKI2L+TB+Haei2W8CxBFYGuiyI9BtZYMZpQahP6k0ItS0nR4vF+uau+RrzDsXgJ6e8FDHjTXKncTw2JVQuwovqKp0cSyo0AzbZkhCOmB2ZtwA8y5hPrznEftx2PmqGQB2tlE9nNT7kW4fEeo7VCGElf5ta6AKB3U8bhiGoCXltb3myXDmWrkZA0BiOPeQPkZUsh3zbIEz+ls4pakm64abxOlHEvH7GYrlGaaCo5Fi9UYFugp0IY9P47c9T1FOBvK662gdV3VwAEF1ryx5OMi4M6b2jkzboVV/wx3D2+pXwj8ZvjO6vv9hAUOs0O02fIo2hTj+wqmTGLkbWVnY1hkq3LxYkuyqbMXUblsYzEZ7akPN0V9JPnm83e6fzoZNdGbbTF7MhgxgIvZQrAocankVndKiq/EPlWVYdczv4qiPmSnpnewYSBVrU5wLXKbmm6vP4psZwgZWERZjRC4JsQfqhhpLmlbON4p01fj/OBI3D/WjYFQxhA== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54df91b1-59e2-44a3-3a56-08d874a001b7 X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2020 02:29:44.9907 (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: 8CGs8lRaOKrme6eXZE1mlGrd3OcSQOOXVwsucmHYsqWqWx0gu1sXL63XPvTN/v4gCfN/3MKjdi6Yn34gX86/8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB3251 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 observed that packet only send BE when pumping iperf with VI. we need to set priority before forwarding packet. Signed-off-by: Jia-Shyr Chuang Signed-off-by: Ting-Ying Li Signed-off-by: Chi-hsien Lin Signed-off-by: Wright Feng --- v2: Fix sparse warning and remove the macro from the patch --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 12 +- .../broadcom/brcm80211/brcmfmac/core.c | 112 +++++++++++++++++- .../broadcom/brcm80211/brcmfmac/core.h | 17 ++- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 31 ++++- 4 files changed, 166 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 2f24222eb59c..5e49ac3d82b9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -611,7 +611,7 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name, return ERR_PTR(err); } -static bool brcmf_is_apmode(struct brcmf_cfg80211_vif *vif) +bool brcmf_is_apmode(struct brcmf_cfg80211_vif *vif) { enum nl80211_iftype iftype; @@ -4812,7 +4812,6 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err = -EINVAL; goto exit; } - /* Interface specific setup */ if (dev_role == NL80211_IFTYPE_AP) { if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss)) @@ -4892,7 +4891,6 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err); goto exit; } - 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); @@ -6086,6 +6084,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 043c9cbc6394..04c505482c5a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -903,7 +903,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); - + spin_lock_init(&(ifp)->sta_list_lock); + /* Initialize STA info list */ + INIT_LIST_HEAD(&ifp->sta_list); if (mac_addr != NULL) memcpy(ifp->mac_addr, mac_addr, ETH_ALEN); @@ -1560,3 +1562,111 @@ void __exit brcmf_core_exit(void) #endif } +/** + * brcmf_find_sta() - Find STA with MAC address ea in an interface's STA list + * + * @ifp: interface control information + * @ea: mac address + */ +struct brcmf_sta * +brcmf_find_sta(struct brcmf_if *ifp, const u8 *ea) +{ + struct brcmf_sta *sta; + unsigned long flags; + + spin_lock_irqsave(&(ifp)->sta_list_lock, (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]); + spin_unlock_irqrestore(&(ifp)->sta_list_lock, (flags)); + return sta; + } + } + spin_unlock_irqrestore(&(ifp)->sta_list_lock, (flags)); + + return (struct brcmf_sta *)NULL; +} + +/** + * brcmf_add_sta() - Add STA into the interface's STA list. + * + * @ifp: interface control information + * @ea: mac address + */ +static 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 == (struct brcmf_sta *)NULL) { + brcmf_err("Alloc failed\n"); + return (struct 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); + + spin_lock_irqsave(&(ifp)->sta_list_lock, (flags)); + + list_add_tail(&sta->list, &ifp->sta_list); + + spin_unlock_irqrestore(&(ifp)->sta_list_lock, (flags)); + return sta; +} + +/** + * brcmf_del_sta() - Delete STA from the interface's STA list. + * + * @ifp: interface control information + * @ea: mac address + */ +void +brcmf_del_sta(struct brcmf_if *ifp, const u8 *ea) +{ + struct brcmf_sta *sta, *next; + unsigned long flags; + + spin_lock_irqsave(&(ifp)->sta_list_lock, (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); + } + } + + spin_unlock_irqrestore(&(ifp)->sta_list_lock, (flags)); +} + +/** + * brcmf_findadd_sta() - Add STA if it doesn't exist. Not reentrant. + * + * @ifp: interface control information + * @ea: mac address + */ +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 5767d665cee5..9ebafe0b2117 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -193,6 +193,18 @@ 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]; +}; + +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 +227,8 @@ 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); +bool brcmf_is_apmode(struct brcmf_cfg80211_vif *vif); #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 7c8e08ee8f0f..b98cf5e2d0a8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -1141,7 +1141,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; @@ -1190,6 +1191,34 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) return; } + eh = (struct ethhdr *)(skb->data); + if (brcmf_is_apmode(ifp->vif)) { + 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, false); } From patchwork Tue Oct 20 02:28:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 11845617 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 70C2814B7 for ; Tue, 20 Oct 2020 02:30:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DAC1222E9 for ; Tue, 20 Oct 2020 02:30:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="oPqUH70o" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390608AbgJTCaL (ORCPT ); Mon, 19 Oct 2020 22:30:11 -0400 Received: from mail-eopbgr750093.outbound.protection.outlook.com ([40.107.75.93]:23713 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390606AbgJTCaL (ORCPT ); Mon, 19 Oct 2020 22:30:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DJqa/pnSlgHTmyPxZS9pG7CoX7q+TV1hB720shxdR7eVAWe/PAcXCybYI+Rc6qMORHzYOqKEpZ+/c4F7od9vZiJXlDYGv9PMfwLWCBgumRyulDkMBVFn+l+/FjUoMRpSUk7VQnCv1Y77iBHSIwNVV1mMGeTPF9+wCiYeqm8k5hpRBSsDDNizqxxH+InG+p8MWfZZGocobRe3G2SKqhOOcnPfMR8Z8NkAm38Sxnf6xqebjS6Y9sWBWV4gYH3HAQDbRs9woxXV7Xu3QX4uNb0LXuMSvog7hxuCchMjqTKqSQ9APqfporvKyO8r2OZzmmarUelJmuCiVD5DoIy55yjraw== 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=tTsXrwW/NYTrBFtyya6O68hbSrBLAx9bJdVZNvE+IP8=; b=Zm4VGgOfey7ZUcCa2QQUZ3di7oO7CoPMz/Gf3UJxGEwQfp8CrRDAvXz3G8z4VWs9F7hZ4wmDmxlrv5QsrUP/3jrUyvicI04LYrTenb77lKCPQMi+t8ho8fDZgpNpcog5ile0J69ga5vuThCjnJyOsTGWUG5Cx335ZprOqFJdpBOs9BhG3pqyvx0KVGdypAWgHJ2QVSuwUn5U9mJG8sJRD3FLndow7x2eRRNbgAcY0vJDE7IJGxMzZM/SifyU4EcRp1aP9oPPd+DJb0D3yMkrEWqZt48/46IT+CJF7tJLUxJc86w1FNSXFh4q4x2Dk1B+XhDx6AWzaUXaSN/Eb+2huw== 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=tTsXrwW/NYTrBFtyya6O68hbSrBLAx9bJdVZNvE+IP8=; b=oPqUH70o4RMMzqEC+2lQSJFURSiqLBURzFy2aEvysIEdgIl3e8Pgv0KHrLT5o//OVhszfxyM5CYqgMDj2EpRaztVzNefRrBO4gltGSM5AQJdS9RpjS31KMBWYDe3XZUK/STjoZFOlXajEcboRgB9duO89Emu4u7/XshCM0Kmxls= 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 BN6PR06MB3251.namprd06.prod.outlook.com (2603:10b6:405:3e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23; Tue, 20 Oct 2020 02:30:01 +0000 Received: from BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843]) by BN8PR06MB5889.namprd06.prod.outlook.com ([fe80::59fc:a93d:7f49:e843%5]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 02:30:01 +0000 From: Wright Feng To: linux-wireless@vger.kernel.org, Arend van Spriel , Kalle Valo , chi-hsien.lin@cypress.com Cc: wright.feng@cypress.com, brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Franky Lin , Hante Meuleman , Ting-Ying Li Subject: [PATCH v2 4/4] brcmfmac: add a variable for packet forwarding condition Date: Mon, 19 Oct 2020 21:28:12 -0500 Message-Id: <20201020022812.37064-5-wright.feng@cypress.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201020022812.37064-1-wright.feng@cypress.com> References: <20201020022812.37064-1-wright.feng@cypress.com> X-Originating-IP: [157.95.12.33] X-ClientProxiedBy: MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) To BN8PR06MB5889.namprd06.prod.outlook.com (2603:10b6:408:c2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote06.aus.cypress.com (157.95.12.33) by MN2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:208:1b4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 02:29:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 502b9895-f0b5-4c51-27d6-08d874a00b20 X-MS-TrafficTypeDiagnostic: BN6PR06MB3251: X-LD-Processed: 011addfc-2c09-450d-8938-e0bbc2dd2376,ExtAddr,ExtFwd 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: OCaBPiy9fg9rYshnnpSuwWM+essvwE3za2u0k1RXv8sHETEkz41TPFFggxCdulVYzR6eNaMrLooRnt6VsSyf9VyJ8XPYy3VtEXSAEM4P/+zpYSmlNyESaLZeqEO1mMjYXecDeucXz+t80m8bQ6TcZm6h/4DH1lO152OeOYNuNKAVLdF5kKmkD/H4hO2d+dJ7UvciRj/sSqQ5mDNCFAqts06/O/vMIQImYHgEEmHMTUyjBFLF3X/ZyJ0J0/7qezf0MR2cVRC/NPdkZWHDQt175jkNlxHHOcC4IgKrwsVCNbi7hBV/iev85dbgNnCHMFU+AHEMrzk9bRDeSgF1uhbboQ== 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)(376002)(346002)(136003)(396003)(366004)(66946007)(66556008)(66476007)(7696005)(52116002)(107886003)(6486002)(8676002)(186003)(16526019)(1076003)(316002)(44832011)(6666004)(478600001)(26005)(5660300002)(2906002)(86362001)(6636002)(54906003)(83380400001)(36756003)(8936002)(956004)(110136005)(2616005)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 3xsyAJpo4zaLAoQ++oJy5KrU05cpnFh6l9KZeTKG5eQeBmsaqmfAriyqLFTqqNe4qeYRRF+BLON5YmlrHAj4x9mTJ59FoMXNKP8vXkR+8OdKd+/QBMS7FICEvokNAVpp9IXtBelQmJ9FQA5GMcoLYlZKlmiz1uh2TiPbGHI1wy2XIJM6OxF+t8SHDPjBZvNzfPLmvMOPkxXBjJsib8yYOGIhytYXHFDyqoRfu3Iu2jpJSlXZXaXdRTbY6qsVR5E2XESrt7y26kevQ2ZCbNn5je+KT5lnZeYp03CjYwTsIDkIT28F4Bq5AjQTbHOwX0U+Va6dgu3n8VYlMK+aYY5ghzsbiHmLL/cldjpQwpGR2lbv16W6/Wa/g7jp6Pl+Afd7ph74XyZIcayFegVB8uQfyKcPLQ87RJ286Efq6MXPj6zPdYKCF7BMtFogW0isV+rt1VnAdWEPkc7+yFsXTYsBYF99GWLocxJukYhnvrh30CIubx+DLTIWGGawDy7fOr8J6gpXjFoFiob0wfJwkUg6K3LZmnzPpbAYBtiZgcZ0e4JKOWzV2/dL13rcWZgAFA93xaCjIKj1hxz+QNZsv1K+nEXqMUmfk25dJB69uq92s+NK98PNlBdiF5emvWsbS+d2A3Hw19PxWUnWb2zHH3h9eA== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 502b9895-f0b5-4c51-27d6-08d874a00b20 X-MS-Exchange-CrossTenant-AuthSource: BN8PR06MB5889.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2020 02:30:00.9407 (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: NhPoq0Q8tI+d8/8hg52ipKwuoijWpdS1ZjG4Dghu+276B4RNjFC59Hy9kj018mBgyBpfzzV03DvHKhK9UZdM/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB3251 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 Signed-off-by: Wright Feng --- v4: Change conditional statements --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 17 +++++++++++++++-- .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + .../broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 5e49ac3d82b9..063cbb09d751 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5484,8 +5484,8 @@ 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; + int ret = 0, result = 0; + u32 ap_isolate, val; brcmf_dbg(TRACE, "Enter\n"); ifp = netdev_priv(dev); @@ -5496,6 +5496,19 @@ 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 enables packet forwarding. */ + result = brcmf_fil_iovar_int_get(ifp, "ap_isolate", &val); + if (result == 0 && + params->ap_isolate == 0 && + val == 1) { + ifp->fmac_pkt_fwd_en = true; + } else { + if (result < 0) + brcmf_err("get ap_isolate iovar failed: result=%d\n", result); + 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 9ebafe0b2117..30b29053d133 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -195,6 +195,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 b98cf5e2d0a8..2d7e77097209 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -1192,7 +1192,7 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) } eh = (struct ethhdr *)(skb->data); - if (brcmf_is_apmode(ifp->vif)) { + if (brcmf_is_apmode(ifp->vif) && ifp->fmac_pkt_fwd_en) { skb_set_network_header(skb, sizeof(struct ethhdr)); skb->protocol = eh->h_proto; skb->priority = cfg80211_classify8021d(skb, NULL);