All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 19/22] brcmfmac: use credit mechanism for BC/MC if support by firmware
Date: Thu, 6 Jun 2013 13:18:04 +0200	[thread overview]
Message-ID: <1370517487-14395-20-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1370517487-14395-1-git-send-email-arend@broadcom.com>

The firmware can sent an event indicating it supports the credit
mechanism for BC/MC traffic. This patch takes that into account.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/fweh.h     |    3 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |   31 +++++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
index 6ec5db9..e679214 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
@@ -101,7 +101,8 @@ struct brcmf_event;
 	BRCMF_ENUM_DEF(P2P_PROBEREQ_MSG, 72) \
 	BRCMF_ENUM_DEF(DCS_REQUEST, 73) \
 	BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
-	BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75)
+	BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
+	BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
 
 #define BRCMF_ENUM_DEF(id, val) \
 	BRCMF_E_##id = (val),
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
index 5d809c7..b173311 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
@@ -426,6 +426,7 @@ struct brcmf_fws_info {
 	struct brcmf_fws_stats stats;
 	struct brcmf_fws_hanger hanger;
 	enum brcmf_fws_fcmode fcmode;
+	bool bcmc_credit_check;
 	struct brcmf_fws_macdesc_table desc;
 	struct workqueue_struct *fws_wq;
 	struct work_struct fws_dequeue_work;
@@ -1435,6 +1436,20 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp,
 	return 0;
 }
 
+static int brcmf_fws_notify_bcmc_credit_support(struct brcmf_if *ifp,
+						const struct brcmf_event_msg *e,
+						void *data)
+{
+	struct brcmf_fws_info *fws = ifp->drvr->fws;
+	ulong flags;
+
+	brcmf_fws_lock(ifp->drvr, flags);
+	if (fws)
+		fws->bcmc_credit_check = true;
+	brcmf_fws_unlock(ifp->drvr, flags);
+	return 0;
+}
+
 int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
 		      struct sk_buff *skb)
 {
@@ -1803,6 +1818,12 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
 		  eh->h_dest, multicast, fifo);
 
 	brcmf_fws_lock(drvr, flags);
+	/* multicast credit support is conditional, setting
+	 * flag to false to assure credit is consumed below.
+	 */
+	if (fws->bcmc_credit_check)
+		multicast = false;
+
 	if (skcb->mac->suppressed ||
 	    fws->bus_flow_blocked ||
 	    brcmf_fws_mac_desc_closed(fws, skcb->mac, fifo) ||
@@ -1875,7 +1896,8 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker)
 	brcmf_fws_lock(fws->drvr, flags);
 	for (fifo = NL80211_NUM_ACS; fifo >= 0 && !fws->bus_flow_blocked;
 	     fifo--) {
-		while (fws->fifo_credit[fifo]) {
+		while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) &&
+		       (fifo == BRCMF_FWS_FIFO_BCMC))) {
 			skb = brcmf_fws_deq(fws, fifo);
 			if (!skb)
 				break;
@@ -1944,6 +1966,13 @@ int brcmf_fws_init(struct brcmf_pub *drvr)
 		brcmf_err("register credit map handler failed\n");
 		goto fail;
 	}
+	rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT,
+				 brcmf_fws_notify_bcmc_credit_support);
+	if (rc < 0) {
+		brcmf_err("register bcmc credit handler failed\n");
+		brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP);
+		goto fail;
+	}
 
 	/* setting the iovar may fail if feature is unsupported
 	 * so leave the rc as is so driver initialization can
-- 
1.7.10.4



  parent reply	other threads:[~2013-06-06 11:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 11:17 [PATCH 00/22] brcmfmac: firmware-signalling fixes and cleanup Arend van Spriel
2013-06-06 11:17 ` [PATCH 01/22] brcmfmac: allow firmware-signal tlv to be longer than specified Arend van Spriel
2013-06-06 11:17 ` [PATCH 02/22] brcmfmac: remove fifo bitfield from brcmf_skbuff_cb::if_flags Arend van Spriel
2013-06-06 11:17 ` [PATCH 03/22] brcmfmac: Take bus flowcontrol at credit mgmt into account Arend van Spriel
2013-06-06 11:17 ` [PATCH 04/22] brcmfmac: rework credit pickup to assure consistent handling Arend van Spriel
2013-06-06 11:17 ` [PATCH 05/22] brcmfmac: explicitly indicate sk_buff is sent upon request credit Arend van Spriel
2013-06-06 11:17 ` [PATCH 06/22] brcmfmac: reducing debug logging in firmware-signalling code Arend van Spriel
2013-06-06 11:17 ` [PATCH 07/22] brcmfmac: On bus flow control use fw signalling or netif Arend van Spriel
2013-06-06 11:17 ` [PATCH 08/22] brcmfmac: For FW signalling it is necessary to track gen bit Arend van Spriel
2013-06-06 11:17 ` [PATCH 09/22] brcmfmac: Correct creditmap when credit borrowing is active Arend van Spriel
2013-06-06 11:17 ` [PATCH 10/22] brcmfmac: Sent TIM information in case of data available Arend van Spriel
2013-06-06 11:17 ` [PATCH 11/22] brcmfmac: Find correct MAC descriptor in case of TDLS Arend van Spriel
2013-06-06 11:17 ` [PATCH 12/22] brcmfmac: fix invalid ifp lookup in firmware-signalling Arend van Spriel
2013-06-06 11:17 ` [PATCH 13/22] brcmfmac: Accept only first creditmap event Arend van Spriel
2013-06-06 11:17 ` [PATCH 14/22] brcmfmac: Signalling header push and pull on logic places Arend van Spriel
2013-06-06 11:18 ` [PATCH 15/22] brcmfmac: Fix endless loop when brcmf_fws_commit_skb fails Arend van Spriel
2013-06-06 11:18 ` [PATCH 16/22] brcmfmac: Simplify counting transit count Arend van Spriel
2013-06-06 11:18 ` [PATCH 17/22] brcmfmac: fix send_pkts statistic counter in firmware-signalling Arend van Spriel
2013-06-06 11:18 ` [PATCH 18/22] brcmfmac: Always use fifo_credits, also for requested credits Arend van Spriel
2013-06-06 11:18 ` Arend van Spriel [this message]
2013-06-06 11:18 ` [PATCH 20/22] brcmfmac: add trace event for capturing BDC header Arend van Spriel
2013-06-06 11:18 ` [PATCH 21/22] brcmfmac: increment hard_header_len instead of overriding Arend van Spriel
2013-06-06 11:18 ` [PATCH 22/22] brcmfmac: add debugfs statistics for firmware-signalling Arend van Spriel
2013-06-11 20:27 ` [PATCH 00/22] brcmfmac: firmware-signalling fixes and cleanup Arend van Spriel
2013-06-11 20:59   ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370517487-14395-20-git-send-email-arend@broadcom.com \
    --to=arend@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.