Commit Graph

225 Commits

Author SHA1 Message Date
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Xiang Xiao
5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
chao.an
a4aa8ae491 wqueue/notifier: update the work notifier usage
usage changed after commit 90c52e6f8f7efce97ac718c0f98addc13ec880d2

Change-Id: Ifb0d739b046a6794b5b3ac177f489fb9a1c5c799
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-21 14:16:19 +08:00
chao.an
97bead5496 net: complement wireless handling as ethernet
Change-Id: I13cc4cbfc1e305e17c0630f11a1173afe96e8a03
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-11 08:04:18 -03:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt
4ae09a3b80 net/netlink: Redesign the logic that handles notifications of when response data is available. Signal handlers are sub-optimal inside the OS (especially after the preceding change which forces the hand). Instead, use the work queue notifiers as is done with all other network notifiers. 2019-11-28 14:20:40 -06:00
Gregory Nutt
bda0a9c6a7 net/netlink: Fix offset in rtattr. include/net/route.h: Correct form and naming of sruct rtentry. include/netpacket/netlink.h: Add some definitions that will be needed to access routing tables. 2019-11-10 12:35:15 -06:00
Gregory Nutt
3b275fcf4e net/: Run nxstyle against all C files. 2019-10-25 11:31:42 -06:00
Xiang Xiao
6c484847d5 net/: Decouple autoconfig and icmpv6 socket to avoid the invalid kconfig combination. 2019-09-20 12:45:05 -06:00
Gregory Nutt
27e4bfffd4 Update some comments and README files. 2019-08-24 13:06:43 -06:00
Gregory Nutt
1346f29151 net/: Fix alignment and spacing problems found by tools/nxstyle. 2019-07-02 18:02:23 -06:00
anchao
c9b73f5139 net/icmp and icmpv6: Bind icmp callback from device to connection. Resolves the issue that bind() could not be called before send() 2019-03-19 09:43:32 -06:00
Gregory Nutt
f6b00e1966 tools/nxstyle.c: Fix logic error that prevent detecion of '/' and '/=' as operators. net/: Minor updates resulting from testing tools/nxstyle. 2019-03-11 12:48:39 -06:00
Gregory Nutt
efe65749ce Fix condition logic: The setup seems to support a network without sockets. That is not the case.
Squashed commit of the following:

    sched/sched/sched_getsockets.c:  Fix an error in conditional compilation.
    fs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NSOCKET_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    syscall/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    tools/:  Fixups for CONFIG_NSOCKET_DESCRIPTORS no longer used to disable sockets.
