1.Consolidate absolute to relative timeout conversion into one place(_net_timedwait)
2.Drive the wait timeout logic by net_timedwait instead of devif_timer
This patch help us remove devif_timer(period tick) to save the power in the future.
Change-Id: I534748a5d767ca6da8a7843c3c2f993ed9ea77d4
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Author: Gregory Nutt <gnutt@nuttx.org>
Run all .h and .c files modified in last PR through nxstyle.
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Net cleanup (#17)
* Fix the semaphore usage issue found in tcp/udp
1. The count semaphore need disable priority inheritance
2. Loop again if net_lockedwait return -EINTR
3. Call nxsem_trywait to avoid the race condition
4. Call nxsem_post instead of sem_post
* Put the work notifier into free list to avoid the heap fragment in the long run. Since the allocation strategy is encapsulated internally, we can even refine the implementation later.
* Network stack shouldn't allocate memory in the poll implementation to avoid the heap fragment in the long run, other modification include:
1. Select MM_IOB automatically since ICMP[v6] socket can't work without the read ahead buffer
2. Remove the net lock since xxx_callback_free already do the same thing
3. TCP/UDP poll should work even the read ahead buffer isn't enabled at all
* Add NET_ prefix for UDP_NOTIFIER and TCP_NOTIFIER option to align with other UDP/TCP option convention
* Remove the unused _SF_[IDLE|ACCEPT|SEND|RECV|MASK] flags since there are code to set/clear these flags, but nobody check them.
Normally it is required that the network be in the "down" state when re-configuring the network interface. This is thought not to be a necessary here because.
1. The ICMPv6 logic here runs with the network locked so there can be no outgoing packets with bad source IP addresses from any asynchronous network activity using the device being reconfigured.
2. Incoming packets depend only upon the MAC filtering. Network drivers do not use the IP address; they filter incoming packets using only the MAC address which is not being changed here.
net/mld: Checksum calculation needs to know the full size of the IPv6 header, including the size of the extension headers. The payload size in the IPv64 header must include the extension headers (not considered part of the header in this case). Fixes a few additional errors in size, endian-ness and checksum calculations. Wireshark now reports the the outgoing Report has a good checksum.
net/mld/mld_query.c: Add a cast to assure that the left shift does not overflow.
include/nuttx/net/ipv6ext.h: Fix some terminology: Hop-by-hop, not Hop-to-hop or Hop2hop.
net/devif/ipv6_input.c and net/icmpv6/icmpv6_input.c: Add logic to skiip over the variable number of IPv6 extension headers that may be present between the IPv6 header and the transport layer header. The extension headers are simply ignored. This is necessary because with MLD, certain incoming messages may have, at a mimimum, a Router Alert Hop-by-hop extension header.
net/inet/ipv6_setsockopt.c: Implement the IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP socket options.
Squashed commit of the following:
net/icmpv6: IPPROT_ICMP6 socket logic now builds without error.
net/icmpv6: Add support for read-ahead and poll(). Initial commit is just cloned from ICMP with the appropriate name changes.
configs/: All defconfig filess that include CONFIG_NET_ICMPv6_SOCKET=y need to select CONFIG_SYSTEM_PING6=y and deselect CONFIG_DISABLE_POLL.
Update NSH documention to show that ping6 is now a built in command.
net/icmpv6: Add icmpv6_sendto.c and icmpv6_recvfrom.c. Initial versions are just clones from icmp/ with appropriate name changes.
net/icmpv6: Clone some ICMP socket logic as the beginning of support for ICMPv6 socket support.
Rename CONFIG_NET_ICMPv6_PING to CONFIG_NET_ICMPv6_SOCKET. Move prototype for icmpv6_ping from include/nuttx/net/icmpv6 to net/icmpv6/icmpv6.h