Commit Graph

2314 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
09869e5d41 net/tcp/tcp.h: Remove unused extern g_netdevices 2021-03-30 12:27:50 -05:00
YAMAMOTO Takashi
1c29a2e8e8 net/tcp/tcp_send_buffered.c: Fix non-blocking I/O
My recent changes to buffered tcp send broke this. [1]

One of my local apps using non-blocking tcp is working
again with this fix.

[1]
```
commit 837e1a72a4
Author: YAMAMOTO Takashi <yamamoto@midokura.com>
Date:   Mon Mar 15 16:19:42 2021 +0900

    tcp_send_buffered.c: improve tcp write buffering
```
2021-03-30 01:12:55 -05:00
YAMAMOTO Takashi
271e748ba5 tcp_send_buffered.c: Add a bit more info to an ninfo() 2021-03-30 01:12:55 -05:00
YAMAMOTO Takashi
a2840b6354 tcp_send_buffered.c: Add an assertion 2021-03-30 01:12:55 -05:00
YAMAMOTO Takashi
ef9adcf399 tcp_send_buffered.c: Remove dead code 2021-03-30 01:12:55 -05:00
chao.an
a988437e90 net/dev: check the available address further
check the available address further to avoid obtain unusable device

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-23 06:52:32 -07:00
chao.an
03f899f302 net/usrsock: add send multi-elements support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-23 00:44:37 -07:00
chao.an
9bdf4ccd68 net/arp: add timeout to avoid infinite send wait
add timeout to avoid infinite send wait if the network device is unreachable

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-23 00:28:43 -07:00
YAMAMOTO Takashi
837e1a72a4 tcp_send_buffered.c: improve tcp write buffering
* Send data chunk-by-chunk
  Note: A stream socket doesn't have atomicity requirement.

* Increase the chance to use full-sized segments

Benchmark numbers in my environment:

* Over ESP32 wifi
* The peer is NetBSD, which has traditional delayed ack TCP
* iperf uses 16384 bytes buffer

---

without this patch,
CONFIG_IOB_NBUFFERS=36
CONFIG_IOB_BUFSIZE=196

does not work.
see https://github.com/apache/incubator-nuttx/pull/2772#discussion_r592820639

---

without this patch,
CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_BUFSIZE=196
```
nsh> iperf -c 192.168.8.1
       IP: 192.168.8.103

 mode=tcp-client sip=192.168.8.103:5001,dip=192.168.8.1:5001, interval=3, time=30

        Interval Bandwidth

   0-   3 sec,  4.11 Mbits/sec
   3-   6 sec,  4.63 Mbits/sec
   6-   9 sec,  4.89 Mbits/sec
   9-  12 sec,  4.63 Mbits/sec
  12-  15 sec,  4.85 Mbits/sec
  15-  18 sec,  4.85 Mbits/sec
  18-  21 sec,  5.02 Mbits/sec
  21-  24 sec,  3.67 Mbits/sec
  24-  27 sec,  4.94 Mbits/sec
  27-  30 sec,  4.81 Mbits/sec
   0-  30 sec,  4.64 Mbits/sec
nsh>
```

---

with this patch,
CONFIG_IOB_NBUFFERS=36
CONFIG_IOB_BUFSIZE=196
```
nsh> iperf -c 192.168.8.1
       IP: 192.168.8.103

 mode=tcp-client sip=192.168.8.103:5001,dip=192.168.8.1:5001, interval=3, time=30

        Interval Bandwidth

   0-   3 sec,  5.33 Mbits/sec
   3-   6 sec,  5.59 Mbits/sec
   6-   9 sec,  5.55 Mbits/sec
   9-  12 sec,  5.59 Mbits/sec
  12-  15 sec,  5.59 Mbits/sec
  15-  18 sec,  5.72 Mbits/sec
  18-  21 sec,  5.68 Mbits/sec
  21-  24 sec,  5.29 Mbits/sec
  24-  27 sec,  4.67 Mbits/sec
  27-  30 sec,  4.50 Mbits/sec
   0-  30 sec,  5.35 Mbits/sec
nsh>
```

---

with this patch,
CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_BUFSIZE=196
```
nsh> iperf -c 192.168.8.1
       IP: 192.168.8.103

 mode=tcp-client sip=192.168.8.103:5001,dip=192.168.8.1:5001, interval=3, time=30

        Interval Bandwidth

   0-   3 sec,  5.51 Mbits/sec
   3-   6 sec,  4.67 Mbits/sec
   6-   9 sec,  4.54 Mbits/sec
   9-  12 sec,  5.42 Mbits/sec
  12-  15 sec,  5.37 Mbits/sec
  15-  18 sec,  5.11 Mbits/sec
  18-  21 sec,  5.07 Mbits/sec
  21-  24 sec,  5.29 Mbits/sec
  24-  27 sec,  5.77 Mbits/sec
  27-  30 sec,  4.63 Mbits/sec
   0-  30 sec,  5.14 Mbits/sec
nsh>
```
2021-03-22 01:12:59 -07:00
chao.an
e03218ab71 net/tcp: reset the connection ref count before tcp_free()
reset the connection refcount if SYN retry count has elapsed

Assertion:

up_assert: Assertion failed at file:tcp/tcp_conn.c line: 764 task: netdev_wq

N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-22 10:55:30 +09:00
Nathan Hartman
4653dc14d3 Fix typos (and nxstyle errors)
ReleaseNotes,
arch/arm/src/cxd56xx/cxd56_dmac_common.h,
arch/arm/src/efm32/efm32_dma.h,
arch/arm/src/lpc54xx/lpc54_lcd.c,
arch/arm/src/rp2040/rp2040_dmac.h,
arch/arm/src/stm32/stm32_dma.h,
arch/arm/src/stm32f0l0g0/stm32_dma.h,
arch/arm/src/stm32f7/stm32_dma.h,
arch/arm/src/stm32h7/stm32_dma.h,
arch/arm/src/stm32l4/stm32l4_dma.h,
arch/renesas/src/rx65n/rx65n_dtc.h,
fs/spiffs/src/spiffs_vfs.c,
net/route/cacheroute.h,
net/route/net_cacheroute.c,
net/route/net_foreach_fileroute.c,
net/route/net_foreach_ramroute.c,
net/route/net_foreach_romroute.c, and
net/route/route.h:

    * Fix the following typos:
      - remove spurious "are"
      - "tot he" -> "to the"

arch/arm/src/stm32f0l0g0/stm32_dma.h and
arch/arm/src/stm32l4/stm32l4_dma.h:

    * Fix nxstyle errors.
2021-03-21 21:51:14 +01:00
chao.an
a5613e6008 net/tcp: correct the port byte order
1. unify the byte order to network
2. Do not re-select the port if the local port has been bind()

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-20 09:13:18 -07:00
chao.an
60407c8c8a net/tcp: do not start the tcp monitor if unestablished
Add more sanity checks to avoid TCP moniter start fail if the
TCP handle unestablished, the dup(2) operation should work at any time

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-19 17:23:18 +09:00
Jiuzhu Dong
e96c8b9283 fs: allocate file/socket dynamically
Change-Id: I8aea63eaf0275f47f21fc8d5482b51ffecd5c906
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-17 06:46:42 -07:00
YAMAMOTO Takashi
45098769e7 tcp_sendfile.c: Remove an unused copy of CONFIG_NET_TCP_SPLIT_SIZE 2021-03-15 04:52:58 -07:00
Xiang Xiao
9523d4bea4 net/local: Remove local_send.c since nobody use it now
Forget to remove in:
commit e223f60c09
Author: Peter Bee <bijunda1@xiaomi.com>
Date:   Tue Dec 1 14:55:16 2020 +0800

    net/socket: move si_send/recv into sendmsg/recvmsg

    Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
    the other way round.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-12 16:42:52 -03:00
