net: Copy out also can cmsg data into the end of packet
This has been broken at some point. Just fix it by copying the can frame and the cmsg data into IOB, and fix devif_poll to copy out the full data. The can drivers expect to find the timeout timestamp in the end of the frame. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
parent
313b2cd1ed
commit
ef827e88a7
|
@ -109,8 +109,8 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||
/* Copy the packet data into the device packet buffer and send it */
|
||||
|
||||
int ret = devif_send(dev, pstate->snd_buffer,
|
||||
pstate->snd_buflen, 0);
|
||||
dev->d_len = dev->d_sndlen;
|
||||
pstate->snd_buflen + pstate->pr_msglen, 0);
|
||||
dev->d_len = dev->d_sndlen - pstate->pr_msglen;
|
||||
if (ret <= 0)
|
||||
{
|
||||
pstate->snd_sent = ret;
|
||||
|
@ -122,7 +122,6 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||
{
|
||||
memcpy(dev->d_buf + pstate->snd_buflen, pstate->pr_msgbuf,
|
||||
pstate->pr_msglen);
|
||||
dev->d_sndlen = pstate->snd_buflen + pstate->pr_msglen;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1032,6 +1032,7 @@ static int devif_poll_callback(FAR struct net_driver_s *dev)
|
|||
|
||||
int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
||||
{
|
||||
unsigned len;
|
||||
uint16_t llhdrlen;
|
||||
FAR uint8_t *buf;
|
||||
int bstop;
|
||||
|
@ -1054,7 +1055,8 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
|||
{
|
||||
/* Copy iob to flat buffer */
|
||||
|
||||
iob_copyout(buf, dev->d_iob, dev->d_len, -llhdrlen);
|
||||
len = MAX(dev->d_len, dev->d_sndlen);
|
||||
iob_copyout(buf, dev->d_iob, len, -llhdrlen);
|
||||
|
||||
/* Restore flat buffer pointer */
|
||||
|
||||
|
|
Loading…
Reference in New Issue