mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 15:18:15 +00:00
wil6210: make sure Rx ring sizes are correlated
When enlarging rx_ring_order module param, wil6210 fails to load because there are not enough Rx buffers. Fix this by enlarging number of Rx buffers at startup, if needed based on rx_ring_order. Signed-off-by: Dedy Lansky <dlansky@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
cbebe277be
commit
61e5ec0447
4 changed files with 12 additions and 7 deletions
|
@ -1689,7 +1689,7 @@ int __wil_up(struct wil6210_priv *wil)
|
||||||
WIL_RX_RING_SIZE_ORDER_DEFAULT :
|
WIL_RX_RING_SIZE_ORDER_DEFAULT :
|
||||||
WIL_RX_RING_SIZE_ORDER_TALYN_DEFAULT;
|
WIL_RX_RING_SIZE_ORDER_TALYN_DEFAULT;
|
||||||
|
|
||||||
rc = wil->txrx_ops.rx_init(wil, 1 << rx_ring_order);
|
rc = wil->txrx_ops.rx_init(wil, rx_ring_order);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -872,7 +872,7 @@ static void wil_rx_buf_len_init(struct wil6210_priv *wil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wil_rx_init(struct wil6210_priv *wil, u16 size)
|
static int wil_rx_init(struct wil6210_priv *wil, uint order)
|
||||||
{
|
{
|
||||||
struct wil_ring *vring = &wil->ring_rx;
|
struct wil_ring *vring = &wil->ring_rx;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -886,7 +886,7 @@ static int wil_rx_init(struct wil6210_priv *wil, u16 size)
|
||||||
|
|
||||||
wil_rx_buf_len_init(wil);
|
wil_rx_buf_len_init(wil);
|
||||||
|
|
||||||
vring->size = size;
|
vring->size = 1 << order;
|
||||||
vring->is_rx = true;
|
vring->is_rx = true;
|
||||||
rc = wil_vring_alloc(wil, vring);
|
rc = wil_vring_alloc(wil, vring);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
|
|
@ -606,9 +606,9 @@ static void wil_rx_buf_len_init_edma(struct wil6210_priv *wil)
|
||||||
WIL_MAX_ETH_MTU : WIL_EDMA_RX_BUF_LEN_DEFAULT;
|
WIL_MAX_ETH_MTU : WIL_EDMA_RX_BUF_LEN_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wil_rx_init_edma(struct wil6210_priv *wil, u16 desc_ring_size)
|
static int wil_rx_init_edma(struct wil6210_priv *wil, uint desc_ring_order)
|
||||||
{
|
{
|
||||||
u16 status_ring_size;
|
u16 status_ring_size, desc_ring_size = 1 << desc_ring_order;
|
||||||
struct wil_ring *ring = &wil->ring_rx;
|
struct wil_ring *ring = &wil->ring_rx;
|
||||||
int rc;
|
int rc;
|
||||||
size_t elem_size = wil->use_compressed_rx_status ?
|
size_t elem_size = wil->use_compressed_rx_status ?
|
||||||
|
@ -623,7 +623,12 @@ static int wil_rx_init_edma(struct wil6210_priv *wil, u16 desc_ring_size)
|
||||||
"compressed RX status cannot be used with SW reorder\n");
|
"compressed RX status cannot be used with SW reorder\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
if (wil->rx_status_ring_order <= desc_ring_order)
|
||||||
|
/* make sure sring is larger than desc ring */
|
||||||
|
wil->rx_status_ring_order = desc_ring_order + 1;
|
||||||
|
if (wil->rx_buff_id_count <= desc_ring_size)
|
||||||
|
/* make sure we will not run out of buff_ids */
|
||||||
|
wil->rx_buff_id_count = desc_ring_size + 512;
|
||||||
if (wil->rx_status_ring_order < WIL_SRING_SIZE_ORDER_MIN ||
|
if (wil->rx_status_ring_order < WIL_SRING_SIZE_ORDER_MIN ||
|
||||||
wil->rx_status_ring_order > WIL_SRING_SIZE_ORDER_MAX)
|
wil->rx_status_ring_order > WIL_SRING_SIZE_ORDER_MAX)
|
||||||
wil->rx_status_ring_order = WIL_RX_SRING_SIZE_ORDER_DEFAULT;
|
wil->rx_status_ring_order = WIL_RX_SRING_SIZE_ORDER_DEFAULT;
|
||||||
|
|
|
@ -614,7 +614,7 @@ struct wil_txrx_ops {
|
||||||
int cid, int tid);
|
int cid, int tid);
|
||||||
irqreturn_t (*irq_tx)(int irq, void *cookie);
|
irqreturn_t (*irq_tx)(int irq, void *cookie);
|
||||||
/* RX ops */
|
/* RX ops */
|
||||||
int (*rx_init)(struct wil6210_priv *wil, u16 ring_size);
|
int (*rx_init)(struct wil6210_priv *wil, uint ring_order);
|
||||||
void (*rx_fini)(struct wil6210_priv *wil);
|
void (*rx_fini)(struct wil6210_priv *wil);
|
||||||
int (*wmi_addba_rx_resp)(struct wil6210_priv *wil, u8 mid, u8 cid,
|
int (*wmi_addba_rx_resp)(struct wil6210_priv *wil, u8 mid, u8 cid,
|
||||||
u8 tid, u8 token, u16 status, bool amsdu,
|
u8 tid, u8 token, u16 status, bool amsdu,
|
||||||
|
|
Loading…
Add table
Reference in a new issue