2019-02-11 15:47:25 -06:00
Gregory Nutt
732bef73a7 include/net/if.h: Fix some macro definitions overlooked in commit d105dc9b5e. Also corrects the name of a structure: mii_ioctl_notify_s vs mii_iotcl_notify_s. 2019-01-27 16:43:42 -06:00
Xiang Xiao
fe421022e2 sched/wqueue/kwork_notifier.c and several Kconfig files: Notifier should work with either lpwork or hpwork and other minor typo fix. 2019-01-27 11:02:56 -06:00
Xiang Xiao
71e1056e6d net/icmpv6, neighbor, and netdev: Rename netdev_dev_lladdrsize() to netdev_lladdrsize() and move the prototype to include/nuttx/nex/netdev.h, giving is global scope within the OS. Reviewer: This degrades the integrity of the modular architecture by introducing a new coupling via C function call. Not a good thing at all. 2018-11-09 16:05:11 -06:00
Gregory Nutt
b93c3c13c4 net/: Fix some compile errors introduce with recent networking patches. Found in build testing. 2018-11-09 14:25:44 -06:00
Xiang Xiao
eb31dc69ac net/: Remove the unnecessary arp.h inclusion 2018-11-09 14:01:12 -06:00
Gregory Nutt
5b7ef856a0 Squashed commit of the following:
net/mld:  The MLD logic now compiles and is much less toxic.  It still is not a proper MLD implementation:  (1) It is basically a port of IGMP, tweaked to work with IPv6 and ICMPv6 MLD messages, (2) it needs a proper analysis and comparison with RFC 3810, and (3) it is completely untested.  For this reason, it will remain EXPERIMENTAL for some time.
    net/mld:  Add some missing macros, more fixes related to IPv6 vs IPv4 types,
    net/mld:  More compilation cleaning.  Most fixups for IPv6 vs IPv4 types.
    net/mld:  Hook crudely converted .c files into build system and resolve a few of the many, many compilation/design problems.
    net/mld:  Add support for MLD statistics.
    net/mld:  Hook in MLD poll and packet transmission logic.
    net/mld:  Change references to IPv4 definitions to IPv6 definitions; Remove mld_input() since MLD piggybacks on ICMPv6 input.  Add functions to catch MLD messages dispatched by ICMPv6 input logic.
    net/mld:  As a starting point, copy all net/igmp/*.c files to net/mld/. and change all occurrences of igmp (or IGMP) to mld (or MLD).
    net/mld:  More compilation cleaning.  Most fixups for IPv6 vs IPv4 types.
    net/mld:  Hook crudely converted .c files into build system and resolve a few of the many, many compilation/design problems.
    net/mld:  Add support for MLD statistics.
    net/mld:  Hook in MLD poll and packet transmission logic.
    net/mld:  Change references to IPv4 definitions to IPv6 definitions; Remove mld_input() since MLD piggybacks on ICMPv6 input.  Add functions to catch MLD messages dispatched by ICMPv6 input logic.
    net/mld:  As a starting point, copy all net/igmp/*.c files to net/mld/. and change all occurrences of igmp (or IGMP) to mld (or MLD).
2018-11-01 15:19:47 -06:00
Gregory Nutt
6d93658ff8 Add new configuratin CONFIG_NET_MCASTGROUP. This option is selected automatically if either CONFIG_NET_IGMP or CONFIG_NET_MLD are selected. Most conditional logic based on CONFIG_NET_IGMP replaced with conditioning on CONFIG_NET_MCASTGROUP. 2018-10-31 15:03:51 -06:00
Gregory Nutt
dcb7ce8afd tools/nxstyle.c: Add logic to catch another formatting error and to eliminate some false alarms. Includes cosmetic changes to several files ... mostly as a result of testing nxstyle and finding issues. 2018-10-29 16:25:57 -06:00
Gregory Nutt
7d2b250cbc net/netdev: All utility functions that lookup network devices should begin with netdev_findby_. Also correct some comments and the name of a formal parameter. 2018-10-29 12:21:22 -06:00
Gregory Nutt
9f754ed1dc include/sys/sockio.h, net/netdev/netdev_ioctl.c: Fix a compile error introducted with commit 34db6d1433. That commit added the semi-standard ip_msfilter structure to netinet/in.h. Howver, there was a non-standard version of that structure in sys/sockio.h. This commit removes the non-standard version of struct ip_msfilter and adapts the IOCTL and device lookup logic in net/netdev to work with the new, semi-standard version in netinet/in.h. 2018-10-29 06:50:47 -06:00
Gregory Nutt
8c4cefdd10 Fix some new warndings found in build testing. 2018-09-15 13:22:45 -06:00
Gregory Nutt
11a635dcb3 mm/iob: IOB free notifier should accept the work queue ID as a paramter. The notification may need to run on either the high- or low- priority work queue. sched/work: Change the default priority of the low-priority work queue to 100. 2018-09-11 08:49:39 -06:00
Gregory Nutt
af0ee3c8f7 sched/wqueue: Add an option to work queue notifier so that the notification can occur on different work queues. 2018-09-11 07:22:23 -06:00
Gregory Nutt
9d3148406c Signals were not a good choice of IPC to implement the poll function for several reasons: In order to handle the asynchrnous poll-related event, a substantial amount of state information is needed. Signals are only capable of passing minimal amounts of data. There are also complexities with performing kernel space signal handlers in kernel space code that is better to avoid. So, instead of signals, the equivalent logic was converted to run via a callback that executes on the high-priority work queue.
Squashed commit of the following:

    Fix up some final compile isses.

    net/netdev:  Convert the network down notification logic to use the new wqueue-based notification factility.

    net/udp:  Convert the UDP readahead notification logic to use the new wqueue-based notification factility.

    net/tcp:  Convert the TCP readahead notification logic to use the new wqueue-based notification factility.

    mm/iob:  Convert the IOB notification logic to use the new wqueue-based notification factility.

    sched/wqueue:  Signals are not good IPCs to support the target poll functionality for several reasons including the amount of data that can be passed with a signal and in the fact that in protected and kernel modes, user threads executing signal handlers in protected, kernel memory is problematic.  Instead, convert the same logic to perform the notifications via function callback on the high priority work queue.
2018-09-09 15:01:44 -06:00
Gregory Nutt
20814acad2 sched/signal: In signal notification facility, use sigqueue() to notify vs. kill(). With sigqueue, we can pass more info (but still not enough). 2018-09-09 11:57:25 -06:00
Gregory Nutt
32e3e51678 net/netdev: Add signal notification for the case where the network goes down. 2018-09-09 10:39:25 -06:00
dongjianli
b48804cfc2 net/netdev/netdev_ioctl.c: Add si_ioctl callback and net_ioctl_arglen so usrsock could forward the ioctl to the remote end 2018-08-26 14:54:26 -06:00
Xiang Xiao
fd1405d976 netdev_findby_ipv[4|6]addr return netdev_default() as last resort but don't return loopback device if another network device is in the UP state. 2018-08-26 14:40:47 -06:00
Gregory Nutt
3bf96c8e7e net/arp: Improve arp_find() commit 9774d35010 to reduce the amount and frequency of data copies. 2018-08-25 07:12:21 -06:00
Gregory Nutt
9774d35010 net/arp: Make the function arp_find() thread-safe. It now returns a copy of the ARP table entry, rather than a potentially unstable reference to the ARP table entry. 2018-08-24 17:36:08 -06:00
Gregory Nutt
4b92f71a82 net/netdev/netdev_register.c: Eliminate a newly introduced warning. 2018-08-14 13:54:10 -06:00
Gregory Nutt
b00a2e5c54 net/: Change order of logic: Select the user-defined interface name format BEFORE determining the minor device number. Otherwise, the devault interface name will be used. 2018-08-14 08:40:06 -06:00
Gregory Nutt
4a724b1f3c net/: Remove all references to CONFIG_NET_USER_DEVFMT. That feature is now unconditionally enabled. This was done because (1) the feature does not require very much additional memory, and (2) it causes confusion in the configuration due to the additional complexity. And network drivers that fail to zero the device structure interface name field (d_ifname) because calling netdev_register() will, however, get a nasty surprise. 2018-08-14 08:01:52 -06:00
Gregory Nutt
22cd0d47fa This commit attempts remove some long standard confusion in naming and some actual problems that result from the naming confusion. The basic problem is the standard MTU does not include the size of the Ethernet header. For clarity, I changed the naming of most things called MTU to PKTSIZE. For example, CONFIG_NET_ETH_MTU is now CONFIG_NET_ETH_PKTSIZE.
This makes the user interface a little hostile.  People thing of an MTU of 1500 bytes, but the corresponding packet is really 1514 bytes (including the 14 byte Ethernet header).  A more friendly solution would configure the MTU (as before), but then derive the packet buffer size by adding the MAC header length.  Instead, we define the packet buffer size then derive the MTU.

The MTU is not common currency in networking.  On the wire, the only real issue is the MSS which is derived from MTU by subtracting the IP header and TCP header sizes (for the case of TCP).  Now it is derived for the PKTSIZE by subtracting the IP header, the TCP header, and the MAC header sizes.  So we should be all good and without the recurring 14 byte error in MTU's and MSS's.

Squashed commit of the following:

    Trivial update to fix some spacing issues.
    net/: Rename several macros containing _MTU to _PKTSIZE.
    net/: Rename CONFIG_NET_SLIP_MTU to CONFIG_NET_SLIP_PKTSIZE and similarly for CONFIG_NET_TUN_MTU.  These are not the MTU which does not include the size of the link layer header.  These are the full size of the packet buffer memory (minus any GUARD bytes).
    net/: Rename CONFIG_NET_6LOWPAN_MTU to CONFIG_NET_6LOWPAN_PKTSIZE and similarly for CONFIG_NET_TUN_MTU.  These are not the MTU which does not include the size of the link layer header.  These are the full size of the packet buffer memory (minus any GUARD bytes).
    net/: Rename CONFIG_NET_ETH_MTU to CONFIG_NET_ETH_PKTSIZE.  This is not the MTU which does not include the size of the link layer header.  This is the full size of the packet buffer memory (minus any GUARD bytes).
    net/: Rename the file d_mtu in the network driver structure to d_pktsize.  That value saved there is not the MTU.  The packetsize is the memory large enough to hold the maximum packet PLUS the size of the link layer header.  The MTU does not include the link layer header.
2018-07-04 14:10:40 -06:00
Gregory Nutt
e59b26370d Squashed commit of the following:
Fix a few typo/compilation problems.
    net/:  Remove all CONFIG_NET_xxx_TCP_RECVWNDO configuration variables.  They were used only to initialize the d_recwndo of the network device structure which no longer exists.
    net/:  Remove the device TCP receive window field (d_recvwndo) from the device structure.  That value is no longer retained, but is calculated dynamically.
    Remove some dangling references to CONFIG_NET_TCP_RWND_CONTROL.
    net/tcp:  Take read-ahead throttling into account when calculating the TCP receive window size.
    net/tcp: tcp_get_recvwindow() now returns the receive window size directly (vs. indirectly via the device structure).
    net/tcp:  Remove CONFIG_NET_TCP_RWND_CONTROL.  TCP window algorithm is now trigged only by CONFIG_NET_TCP_READAHEAD.
2018-07-01 07:59:33 -06:00
Gregory Nutt
bdb73a60ca Fix some errors found in build testing. 2018-06-25 17:06:29 -06:00
Gregory Nutt
c439b93627 net/procfs and netdev: Fix some problems with ifconfig introduced with last changes. Also picks up one of Sebastien's changes that did not make it it before. net/udp: Fixes a DEBUGASSERT. 2018-06-25 17:06:11 -06:00
Gregory Nutt
2a29fe0223 net/netdev: Fix.. Too many calls to net_unlock() 2018-06-25 14:21:33 -06:00
Gregory Nutt
5a0cf3c9a8 net/netdev: Add an algorithm to prevent an interface index from being reused until all network interfaces have by assigned once. The prevents removable devices from being removed, unregistered and re-installed, re-registered and keeping the same interface index. 2018-06-25 12:57:42 -06:00
Gregory Nutt
c65e1aa3df Squashed commit of the following:
syscalls/:  Add syscall support for if_nametoindex() and if_indextoname()
    net/: Update some comments.
2018-06-25 12:41:28 -06:00
Gregory Nutt
7c1394d814 Squashed commit of the following:
net/netdev:  Add implementation of if_nametoindex() and if indextoname().
    net/pkt:  Raw AF_PACKET sockets now depend on CONFIG_NETDEV_IFINDEX.
    net/procfs:  Tweak to handle traversal of interfaces if CONFIG_NETDEV_IFINDEX is not defined.
    net/netdev.h:  Update netdev_findbyaddr() to use the assigned device index.
    Trivial typo fix
    net/netdev:  Add support for assigned an interface index to a device when it is regisgtered.
2018-06-25 12:08:10 -06:00
Gregory Nutt
a0e169ad7b net/: Fix a sixlowpan typo bug recently introduced; Rename g_ipv6_allzeroaddre with the more meaning g_ipv6_unspecaddr since the all-zero address is the IPv6 unspecified address (sometime IN6_ADDR_ANY). Remove more inline tests for IPv6 multicast with tcommint net_is_addr_mcast() macro. Update some comments. 2018-06-23 12:53:27 -06:00
Gregory Nutt
5bb216fb90 net/: There are many different checks for IPv6 multicast addresses. Most of the checks are different. RFC 3513 clearly specifies how to detect an IPv6 multilcast address: they should begin with 0xffxx. I did not change some of the checks in ipv6_input.c, however. In that file, the comments indicate that the code should only pick of certain mulicast address that begin withi 0xff02. 2018-06-23 10:13:38 -06:00
Gregory Nutt
fd844f8eac include/nuttx/wireless/bluetooth: Move Bluetooth header files from include/nuttx/wireless to include/nuttx/wireless/bluetooth for symmetry with other wireless technologies. 2018-04-29 12:43:09 -06:00