From 58d0c1f22851cb8196e4de3f12f9302c0a969487 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 6 Apr 2017 18:11:04 -0600 Subject: [PATCH] 6loWPAN: Back out part of the last commit. That included two fixes for a problem. One that didn't work and is unnecessary and one that is necessary. The commit removes the former. --- net/sixlowpan/sixlowpan_internal.h | 16 -------- net/sixlowpan/sixlowpan_send.c | 60 ++---------------------------- 2 files changed, 4 insertions(+), 72 deletions(-) diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h index 23bff8ad98..d6a795c554 100644 --- a/net/sixlowpan/sixlowpan_internal.h +++ b/net/sixlowpan/sixlowpan_internal.h @@ -327,22 +327,6 @@ struct ipv6icmp_hdr_s struct icmpv6_iphdr_s icmp; }; -/* IPv6 + TCP or UDP or ICMPv6 header */ - -union ipv6_hdr_u -{ - struct ipv6_hdr_s ipv6; -#ifdef CONFIG_NET_TCP - struct ipv6tcp_hdr_s ipv6tcp; -#endif -#ifdef CONFIG_NET_UDP - struct ipv6udp_hdr_s ipv6udp; -#endif -#ifdef CONFIG_NET_ICMPv6 - struct ipv6icmp_hdr_s ipv6icmp -#endif -}; - /* IEEE802.15.4 Frame Definitions *******************************************/ /* The IEEE 802.15.4 frame has a number of constant/fixed fields that can be * counted to make frame construction and max payload calculations easier. diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index cf15cac28b..8338a41347 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -83,10 +82,10 @@ struct sixlowpan_send_s int s_result; /* The result of the transfer */ uint16_t s_timeout; /* Send timeout in deciseconds */ systime_t s_time; /* Last send time for determining timeout */ + FAR const struct ipv6_hdr_s *s_ipv6hdr; /* IPv6 header, followed by UDP or TCP header. */ FAR const struct rimeaddr_s *s_destmac; /* Destination MAC address */ FAR const void *s_buf; /* Data to send */ size_t s_len; /* Length of data in buf */ - FAR const union ipv6_hdr_u s_ipv6hdr; /* IPv6 header, followed by UDP, TCP, or ICMPv6 header. */ }; /**************************************************************************** @@ -181,8 +180,8 @@ static uint16_t send_interrupt(FAR struct net_driver_s *dev, sinfo->s_result = sixlowpan_queue_frames((FAR struct ieee802154_driver_s *)dev, - &sinfo->s_ipv6hdr.ipv6, sinfo->s_buf, - sinfo->s_len, sinfo->s_destmac); + sinfo->s_ipv6hdr, sinfo->s_buf, sinfo->s_len, + sinfo->s_destmac); flags &= ~WPAN_POLL; neighbor_reachable(dev); @@ -218,56 +217,6 @@ end_wait: return flags; } -/**************************************************************************** - * Name: sixlowpan_ipv6_copy - * - * Description: - * Make a copy of the IPv6 + {TCP, UDP, ICMPv6} header structure. - * - * Input Parameters: - * ipv6hdr - IPv6 header followed by TCP or UDP header. - * sinfo - Send state structure reference - * - * Returned Value: - * None - * - ****************************************************************************/ - -static void sixlowpan_ipv6_copy(FAR const struct ipv6_hdr_s *ipv6hdr, - FAR struct sixlowpan_send_s *sinfo) -{ - size_t structsize; - - switch (ipv6hdr->proto) - { -#ifdef CONFIG_NET_TCP - case IP_PROTO_TCP: - structsize = sizeof(struct ipv6tcp_hdr_s); - break; -#endif - -#ifdef CONFIG_NET_UDP - case IP_PROTO_UDP: - structsize = sizeof(struct ipv6udp_hdr_s); - break; -#endif - -#ifdef CONFIG_NET_ICMPv6 - case IP_PROTO_ICMP6: - structsize = sizeof(struct ipv6icmp_hdr_s); - break; -#endif - - default: - nwarn("WARNING: Unrecognized proto: %u\n", ipv6hdr->proto); - structsize = sizeof(struct ipv6_hdr_s); - break; - } - - memcpy((FAR void *)&sinfo->s_ipv6hdr, (FAR const void *)ipv6hdr, - structsize); -} - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -322,12 +271,11 @@ int sixlowpan_send(FAR struct net_driver_s *dev, sinfo.s_result = -EBUSY; sinfo.s_timeout = timeout; sinfo.s_time = clock_systimer(); + sinfo.s_ipv6hdr = ipv6hdr; sinfo.s_destmac = destmac; sinfo.s_buf = buf; sinfo.s_len = len; - sixlowpan_ipv6_copy(ipv6hdr, &sinfo); - net_lock(); if (len > 0) {