Commit Graph

2368 Commits

Author SHA1 Message Date
ligd a498995a30 rpmgs_socket: set RPMSG_SOCKET_NAME_SIZE to 16 for handing prefix
Change-Id: I88dbb6a47f3ea8fc186f52c5966ff0dd4dd12b5b
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-10-18 23:36:14 +08:00
ligd c248a5c3ef local_socket: recv should return 0 NOT -ECONNRESET if remote closed
ref:
https://man7.org/linux/man-pages/man2/recv.2.html

Change-Id: Ic6f2d289eed7599d15049354b6bdb853ebc3834d
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-10-18 23:36:14 +08:00
liuhaitao 8637e2a550 Merge remote-tracking branch 'remotes/mirtos/dev-nuttx-10.1-20210927' into dev
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Change-Id: If5a0166dbc7c9a595db9b7758cbacaf6af278d5d
2021-10-18 22:12:06 +08:00
ligd 5e47a24aba local_socket: set lc_peer when accept() instead of connect()
Change-Id: I878fb7c3dc165c1a0d969955cae818ecbcff155d
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-10-18 21:49:14 +08:00
ligd b6e357eccf socket_rpmsg: support SOCK_SEQPACKET
Change-Id: Ib7d80210285386cb10de35400b3cd6d2854f5503
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-10-09 15:31:36 +08:00
Jiuzhu Dong 4a7cdc93c3 net: always compile listen.c and accept.c when enable CONFIG_NET
N/A

Change-Id: Iefb46bac2c7322b44b8b1ae410db66d072703351
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-10-09 12:15:06 +08:00
ligd d5e4ed61ea rpmsg_socket: move rpmsg_send out of lock
Change-Id: I19a4d12979016de7bb254c4bd0309c80ce339769
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-09-28 14:17:42 +08:00
chao.an f2e15a47de net/local: set the filep to peer on stream mode
Change-Id: I2e0b8f31bcd3c1c238f1b18456416678d5deae1e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-27 17:03:46 +08:00
liuhaitao 999fe1f9f8 Merge remote-tracking branch 'mirtos/master' into dev
Last commit id:
commit 649f99ce30 (mirtos/master)
Author: FASTSHIFT <vifextech@foxmail.com>
Date:   Wed Sep 22 15:38:43 2021 +0800

    libc/misc: add lib_glob.

    Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Change-Id: I2f584a4432f835c661e3c02cf7324d5e92e9c738
2021-09-26 21:59:56 +08:00
chao.an 1b5d6aa068 net/local: add socket message control support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-24 08:09:28 -07:00
chao.an ea82a0b638 net/local: add local_peerconn helper
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-24 08:09:28 -07:00
chao.an 1e078795fb net/local: split the waiter node from lc_node
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-24 08:09:28 -07:00
chao.an 1ba922a826 net/local: replace the listener list to global
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-24 08:09:28 -07:00
chao.an c132e5bed4 net/tcp: sanity check for the listen address
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 23:07:57 -07:00
chao.an 5a2510d48d net/dup: only start tcp monitor on INET domain
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 19:02:03 -07:00
chao.an 538ef4f6d5 net/tcp: sanity check for the listen address
Change-Id: Idb6ce5b5cc22aa3b2586bcf1c0abe0268f136b51
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 15:57:55 +08:00
chao.an 3c67a53f7d net/local: add socket message control support
Change-Id: I95350fdff292dbf1b4132f7a98a6454068ef6173
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 11:31:58 +08:00
chao.an b834ed9bd8 net/dup: only start tcp monitor on INET domain
Change-Id: Ic36a26190aa9c2d9f6418787e012ea26261abc8f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 11:31:58 +08:00
chao.an 69463373a4 Revert "net/local: bypass the message field to support SCM further"
This reverts commit 2394394401.

Change-Id: Ia13bc67c4181e0e7cd06a875c0516a2c2c627315
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-22 22:14:40 +08:00
Alexander Lunev a72c10cb55 net/devif/devif_callback.c: made the connection event list doubly linked.
The resulting time complexities are as follows:
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(1) (i.e. O(n) to empty the whole list).
* devif_conn_event() time complexity is O(n).

Change-Id: Id43218407bfd67659bbf5daf40b1d096ea201e45
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-22 19:31:02 +08:00
Alexander Lunev eafe6e50ac net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.

Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
  and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
  It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
  while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
  and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).