Peter Bee
6f995e377c fix local_sendmsg return length
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-03-12 21:04:39 +08:00
Masayuki Ishikawa
e65d5d8c73 Revert "net: tcp: Add DEBUGASSERT() in psock_tcp_send()"
Summary:
- Based on the discussion (PR#2772), let me revert the commit

Impact:
- None

Testing:
- N/A

This reverts commit ec8bf5c8c1.

Suggested-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-03-12 16:23:01 +08:00
Gustavo Henrique Nihei
330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Gustavo Henrique Nihei
47cb41c92f makefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
ligd
70442d1f9d net/socket_rpmsg: add net socket rpmsg support
Change-Id: Ie23ee4c0052cf2fc66972ea9bc5f11c070fbcf8a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-07 01:45:51 -08:00
Peter Bee
e223f60c09 net/socket: move si_send/recv into sendmsg/recvmsg
Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
the other way round.

Change-Id: I7b858556996e0862df22807a6edf6d7cfe6518fc
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-03-05 04:46:13 -08:00
Jiuzhu Dong
4d5a964f29 net: unify socket into file descriptor
Change-Id: I9bcd21564e6c97d3edbb38aed1748c114160ea36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-03 19:01:41 -08:00
Xiang Xiao
8d0fd4038b Remove the empty xxx_initialize functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I63cb6b37f78e910663724659e11f53e3335d419f
2021-03-03 08:21:04 +00:00
Xiang Xiao
9473434587 Ensure the kernel component don't call userspace API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-01 09:23:09 +09:00
Gustavo Henrique Nihei
76acb32e29 Fix typos reported by codespell 2021-02-25 11:31:49 -08:00
Alin Jerpelea
37d5c1b0d9 net: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
Alin Jerpelea
7dc7ef45f1 net: nxstyle fixes
Nxstyle fixes to pass CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
Xiang Xiao
1a9267db65 net/local: Add an option to specify the prefix of named pipe
to avoid the user create socket under the real filesystem
which isn't supported by nuttx VFS yet.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib04c90e9c3c5a215bfda65515498d81e5f834895
2021-02-05 04:58:12 -08:00
Peter van der Perk
22437698f1 [imxrt] Fix FlexCAN tx dropping frames 2021-02-02 17:51:29 -03:00
chao.an
38e2c4ba53 net/ip: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-30 16:04:39 -08:00
chao.an
ab148bc69f net/ip: do not drop the udp packet from IP layer
this change to support receive the udp data from the specified
port without obtaining the address.

e.g: disable the Bootstrap flag on dhcpc handshake

Reference:
RFC1542: Clarifications and Extensions for the Bootstrap Protocol.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-30 16:04:39 -08:00
Masayuki Ishikawa
ec8bf5c8c1 net: tcp: Add DEBUGASSERT() in psock_tcp_send()
Summary:
- This commit adds DEBUGASSERT() to check the IOB size

Impact:
- None

Testing:
- Tested with sabre-6quad:netnsh with QEMU

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-29 00:05:01 -08:00
Abdelatif Guettouche
7e3d4a5f29 net: Remove duplicate forward references.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-01-16 07:39:04 -08:00
Abdelatif Guettouche
6385408483 net/: Correct some comments.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-01-15 16:23:12 -05:00
Abdelatif Guettouche
8e4397968c net/ & esp32/wlan: Fix some typos and nxstyle issues.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-01-14 07:57:27 -06:00
Xiang Xiao
0dc6990166 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
Xiang Xiao
0536953ded Kernel module should prefer functions with nx/kmm prefix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
chao.an
ae5b727580 net/tcp/handshake: send the SYN immediately.
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-18 14:16:11 +09:00
chao.an
5e9e50991c net/tcp: send the ack on nonblock mode
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-18 14:16:11 +09:00
Juha Niskanen
de1ad1fdb3 net: fix typos, incorrect comments, nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 09:06:28 -06:00
John Bampton
ba12c6c0cf Fix spelling 2020-12-12 19:18:08 +01:00
chao.an
8d0118569c [Performance]net/tcp: send the ACK in time after obtain ahead buffer from iobs
Request the TCP ACK to estimate the receive window after handle
any data already buffered in a read-ahead buffer.

Change-Id: Id998a1125dd2991d73ba4bef081ddcb7adea4f0d
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-10 12:23:47 +09:00
chao.an
881dd9d62d net/tcp: add a member to record the current receiving window
Change-Id: Ic4c46d643a905fdd3a828e563eab4814da70dbe5
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-10 12:23:47 +09:00
chao.an
794a6ec23d net/tcp: rename the winszie to snd_wnd to make the semantics more accurate
Change-Id: I8fdc7cf78a7f2cd53a30ef1de702b1a697c43238
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-10 12:23:47 +09:00
Brennan Ashton
68b526b335 tcp: Remove incomplete support for TCP reassembly 2020-12-09 07:25:26 -08:00
Gregory Nutt
45699e2701 net/tcp/tcp_input.c: Correct bad check of urgent data length
Urgent data preceded "normal" data in the TCP payload.  If the urgent data is larger than the size of the TCP payload, this indicates that the entire payload is urgent data and that urgent data continues in the next packet.

This case was handled correctly for the case where urgent data was present but was not being handled correctly in the case where the urgent data was NOT present.
2020-12-09 07:25:14 -08:00
chao.an
e37001f269 net/setsockopt/IP_MULTICAST_TTL: add handles of different prototypes
Reference here:
b3298500b2/net/ipv4/ip_sockglue.c (L923-L932)

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-05 10:44:53 -08:00
chao.an
5ad2c931a3 net/inet: fix nxstyle warnings
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-05 10:44:53 -08:00
chao.an
4af687b8c2 net/igmp: add MULTICAST_TTL support
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-05 10:44:53 -08:00
YAMAMOTO Takashi
87f93071e0 net/sixlowpan/sixlowpan_icmpv6send.c: Fix a syslog format 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
3f57667647 net/sixlowpan/sixlowpan_icmpv6send.c: Appease nxstyle 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
cee4261c0d net/tcp/tcp_sendfile.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
chao.an
dbd6e9be16 net/procfs: handle opendir("/proc/net/") correctly
Change-Id: I092bade082ba673b30257add4f869ac5bfa55ca6
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 05:56:35 -06:00
chao.an
ad66ea51e5 net/igmp: fix nxstyle warning
Change-Id: I6bb84038e035b81ea66b128ebf109f4a392ee6ab
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 12:23:04 +01:00
chao.an
ab78bae12f net/igmp: add sanity check to handle allocate fail
Change-Id: Ia3128c9c2b219345fb6ac2789ece7760c6aee663
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 12:23:04 +01:00
chao.an
316cdccf82 net/sockopt: Try usrsock further if the protocol not available
fallback to usrsock if the features are not implemented locally

Change-Id: I46e2d6452d7edd3fa5b3d508945511cd48f22ebb
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 12:22:48 +01:00
chao.an
51efe468b9 net/sockopt: fix invalid option set
fix invalid option set if enable UDP without TCP

Change-Id: I732893501a9b28749706d6f860c77ae9e14b358c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 12:22:48 +01:00
YAMAMOTO Takashi
7c46aface0 net/sixlowpan/sixlowpan_udpsend.c: Fix a syslog format 2020-12-02 02:53:47 -06:00
YAMAMOTO Takashi
e4760ca93b net/sixlowpan/sixlowpan_tcpsend.c: Fix syslog formats 2020-12-02 02:53:47 -06:00
chao.an
c2b0006dcd net/tcp: implement the fast retransmit
RFC2001: TCP Slow Start, Congestion Avoidance, Fast Retransmit,
         and Fast Recovery Algorithms

...

3.  Fast Retransmit
  Modifications to the congestion avoidance algorithm were proposed in
  1990 [3].  Before describing the change, realize that TCP may
  generate an immediate acknowledgment (a duplicate ACK) when an out-
  of-order segment is received (Section 4.2.2.21 of [1], with a note
  that one reason for doing so was for the experimental fast-
  retransmit algorithm).  This duplicate ACK should not be delayed.
  The purpose of this duplicate ACK is to let the other end know that a
  segment was received out of order, and to tell it what sequence
  number is expected.

  Since TCP does not know whether a duplicate ACK is caused by a lost
  segment or just a reordering of segments, it waits for a small number
  of duplicate ACKs to be received.  It is assumed that if there is
  just a reordering of the segments, there will be only one or two
  duplicate ACKs before the reordered segment is processed, which will
  then generate a new ACK.  If three or more duplicate ACKs are
  received in a row, it is a strong indication that a segment has been
  lost.  TCP then performs a retransmission of what appears to be the
  missing segment, without waiting for a retransmission timer to
  expire.

Change-Id: Ie2cbcecab507c3d831f74390a6a85e0c5c8e0652
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-01 11:36:10 -06:00
chao.an
234d3df19f net/tcp: correct the available iobs count if throttle is enabled
The number of available iobs is already sub in iob_navail(true) on line 114

net/tcp/tcp_recvwindow.c:
...
 73 uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev)
