From d295b4e1f1d7fc5ea5d65031a68a4455c64d84b0 Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 7 Dec 2022 22:36:56 +0800 Subject: [PATCH] net/devif: Use the device ll header length to calculate send limit Signed-off-by: chao an --- net/devif/devif_cansend.c | 3 +-- net/devif/devif_pktsend.c | 3 +-- net/devif/devif_send.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/net/devif/devif_cansend.c b/net/devif/devif_cansend.c index 753868fe82..5807fdf773 100644 --- a/net/devif/devif_cansend.c +++ b/net/devif/devif_cansend.c @@ -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) { diff --git a/net/devif/devif_pktsend.c b/net/devif/devif_pktsend.c index 8c98699e69..7b3982c81b 100644 --- a/net/devif/devif_pktsend.c +++ b/net/devif/devif_pktsend.c @@ -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) { diff --git a/net/devif/devif_send.c b/net/devif/devif_send.c index 020e843909..bfb963e84c 100644 --- a/net/devif/devif_send.c +++ b/net/devif/devif_send.c @@ -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) {