Spirit: Increase number of retries if there is no acknowledgement; Add interrupt handling for the case where the max number of retries expires. Fix some badly implemented queue management code. With these changes the basic UDP and TCP tests work.

This commit is contained in:
Gregory Nutt 2017-08-04 15:20:10 -06:00
parent 8027d1bf18
commit 5d96385c52
2 changed files with 40 additions and 32 deletions

View File

@ -376,27 +376,21 @@ Configuration sub-directories
issues with address filtering, CRC calculation, and data integrity
(like bad UDP checksums). Lot's more to be done!
2017-08-04: Corrected the length width field being set to narrow.
The length 90 (0x5a) was being truncated to 26 (0x1a). I thought
that this would correct the checksum problem, but it does not.
It is still necessary to run with CRC disabled.
Fixed some of the address filtering issues: In Basic packets,
need to force the Spirit to send the destination address. This
fixes address filtering. But...
2017-08-04: Fixed some of the address filtering issues: In Basic
packets, need to force the Spirit to send the destination address.
This fixes address filtering. But...
Converted to STack vs Basic packets. We need to do this because
the Basic packets do not provide the source node address. Now
correctly gets the source node address and uncompresses the source
IP address.
With these changes, the UDP test is now fully functional.
In addition, to avoid packet loss due to data overrun, I enabled
the AutoAck, TX retries, the RX timeout options.
There are issues with the TCP test. This appears to be data loss:
The TCP client sends 18 packets, but the server only receives 5. I
assume that this because of data overrun. I enabled the AutoAck,
TX retries, the RX timeout options. This seems to reduce the packet
loss but the TCP test still does not fun perfectly.
With these changes (along with other, significant bugfixes), both
the UDP test is now fully functional. CRC filtering still must be
disabled.
Test Matrix:
The following configurations have been tested successfully (with
@ -405,10 +399,8 @@ Configuration sub-directories
TEST DATE
COMPRESSION UDP TCP Telnet
----------- ----- ----- ------
hc06 08/04 --- ---
--- --- ---
hc06 08/04 08/04 --- (CRC disabled)
hc1 --- --- ---
--- --- ---
ipv6 --- --- ---
----------- ----- ----- ------

View File

@ -317,7 +317,7 @@ static const struct spirit_pktstack_llp_s g_llp_init =
{
S_ENABLE, /* autoack */
S_DISABLE, /* piggyback */
PKT_N_RETX_3 /* maxretx */
PKT_N_RETX_10 /* maxretx */
};
/* GPIO Configuration.
@ -968,9 +968,10 @@ static void spirit_interrupt_work(FAR void *arg)
spirit_schedule_transmit_work(priv);
}
if (irqstatus.IRQ_TX_FIFO_ERROR != 0)
if (irqstatus.IRQ_TX_FIFO_ERROR != 0 ||
irqstatus.IRQ_MAX_RE_TX_REACH != 0)
{
wlwarn("WARNING: Tx FIFO Error\n");
wlwarn("WARNING: Tx FIFO Error/Max retries\n");
DEBUGVERIFY(spirit_command(spirit, COMMAND_FLUSHTXFIFO));
priv->state = DRIVER_STATE_IDLE;
@ -1113,7 +1114,7 @@ static void spirit_interrupt_work(FAR void *arg)
pktmeta->pm_dest.pa_addr[0] =
spirit_pktcommon_get_nodeaddress(spirit);
wlinfo("RX srcaddr=%02 destaddr=%02\n",
wlinfo("RX srcaddr=%02x destaddr=%02x\n",
pktmeta->pm_src.pa_addr[0],
pktmeta->pm_dest.pa_addr[0]);
@ -1121,13 +1122,17 @@ static void spirit_interrupt_work(FAR void *arg)
* completed RX transfers.
*/
pktmeta->pm_flink = priv->rxtail;
priv->rxtail = pktmeta;
if (priv->rxhead == NULL)
pktmeta->pm_flink = NULL;
if (priv->rxtail == NULL)
{
priv->rxhead = pktmeta;
priv->rxhead = pktmeta;
}
else
{
priv->rxtail->pm_flink = pktmeta;
}
priv->rxtail = pktmeta;
/* Forward the packet to the network. This must be done
* on the LP work queue with the network locked.
@ -1926,15 +1931,19 @@ static int spirit_req_data(FAR struct sixlowpan_driver_s *netdev,
sizeof(struct pktradio_addr_s));
pktmeta->pm_iob = iob;
/* Add the IOB container to the queue of outgoing IOBs. */
/* Add the IOB container to tail of the queue of outgoing IOBs. */
pktmeta->pm_flink = priv->txtail;
priv->txtail = pktmeta;
if (priv->txhead == NULL)
pktmeta->pm_flink = NULL;
if (priv->txtail == NULL)
{
priv->txhead = pktmeta;
priv->txhead = pktmeta;
}
else
{
priv->txtail->pm_flink = pktmeta;
}
priv->txtail = pktmeta;
/* If there are no transmissions or receptions in progress, then start
* tranmission of the frame in the IOB at the head of the IOB queue.
@ -2142,6 +2151,13 @@ int spirit_hw_initialize(FAR struct spirit_driver_s *priv,
return ret;
}
ret = spirit_irq_enable(spirit, MAX_RE_TX_REACH, S_ENABLE);
if (ret < 0)
{
wlerr("ERROR: Enable MAX_RE_TX_REACH failed: %d\n", ret);
return ret;
}
ret = spirit_irq_enable(spirit, TX_FIFO_ERROR, S_ENABLE);
if (ret < 0)
{