...
114   niob_avail    = iob_navail(true);

Change-Id: I230927904d8db08ed8d95d7fa18c5c5fce08aa5e
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 23:24:44 -06:00
chao.an
049c991d28 style/Kconfig: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:30 +01:00
chao.an
c56785bd0d style/Makefile: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:30 +01:00
chao.an
4305718691 net/tcp: fix nxstyle warnings
Change-Id: Id885fefc80caa12806c73778e632c8b0c5888be0
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 00:03:47 -06:00
chao.an
bf21056001 net/tcp: fallback to unthrottle pool to avoid deadlock
Add a fallback mechanism to ensure that there are still available
iobs for an free connection, Guarantees all connections will have
a minimum threshold iob to keep the connection not be hanged.

Change-Id: I59bed98d135ccd1f16264b9ccacdd1b0d91261de
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 00:03:47 -06:00
Juha Niskanen
ebb5fb7480 net/neighbor/neighbor_ethernet_out.c: fix build error without ICMPv6
Patch fixes following build error when
CONFIG_NET_IPv6 && !CONFIG_NET_ICMPv6 && CONFIG_NET_ETHERNET:

  nuttx/staging/libnet.a(neighbor_ethernet_out.o): In function `neighbor_ethernet_out':
  nuttx/net/neighbor/neighbor_ethernet_out.c:188: undefined reference to `icmpv6_solicit'

IPv6 without ICMPv6 is not very useful, but at least this patch
allows neighbor_ethernet_out() to be used with a packet socket or
with multicast address (point-to-point IPv6 links) even in that case.

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-27 10:27:45 -06:00
chao.an
a97aefe10a net/icmp: add sanity check to avoid wild data length
net device buffer overflow if the icmp packet is too large

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-27 06:45:16 -08:00
YAMAMOTO Takashi
dbe389a6bd net/usrsock/usrsock_dev.c: Fix syslog formats 2020-11-27 05:18:57 -06:00
YAMAMOTO Takashi
cc9b3a3ec5 net/tcp/tcp_appsend.c: Fix syslog formats
Note: tx_unacked is either uint16_t or uint32_t depending on the config.
2020-11-27 05:18:57 -06:00
YAMAMOTO Takashi
cbdbb369c0 net/tcp/tcp_input.c: Fix syslog formats
Note: tx_unacked is either uint16_t or uint32_t depending on the config.
2020-11-27 05:18:57 -06:00
YAMAMOTO Takashi
af6719965f net/tcp/tcp_appsend.c: Fix syslog formats 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi
390f766b36 net/tcp/tcp_appsend.c: Appease nxstyle 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi
40d4c03a8c net/tcp/tcp_input.c: Fix syslog formats 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi
17654f592e net/tcp/tcp_send_buffered.c: Fix syslog formats 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi
ff6201fc0a net/udp/udp_sendto_buffered.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
634713cec4 net/tcp/tcp_sendfile.c: Fix syslog formats 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
298299684e net/ieee802154/ieee802154_sendto.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
7b3cd145de net/ieee802154/ieee802154_sockif.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
ee1c914277 net/tcp/tcp_input.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
bfff9e5691 net/igmp/igmp_poll.c: Fix syslog formats
The following nxstyle errors are known.
They are a part of the copyright notice.

net/igmp/igmp_poll.c:22:82: error: Long line found
net/igmp/igmp_poll.c:29:82: error: Long line found
2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
79d2a4b82b net/igmp/igmp_mcastmac.c: Fix syslog formats
The following nxstyle errors are known.
They are a part of the copyright notice.

net/igmp/igmp_mcastmac.c:22:82: error: Long line found
net/igmp/igmp_mcastmac.c:29:82: error: Long line found
2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
a403e6eec2 net/igmp/igmp_join.c: Fix a syslog format 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
ffe29f9025 net/igmp/igmp_join.c: Appease nxstyle
The following nxstyle errors are intentionally left
because they are a part of the copyright notice.

net/igmp/igmp_join.c:22:82: error: Long line found
net/igmp/igmp_join.c:29:82: error: Long line found
2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
d6e87d7f40 net/igmp/igmp_input.c: Fix a syslog format 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
70a964bdcb net/igmp/igmp_group.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
b7be6047bb net/sixlowpan/sixlowpan_send.c: Fix a syslog format 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
dcfe08d227 net/sixlowpan/sixlowpan_tcpsend.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
d4b5684eba net/sixlowpan/sixlowpan_framelist.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
d5a5b6979d net/sixlowpan/sixlowpan_framelist.c: Appease nxstyle 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
3ed096cc08 net/bluetooth/bluetooth_sendto.c: Fix a syslog format 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
d851cd9322 net/bluetooth/bluetooth_sockif.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi
28fda4e5bb net/tcp/tcp_send_unbuffered.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
Matias N
d5b6ec450f Parallelize depend file generation 2020-11-22 09:02:59 -03:00
YAMAMOTO Takashi
8cb6790cef net/tcp/tcp_send_unbuffered.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
8a23f98233 net/tcp/tcp_wrbuffer_dump.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
bf9b36cf92 net/local/local_sockif.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
49055bc638 net/local/local_sendpacket.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
6ddaa18ee8 net/local/local_recvfrom.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
ba1b6876b4 net/tcp/tcp_send_buffered.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
3297c09d58 net/socket/send.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
c443809125 net/local/local_recvfrom.c: Appease nxstyle 2020-11-20 22:22:53 -08:00
GAEHWILER Reto
cbd4e90781 net/tcp: Rectified keepalive fix
Simplification of previous fix. Also fixes the case when new data should
be sent while a keepalive is not yet acked.
2020-11-18 17:40:42 -03:00
YAMAMOTO Takashi
87f73862fd net/local/local_fifo.c: Fix a few printf format warnings 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
26e1e4c74c net/can/can_getsockopt.c: Fix type mismatches 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
be76d43e25 net/procfs/netdev_statistics.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
62be7ba8b2 net/local/local_fifo.c: Appease nxstyle 2020-11-16 05:46:53 -08:00
YAMAMOTO Takashi
ba34213222 net/procfs/netdev_statistics.c: Appease nxstyle 2020-11-16 05:46:53 -08:00
chao.an
73d5700183 net/udp: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-10 19:40:41 -08:00
chao.an
95be9eaf4b net/callback: remove the assert check of conn instance
remove the connection assertion since the instance will be invalid
if the network device has been taken down.

net/netdev/netdev_ioctl.c:

1847 void netdev_ifdown(FAR struct net_driver_s *dev)
1848 {
...
1871       /* Notify clients that the network has been taken down */
1872
1873       devif_dev_event(dev, NULL, NETDEV_DOWN);
...
1883 }

Change-Id: I492b97b5ebe035ea67bbdd7ed635cb13d085e89c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-10 19:40:41 -08:00
Matias N
5c2750a960 fix typos 2020-10-28 22:02:09 -07:00
chao.an
a22f5bb8b0 net/tcp: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-10-28 11:41:16 -07:00
chao.an
d78bf36740 net/tcp: fix tcp socket close timeout if loss wireless connection
In the current net stack implementation, there is no mechanism
for notifying the loss of the wireless connection, if the network
is disconnected then application sends data packets through tcp,
the tcp_timer will keep retrying fetch the ack for awhile, the
connection status will not be able to be switched timely.

Change-Id: I84d1121527edafc6ee6ad56ba164838694e7e11c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-10-28 11:41:16 -07:00
GAEHWILER Reto
83745652c4 TCP-stack fix for stalled tcp sockets due to broken keepalive
Fixes an issue where tcp sockets with activated keepalives stalled and
were not properly closed. Poll would not indicate a POLLHUP and therefore
locks down the application.

* tcp_conn_s.tcp_conn_s & tcp_conn_s.keepintvl changed to uint32_t
  According RFC1122 keepidle MUST have a default of 2 hours.
2020-10-27 11:21:56 -07:00
ligd
90f3d2851c net/devif/devif_callback.c: remove harmful debug check
N/A

Cause of curr maybe NULL, and following logic can handle this

Change-Id: I999c051a8f2e2698400fc8793ba068073a306972
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-10-26 14:19:01 -03:00
Matias N
5386f972fa bluetooth: Add support for HCI RAW channel; make host layer optional 2020-10-25 17:04:25 -07:00
Brennan Ashton
1080d3f411 Bluetooth: Start implementing BTPROTO_HCI socket support
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-10-25 17:04:25 -07:00
Yoshinori Sugino
3ac90fca79 Remove tabs and spaces at the end of lines 2020-10-24 09:38:21 +01:00
Xiang Xiao
2956b8516b Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-20 01:45:06 -07:00
Xiang Xiao
eb4121ce38 Change all 'Nuttx' to 'NuttX'
Unify the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-20 01:45:06 -07:00
Nathan Hartman
80ce7800a9 Sources and Docs: Fix typos and nxstyle issues
Documentation/contributing/coding_style.rst:

    * Fix repeated words: ("this this").
    * Remove trailing spaces.

boards/z80/z80/z80sim/README.txt:

    * Fix repeated words: ("this this") and rewrap lines.

graphics/Kconfig,
libs/libc/math/Kconfig:

    * Fix repeated words: ("this this").

arch/arm/src/armv7-a/arm_assert.c,
arch/arm/src/armv7-r/arm_assert.c,
arch/arm/src/imxrt/imxrt_enet.c,
arch/arm/src/kinetis/kinetis_enet.c,
arch/arm/src/kinetis/kinetis_flexcan.c,
arch/arm/src/s32k1xx/s32k1xx_enet.c,
arch/arm/src/s32k1xx/s32k1xx_flexcan.c,
arch/arm/src/stm32/stm32_pwm.c,
arch/arm/src/stm32h7/stm32_pwm.c,
arch/arm/src/stm32l4/stm32l4_pwm.c,
arch/renesas/src/rx65n/rx65n_usbdev.c,
binfmt/libnxflat/libnxflat_bind.c,
drivers/pipes/pipe_common.c,
net/igmp/igmp_input.c,
net/tcp/tcp_conn.c,
sched/sched/sched_roundrobin.c:

    * Fix typo in comment ("this this").

arch/arm/src/cxd56xx/cxd56_usbdev.c,
arch/arm/src/lc823450/lc823450_usbdev.c:

    * Fix typo in comment and rewrap lines.

arch/arm/src/imxrt/imxrt_usbdev.c,
arch/arm/src/stm32/stm32_dac.c,
arch/arm/src/stm32f0l0g0/stm32_pwm.c,
arch/arm/src/stm32f7/stm32_pwm.c,
arch/arm/src/tiva/lm/lm4f_gpio.h,
fs/nxffs/nxffs_write.c,
include/nuttx/analog/pga11x.h,
include/nuttx/usb/usbdev.h,
net/mld/mld_join.c:

    * Fix typo in comment ("this this").
    * Fix nxstyle issues.
2020-10-02 04:54:52 +02:00
David Sidrane
e254083a7d net:Add ARCH_PHY_POLLED option 2020-10-01 15:28:51 +08:00
Juha Niskanen
366e8afdb1 net/usrsock: fix outputted function name in debug prints
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-09-21 10:36:31 -03:00
Xiang Xiao
b0797263ca libc/stdio: Allocate file_struct dynamically
1.Reduce the default size of task_group_s(~512B each task)
2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia872137504fddcf64d89c48d6f0593d76d582710
2020-09-11 17:58:17 +08:00
Bhindhiya
d7aec84dbe Resolve build warnings in file mld_group.c 2020-09-04 21:16:00 +08:00
Brennan Ashton
797bf447d1 net: For Bluetooth sockets use the Linux sockaddr types
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-08-29 14:04:54 -06:00
Xiang Xiao
b5f429c88b Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Xiang Xiao
ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
chao.an
e5f6dafe1f net/socket: add SOCK_CLOEXEC/SOCK_NONBLOCK support
Reference here:
https://github.com/torvalds/linux/blob/master/include/linux/net.h

Change-Id: I9fd0170bcd1ae7e778e951d454ada76f63854de5
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 23:38:18 -05:00
Xiang Xiao
acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Xiang Xiao
a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
Xiang Xiao
f618de9c97 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao
4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
YAMAMOTO Takashi
4f7745ae1c net/tcp/tcp_timer.c: Remove redundant assignments
Found by clang-check:

tcp/tcp_timer.c:185:15: warning: Value stored to 'result' is never read
              result = tcp_callback(dev, conn, TCP_TIMEDOUT);
              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:264:23: warning: Value stored to 'result' is never read
                      result = tcp_callback(dev, listener, TCP_TIMEDOUT);
                      ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:300:19: warning: Value stored to 'result' is never read
                  result = tcp_callback(dev, conn, TCP_TIMEDOUT);
                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
2020-08-03 22:52:31 -05:00
Xiang Xiao
2d7f58d165 net/procfs: Support chdir("/proc/net/") correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I47295019c6054c869545e33258ad3460896e851a
2020-08-03 21:00:18 +01:00
SPRESENSE
8f39b20488 net/usrsock: Fix recv() couldn't peek data
Fix a bug that recv() couldn't peek receive data.
recv() would be failed by previous recv() call with MSG_PEEK.
2020-07-30 20:58:15 -05:00
YAMAMOTO Takashi
9087eb6d84 net/devif/devif_callback.c: Remove a redundant assignment
Found by clang-check:

devif/devif_callback.c:508:7: warning: Value stored to 'cb' is never read
      cb = next;
      ^    ~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
bf9ba474a5 net/icmp/icmp_recvfrom.c: fix a NULL dereference
Found by clang-check:

icmp/icmp_recvfrom.c:374:30: warning: Dereference of null pointer (loaded from variable 'fromlen')
      if (fromlen == NULL && *fromlen < sizeof(struct sockaddr_in))
                             ^~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
SPRESENSE
d2f75467b5 net/usrsock: Add flags to sendto/recvfrom in usrsock
Add flags argument into sendto() and recvfrom() APIs for MSG_* flags can
handling in the daemon.

