ieee802154_req_data: Don't modify the IOB until we are certain that no EINTR errors will occur. Otherwise, the retry will fail
This commit is contained in:
parent
192bacbd7f
commit
d9f549121c
|
@ -460,8 +460,7 @@ Configurations
|
|||
|
||||
telnetd_daemon: ERROR: socket failure: 106
|
||||
|
||||
2017-06-20: I am get EINTR errors from the MAC layer when trying the
|
||||
udpclient tries to send messages. Still under investigation.
|
||||
2017-06-20: Debug underway.. not yet functional.
|
||||
|
||||
nsh:
|
||||
|
||||
|
|
|
@ -444,6 +444,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
|||
|
||||
/* Add the first frame to the IOB queue */
|
||||
|
||||
ninfo("Queuing frame io_len=%u io_offset=%u\n",
|
||||
iob->io_len, iob->io_offset);
|
||||
|
||||
qhead = iob;
|
||||
qtail = iob;
|
||||
|
||||
|
@ -522,6 +525,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
|||
|
||||
/* Add the next frame to the tail of the IOB queue */
|
||||
|
||||
ninfo("Queuing frame io_len=%u io_offset=%u\n",
|
||||
iob->io_len, iob->io_offset);
|
||||
|
||||
qtail->io_flink = iob;
|
||||
qtail = iob;
|
||||
|
||||
|
@ -544,6 +550,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
|||
|
||||
/* And submit the frame to the MAC */
|
||||
|
||||
ninfo("Submitting framelist\n");
|
||||
ret = sixlowpan_frame_submit(ieee, &meta, iob);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -580,6 +587,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
|||
|
||||
/* And submit the frame to the MAC */
|
||||
|
||||
ninfo("Submitting frame length=%u io_offset=%u\n",
|
||||
iob->io_len, iob->io_offset);
|
||||
|
||||
ret = sixlowpan_frame_submit(ieee, &meta, iob);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
@ -82,12 +82,15 @@ int mac802154_req_data(MACHANDLE mac,
|
|||
uint8_t mhr_len = 3;
|
||||
int ret;
|
||||
|
||||
wlinfo("Received frame io_len=%u io_offset=%u\n",
|
||||
frame->io_offset, frame->io_len);
|
||||
|
||||
/* Check the required frame size */
|
||||
|
||||
if (frame->io_len > IEEE802154_MAX_PHY_PACKET_SIZE)
|
||||
{
|
||||
return -E2BIG;
|
||||
}
|
||||
{
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
/* Cast the first two bytes of the IOB to a uint16_t frame control field */
|
||||
|
||||
|
@ -226,10 +229,9 @@ int mac802154_req_data(MACHANDLE mac,
|
|||
* here that created the header
|
||||
*/
|
||||
|
||||
wlinfo("mhr_len=%u\n", mhr_len);
|
||||
DEBUGASSERT(mhr_len == frame->io_offset);
|
||||
|
||||
frame->io_offset = 0; /* Set the offset to 0 to include the header */
|
||||
|
||||
/* Allocate the txdesc, waiting if necessary, allow interruptions */
|
||||
|
||||
ret = mac802154_txdesc_alloc(priv, &txdesc, true);
|
||||
|
@ -243,6 +245,16 @@ int mac802154_req_data(MACHANDLE mac,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Set the offset to 0 to include the header ( we do not want to
|
||||
* modify the frame until AFTER the last place that -EINTR could
|
||||
* be returned and could generate a retry. Subsequent error returns
|
||||
* are fatal and no retry should occur.
|
||||
*/
|
||||
|
||||
frame->io_offset = 0;
|
||||
|
||||
/* Then initialize the TX descriptor */
|
||||
|
||||
txdesc->conf->handle = meta->msdu_handle;
|
||||
txdesc->frame = frame;
|
||||
txdesc->frametype = IEEE802154_FRAME_DATA;
|
||||
|
@ -269,7 +281,7 @@ int mac802154_req_data(MACHANDLE mac,
|
|||
*/
|
||||
|
||||
ret = -ENOTSUP;
|
||||
goto errout_with_sem;
|
||||
goto errout_with_txdesc;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -306,7 +318,7 @@ int mac802154_req_data(MACHANDLE mac,
|
|||
else
|
||||
{
|
||||
ret = -EINVAL;
|
||||
goto errout_with_sem;
|
||||
goto errout_with_txdesc;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -327,6 +339,9 @@ int mac802154_req_data(MACHANDLE mac,
|
|||
|
||||
return OK;
|
||||
|
||||
errout_with_txdesc:
|
||||
/* REVISIT: Free TX descriptor, but preserve the IOB. */
|
||||
|
||||
errout_with_sem:
|
||||
mac802154_givesem(&priv->exclsem);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue