Commit Graph

200 Commits

Author SHA1 Message Date
Gregory Nutt 57bc329aac Run nxstyle all .c and .h files modified by PR. 2020-05-17 14:01:00 -03:00
Gregory Nutt a569006fd8 sched/: Make more naming consistent
Rename various functions per the quidelines of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    nxsem_setprotocol -> nxsem_set_protocol
    nxsem_getprotocol -> nxsem_get_protocol
    nxsem_getvalue -> nxsem_get_value
2020-05-17 14:01:00 -03:00
Gregory Nutt 759d8c1bfa Run nxstyle against files modified in previous commit. 2020-04-13 02:09:34 +08:00
Gregory Nutt ca2b0a3657 Fix more warnings noted in PR checks
arp/arp_notify.c:132:43: warning: for loop has empty body [-Wempty-body]
           prev = curr, curr = curr->nt_flink);
                                              ^

    sixlowpan/sixlowpan_tcpsend.c:806:31: warning: implicit conversion from 'unsigned int' to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Wconstant-conversion]
                                  _SO_TIMEOUT(psock->s_sndtimeo));
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Numerous warnings like:

    ieee802154_getreq.c:93:3: warning: implicit declaration of function 'memcpy' is invalid in C99 [-Wimplicit-function-declaration]
      IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr);
      ^

    nxfonts/nxfonts_cache.c:839:35: warning: for loop has empty body [-Wempty-body]
               fcache = fcache->flink);

    bluetooth/bluetooth_finddev.c💯11: warning: implicit declaration of function 'memcmp' is invalid in C99 [-Wimplicit-function-declaration]
          if (BLUETOOTH_ADDRCMP(dev->d_mac.radio.nv_addr, match->bf_addr))
              ^

    rwbuffer.c:559:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      if (rwb->rhmaxblocks > 0 && rwb->rhnblocks > 0)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-04-13 02:09:34 +08:00
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
patacongo 51cbc85535 net/: Run current nxstyle against all .c files under net/. Correct new problems identified by nxstyle. This is primarily a verification of the nxstyle changes (which all look good). (#89)
Co-authored-by: Gregory Nutt <gnutt@nuttx.org>
2020-01-12 21:17:29 +01:00
Gregory Nutt 98f431d8d8 net/: Run all .c files under net/ through tools/nxstyle and fix all resulting complaints. 2020-01-11 13:41:33 -03:00
Xiang Xiao 5c5c08efcd network: simplify the timeout process logic
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>
2020-01-11 08:24:49 -06:00
Gregory Nutt afc2bffb7d net/icmpv6/icmpv6_netpoll.c: Fix two warnings found in build testing
Description:

Fix two warnings found in build testing: (1) Need to include nuttx/semaphore.h
from prototype of nxsem_post() and (2) need to initialize return value of function.
Uninittialized garbage was being returned on success.Fix two warnings found in
build testing: (1) Need to include nuttx/semaphore.h from prototype of
nxsem_post() and (2) need to initialize return value of function.
Uninittialized garbage was being returned on success.
2020-01-07 18:49:55 -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
Xiang Xiao 90c52e6f8f Squashed commit of the following:
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.
2019-12-31 09:26:14 -06:00
Nathan Hartman 9655730ef8 Fix various typos and spelling errors. 2019-12-12 07:41:51 -06:00
Xiang Xiao e1e192fc33 net/: icmp[v6] fix ping[6] complain 'WARNING: Received after timeout'. The root cause is that icmp[v6]_pollsetup monitors ICMP[v6]_NEWDATA, but icmp[v6]_input reports ICMP[v6]_ECHOREPLY. This change lets icmp[v6]_input report report ICMP[v6]_NEWDATA to fix this issue and remove ICMP[v6]_ECHOREPLY to avoid the wrong usage in the future. 2019-11-27 08:09:51 -06:00
Xiang Xiao 250bde034d net/: icmp[v6]_pollsetup should always return POLLWRNORM if the caller requests it since ICMP[v6] doesn't utilize IOB buffer for sending and always needs to wait for an ICMP[v6]_POLL. 2019-11-27 08:04:14 -06:00
Xiang Xiao 1905e01fda net/: ICMP/ICMPv6/TCP/UDP poll shouldn't set POLLHUP and POLLOUT at the same time the standard require that only report POLLHUP:
https://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html.
2019-11-25 09:59:50 -06:00
Xiang Xiao 34ec7c97eb net/icmp/icmp_netpoll.c and icmpv6/icmpv6_netpoll.c: ICMP/ICMPv6 should always report POLLHUP and POLLERR, regardless of requested 'events'. 2019-11-25 09:57:49 -06:00
Gregory Nutt 3b275fcf4e net/: Run nxstyle against all C files. 2019-10-25 11:31:42 -06:00
Bernd Walter 0008ff33b3 net/icmpv6/icmpv6_rnotify.c: Correct a bad index in debug output. 2019-09-25 06:29:02 -06:00
Bernd Walter 338f09acfc drivers/net and net/: Use ntoh() when printing IPv6 addresses so that the addresses appear in friendlier host order vs. network order. 2019-09-24 10:06:42 -06:00
Xiang Xiao 9830791960 net/icmpv6/icmpv6_poll.c: Fix typo error in icmpv6_poll. 2019-09-24 09:28:07 -06:00
Xiang Xiao b4e7ca5aac net/icmpv6/icmpv6_autoconfig.c: cmpv6_autoconfig() error handling must not overwrite overwrite the error code. 2019-09-20 12:51:37 -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 23e1d2e403 Dispatch ICMP_POLL to device's callback list too since icmpv6_neighbor still append the callback into this list. 2019-09-20 07:54:10 -06:00
Gregory Nutt 6266e067e9 net/: Re-order the content of all address-family socket 'connection' structures so that they begin with a comomon prologue. This permits better use of logic for different address family types. 2019-09-01 08:47:01 -06:00
Anthony Merlino 70404ed0dc Merged in antmerlino/nuttx/iobinstrumentation (pull request #1001)
Iobinstrumentation

* mm/iob: Introduces producer/consumer id to every iob call. This is so that the calls can be instrumented to monitor the IOB resources.

* iob instrumentation - Merges producer/consumer enumeration for simpler IOB user.

* fs/procfs: Starts adding support for /proc/iobinfo

* fs/procfs: Finishes first pass of simple IOB user stastics and /proc/iobinfo entry

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-16 22:42:25 +00:00
Bernd Walter 5d01ce6c58 net/icmpv6/icmpv6_autoconfig.c: Use ntohs() to convert IPv6 address from network to host order int network debug output. 2019-07-06 07:02:51 -06:00
Gregory Nutt b49be4bb20 Squashed commit of the following:
arch/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    sched/ audio/ crypto/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    Documentation/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    fs/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    graphics/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    net/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    drivers/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    include/, syscall/, wireless/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    configs/:  Remove all references to CONFIG_DISABLE_POLL.  Standard POSIX poll can no longer be disabled.
2019-05-21 18:57:54 -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 854046a931 /net/devif/ipv6_input.c: Correct handling of IPv6 extension headers. The main confusion was that the payload length in the IPv6 header does not include its extension headers.
net/icmpv6/icmpv6_input.c:  Correct caculation of the ICMPv6 header address
    net/mld/mld_query.c:  Correct back test for group found.
    net/mld/mld_report.c: Fix host vs. network order problem.
    net/mld/mld_send.c: Correct the address used in sending the General Query.  It should be the unspecified address in that case.
    net/mld:  Querying workaround.  The MLD implementation does not follow the RFC correct when it is the Querier.  The Querier should use a general query and get query messages from all members of all groups.  This would be driven by a single timer since all groups are queried at once.  Instead, the design currently uses a Multicast Address Specific Query with one timer per group and ignores groups that we are not members of.
2018-11-10 11:29:02 -06:00
Gregory Nutt 68a115aed9 net/icmpv6/icmpv6_autoconfig.c and icmpv6_rnotify.c: Don't take the network device down when reconfiguring only the IP address from within ICMPv6 logic. Recommended by Xiang Xiao in order to avoid the long delays of bringing some networks back up.
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.
2018-11-10 07:13:54 -06:00
Gregory Nutt 8527fcf4c5 net/icmpv6/icmpv6_input.c: Fix some ICMPv6 introduced with recent changes. 2018-11-09 16:10:19 -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
Xiang Xiao a139b7f9b1 net/arp and icmpv6: Double the delay time on each iteration for ARP/ICMP to fight work jitter better. 2018-11-09 15:55:38 -06:00
Xiang Xiao 4f25b83f8f et/icmpv6: Remove the coupling between ICMPv6 and Ethernet by moving all Ethernet stuff to neighbor_ethernet_out.c and make the mac address as first field. 2018-11-09 15:41:23 -06:00
Xiang Xiao a3cda3867b net/icmpv6/icmpv6_linkipaddr.c: Encapsulate the link scope address generation into icmpv6_linkipaddr() 2018-11-09 15:28:58 -06:00
Xiang Xiao 52021a5300 net/icmpv6/icmpv6_conn.c: icmpv6_free() remove reference count operation since it's already done in icmpv6_close(). 2018-11-09 15:22:25 -06:00
Xiang Xiao 688ccb156a net/icmpv6/icmpv6_neighbor.c: icmpv6_neighbor shouldn't use the out of scope variable(dripaddr) 2018-11-09 15:18:17 -06:00
Xiang Xiao 0a6e234962 net/neighbor: neighbor_lookup() checks if the target IP belongs to one of the local network devices. 2018-11-09 14:14:15 -06:00
Xiang Xiao eb31dc69ac net/: Remove the unnecessary arp.h inclusion 2018-11-09 14:01:12 -06:00
Gregory Nutt 6ca2bcb577 net/icmpv6/icmpv6_input.c: Fix yet another build issue in this file found by build testing. 2018-11-09 11:44:01 -06:00
Xiang Xiao 44bcd2c44d net/: add NET_ICMP[v6]_NO_STACK for usrsock case 2018-11-09 11:25:57 -06:00
Xiang Xiao 26ae4176f0 net/arp and net/icmpv6: don't call d_txavail directly since it may point to NULL 2018-11-09 11:22:58 -06:00
Gregory Nutt 9d2e6cf66a net/icmpv6/icmpv6_input.c: Fix a recently introduced error found in build testing. 2018-11-09 11:08:51 -06:00
Gregory Nutt 9c3e65f15f net/mld: Fix a few compilation problems that cropped up in a different network configuration. Fix a logic error in setting the 'Other Querier Present' timer. Various cosmetic improvements. 2018-11-07 18:21:21 -06:00
Gregory Nutt 02f83334d5 Squashed commit of the following:
net/mld:  Fix a couple of places where I forgot to unlock the network in the previous commit.

    net/mld:  Implement 'Other Querier Present Timer'.  This timer is used to revert to Querier mode if there is no other querier on the network.  Also, fix some naming:  The Done message is not just Version 1 but is used with Version 2 as well.

    net/igmp:  Back out some blind, backported improvements to IGMP from MLD.  There are too many subtle differences in the protocols for this to be safe.
2018-11-07 10:40:30 -06:00
Gregory Nutt 33ed27ae65 Squashed commit of the following:
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.
2018-11-05 08:56:07 -06:00
Gregory Nutt b1a61834d9 net/mld: Review and update all MLD message receipt logic. Also ripple changs that are, hopefully, improvements back to IGMP. 2018-11-04 10:57:21 -06:00