However, MSG_DONTWAIT should process in usrsock, so it unnecessary to pass to
the daemon like O_NONBLOCK.
2020-07-29 09:40:51 +02:00
SPRESENSE
e249a2f82f Makefile: Fix Make.dep not updated by config changes
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:

 1) Add source files by config symbol
 2) Include header files in #ifdef directive

These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
2020-07-28 03:59:45 -05:00
SPRESENSE
76c87d2f85 net/socket: Fix nxstyle issue 2020-07-22 11:41:53 +01:00
SPRESENSE
5ee0432d6f net/socket: Fix sanity checking of socket interface
No error occurs even if NULL is set in the input argument
of socket API. So added an argument check process.
2020-07-22 11:41:53 +01:00
Kazuya Hioki
822061a3d0 net: Fix dupulicated NET_USRSOCK in Kconfig
Reviewed-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Signed-off-by: Kazuya Hioki <Kazuya.Hioki@sony.com>
2020-07-19 20:05:50 -07:00
Xiang Xiao
9dff16e0e4 fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ieaf325c899d1c349d64dfa15bddcc32afd1fce42
2020-07-10 21:30:02 +01:00
chao.an
e7f2dc8173 net/sockopt: change the socket option style from Linux to BSD
Linux Programmer's Manual
...
IP(7)
...
NOTES
...
    Using the SOL_IP socket options level isn't portable;
    BSD-based stacks use the IPPROTO_IP level.

Change-Id: I63ea5ec7714481b5201608ec4449e522e2be3da2
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 18:49:58 -03:00
chao.an
d6a0da41d5 net/vfcntl: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-24 13:48:41 +01:00
chao.an
f56e0e004b fs/setfd: correct the return value
Change-Id: I766f3760e7167a579b73673c44b70847ee06850b
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-24 13:48:41 +01:00
Peter van der Perk
ba5fe5cee3 SocketCAN: Fixed dropping timestamped frames when running in CAN2.0B 2020-06-17 15:17:38 -07:00
Peter van der Perk
4eecf8561f FlexCAN interrupt fixes, old compiler fixes
SocketCAN old compiler fix
2020-06-16 15:35:43 -03:00
Xiang Xiao
fdb7e6e460 net/igmp: Fix the compiler warning on 64bit platform
igmp/igmp_timer.c: In function ‘igmp_timeout’:
igmp/igmp_timer.c:163:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  163 |   group = (FAR struct igmp_group_s *)arg;
      |           ^
igmp/igmp_timer.c: In function ‘igmp_startticks’:
igmp/igmp_timer.c:200:55: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  200 |   ret = wd_start(group->wdog, ticks, igmp_timeout, 1, (uint32_t)group);
      |                                                       ^
igmp/igmp_timer.c:200:38: warning: passing argument 3 of ‘wd_start’ from incompatible pointer type [-Wincompatible-pointer-types]
  200 |   ret = wd_start(group->wdog, ticks, igmp_timeout, 1, (uint32_t)group);
      |                                      ^~~~~~~~~~~~
      |                                      |
      |                                      void (*)(int,  uint32_t, ...) {aka void (*)(int,  unsigned int, ...)}
In file included from igmp/igmp_timer.c:50:
/home/xiaoxiang/mirtos/nuttx/include/nuttx/wdog.h:233:53: note: expected ‘wdentry_t’ {aka ‘void (*)(int,  long unsigned int, ...)’} but argument is of type ‘void (*)(int,  uint32_t, ...)’ {aka ‘void (*)(int,  unsigned int, ...)’}
  233 | int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...);

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I153355f85f583f5441d97a0b1278bce167eb3fd0
2020-06-15 21:21:42 +01:00
Ouss4
c8d83e0a88 net/can/can_setsockopt&can_getsockopt.c: Initialiaze ret variable to
eliminate any warning.
2020-06-15 12:20:32 -06:00
Ouss4
155903fc54 net/can/can.h: Add can_setsockopt and can_getsockopt prototypes. 2020-06-15 12:20:32 -06:00
Gregory Nutt
5e6d9944d7 net/socket/getsockopt.c: Eliminate warning
##[error]socket/getsockopt.c:362:7: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       int ret;
           ^~~
2020-06-15 16:10:47 +01:00
Peter van der Perk
b5c5948e1c NXStyle fixes 2020-06-15 08:07:19 -06:00
Peter van der Perk
55d9e5f7af net: Add SocketCAN support 2020-06-15 08:07:19 -06:00
Alan C. Assis
089a633c76 Fix wrong space instead of TAB 2020-06-15 07:13:21 -06:00
Alan C. Assis
7609b67496 Fix issues reported on PR #1233 2020-06-15 07:13:21 -06:00
Alan C. Assis
6ff18a7f3b Rename NETDEV_WBIM_FORMAT with NETDEV_WWAM_FORMAT 2020-06-15 07:13:21 -06:00
Alan C. Assis
e1be7ace4b Fix netdev and add Apache license to the file 2020-06-15 07:13:21 -06:00
Adam Porter
07c0faff59 Add support to CDC-MBIM USB host driver
This driver was created by Adam Porter and posted on NuttX
mailing list at Google Group on Nov 14 2019
2020-06-15 07:13:21 -06:00
Jukka Laitinen
17e45820c6 net/inet/inet_sockif.c: Fix long lines
Signed-off-by: Jukka Laitinen <jukka.laitinen@intel.com>
2020-06-01 21:54:06 +08:00
Jukka Laitinen
1f8de344dd net/inet/inet_sockif.c: Fix debugassert compilation
Should derefer addrlen pointer, instead of comparing whether
the pointer itself is > 0

Signed-off-by: Jukka Laitinen <jukka.laitinen@intel.com>
2020-06-01 21:54:06 +08:00
Xiang Xiao
7e5b0f81e9 build: Replace -I with INCDIR
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 20:20:12 +01:00
Xiang Xiao
23668a4b9b build: Remove the empty variable assignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:24:13 -06:00
Xiang Xiao
dd61d3d9f9 build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 18:00:40 +01:00
Gregory Nutt
154a87993f fs/vfs/fd_open.c: fs_fdopen() must not set errno
Functions within the OS must never set the errno value.  fs_fdopen() was setting the errno value.  Now, after some parameter changes, it reports errors via a negated errno integer return value as do most all other internal OS functions.
2020-05-23 15:22:09 +08:00
Xiang Xiao
1a95cce1a3 build: Move .config check to the top Makefile
remove the workaround to handle the inexistence of .config/Make.defs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-20 17:57:34 +01:00
Masayuki Ishikawa
c7500c5c9d net: tcp: Fix port info in warning message in tcp_input.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-19 13:36:45 +08:00
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
35efcee5c9 net/netdev/netdev_register.c: Add some comments.
This commit adds some short comments to explain some perplexing logic of PR #1047.
2020-05-15 15:48:00 +01:00
chao.an
87af256ad6 net/udp: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-15 07:27:01 -06:00
chao.an
7a62a59dec net/conn: generate port base dynamically
In some extreme scenarios(eg. crash, reboot, reset, etc...),
an established connection cannot guarantee that the port can be
closed properly, if we try to reconnect quickly after reset, the
connection will fail since the current port is same as the
previous one, the previous port connection has been hold on server side.

dynamically apply for the port base to avoid duplication.

Change-Id: I0089244b2707ea61f553a4dae09c7af3649c70bd
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-15 07:27:01 -06:00
YAMAMOTO Takashi
573f02791f netdev_ioctl: Update a comment 2020-05-14 11:26:03 -06:00
chao.an
a5868864bc net: remove unnecessary spaces
minor style fix

