From patchwork Wed Jun 29 19:54:27 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: 9206159 X-Patchwork-Delegate: kvalo@adurom.com 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 730896075A for ; Wed, 29 Jun 2016 19:55:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67FC428609 for ; Wed, 29 Jun 2016 19:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A58028620; Wed, 29 Jun 2016 19:55:59 +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=ham 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 EEC52285C6 for ; Wed, 29 Jun 2016 19:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbcF2Tz0 (ORCPT ); Wed, 29 Jun 2016 15:55:26 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33755 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751839AbcF2TzW (ORCPT ); Wed, 29 Jun 2016 15:55:22 -0400 Received: by mail-lf0-f68.google.com with SMTP id l188so6152137lfe.0; Wed, 29 Jun 2016 12:55:21 -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=JTHHmec7azHzknnpbbsENU/Pxo6Mo7rZXk2ZYKyxP0o=; b=b7lJxEjmpDR+yUoLQWx0RewaTsM3OnJzx85uzr3wyFdO52UlWW0UzoQKoSDaSzKzRq 6uQn9O3BZUYMfcNLY7t7XAIsSVuIyykJY+fHF9436fG4uuy13iUHkiPQ/QSRGWKfk5jI J64vW8KqFHXre71/74aDgghrl7SkxOXMesrjesA8QnD/6LZwnOOSg7YYxsUpnZOFvGnk /cTCWrG6YOIB5Rj0UaP990k/4iH+z7u6Nb+KRLRnRtqq1f9QBJuMtZr4DSdEowRsEsz1 dxZHVm4P0/oIit+nxAeFyLVIEp1PJ0gUDRT4HbWABm119khvagorduKccwG59mnFj7wc jtZg== 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=JTHHmec7azHzknnpbbsENU/Pxo6Mo7rZXk2ZYKyxP0o=; b=YHr575EHe3X+DXGvv3bn30UxqmgjBthoUrJ2/L+FCa7C+xkeQshNJtwhIP3Fz0Dd8u y0KCnGyyngcbUQTssUzYasZtz3zdIF+qB9rEAOojyM8E4PpgaA7wgG/CmaZlBJEpZmA1 mrlvQeSdfk/yEuHDz70/l4bux7M5bgoxq4Y1wOe4T0w54YALURqaYoUIN0Z1IxaP98jW +mh8CNkBrbkLXttQHOyetSgnLgsuE6ncRpmnRoGxfZT5f7so6gPxwSz2KDEFmPS2EXZa zJ8Lmj8+oIpeZ/1So6A8ABwAtUDSCPBYsNwJ99v10KZZYCeXTA4ecW3j7M9yMndMorhP tFlQ== X-Gm-Message-State: ALyK8tJ3rVr+3n74DmIo8g26FhNN1sT5pXbt+yUEhn3i3SovazXZHQY8jDTDcxltY+DX+g== X-Received: by 10.46.33.80 with SMTP id h77mr3065175ljh.29.1467230120472; Wed, 29 Jun 2016 12:55:20 -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 u19sm856064lja.12.2016.06.29.12.55.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jun 2016 12:55:19 -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 2/2] brcmfmac: support removing AP interfaces with "interface_remove" Date: Wed, 29 Jun 2016 21:54:27 +0200 Message-Id: <1467230067-3302-3-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1467230067-3302-1-git-send-email-zajec5@gmail.com> References: <1466353420-30998-1-git-send-email-zajec5@gmail.com> <1467230067-3302-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 --- .../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 a5db953..6e6066a 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: