From patchwork Sat Sep 24 20:44:18 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: 9349301 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 3C71460B16 for ; Sat, 24 Sep 2016 20:45:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EC2C29023 for ; Sat, 24 Sep 2016 20:45:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14E1729018; Sat, 24 Sep 2016 20:45:01 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 7311629018 for ; Sat, 24 Sep 2016 20:45:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030317AbcIXUok (ORCPT ); Sat, 24 Sep 2016 16:44:40 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:32864 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754611AbcIXUoi (ORCPT ); Sat, 24 Sep 2016 16:44:38 -0400 Received: by mail-lf0-f67.google.com with SMTP id l131so7451265lfl.0; Sat, 24 Sep 2016 13:44:36 -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:mime-version :content-transfer-encoding; bh=bWei7DbXGEdwBOoG9Jq5Ri3OcrdD/hL/HH2Oa6SS7gs=; b=FTUGRg0ymne1sasoHRnIlTNyBX7vAnjEseLT4N+oZcFCmZBi7HAN3CIWp+eZgSYrFF 6OtfJboLx3u5rsxIXgKr3nYpJcrkSkl1ebRmg4Ms0npdfB7Lg1ZHEcW7N5etVMzJODSP v4C5q4bZxwyqHPq3E5UY1S5Dl0iNuPOnOBHGbc2fiZe6WJyem+XWdinhR0VO/35I7eIg Y8cC7TkTFkdTegQNtQFezyaZ1iMjGGHa0zkDNSLWnPTGR0/vHwoGwu+WwDrVS4+PtoSc 2eJ41fJYuFkA6SwoEZLH3DLjrHyshkJxrB2CMVfqhvkIFxLn/2Iyj44csiBgHNitgqph PoDQ== 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:mime-version :content-transfer-encoding; bh=bWei7DbXGEdwBOoG9Jq5Ri3OcrdD/hL/HH2Oa6SS7gs=; b=aSK9RQuy5wZ/Cny0qsealQVzTDz6Xi9G2SphMwHdH7xCRLxaT/V3In+vAv5qN0ws9r TqaV4BOoeHDQudohS5nQVvvOP/Rw8TZkJpy1m3lbTJkCQdLwDuodvecxPP0ONlufxhtZ g7hj68d+ZwNaOVy0whf5vvqv7umeF7qD/JSDXuhzzYipaarmnW2phA1v0Rze0naYQoZ5 Tbw9Qm6IsuSwXXkX9c09nxCxalOQe4haan2vKeut++iecn/FCuHPFwJ6ORUIN3C8828d KUi5qkO3GAu35jSqemtBIj+ZIoKxfhL9gTnvNQ2o5A3tBBjpP0/g3CgsvHnVsUUiZBmL UIig== X-Gm-Message-State: AA6/9RlVMUj1B3bqf4rExZ1XSi8+AzpInTufK83l6gc2ne3GXhCXXnEJAGeYgitxtT0uNQ== X-Received: by 10.46.69.137 with SMTP id s131mr1024090lja.72.1474749875611; Sat, 24 Sep 2016 13:44:35 -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 o84sm2286839lfi.34.2016.09.24.13.44.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Sep 2016 13:44:34 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Pieter-Paul Giesberts , Franky Lin , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH 1/2] brcmfmac: initialize fws(ignal) for BCDC protocol only Date: Sat, 24 Sep 2016 22:44:18 +0200 Message-Id: <20160924204419.10213-1-zajec5@gmail.com> X-Mailer: git-send-email 2.9.3 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 From: Rafał Miłecki There are two protocols used by Broadcom FullMAC devices: BCDC and msgbuf. They use different ways for (some part of) communication with the firmware. Firmware Signaling is required for the first one only (BCDC). So far we were always initializing fws and always calling it's skb processing function. It was fws that was passing skb processing to the protocol specific function. It was redundant for the msgbuf case. Simply taking few lines of code out of fws allows us to totally avoid using it. This simplifies code flow, saves some memory & will allow further optimizations like not compiling fwsignal.c. Signed-off-by: Rafał Miłecki --- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 24 ++++++++++++++++------ .../broadcom/brcm80211/brcmfmac/fwsignal.c | 17 ++++++--------- .../broadcom/brcm80211/brcmfmac/fwsignal.h | 1 + 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 27cd50a..bc3d8ab 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -250,7 +250,17 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, if (eh->h_proto == htons(ETH_P_PAE)) atomic_inc(&ifp->pend_8021x_cnt); - ret = brcmf_fws_process_skb(ifp, skb); + /* determine the priority */ + if (skb->priority == 0 || skb->priority > 7) + skb->priority = cfg80211_classify8021d(skb, NULL); + + if (drvr->fws && brcmf_fws_skbs_queueing(drvr->fws)) { + ret = brcmf_fws_process_skb(ifp, skb); + } else { + ret = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb); + if (ret < 0) + brcmf_txfinalize(ifp, skb, false); + } done: if (ret) { @@ -405,7 +415,7 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) struct brcmf_if *ifp; /* await txstatus signal for firmware if active */ - if (brcmf_fws_fc_active(drvr->fws)) { + if (drvr->fws && brcmf_fws_fc_active(drvr->fws)) { if (!success) brcmf_fws_bustxfail(drvr->fws, txp); } else { @@ -1006,11 +1016,13 @@ int brcmf_bus_start(struct device *dev) } brcmf_feat_attach(drvr); - ret = brcmf_fws_init(drvr); - if (ret < 0) - goto fail; + if (bus_if->proto_type == BRCMF_PROTO_BCDC) { + ret = brcmf_fws_init(drvr); + if (ret < 0) + goto fail; - brcmf_fws_add_interface(ifp); + brcmf_fws_add_interface(ifp); + } drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev, drvr->settings->p2p_enable); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c index a190f53..495eaf8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c @@ -2100,16 +2100,6 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) int rc = 0; brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); - /* determine the priority */ - if ((skb->priority == 0) || (skb->priority > 7)) - skb->priority = cfg80211_classify8021d(skb, NULL); - - if (fws->avoid_queueing) { - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb); - if (rc < 0) - brcmf_txfinalize(ifp, skb, false); - return rc; - } /* set control buffer information */ skcb->if_flags = 0; @@ -2155,7 +2145,7 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp) struct brcmf_fws_info *fws = ifp->drvr->fws; struct brcmf_fws_mac_descriptor *entry; - if (!ifp->ndev) + if (!fws || !ifp->ndev) return; entry = &fws->desc.iface[ifp->ifidx]; @@ -2442,6 +2432,11 @@ void brcmf_fws_deinit(struct brcmf_pub *drvr) kfree(fws); } +bool brcmf_fws_skbs_queueing(struct brcmf_fws_info *fws) +{ + return !fws->avoid_queueing; +} + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) { if (!fws->creditmap_received) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h index ef0ad85..8f7c1d7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h @@ -20,6 +20,7 @@ int brcmf_fws_init(struct brcmf_pub *drvr); void brcmf_fws_deinit(struct brcmf_pub *drvr); +bool brcmf_fws_skbs_queueing(struct brcmf_fws_info *fws); bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb); int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);