wireless/bcm43xxx/qspi: try tx after rx fails
1. Try tx after rx fails to avoid gspi_thread busy to try rx 2. Add some delay if alloc frame buffer failed Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
d5ac2be84f
commit
1779433c35
@ -356,7 +356,6 @@ static int bcmf_gspi_thread(int argc, char **argv)
|
|||||||
uint16_t intr_flags;
|
uint16_t intr_flags;
|
||||||
int ret;
|
int ret;
|
||||||
int length;
|
int length;
|
||||||
int wait_count = 0;
|
|
||||||
bool wait_for_event;
|
bool wait_for_event;
|
||||||
bool enter_low_power = false;
|
bool enter_low_power = false;
|
||||||
|
|
||||||
@ -424,7 +423,10 @@ static int bcmf_gspi_thread(int argc, char **argv)
|
|||||||
|
|
||||||
/* If we don't have a frame leave the loop */
|
/* If we don't have a frame leave the loop */
|
||||||
|
|
||||||
if (length == 0) break;
|
if (length == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Read and process frame. This updates gspi->status */
|
/* Read and process frame. This updates gspi->status */
|
||||||
|
|
||||||
@ -436,43 +438,21 @@ static int bcmf_gspi_thread(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wlerr("error reading f2 frame: %d\n", ret);
|
wlwarn("error reading f2 frame: %d\n", ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (wait_for_event)
|
||||||
{
|
{
|
||||||
/* If we don't have anything to read, try sending a packet */
|
/* Send the frame */
|
||||||
|
|
||||||
while ((status & CYW_REG_STATUS_F2_RECEIVE_RDY) == 0)
|
do
|
||||||
{
|
{
|
||||||
/* Oops! no room for a packet. We'll wait a bit to see
|
ret = bcmf_gspi_send_f2_frame(priv);
|
||||||
* if room shows up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
wlinfo(">>>> not ready to receive\n");
|
|
||||||
|
|
||||||
if (++wait_count > 100)
|
|
||||||
{
|
|
||||||
wlerr("Chip cannot receive F2 frame\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No room at the inn for an f2 frame -- wait a bit */
|
|
||||||
|
|
||||||
usleep(10000);
|
|
||||||
|
|
||||||
status = bcmf_gspi_read_reg_32(gspi,
|
status = bcmf_gspi_read_reg_32(gspi,
|
||||||
gspi_f0_bus,
|
gspi_f0_bus, CYW_REG_STATUS);
|
||||||
CYW_REG_STATUS);
|
|
||||||
}
|
}
|
||||||
|
while (ret == OK && (status & CYW_REG_STATUS_F2_RECEIVE_RDY));
|
||||||
/* reset the count for next time */
|
|
||||||
|
|
||||||
wait_count = 0;
|
|
||||||
|
|
||||||
/* We have space, send the frame */
|
|
||||||
|
|
||||||
ret = bcmf_gspi_send_f2_frame(priv);
|
|
||||||
|
|
||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
@ -480,12 +460,13 @@ static int bcmf_gspi_thread(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
|
||||||
if (ret != -ENODATA)
|
if (ret != -ENODATA)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
||||||
wlerr("error sending f2 frame: %d\n", ret);
|
wlerr("error sending f2 frame: %d\n", ret);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
nxsig_usleep(10 * 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +492,10 @@ static int bcmf_gspi_thread(int argc, char **argv)
|
|||||||
&gbus->thread_signal,
|
&gbus->thread_signal,
|
||||||
BCMF_GSPI_LOWPOWER_TIMEOUT_TICK);
|
BCMF_GSPI_LOWPOWER_TIMEOUT_TICK);
|
||||||
|
|
||||||
if (ret == -ETIMEDOUT) enter_low_power = true;
|
if (ret == -ETIMEDOUT)
|
||||||
|
{
|
||||||
|
enter_low_power = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
|
#include <nuttx/signal.h>
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -40,7 +41,7 @@
|
|||||||
#include "bcmf_bdc.h"
|
#include "bcmf_bdc.h"
|
||||||
#include "bcmf_utils.h"
|
#include "bcmf_utils.h"
|
||||||
|
|
||||||
#include "bcmf_netdev.h"
|
#include "bcmf_netdev.h"
|
||||||
|
|
||||||
#include "bcmf_sdio_regs.h"
|
#include "bcmf_sdio_regs.h"
|
||||||
|
|
||||||
@ -327,8 +328,8 @@ int bcmf_gspi_send_f2_frame(FAR struct bcmf_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* TODO handle this case */
|
/* TODO handle this case */
|
||||||
|
|
||||||
wlerr("No credit to send frame\n");
|
wlwarn("No credit to send frame\n");
|
||||||
return -EAGAIN;
|
nxsig_usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nxmutex_lock(&gbus->queue_lock) < 0)
|
if (nxmutex_lock(&gbus->queue_lock) < 0)
|
||||||
|
@ -89,8 +89,7 @@ void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
|
|||||||
|
|
||||||
bcmf_interface_frame_t
|
bcmf_interface_frame_t
|
||||||
*bcmf_interface_allocate_frame(FAR struct bcmf_dev_s *priv,
|
*bcmf_interface_allocate_frame(FAR struct bcmf_dev_s *priv,
|
||||||
bool block,
|
bool block, bool tx)
|
||||||
bool tx)
|
|
||||||
{
|
{
|
||||||
FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *) priv->bus;
|
FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *) priv->bus;
|
||||||
bcmf_interface_frame_t *iframe;
|
bcmf_interface_frame_t *iframe;
|
||||||
@ -122,13 +121,13 @@ bcmf_interface_frame_t
|
|||||||
|
|
||||||
nxmutex_unlock(&ibus->queue_lock);
|
nxmutex_unlock(&ibus->queue_lock);
|
||||||
|
|
||||||
|
nxsig_usleep(10 * 1000);
|
||||||
|
|
||||||
if (!block)
|
if (!block)
|
||||||
{
|
{
|
||||||
wlinfo("No avail buffer\n");
|
wlwarn("No avail buffer\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nxsig_usleep(10 * 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_IEEE80211_BROADCOM_FULLMAC_GSPI)
|
#if defined(CONFIG_IEEE80211_BROADCOM_FULLMAC_GSPI)
|
||||||
|
Loading…
Reference in New Issue
Block a user