Commit df738c2f authored by Hante Meuleman's avatar Hante Meuleman Committed by Kalle Valo

brcmfmac: Update msgbuf read pointer quicker.

On device to host data using msgbuf the read pointer gets updated
once all data is processed. Updating this pointer more frequently
allows the firmware to add more data quicker. This will result in
slightly higher and more stable throughput on CPU bounded host
processors.
Reviewed-by: default avatarArend Van Spriel <arend@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarHante Meuleman <meuleman@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e996db69
...@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struct brcmf_commonring *commonring, ...@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struct brcmf_commonring *commonring,
void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring, void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
u16 *n_items) u16 *n_items)
{ {
void *ret_addr;
if (commonring->cr_update_wptr) if (commonring->cr_update_wptr)
commonring->cr_update_wptr(commonring->cr_ctx); commonring->cr_update_wptr(commonring->cr_ctx);
...@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring, ...@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
if (*n_items == 0) if (*n_items == 0)
return NULL; return NULL;
ret_addr = commonring->buf_addr + return commonring->buf_addr +
(commonring->r_ptr * commonring->item_len); (commonring->r_ptr * commonring->item_len);
commonring->r_ptr += *n_items;
if (commonring->r_ptr == commonring->depth)
commonring->r_ptr = 0;
return ret_addr;
} }
int brcmf_commonring_read_complete(struct brcmf_commonring *commonring) int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
u16 n_items)
{ {
commonring->r_ptr += n_items;
if (commonring->r_ptr == commonring->depth)
commonring->r_ptr = 0;
if (commonring->cr_write_rptr) if (commonring->cr_write_rptr)
return commonring->cr_write_rptr(commonring->cr_ctx); return commonring->cr_write_rptr(commonring->cr_ctx);
......
...@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struct brcmf_commonring *commonring, ...@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struct brcmf_commonring *commonring,
u16 n_items); u16 n_items);
void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring, void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
u16 *n_items); u16 *n_items);
int brcmf_commonring_read_complete(struct brcmf_commonring *commonring); int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
u16 n_items);
#define brcmf_commonring_n_items(commonring) (commonring->depth) #define brcmf_commonring_n_items(commonring) (commonring->depth)
#define brcmf_commonring_len_item(commonring) (commonring->item_len) #define brcmf_commonring_len_item(commonring) (commonring->item_len)
......
...@@ -75,6 +75,8 @@ ...@@ -75,6 +75,8 @@
#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96 #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
#define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32 #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
struct msgbuf_common_hdr { struct msgbuf_common_hdr {
u8 msgtype; u8 msgtype;
...@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(struct brcmf_msgbuf *msgbuf, ...@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(struct brcmf_msgbuf *msgbuf,
{ {
void *buf; void *buf;
u16 count; u16 count;
u16 processed;
again: again:
buf = brcmf_commonring_get_read_ptr(commonring, &count); buf = brcmf_commonring_get_read_ptr(commonring, &count);
if (buf == NULL) if (buf == NULL)
return; return;
processed = 0;
while (count) { while (count) {
brcmf_msgbuf_process_msgtype(msgbuf, brcmf_msgbuf_process_msgtype(msgbuf,
buf + msgbuf->rx_dataoffset); buf + msgbuf->rx_dataoffset);
buf += brcmf_commonring_len_item(commonring); buf += brcmf_commonring_len_item(commonring);
processed++;
if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
brcmf_commonring_read_complete(commonring, processed);
processed = 0;
}
count--; count--;
} }
brcmf_commonring_read_complete(commonring); if (processed)
brcmf_commonring_read_complete(commonring, processed);
if (commonring->r_ptr == 0) if (commonring->r_ptr == 0)
goto again; goto again;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment