The patches are for throughput enhancement with flow control mode enabled
and introduce a new module parameter to enhance TX throughput as well.
Changes since v1:
Remove the patch "calling skb_orphan before sending skb to SDIO bus"
Revise the patch "brcmfmac: add credit numbers updating support"
Wright Feng (2):
brcmfmac: add credit numbers updating support
brcmfmac: make firmware frameburst mode a module parameter
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 7 ++++++
.../broadcom/brcm80211/brcmfmac/common.c | 5 ++++
.../broadcom/brcm80211/brcmfmac/common.h | 2 ++
.../broadcom/brcm80211/brcmfmac/fwil.h | 1 +
.../broadcom/brcm80211/brcmfmac/fwsignal.c | 23 ++++++++++++-------
5 files changed, 30 insertions(+), 8 deletions(-)
--
2.19.1
The credit numbers are static and tunable per chip in firmware side.
However the credit number may be changed that is based on packet pool
length and will send BRCMF_E_FIFO_CREDIT_MAP event to notify host driver
updates the credit numbers during interface up.
The purpose of this patch is making host driver has ability of updating
the credit numbers when receiving the BRCMF_E_FIFO_CREDIT_MAP event.
Signed-off-by: Wright Feng <[email protected]>
---
v2: replace brcmf_err with WARN_ONCE
---
.../broadcom/brcm80211/brcmfmac/fwsignal.c | 23 ++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
index f3cbf78c8899..c75be2703b3e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
@@ -511,6 +511,7 @@ struct brcmf_fws_info {
struct work_struct fws_dequeue_work;
u32 fifo_enqpkt[BRCMF_FWS_FIFO_COUNT];
int fifo_credit[BRCMF_FWS_FIFO_COUNT];
+ int init_fifo_credit[BRCMF_FWS_FIFO_COUNT];
int credits_borrowed[BRCMF_FWS_FIFO_AC_VO + 1];
int deq_node_pos[BRCMF_FWS_FIFO_COUNT];
u32 fifo_credit_map;
@@ -1237,6 +1238,9 @@ static void brcmf_fws_return_credits(struct brcmf_fws_info *fws,
}
fws->fifo_credit[fifo] += credits;
+ if (fws->fifo_credit[fifo] > fws->init_fifo_credit[fifo])
+ fws->fifo_credit[fifo] = fws->init_fifo_credit[fifo];
+
}
static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws)
@@ -1595,19 +1599,21 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp,
brcmf_err("event payload too small (%d)\n", e->datalen);
return -EINVAL;
}
- if (fws->creditmap_received)
- return 0;
fws->creditmap_received = true;
brcmf_dbg(TRACE, "enter: credits %pM\n", credits);
brcmf_fws_lock(fws);
for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) {
- if (*credits)
+ fws->fifo_credit[i] += credits[i] - fws->init_fifo_credit[i];
+ fws->init_fifo_credit[i] = credits[i];
+ if (fws->fifo_credit[i] > 0)
fws->fifo_credit_map |= 1 << i;
else
fws->fifo_credit_map &= ~(1 << i);
- fws->fifo_credit[i] = *credits++;
+ WARN_ONCE(fws->fifo_credit[i] < 0,
+ "fifo_credit[%d] is negative(%d)\n", i,
+ fws->fifo_credit[i]);
}
brcmf_fws_schedule_deq(fws);
brcmf_fws_unlock(fws);
@@ -2013,7 +2019,7 @@ static int brcmf_fws_borrow_credit(struct brcmf_fws_info *fws)
}
for (lender_ac = 0; lender_ac <= BRCMF_FWS_FIFO_AC_VO; lender_ac++) {
- if (fws->fifo_credit[lender_ac]) {
+ if (fws->fifo_credit[lender_ac] > 0) {
fws->credits_borrowed[lender_ac]++;
fws->fifo_credit[lender_ac]--;
if (fws->fifo_credit[lender_ac] == 0)
@@ -2210,8 +2216,9 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker)
}
continue;
}
- while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) &&
- (fifo == BRCMF_FWS_FIFO_BCMC))) {
+ while ((fws->fifo_credit[fifo] > 0) ||
+ ((!fws->bcmc_credit_check) &&
+ (fifo == BRCMF_FWS_FIFO_BCMC))) {
skb = brcmf_fws_deq(fws, fifo);
if (!skb)
break;
@@ -2222,7 +2229,7 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker)
break;
}
if ((fifo == BRCMF_FWS_FIFO_AC_BE) &&
- (fws->fifo_credit[fifo] == 0) &&
+ (fws->fifo_credit[fifo] <= 0) &&
(!fws->bus_flow_blocked)) {
while (brcmf_fws_borrow_credit(fws) == 0) {
skb = brcmf_fws_deq(fws, fifo);
--
2.19.1
This patch is for adding a new module parameter "frameburst".
With setting "frameburst=1" in module parameters, firmware frameburst mode
will be enabled. The feature can enable per-packet framebursting in
firmware side and get higher TX throughput in High Throughput(HT) mode.
Signed-off-by: Wright Feng <[email protected]>
---
.../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++++
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 5 +++++
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h | 1 +
4 files changed, 15 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 230a378c26fc..4a05d3f50cff 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6638,6 +6638,13 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
brcmf_configure_arp_nd_offload(ifp, true);
+ if (ifp->drvr->settings->frameburst) {
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
+ if (err)
+ brcmf_info("setting frameburst mode failed\n");
+ brcmf_dbg(INFO, "frameburst mode enabled\n");
+ }
+
cfg->dongle_up = true;
default_conf_out:
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 94044a7a6021..0ad4c3196e5d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -78,6 +78,10 @@ static int brcmf_iapp_enable;
module_param_named(iapp, brcmf_iapp_enable, int, 0);
MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
+static int brcmf_frameburst;
+module_param_named(frameburst, brcmf_frameburst, int, 0);
+MODULE_PARM_DESC(frameburst, "Enable firmware frameburst feature");
+
#ifdef DEBUG
/* always succeed brcmf_bus_started() */
static int brcmf_ignore_probe_fail;
@@ -419,6 +423,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
settings->fcmode = brcmf_fcmode;
settings->roamoff = !!brcmf_roamoff;
settings->iapp = !!brcmf_iapp_enable;
+ settings->frameburst = !!brcmf_frameburst;
#ifdef DEBUG
settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
#endif
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
index a34642cb4d2f..b91975258a68 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
@@ -47,6 +47,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global;
* @feature_disable: Feature_disable bitmask.
* @fcmode: FWS flow control.
* @roamoff: Firmware roaming off?
+ * @frameburst: Firmware frame burst mode.
* @ignore_probe_fail: Ignore probe failure.
* @country_codes: If available, pointer to struct for translating country codes
* @bus: Bus specific platform data. Only SDIO at the mmoment.
@@ -57,6 +58,7 @@ struct brcmf_mp_device {
int fcmode;
bool roamoff;
bool iapp;
+ bool frameburst;
bool ignore_probe_fail;
struct brcmfmac_pd_cc *country_codes;
union {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
index 63b1287e2e6d..b6b183b18413 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
@@ -80,6 +80,7 @@
#define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
#define BRCMF_C_SET_ASSOC_PREFER 205
#define BRCMF_C_GET_VALID_CHANNELS 217
+#define BRCMF_C_SET_FAKEFRAG 219
#define BRCMF_C_GET_KEY_PRIMARY 235
#define BRCMF_C_SET_KEY_PRIMARY 236
#define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
--
2.19.1
On 11/2/2018 9:24 AM, Wright Feng wrote:
> This patch is for adding a new module parameter "frameburst".
> With setting "frameburst=1" in module parameters, firmware frameburst mode
> will be enabled. The feature can enable per-packet framebursting in
> firmware side and get higher TX throughput in High Throughput(HT) mode.
So why not always enable it in firmware as it seems to be the default in
recent firmware anyway.
Regards,
Arend
> Signed-off-by: Wright Feng <[email protected]>
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++++
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 5 +++++
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h | 1 +
> 4 files changed, 15 insertions(+)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> index 230a378c26fc..4a05d3f50cff 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -6638,6 +6638,13 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
>
> brcmf_configure_arp_nd_offload(ifp, true);
>
> + if (ifp->drvr->settings->frameburst) {
> + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
> + if (err)
> + brcmf_info("setting frameburst mode failed\n");
> + brcmf_dbg(INFO, "frameburst mode enabled\n");
> + }
> +
> cfg->dongle_up = true;
> default_conf_out:
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
> index 94044a7a6021..0ad4c3196e5d 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
> @@ -78,6 +78,10 @@ static int brcmf_iapp_enable;
> module_param_named(iapp, brcmf_iapp_enable, int, 0);
> MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
>
> +static int brcmf_frameburst;
> +module_param_named(frameburst, brcmf_frameburst, int, 0);
> +MODULE_PARM_DESC(frameburst, "Enable firmware frameburst feature");
> +
> #ifdef DEBUG
> /* always succeed brcmf_bus_started() */
> static int brcmf_ignore_probe_fail;
> @@ -419,6 +423,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
> settings->fcmode = brcmf_fcmode;
> settings->roamoff = !!brcmf_roamoff;
> settings->iapp = !!brcmf_iapp_enable;
> + settings->frameburst = !!brcmf_frameburst;
> #ifdef DEBUG
> settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
> #endif
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
> index a34642cb4d2f..b91975258a68 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
> @@ -47,6 +47,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global;
> * @feature_disable: Feature_disable bitmask.
> * @fcmode: FWS flow control.
> * @roamoff: Firmware roaming off?
> + * @frameburst: Firmware frame burst mode.
> * @ignore_probe_fail: Ignore probe failure.
> * @country_codes: If available, pointer to struct for translating country codes
> * @bus: Bus specific platform data. Only SDIO at the mmoment.
> @@ -57,6 +58,7 @@ struct brcmf_mp_device {
> int fcmode;
> bool roamoff;
> bool iapp;
> + bool frameburst;
> bool ignore_probe_fail;
> struct brcmfmac_pd_cc *country_codes;
> union {
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
> index 63b1287e2e6d..b6b183b18413 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
> @@ -80,6 +80,7 @@
> #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
> #define BRCMF_C_SET_ASSOC_PREFER 205
> #define BRCMF_C_GET_VALID_CHANNELS 217
> +#define BRCMF_C_SET_FAKEFRAG 219
> #define BRCMF_C_GET_KEY_PRIMARY 235
> #define BRCMF_C_SET_KEY_PRIMARY 236
> #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
>
On 11/2/2018 9:24 AM, Wright Feng wrote:
> The patches are for throughput enhancement with flow control mode enabled
> and introduce a new module parameter to enhance TX throughput as well.
>
> Changes since v1:
> Remove the patch "calling skb_orphan before sending skb to SDIO bus"
> Revise the patch "brcmfmac: add credit numbers updating support"
I also saw a patch Chi-Hsien Lin regarding fwsignal support. It would be
good if that patch was part of this patch series as they seem dependent
or at least related.
Regards,
Arend
> Wright Feng (2):
> brcmfmac: add credit numbers updating support
> brcmfmac: make firmware frameburst mode a module parameter
>
> .../broadcom/brcm80211/brcmfmac/cfg80211.c | 7 ++++++
> .../broadcom/brcm80211/brcmfmac/common.c | 5 ++++
> .../broadcom/brcm80211/brcmfmac/common.h | 2 ++
> .../broadcom/brcm80211/brcmfmac/fwil.h | 1 +
> .../broadcom/brcm80211/brcmfmac/fwsignal.c | 23 ++++++++++++-------
> 5 files changed, 30 insertions(+), 8 deletions(-)
>
Arend van Spriel 於 11/2/2018 8:31 PM 寫道:
> On 11/2/2018 9:24 AM, Wright Feng wrote:
>> This patch is for adding a new module parameter "frameburst".
>> With setting "frameburst=1" in module parameters, firmware frameburst
>> mode
>> will be enabled. The feature can enable per-packet framebursting in
>> firmware side and get higher TX throughput in High Throughput(HT) mode.
>
> So why not always enable it in firmware as it seems to be the default in
> recent firmware anyway.
>
> Regards,
> Arend
We don't have all the chips(some are not belong to Cypress) to do
modification and verify them in our internal test, so the frameburst
feature will not benefit to all firmwares.
How about removing module parameter and setting frameburst to be default
in host driver side? It will be good to all Linux supported chips and
users.
-Wright
>
>> Signed-off-by: Wright Feng <[email protected]>
>> ---
>> .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++++
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 5 +++++
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h | 1 +
>> 4 files changed, 15 insertions(+)
>>
>> diff --git
>> a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
>> index 230a378c26fc..4a05d3f50cff 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
>> @@ -6638,6 +6638,13 @@ static s32 brcmf_config_dongle(struct
>> brcmf_cfg80211_info *cfg)
>>
>> brcmf_configure_arp_nd_offload(ifp, true);
>>
>> + if (ifp->drvr->settings->frameburst) {
>> + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
>> + if (err)
>> + brcmf_info("setting frameburst mode failed\n");
>> + brcmf_dbg(INFO, "frameburst mode enabled\n");
>> + }
>> +
>> cfg->dongle_up = true;
>> default_conf_out:
>>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
>> index 94044a7a6021..0ad4c3196e5d 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
>> @@ -78,6 +78,10 @@ static int brcmf_iapp_enable;
>> module_param_named(iapp, brcmf_iapp_enable, int, 0);
>> MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted
>> Inter-Access Point Protocol");
>>
>> +static int brcmf_frameburst;
>> +module_param_named(frameburst, brcmf_frameburst, int, 0);
>> +MODULE_PARM_DESC(frameburst, "Enable firmware frameburst feature");
>> +
>> #ifdef DEBUG
>> /* always succeed brcmf_bus_started() */
>> static int brcmf_ignore_probe_fail;
>> @@ -419,6 +423,7 @@ struct brcmf_mp_device
>> *brcmf_get_module_param(struct device *dev,
>> settings->fcmode = brcmf_fcmode;
>> settings->roamoff = !!brcmf_roamoff;
>> settings->iapp = !!brcmf_iapp_enable;
>> + settings->frameburst = !!brcmf_frameburst;
>> #ifdef DEBUG
>> settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
>> #endif
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
>> index a34642cb4d2f..b91975258a68 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
>> @@ -47,6 +47,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global;
>> * @feature_disable: Feature_disable bitmask.
>> * @fcmode: FWS flow control.
>> * @roamoff: Firmware roaming off?
>> + * @frameburst: Firmware frame burst mode.
>> * @ignore_probe_fail: Ignore probe failure.
>> * @country_codes: If available, pointer to struct for translating
>> country codes
>> * @bus: Bus specific platform data. Only SDIO at the mmoment.
>> @@ -57,6 +58,7 @@ struct brcmf_mp_device {
>> int fcmode;
>> bool roamoff;
>> bool iapp;
>> + bool frameburst;
>> bool ignore_probe_fail;
>> struct brcmfmac_pd_cc *country_codes;
>> union {
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
>> index 63b1287e2e6d..b6b183b18413 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
>> @@ -80,6 +80,7 @@
>> #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
>> #define BRCMF_C_SET_ASSOC_PREFER 205
>> #define BRCMF_C_GET_VALID_CHANNELS 217
>> +#define BRCMF_C_SET_FAKEFRAG 219
>> #define BRCMF_C_GET_KEY_PRIMARY 235
>> #define BRCMF_C_SET_KEY_PRIMARY 236
>> #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
>>
>