net/devif: Use the device ll header length to calculate send limit

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-12-07 22:36:56 +08:00 committed by Xiang Xiao
parent 960b4bb2a7
commit d295b4e1f1
3 changed files with 3 additions and 5 deletions

View File

@ -55,8 +55,7 @@
void devif_can_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len)
{
unsigned int limit = NETDEV_PKTSIZE(dev) -
CONFIG_NET_LL_GUARDSIZE;
unsigned int limit = NETDEV_PKTSIZE(dev) - NET_LL_HDRLEN(dev);
if (dev == NULL || len == 0 || len > limit)
{

View File

@ -55,8 +55,7 @@
void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len)
{
unsigned int limit = NETDEV_PKTSIZE(dev) -
CONFIG_NET_LL_GUARDSIZE;
unsigned int limit = NETDEV_PKTSIZE(dev) - NET_LL_HDRLEN(dev);
if (dev == NULL || len == 0 || len > limit)
{

View File

@ -69,7 +69,7 @@ void devif_send(FAR struct net_driver_s *dev, FAR const void *buf,
int len, unsigned int offset)
{
unsigned int limit = NETDEV_PKTSIZE(dev) -
CONFIG_NET_LL_GUARDSIZE - offset;
NET_LL_HDRLEN(dev) - offset;
if (dev == NULL || len == 0 || len > limit)
{