Change-Id: I06b6fe48628440490090b89a39baf01481f79b79
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:54:57 -06:00
chao.an
9cc2f50405 netdev/register: configurable net packet size
Change-Id: I2af571a0273e67a06c1b4543eac3ded7cfdd8060
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:54:57 -06:00
chao.an
03f462c5cd net/sockopt: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:53:15 -06:00
chao.an
608436a75f net/sockopt: do not set the errno to SO_ERROR
SO_ERROR is used to report asynchronous errors that are the result
of events within the network stack and not synchronous errors that
are the result of a library call(send/recv/connect)

Synchronous results are reported via errno.

Linux Programmer's Manual
...
NAME
       getsockopt, setsockopt - get and set options on sockets
...
RETURN VALUE
...
       On error, -1 is returned, and errno is set appropriately

Change-Id: I1a1a05a684dff8672aaf47eabee157ac0d275c2d
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:53:15 -06:00
Xiang Xiao
63e3054ced Don't need monitor IOB buffer empty event for POLLOUT implementation
It's enough to check the buffer available in the net event handler

Change-Id: I2d7c7a03675cf6eff6ffb42a81b7c7245253e92c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-13 06:50:07 -06:00
Xiang Xiao
517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Gregory Nutt
4b44b628ea Run nxstyle against all .c and .h files modified by this PR.
All complaints fixed except for those that were not possible to fix:

- Used of Mixed case identifier in ESP32 files.  These are references to Expressif ROM functions which are outside of the scope of NuttX.
2020-05-09 14:19:08 -03:00
Gregory Nutt
a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
chao.an
0887203c57 tcp/conn: request arp before the 3-way handshake
Since the request address was not properly resolved before the handshake,
every time of connection, the handshake data will be overwitten into
arp packet and retransmitted until the next tcp timer.
Request the arp address before the handshake to avoid the retransmission.

Change-Id: I80118b9a8096c126c8e16cdf2f7b3d98fca92437
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-09 07:25:03 -06:00
Masayuki Ishikawa
75a8883f07 net: netdev: Fix netdev_vioctl()
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-09 02:10:23 +01:00
Xiang Xiao
b7d922960f Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Xiang Xiao
d9d2fc0d0a debug: Reduce CONFIG_CPP_HAVE_VARARGS usage
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Xiang Xiao
6604cdb3f2 fs: Remove all LIBC_IOCTL_VARIADIC related stuff
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Xiang Xiao
390f9a5fb7 fs/vfs: Add nx_dup and nx_dup2 function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
5b839061f9 net/usrsock: fix error: variable 'pos' is used uninitialized
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-29 07:10:44 -06:00
Gregory Nutt
9400cf2cd1 sched/group: On task creation, do not clone uninitialized descriptors.
Sockets are created in two steps:

1. The socket is allocated, then
2. The socket is initialized.

In SMP mode, there is a possibility that a pthread executing one CPU may create a new task while a pthread on another CPU has allocated the socket but not yet initialized it.  This commit updates the socket clone test to assure that the socket is both allocated and initailized.

Without the change, it is possible that uninitialized sockets could be cloned, leading to errors later in the newly started task.
2020-04-28 21:27:05 +01:00
Xiang Xiao
b432ae5598 Fix nxstyle warning 2020-04-16 11:50:18 -06:00
chao.an
9131ae1f1f netdev/carrier: monitor the driver status 2020-04-16 11:50:04 -06:00
chao.an
10acadb64b netlink: add netlink route notify support 2020-04-16 11:49:53 -06:00
Xiang Xiao
6f1c86d934 netlink: Fix the compiler warning in netlink_add_broadcast
netlink/netlink_conn.c: In function 'netlink_add_broadcast':
netlink/netlink_conn.c:319:45: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  319 |       if (conn->groups & (1 << (group - 1)) == 0)
      |                          ~~~~~~~~~~~~~~~~~~~^~~~
2020-04-16 11:49:40 -06:00
liuhaitao
9ac3a0d4d8 Fix sixlowpan_framer.c build warnings under macos
sixlowpan/sixlowpan_framer.c:104:20: warning: unused function 'sixlowpan_saddrnull'
      [-Wunused-function]
static inline bool sixlowpan_saddrnull(FAR const uint8_t *saddr)
                   ^
sixlowpan/sixlowpan_framer.c:124:20: warning: unused function 'sixlowpan_eaddrnull'
      [-Wunused-function]
static inline bool sixlowpan_eaddrnull(FAR const uint8_t *eaddr)
                   ^