Change-Id: I1123657f9a591b29f2a7546691d58dff58896a18
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-22 19:30:52 +08:00
Alexander Lunev 4ac7945676 net/devif/devif_callback.c: made the connection event list doubly linked.
The resulting time complexities are as follows:
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(1) (i.e. O(n) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-09-21 03:51:06 -07:00
Alexander Lunev 36fbedcbfc net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.

Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
  and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
  It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
  while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
  and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-09-18 21:01:39 -05:00
Gregory Nutt 04c9079954 Back in 2007, an early network implementation was developed for NuttX. This early development was inspired largely by uIP 1.0 and recognition of that was noted in the then BSD license headers. Over the next 14 years, a new, much more advanced, original network was developed for NuttX. However, some references to Adam Dunkels were still present in the file headers.
Because of this, it will take some time to detangle the licensing under net/.  Many new features, original features were added to the NuttX network.  Clearly, any references to Adam Dunkels in the files that implement these new features that have no counterpart in uIP 1.0 are errors.

This PR removes the references and converts the license headers to Apache 2.0 where possible.  The affected files include only (1) the implementation of IPv6 (including neighbor support under ICMPv6) and (2) Raw sockets.  Neither of these features are present in uIP 1.0 and the licenses can be freely updated.
2021-09-17 21:49:44 -05:00
chao.an 358e387d8a net/local: split the waiter node from lc_node
Change-Id: I5b052aa34bf9c37dcfd948d24875454467ed8af5
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-16 17:42:05 +08:00
Jiuzhu Dong e2c717d1fd net: limit NET_NACTIVESOCKETS to 4 when enable DEFAULT_SMALL
Change-Id: Iac28b59227f84c4df0d81d75f34aabad39191f5b
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-16 10:50:24 +08:00
chao.an 32ea5aa887 net/local: replace the listener list to global
Change-Id: Id4700fddeea27a2a86cca2e4aa6284424b53ec4d
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 23:20:57 +08:00
chao.an 2394394401 net/local: bypass the message field to support SCM further
Change-Id: I51028036db049788d7db4289e26821a3bf1e1dd0
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 23:08:30 +08:00
chao.an 09a752e602 net/local: add local_peerconn helper
Change-Id: I2cbceb68f709c581bc0b878844dd16efcd76d4a7
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 22:04:12 +08:00
Alin Jerpelea 91a5f90a7f author: UVC Ingenieure : update licenses to Apache
Gregory Nutt has submitted the SGA
UVC Ingenieure has submitted the SGA
Max Holtzberg has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-09-15 15:57:55 +08:00
chao.an b991b75e87 net/local: add FIONSPACE support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 12:11:32 +08:00
chao.an e10b546006 net/udp: fix buffer release handling on failed buffer alloc
Attempt to release write buffer on failed UDP write I/O buffer
alloc and tryalloc failed to wrb->wb_iob assertion.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 12:03:21 +08:00
chao.an ad480a31bd net/local_recvmsg: remove unused return
Change-Id: I4c3b9a17a36fbb1aba84ebfb96bbe5920d03ddf5
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-13 18:04:47 +08:00
Jiuzhu Dong ce4b79d554 rpmsg_socket: add prefix "rpmsg-socket" for the name of rpmsg endpoint
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-12 11:32:05 +08:00
chao.an f70bc7c5f1 net/local: add FIONSPACE support
Change-Id: Ib96079c6ef7fe3df60ee9f83330b6ed55718bc5f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-09 20:02:04 +08:00
Jiuzhu Dong 04b3a17662 rpmsg_socket: add prefix "rpmsg-socket" for the name of rpmsg endpoint
Change-Id: If731fb8df651986d944ccbb4f0ba9862b7164676
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-09 16:56:49 +08:00
Masayuki Ishikawa 3330543fe6 net: utils: Remove critical section for SMP in net_lock.c
Summary:
- The critical section was added in Mar 2018 to improve
  stability in SMP mode
- However, I noticed that this critical section is no longer
  needed

Impact:
- None

Testing:
- Tested with spresense:wifi_smp and spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-09-06 14:57:08 +08:00
chao.an 3a0885bafc net/udp: fix buffer release handling on failed buffer alloc
Attempt to release write buffer on failed UDP write I/O buffer
alloc and tryalloc failed to wrb->wb_iob assertion.

Change-Id: Ic77c148c55ded7871d179e321c57bba5ca8e4112
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-30 21:50:57 +08:00
buyuer 001eb7786b net/local: Return the partial write size.
Signed-off-by: buyuer <dingddding@163.com>
2021-08-26 13:28:11 +08:00
丁欣童 07283dffc3 net/local: Return the partial write size
N/A

Fix up that local socket will be endless loop when write data size more
than the fifo size.

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I69d63b7b156f0714333e7103bb266b7fcb1adf03
2021-08-26 10:20:13 +08:00
YAMAMOTO Takashi 95db8bb14f tcp_send_buffered.c: Fix snd_wnd
snd_wnd is an offset from the acked sequence number.
2021-08-25 21:15:14 +08:00
YAMAMOTO Takashi 3f15cd59e8 tcp_input: snd_wnd processing
* Do not accept the window in old segments.
  Implement SND.WL1/WL2 things in the RFC.

* Do not accept the window in the segment w/o ACK bit set.
  The window is an offset from the ack seq.
  (maybe it's simpler to just drop segments w/o ACK though)

* Subtract snd_wnd by the amount of the ack advancement.
2021-08-25 21:15:14 +08:00
YAMAMOTO Takashi 42f1851ca6 tcp_send_buffered.c: Fix snd_wnd
snd_wnd is an offset from the acked sequence number.
2021-08-25 20:56:05 +08:00
YAMAMOTO Takashi 1b82f1c749 tcp_input: snd_wnd processing
* Do not accept the window in old segments.
  Implement SND.WL1/WL2 things in the RFC.

* Do not accept the window in the segment w/o ACK bit set.
  The window is an offset from the ack seq.
  (maybe it's simpler to just drop segments w/o ACK though)

* Subtract snd_wnd by the amount of the ack advancement.
2021-08-25 20:56:05 +08:00
chao.an efaf72a1b1 net/local: correct the return length of sendmsg
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-21 14:59:59 +08:00
chao.an 7c9d73e862 net/local: correct the nonblock send return value
Change-Id: I77b561d748ebb603e275d2fb38c0638093bb1214
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-20 21:40:25 +08:00
chao.an c19edbd08e net/rpmsg: add nonblock connect(2) support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-19 22:25:44 -07:00
chao.an 498830d3f4 net/rpmsg: fix typo in comment
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-19 22:25:44 -07:00
chao.an afef9c2044 net/rpmsg: move the sync handshark to ns_bind callback
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-19 22:25:44 -07:00
chao.an 64e95dc1f5 net/rpmsg: simplify the socket timeout of connect
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-19 22:25:44 -07:00