[drviers/net/ftmac100] receive: process all available RX descriptors

Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
This commit is contained in:
Anton D. Kachalov 2015-07-31 08:48:13 +03:00
parent cbd4586cad
commit 7613d97a90
1 changed files with 40 additions and 36 deletions

View File

@ -626,13 +626,20 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv)
FAR struct ftmac100_rxdes_s *rxdes;
FAR uint8_t *data;
uint32_t len;
int found;
do
{
found = false;
rxdes = ftmac100_current_rxdes(priv);
while (!(rxdes->rxdes0 & FTMAC100_RXDES0_RXDMA_OWN))
{
if (rxdes->rxdes0 & FTMAC100_RXDES0_FRS)
goto found_segment;
{
found = true;
break;
}
/* Clear status bits */
@ -642,21 +649,19 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv)
rxdes = ftmac100_current_rxdes(priv);
}
ndbg("\nNOT FOUND\nCurrent RX %d rxdes0=%08x\n",
if (!found)
{
nvdbg("\nNOT FOUND\nCurrent RX %d rxdes0=%08x\n",
priv->rx_pointer, rxdes->rxdes0);
return;
found_segment:
}
len = FTMAC100_RXDES0_RFL(rxdes->rxdes0);
data = (uint8_t *)rxdes->rxdes2;
ndbg ("RX buffer %d (%08x), %x received (%d)\n",
nvdbg ("RX buffer %d (%08x), %x received (%d)\n",
priv->rx_pointer, data, len, (rxdes->rxdes0 & FTMAC100_RXDES0_LRS));
do
{
/* Check for errors and update statistics */
/* Check if the packet is a valid size for the uIP buffer configuration */
@ -768,14 +773,13 @@ found_segment:
}
}
#endif
}
while (0); /* While there are more packets to be processed */
priv->rx_pointer = (priv->rx_pointer + 1) & (CONFIG_FTMAC100_RX_DESC - 1);
rxdes->rxdes1 &= FTMAC100_RXDES1_EDORR;
rxdes->rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE(RX_BUF_SIZE);
rxdes->rxdes0 |= FTMAC100_RXDES0_RXDMA_OWN;
}
while (true); /* While there are more packets to be processed */
}
/****************************************************************************