2 warnings generated.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-17 01:38:40 +08:00
liuhaitao
2353e46ee9 Fix sixlowpan_utils.c nxstyle complaints
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-16 22:03:28 +08:00
liuhaitao
7afd8c6a21 Fix sixlowpan build break with -Werror option under macos
sixlowpan/sixlowpan_utils.c:535:20: error: unused function 'sixlowpan_issaddrbased' [-Werror,-Wunused-function]
static inline bool sixlowpan_issaddrbased(const net_ipv6addr_t ipaddr,
                   ^
sixlowpan/sixlowpan_utils.c:543:20: error: unused function 'sixlowpan_iseaddrbased' [-Werror,-Wunused-function]
static inline bool sixlowpan_iseaddrbased(const net_ipv6addr_t ipaddr,
                   ^
2 errors generated.
make[1]: *** [sixlowpan_utils.o] Error 1

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-16 22:03:28 +08:00
Xiang Xiao
bd39813883 netlink: Add netlink_add_broadcast function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I1bee7933dca1bdd118d0034a564b4306e1ae5684
2020-04-16 17:40:03 +08:00
chao.an
755265506c netlink: replace the operation handle to connection
Change-Id: Ie55d65823fe7eb7e917349c095cf8fd4f6326e8f
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-16 17:39:37 +08:00
chao.an
16c0c61e3e netlink/route: reuse response terminator
Change-Id: I19c3d97b088231d96909d415d286c728ffe83881
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-16 17:39:06 +08:00
chao.an
85dce03d22 netlink/route: remove domain check
Change-Id: I965788c3bd2e6bfa41048b87d8c26f111f61c48e
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-16 17:39:06 +08:00
Xiang Xiao
df57cacd61 nuttx: Fix the nightly build warning again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-14 11:22:22 +02:00
Xiang Xiao
b22e3b9e28 nuttx: Fix the nightly build warning
lpc2148_spi1.c:142:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type 'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
  142 |   .send              = spi_send,
      |                        ^~~~~~~~
lpc2148_spi1.c:142:24: note: (near initialization for 'g_spiops.send')

In file included from ieee802154/mac802154_bind.c:49:
ieee802154/mac802154_internal.h: In function 'mac802154_setdevmode':
ieee802154/mac802154_internal.h:788:42: warning: converting a packed 'enum ieee802154_devmode_e' pointer (alignment 1) to a 'const union ieee802154_attr_u' pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  788 |                         (FAR const union ieee802154_attr_u *)&mode);
      |                                          ^~~~~~~~~~~~~~~~~

chip/stm32_hciuart.c: In function 'hciuart_read':
chip/stm32_hciuart.c:2104:30: warning: statement with no effect [-Wunused-value]
 2104 |                       ntotal == (ssize_t)ret;
      |                       ~~~~~~~^~~~~~~~~~~~~~~

wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_auth_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:579:23: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  579 |   type = bcmf_getle32(&event->type);
      |                       ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:580:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  580 |   status = bcmf_getle32(&event->status);
      |                         ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_scan_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:619:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  619 |   status = bcmf_getle32(&event->status);
      |                         ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:620:35: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  620 |   escan_result_len = bcmf_getle32(&event->len);
      |                                   ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_bdc.c: In function 'bcmf_bdc_process_event_frame':
wireless/ieee80211/bcm43xxx/bcmf_bdc.c:166:27: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  166 |   event_id = bcmf_getle32(&event_msg->event.type);
      |                           ^~~~~~~~~~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_direct':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:157:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  157 |   ret = SDIO_RECVR5(dev, SD_ACMD52, (uint32_t *)&resp);
      |   ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_extended':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:239:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  239 |           ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |           ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:244:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  244 |           ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |           ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:257:7: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  257 |       ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |       ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:265:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  265 |   SDIO_RECVR1(dev, SD_ACMD52ABRT, (uint32_t *)&resp);
      |   ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~

chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:2860:7: warning: unused variable 'ret' [-Wunused-variable]
 2860 |   int ret;
      |       ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:3044:7: warning: unused variable 'ret' [-Wunused-variable]
 3044 |   int ret;
      |       ^~~

chip/stm32_i2c.c:722:12: warning: 'stm32_i2c_sem_wait_noncancelable' defined but not used [-Wunused-function]
  722 | static int stm32_i2c_sem_wait_noncancelable(FAR struct i2c_master_s *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wireless/gs2200m.c: In function 'gs2200m_read':
wireless/gs2200m.c:727:20: warning: passing argument 1 of 'nxsem_wait' from incompatible pointer type [-Wincompatible-pointer-types]
  727 |   ret = nxsem_wait(dev);
      |                    ^~~
      |                    |
      |                    struct gs2200m_dev_s *

.config:1207:warning: symbol value '' invalid for TESTING_OSTEST_FPUSIZE

platform/audio/cxd56_audio_analog.c:69:13: warning: inline function 'cxd56_audio_clock_is_enabled' declared but never defined
   69 | inline bool cxd56_audio_clock_is_enabled(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:68:13: warning: inline function 'cxd56_audio_clock_disable' declared but never defined
   68 | inline void cxd56_audio_clock_disable(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:67:13: warning: inline function 'cxd56_audio_clock_enable' declared but never defined
   67 | inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~

chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:1348:7: warning: unused variable 'ret' [-Wunused-variable]
 1348 |   int ret;
      |       ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:1496:7: warning: unused variable 'ret' [-Wunused-variable]
 1496 |   int ret;
      |       ^~~

chip/stm32_i2c.c:729:12: warning: 'stm32_i2c_sem_wait_uninterruptble' defined but not used [-Wunused-function]
  729 | static int stm32_i2c_sem_wait_uninterruptble(FAR struct i2c_master_s *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wireless/lpwan/sx127x/sx127x.c:147:52: warning: missing terminating ' character
  147 | #  warning OOK support is not complete, RX+TX doesn't work yet!
      |                                                    ^

str71_spi.c:435:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type
                                               'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
  435 |   .send              = spi_send,
      |                        ^~~~~~~~
str71_spi.c:435:24: note: (near initialization for 'g_spiops.send')

chip/pic32mx-lowconsole.c:147:24: warning: 'pic32mx_getreg' defined but not used [-Wunused-function]
 static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
                        ^
chip/pic32mx-gpio.c:113:20: warning: 'pic32mx_value' defined but not used [-Wunused-function]
 static inline bool pic32mx_value(uint16_t pinset)
                    ^
chip/pic32mz-gpio.c:124:20: warning: 'pic32mz_value' defined but not used [-Wunused-function]
 static inline bool pic32mz_value(pinset_t pinset)
                    ^
chip/pic32mx-usbdev.c:3065:1: warning: 'pic32mx_epreserved' defined but not used [-Wunused-function]
 pic32mx_epreserved(struct pic32mx_usbdev_s *priv, int epno)
 ^

mmcsd/mmcsd_spi.c: In function 'mmcsd_mediachanged':
mmcsd/mmcsd_spi.c:1938:7: warning: 'return' with a value, in function returning void
       return ret;
       ^

In file included from partition/fs_partition.c:42:0:
partition/partition.h:66:19: warning: 'read_partition_block' defined but not used [-Wunused-function]
 static inline int read_partition_block(FAR struct partition_state_s *state,
                   ^

local/local_netpoll.c: In function 'local_pollsetup':
local/local_netpoll.c:305:1: warning: label 'pollerr' defined but not used [-Wunused-label]
 pollerr:
 ^~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If3ea8f32b878aa218072130f7c3018f0d3c1aca5
2020-04-13 12:01:39 -06: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
Gregory Nutt
621151a523 Fix some macOS sim warnings.
These warnings fix a class of warnings that I saw during CI checks for macOS sim builds.  For example:

    devif/devif_callback.c:111:49: warning: for loop has empty body [-Wempty-body]
                   prev = curr, curr = curr->nxtdev);
                                                    ^
    devif/devif_callback.c:111:49: note: put the semicolon on a separate line to silence this warning

I did not put the semi-colon on a separate line, but used braces.
2020-04-11 22:27:42 +01:00
Xiang Xiao
581dbb22fe netlink: Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
369a0fa4fb netlink: all request to NETLINK_ROUTE should use rtgenmsg
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib7a05dbf08277f56882e19a886a12a153889ca38
2020-04-10 08:18:07 -06:00
Xiang Xiao
70012bc4a2 netlink: Remove netlink_route_recvfrom
The same functionality could be implemented in the common place(netlink_recvfrom)

Change-Id: I8aedb29c4f0572f020ca5c0775f06c5e1e17ae4a
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
16dbe373c0 netlink: Implement netlink_connect and netlink_getpeername
and refine netlink_bind and netlink_send implmentation

Change-Id: I2b3e7980eac01dc42927cfaa0a64874df52d6bf5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
5708015674 netlink: Sync the macro with Linux definition
Change-Id: I0c0895fa17e167c67fb12acfdfc6dc3a7fb63b3b
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
e6c30629a1 netlink: Return -EBUSY if some notifier was setup in netlink_notifier_setup
Change-Id: I62d036bb43420934efbf0e9b990ca2cf3dd0b2e5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
3421ec90b4 netlink: Shouldn't call netlink_notify_response in netlink_poll
to avoid sleep inside netlink_poll

Change-Id: Id801c2dae805455a9b91f2e091d001679f0b3d4b
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
9fb6eee5fe netlink: Remove the unused netlink_active
Change-Id: I976b3fbab033baa4eaec35f8f443d4eb971db142
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
ligd
cbf31bca5c global change: fix tools/checkpatch.sh warnnings
Change-Id: I88cfa979c44bcaf3a8f6e036c6bfccd3402ca85a
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
ligd
231ad202ee global change: repace sched_xfree() to kxmm_free()
Changes:
sched_xfree() => kxmm_free()
remove garbage related APIs
remove ARCH_HAVE_GARBAGE

Cause garbage feature move to mm_heap, then don't need
garbage anymore.

Change-Id: If310790a3208155ca8ab319e8d038cb6ff92c518
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
Xiang Xiao
c85fe67ebc net/loopback: Move g_lo_* global variable to libc/net/
so netdb could reuse these global variable directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iaa26ddbdaf416f64d43c6e8888a14bbe0c3405eb
2020-03-30 09:47:28 -06:00
Gregory Nutt
97339e47f1 Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under graphics/, mm/, net/, sched/, wireless/bluetooth.

Still to do:  Files under fs/, drivers/, and arch.  The last is 116 files and will take some effort.
2020-03-29 20:11:10 +01:00
YAMAMOTO Takashi
f8077022bd Introduce CONFIG_DEFAULT_TASK_STACKSIZE
* The appropriate size of stack varies among archs.
  E.g. for 64-bit sim, 2048 is way too small, especially when the task
  happens to use host OS functionalities.
  I plan to allow an arch provide its own default.

* I plan to use this to replace hardcoded "STACKSIZE = 2048" in APPDIR.
2020-03-26 22:30:13 -05:00
YAMAMOTO Takashi
1ffa009c8b Revert "Don't generate .depend anymore"
This reverts commit 79af7fbf4e.

Because:

* btashton reported some issues in local builds:

  https://github.com/apache/incubator-nuttx/pull/603#issuecomment-602264860

* this might be related to the current CI breakage:

  > /bin/sh: 1: /__w/incubator-nuttx/incubator-nuttx/nuttx/tools/mkdeps: not found
2020-03-22 23:07:29 -05:00
Xiang Xiao
79af7fbf4e
Don't generate .depend anymore 2020-03-22 18:15:29 +00:00
Nathan Hartman
a5e643b0cd Fix typos in comments and documentation. 2020-03-16 20:01:11 -06:00
YAMAMOTO Takashi
213c81aebd Fix a typo in kconfig text 2020-03-12 11:38:18 +01:00
chao.an
0376cddd6d net: move the _SF*/_SS* definitions to net.h
Build break caused by 23b8b39799
2020-03-04 21:37:34 -06:00
GAEHWILER Reto
2ba2846ced net/tcp/tcp_input.c: Fix of faulty TCP sequence increments
Sequence numbers must not be incremented in the case of retransmitted packets
2020-03-03 09:15:18 -06:00
Juha Niskanen
f3490e42c3 Fix typos in comments 2020-03-03 09:11:57 -06:00
Nathan Hartman
8ee6be0780 net/icmp/icmp_input.c: Fix memset() implicit decl warning 2020-02-25 12:17:55 -06:00
Gregory Nutt
1f1356a2f5 net/icmp/icmp_input.c: Clear sin_zero
This should have been part of commit 861efdf8a3 but was overlooked.
2020-02-25 09:32:54 -06:00
patacongo
861efdf8a3
net/: Whenever the network initializes an IPv4 address, it must clear sin_zero. 2020-02-25 15:53:39 +01:00
chao.an
42d97079de net/netlink/netlink_route.c: Correct the return value 2020-02-25 07:33:18 -06:00
Alan Carvalho de Assis
d74ca3ab82 Make the tcp_backlog error message clear
The tcp_backlog is used when there is not process running to accept a new connection, but it is limited by the number of allocated backlog containers. The current error message induces the user to believe there is not free memory to allocate a new container, but actually the containers were allocated during the initialization and were available until the last element of the list has been removed to use.
2020-02-24 11:35:01 -06: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
f7ef08cdc1 net/usrsock: Don't return -ESHUTDOWN even usrsockdev_is_opened return false
since usrsock_conn_s::resp::result contain more detailed info and fix the below error in usrsocktest:
Testing group "WakeWithSignal" =>
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_connect_thread":
		line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
			got value: 110
			should be: 113
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_connect_thread":
		line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
			got value: 110
			should be: 113
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_connect_thread":
		line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
			got value: 110
			should be: 113
	[TEST ASSERT FAILED!]
		In function "do_wake_test":
		line 567: Assertion `(bool)((usrsocktest_test_failed)) == (bool)(false)' failed.
			got value: 1
			should be: 0
	Group "WakeWithSignal": [FAILED]
2020-02-22 07:33:01 -06:00
Xiang Xiao
8c8771a29d net/socket: Don't skip return -ENETDOWN in usrsock case
Fix the below error in usrsocktest:
Testing group "WakeWithSignal" =>
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_socket_thread":
		line 122: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((115))' failed.
			got value: 123
			should be: 115
	[TEST ASSERT FAILED!]
		In function "do_wake_test":
		line 567: Assertion `(bool)((usrsocktest_test_failed)) == (bool)(false)' failed.
			got value: 1
			should be: 0
	Group "WakeWithSignal": [FAILED]
2020-02-22 07:30:58 -06:00
Masayuki Ishikawa
e9fe1f84af net: socket: Enable parameter check (addr and addrlen) in getsockname.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-02-21 01:43:12 -06:00
chao.an
d07afc934e fcntl: add O_CLOEXEC/FD_CLOEXEC support 2020-02-20 08:20:38 -06:00
chao.an
c65d8e6a23 net/socket: add MSG_DONTWAIT support
MSG_DONTWAIT (since Linux 2.2)
  Enables nonblocking operation; if the operation would block, the
  call fails with the error EAGAIN or EWOULDBLOCK. This provides
  similar behavior to setting the O_NONBLOCK flag (via the fcntl(2)
  F_SETFL operation), but differs in that MSG_DONTWAIT is a per-call
  option, whereas O_NONBLOCK is a setting on the open file description
  (see open(2)), which will affect all threads in the calling process
  and as well as other processes that hold file descriptors referring
  to the same open file description.
2020-02-19 12:21:28 -06:00
Juha Niskanen
15b78abccf Fix typos in comments 2020-02-14 08:50:45 -06:00
Gregory Nutt
0b25b96759 net/netlink/netlink_route.c: Fix a typo. 2020-02-13 15:04:45 -03:00
Gregory Nutt
7409f57d40 net/pkt: Fix inconsistent use of FAR
Also run all .c and .h files through nxstyle (with -m 0)
2020-02-13 15:10:34 +08:00
Gregory Nutt
3c0b49448a Network Loopback Driver: A configuration option to control packet size.
Historically, the loopback driver used the largest packet size of all enabled link layer protocols.  This permitted packets to be forward via the loopbak device with no major loss of performance.  However, in experimenting with configurations where no other link layer protocols were enabled, this means the loopback packet size was set to the smallest possible size, to the SLIP minimum of 296 bytes.  This resulted in terrible loopback performance.

    This commit adds an option to increase the loopback packet size with the option CONFIG_NET_LOOPBACK_PACKETSIZE.

    The loopback driver packet buffer should be quite large.  The larger the loopback packet buffer, the better will be TCP performance of the loopback transfers.  The Linux loopback device historically used packet buffers of size 16Kb, but that was increased in recent Linux versions to 64Kb.  Those sizes may be excessive for resource constrained MCUs, however.

    The network still enforces the lower limit that is the maximum packet size of all enabled link layer protocols.  But this new option permits the loopback packet size to be increased from that.

    * net/Kconfig:  Adds CONFIG_NET_LOOPBACK_PKTSIZE option
    * include/nuttx/net/netconfig.h:  Assures that the packet size that is used is at least as large as the largest packet size of other link layer protocols.
    * drivers/net/loopback.c:  Use that larger packet size.
    * boards/sim/sim/sim/configs/tcploop/defconfig:  Set the loopback packet size to 1500
2020-02-10 22:17:32 -03:00
Gregory Nutt
10721c0826 Kconfig: Move the ARCH_PHY_INTERRUPT option to net/Kconfig and make it
unconditionally selectable.
2020-02-09 00:55:41 +00:00
liuhaitao
5f7a797e89 net/igmp/igmp.h: include <nuttx/semaphore.h> to fix build break
Build nucleo-144/f767-netnsh fail with below error:
In file included from igmp/igmp_initialize.c:54:
./igmp/igmp.h:130:3: error: unknown type name 'sem_t'
  130 |   sem_t                sem;     /* Used to wait for message transmission */
      |   ^~~~~
make[1]: *** [igmp_initialize.o] Error 1

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-02-02 18:33:42 -08:00
Xiang Xiao
c5b1554d84 Remove NETDEV_LOOPBACK option, NET_LOOPBACK is enough 2020-02-02 08:25:06 -06:00
Xiang Xiao
2d7c072723 Remove duplicated NET_SLIP option from drivers/net/Kconfig 2020-02-02 08:24:50 -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
c1b0aa118c Remove psock_send and sockfd_socket from net/socket/socket.h
Since both is already declared in include/nuttx/net/net.h and fix other minor issue in network socket layer.
2020-01-31 13:45:15 -06:00
Xiang Xiao
0fc7668d65 sendto should always call send if to == NULL || tolen <= 0
Since UDP socket may bind the target with connect call
2020-01-31 13:45:15 -06:00
Xiang Xiao
7e67add999 Implment SO_ACCEPTCONN 2020-01-31 13:45:15 -06:00