net/devif: devif_send supports negative offset

To enable the pkt_sendmsg interface to send packets containing L2 headers

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2024-06-28 18:51:57 +08:00 committed by Alan Carvalho de Assis
parent 4245da43ca
commit d0aa42c2ca
2 changed files with 3 additions and 3 deletions

View File

@ -465,7 +465,7 @@ uint16_t devif_dev_event(FAR struct net_driver_s *dev, uint16_t flags);
****************************************************************************/
int devif_send(FAR struct net_driver_s *dev, FAR const void *buf,
int len, unsigned int offset);
int len, int offset);
/****************************************************************************
* Name: devif_iob_send

View File

@ -67,7 +67,7 @@
****************************************************************************/
int devif_send(FAR struct net_driver_s *dev, FAR const void *buf,
int len, unsigned int offset)
int len, int offset)
{
int ret;
@ -102,7 +102,7 @@ int devif_send(FAR struct net_driver_s *dev, FAR const void *buf,
/* Prepare device buffer before poll callback */
iob_update_pktlen(dev->d_iob, offset, false);
iob_update_pktlen(dev->d_iob, offset < 0 ? 0 : offset, false);
ret = iob_trycopyin(dev->d_iob, buf, len, offset, false);
if (ret != len)