net: move device buffer define to common header

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2022-10-26 12:35:08 +08:00
committed by hartmannathan
parent 6908b6823c
commit a8d3286258
62 changed files with 185 additions and 444 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
/* Set the offset to the beginning of the UDP data payload */
dev->d_appdata = &dev->d_buf[IPv4UDP_HDRLEN + NET_LL_HDRLEN(dev)];
dev->d_appdata = IPBUF(IPv4UDP_HDRLEN);
}
else
{
@@ -92,7 +92,7 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
/* Set the offset to the beginning of the UDP data payload */
dev->d_appdata = &dev->d_buf[IPv6UDP_HDRLEN + NET_LL_HDRLEN(dev)];
dev->d_appdata = IPBUF(IPv6UDP_HDRLEN);
}
}
#endif
+2 -3
View File
@@ -54,20 +54,19 @@
static int ipfwd_packet_proto(FAR struct net_driver_s *dev)
{
FAR struct ipv6_hdr_s *ipv6;
int llhdrlen = NET_LL_HDRLEN(dev);
/* Make sure the there is something in buffer that is at least as large as
* the IPv6_HDR.
*/
if (dev->d_len > (IPv6_HDRLEN + llhdrlen))
if (dev->d_len > (IPv6_HDRLEN + NET_LL_HDRLEN(dev)))
{
if (dev->d_lltype == NET_LL_IEEE802154 ||
dev->d_lltype == NET_LL_PKTRADIO)
{
/* There should be an IPv6 packet at the beginning of the buffer */
ipv6 = (FAR struct ipv6_hdr_s *)&dev->d_buf[llhdrlen];
ipv6 = IPv6BUF;
if ((ipv6->vtc & IP_VERSION_MASK) == IPv6_VERSION)
{
/* Yes.. return the L2 protocol of the packet */
+1 -1
View File
@@ -376,7 +376,7 @@ int ipv4_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
* d_buf.
*/
ipv4 = (FAR struct ipv4_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)];
ipv4 = IPv4BUF;
/* Send the packet asynchrously on the forwarding device. */
+1 -1
View File
@@ -512,7 +512,7 @@ int ipv6_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
* d_buf.
*/
ipv6 = (FAR struct ipv6_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)];
ipv6 = IPv6BUF;
/* Send the packet asynchrously on the forwarding device. */