From patchwork Mon May 30 04:40:54 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: 9140237 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 86D4660801 for ; Mon, 30 May 2016 04:41:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F5E8281B4 for ; Mon, 30 May 2016 04:41:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 713A42821C; Mon, 30 May 2016 04:41:41 +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 1BE1F28212 for ; Mon, 30 May 2016 04:41:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751111AbcE3ElW (ORCPT ); Mon, 30 May 2016 00:41:22 -0400 Received: from mail-lb0-f193.google.com ([209.85.217.193]:32819 "EHLO mail-lb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbcE3ElV (ORCPT ); Mon, 30 May 2016 00:41:21 -0400 Received: by mail-lb0-f193.google.com with SMTP id rs7so3708647lbb.0; Sun, 29 May 2016 21:41:19 -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=/Yty9wpZvwGBwWNiHmDr91DUz2qkwHj+1WebLKwL4C4=; b=tQ0PQXyxrIzKZKn89ktt3bQFWKP246vGrUrkqCftOdBQ8RsIMVe8jwkqWTgjB9oPe9 SMgsLsq9HXpvB0FP46AfEqLQVwgIo6Tdx65uBIhx1lR15QBP6ivh5nLtCYugD6opMr50 3we9SQs3zWRVCV+xBfFGnnCVMHrwMqrTmf5uarhNdykP30s7G68ucCfdhtSbn6aqEzBQ 2QWd1QUE/RAbQtWeZs9cRI4siv+ErYFQcWf03q7TnJyUOZKPmwrT9ZiR9rMlPqNZxKpL KU4Wg/gdStMgXKTqeqXrW/Jrx9ICG+bJgwsOsngOxrJzT1Fn36UblrQM2rZLZb9fESCv EdpA== 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=/Yty9wpZvwGBwWNiHmDr91DUz2qkwHj+1WebLKwL4C4=; b=CNQs+HnOEPHOdL98y7k1U/BzZ7+0W7jiXdopQu+0/qK2Iq005mO+ySc+sfcRtJcDsJ gaU19RK+xaSvgj3G6/8nKuRPfhDb2BxqlYAJs9V+OVO359StX1bV+PhDd1g0FJ038KM2 vOukPo7N1IwaWvMW4TFXgIxQWEnDYbXOFvlfQp5KUSrrKPxLo3+9KoNn20EYYfcxzZCY 8Veb1jqXtEI96yDwxxvvUn5U0+i/ikJM9iA4bobQ9Faae+TtoHOZJRF+oiHLX2bZnUEe EGty+gbnNq/O0fn0q1iyLAiLCWye5undzD4IgIOZqGR40MNioHyxMIpz6VH0IQN3kn4Y FAZQ== X-Gm-Message-State: ALyK8tIzhhh46PMb/e0ACdu29OTNnmcmVaiS6lHb35y4AY9gC5dnKcjlFhE4hIJwNVHjLQ== X-Received: by 10.112.72.225 with SMTP id g1mr3301791lbv.113.1464583277351; Sun, 29 May 2016 21:41:17 -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 1sm2164376ljf.5.2016.05.29.21.41.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2016 21:41:16 -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?= , Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , Hante Meuleman , Pieter-Paul Giesberts , linux-wireless@vger.kernel.org (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), brcm80211-dev-list@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 next] brcmfmac: don't remove interface on link down firmware event Date: Mon, 30 May 2016 06:40:54 +0200 Message-Id: <1464583269-30255-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1464557989-20003-1-git-send-email-zajec5@gmail.com> References: <1464557989-20003-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 There are two firmware events we handle similarly in brcmfmac: BRCMF_E_LINK and BRCMF_E_IF. The difference from firmware point of view is that the first one means BSS remains present in the firmware. Trying to (re)create it (e.g. when adding new virtual interface) will result in an error. Current code treats both events in a similar way. It removes Linux interface for each of them. It works OK with e.g. BCM43602. Its firmware generates both events for each interface. It means we get BRCMF_E_LINK and remove interface. That is soon followed by BRCMF_E_IF which means BSS was also removed in a firmware. The only downside of this is a harmless error like: [ 208.643180] brcmfmac: brcmf_fweh_call_event_handler: no interface object Unfortunately BCM4366 firmware doesn't automatically remove BSS and so it doesn't generate BRCMF_E_IF. In such case we incorrectly remove Linux interface on BRCMF_E_LINK as BSS is still present in the firmware. It results in an error when trying to re-create virtual interface, e.g.: > iw phy phy1 interface add wlan1-1 type __ap [ 3602.929199] brcmfmac: brcmf_ap_add_vif: timeout occurred command failed: I/O error (-5) With this patch we don't remove Linux interface while firmware keeps BSS. Thanks to this we keep a consistent states of host driver and device firmware. Further improvement should be to mark BSS as disabled and remove interface on BRCMF_E_LINK. Then we should add support for reusing BSS-es. Signed-off-by: Rafał Miłecki --- V2: Fix drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:5431:19: warning: unused variable ‘ifp’ [-Wunused-variable] --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 38df1be..d23b95e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5428,7 +5428,6 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg, struct net_device *ndev, const struct brcmf_event_msg *e, void *data) { - struct brcmf_if *ifp = netdev_priv(ndev); static int generation; u32 event = e->event_code; u32 reason = e->reason; @@ -5439,8 +5438,6 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg, ndev != cfg_to_ndev(cfg)) { brcmf_dbg(CONN, "AP mode link down\n"); complete(&cfg->vif_disabled); - if (ifp->vif->mbss) - brcmf_remove_interface(ifp); return 0; }