From patchwork Sun Jun 19 16:23:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9186203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A30860465 for ; Sun, 19 Jun 2016 16:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B54A2040D for ; Sun, 19 Jun 2016 16:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2F3F26490; Sun, 19 Jun 2016 16:36:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EA102040D for ; Sun, 19 Jun 2016 16:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751359AbcFSQg0 (ORCPT ); Sun, 19 Jun 2016 12:36:26 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36540 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbcFSQgX (ORCPT ); Sun, 19 Jun 2016 12:36:23 -0400 Received: by mail-lf0-f66.google.com with SMTP id a2so3551208lfe.3; Sun, 19 Jun 2016 09:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rArtKYsVK1f6BnMGJsmDNWAJOIqA/A91b6K0gByYLLA=; b=SkwgvDPS0l65nBjZMkMJWDfZL6+PEmtANmGhkMYO06A5siUjzI65JOqS46aW9Co171 L+WOGMBUofNYplwdCCKqz4VFQL7gVjyArOHsSBSNV7P51Rb+dW0WBk0WaCc3n2dUNknP TG2VPwMuQe3uyXHNmzv6m0lvIVamkiIXZExLojwrYjG7s0Hm9D7/nhXjES76LivE12rx PgE+J3s56f9ax5+Sx1isPpLWIbZILyPOKD1qHUisoL+tVGh/Ql209hs9l5ekGuLZ5uCt JEnCsjOeLrfJOe7Hl6zGWhx1xQ7vsRgqf4UHl37TL1F6AoTvFJdqyGq8EW9IJItXPN89 kAvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rArtKYsVK1f6BnMGJsmDNWAJOIqA/A91b6K0gByYLLA=; b=gJm2nxJj8nYK+Ma5D4evmCr4WG4u4yabbNZ0eNqKPJg3H9stWw5JucdRze3eUQxJqA sMbGah0jbaFCDBUG3323O7ur+vTOADtLkwbwqfAUGKOrWHIuDjkyA8NWu/fFiHTqVmYM n1fq4RiipjqrNZ0ZK84fsidy/00q7q9p3XPzLTgz0DQg8JCC9Yt0dvxgtBWD+KJ7n+a3 Y0QCHaDHYysZJVnvAgrfkX+fKXzy6/6x5CdsL/lHxEL7OPJckm6Np3nLGz/ok0+CGAiR Lu86tjjA0Pd6C4icb5DNdr8kmgirYrvIn9IWNp99OmqLQ8mF5ofUnn6NWPSOwMx9yGJn xr/g== X-Gm-Message-State: ALyK8tI42ED1TUmZKisEkPpW+JXfZNJjQJd73lZkPmzRRpbaxPeGDCMXIPkn5zsMqJ8erg== X-Received: by 10.46.71.83 with SMTP id u80mr2679241lja.15.1466353434159; Sun, 19 Jun 2016 09:23:54 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id g22sm4016139lji.43.2016.06.19.09.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 09:23:53 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Arend van Spriel , Franky Lin , Hante Meuleman , Pieter-Paul Giesberts , "Franky (Zhenhui) Lin" , linux-wireless@vger.kernel.org (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), brcm80211-dev-list.pdl@broadcom.com (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2 RFC 2/2] brcmfmac: support removing AP interfaces with "interface_remove" Date: Sun, 19 Jun 2016 18:23:25 +0200 Message-Id: <1466353420-30998-2-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1466353420-30998-1-git-send-email-zajec5@gmail.com> References: <1466273932-11554-1-git-send-email-zajec5@gmail.com> <1466353420-30998-1-git-send-email-zajec5@gmail.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove" for removing interfaces. Try to use this method on cfg80211 request. In case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this will just result in firmware rejecting command and this won't change any behavior. Signed-off-by: Rafał Miłecki --- V2: Add extra chcek for ndev. Thanks Arend. --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 502b0a0..1e411dc 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, return err; } +static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy, + struct wireless_dev *wdev) +{ + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); + struct net_device *ndev = wdev->netdev; + struct brcmf_if *ifp = netdev_priv(ndev); + int ret; + int err; + + brcmf_cfg80211_arm_vif_event(cfg, ifp->vif); + + err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); + if (err) { + brcmf_err("interface_remove failed %d\n", err); + goto err_unarm; + } + + /* wait for firmware event */ + ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, + BRCMF_VIF_EVENT_TIMEOUT); + if (!ret) { + brcmf_err("timeout occurred\n"); + err = -EIO; + goto err_unarm; + } + + brcmf_remove_interface(ifp, true); + +err_unarm: + brcmf_cfg80211_arm_vif_event(cfg, NULL); + return err; +} + static int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) { struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); struct net_device *ndev = wdev->netdev; + if (ndev && ndev == cfg_to_ndev(cfg)) + return -ENOTSUPP; + /* vif event pending in firmware */ if (brcmf_cfg80211_vif_event_armed(cfg)) return -EBUSY; @@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) switch (wdev->iftype) { case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_WDS: case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_MESH_POINT: return -EOPNOTSUPP; + case NL80211_IFTYPE_AP: + return brcmf_cfg80211_del_ap_iface(wiphy, wdev); case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_P2P_GO: case NL80211_IFTYPE_P2P_DEVICE: