Commit d64dd2a1 authored by Karun Eagalapati's avatar Karun Eagalapati Committed by Kalle Valo

rsi: buffer full check optimization

We get buffer full event from firmware whenever Tx queue is full
Host should stop writing packets after this and resume after
buffer free event.
Buffer status checking is optimized for once in 4 times if
BUFF_FULL condition is not set, otherwise once for every
packet.
Signed-off-by: default avatarKarun Eagalapati <karun256@gmail.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 23e414cc
...@@ -271,6 +271,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter) ...@@ -271,6 +271,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
"%s: ==> BUFFER_AVAILABLE <==\n", "%s: ==> BUFFER_AVAILABLE <==\n",
__func__); __func__);
dev->rx_info.buf_available_counter++; dev->rx_info.buf_available_counter++;
dev->buff_status_updated = true;
break; break;
case FIRMWARE_ASSERT_IND: case FIRMWARE_ASSERT_IND:
...@@ -333,7 +334,14 @@ int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num) ...@@ -333,7 +334,14 @@ int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num)
(struct rsi_91x_sdiodev *)adapter->rsi_dev; (struct rsi_91x_sdiodev *)adapter->rsi_dev;
u8 buf_status = 0; u8 buf_status = 0;
int status = 0; int status = 0;
static int counter = 4;
if (!dev->buff_status_updated && counter) {
counter--;
goto out;
}
dev->buff_status_updated = false;
status = rsi_sdio_read_register(common->priv, status = rsi_sdio_read_register(common->priv,
RSI_DEVICE_BUFFER_STATUS_REGISTER, RSI_DEVICE_BUFFER_STATUS_REGISTER,
&buf_status); &buf_status);
...@@ -368,10 +376,16 @@ int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num) ...@@ -368,10 +376,16 @@ int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num)
dev->rx_info.semi_buffer_full = false; dev->rx_info.semi_buffer_full = false;
} }
if (dev->rx_info.mgmt_buffer_full || dev->rx_info.buf_full_counter)
counter = 1;
else
counter = 4;
out:
if ((q_num == MGMT_SOFT_Q) && (dev->rx_info.mgmt_buffer_full)) if ((q_num == MGMT_SOFT_Q) && (dev->rx_info.mgmt_buffer_full))
return QUEUE_FULL; return QUEUE_FULL;
if (dev->rx_info.buffer_full) if ((q_num < MGMT_SOFT_Q) && (dev->rx_info.buffer_full))
return QUEUE_FULL; return QUEUE_FULL;
return QUEUE_NOT_FULL; return QUEUE_NOT_FULL;
......
...@@ -114,6 +114,7 @@ struct rsi_91x_sdiodev { ...@@ -114,6 +114,7 @@ struct rsi_91x_sdiodev {
u8 prev_desc[16]; u8 prev_desc[16];
u16 tx_blk_size; u16 tx_blk_size;
u8 write_fail; u8 write_fail;
bool buff_status_updated;
}; };
void rsi_interrupt_handler(struct rsi_hw *adapter); void rsi_interrupt_handler(struct rsi_hw *adapter);
......
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