Commit Graph

2340 Commits

Author SHA1 Message Date
chao.an
1911ae2192 net/tcp: add interface tcp_wrbuffer_timedalloc()
add new interface to support alloc wrbuffer with timeout

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 21:27:39 +01:00
chao.an
a92d5f622e net/ioballoc: add support of alloc with timeout net_iobtimedalloc()
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 21:27:39 +01:00
chao.an
c73df52c46 net/socket: fix shadow variable
socket/setsockopt.c: In function ‘psock_socketlevel_option’:
socket/setsockopt.c:168:38: warning: declaration of ‘conn’ shadows a previous local [-Wshadow]
  168 |               FAR struct tcp_conn_s *conn;
      |                                      ^~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 17:55:16 +01:00
raiden00pl
cbbe1c661e net/can/can_recvmsg.c: fix unused variable 'conn' error 2022-02-14 10:42:01 +08:00
raiden00pl
5b678ab12e net/can/can_setsockopt.c: fix assertion, value can be NULL 2022-02-13 23:16:00 +08:00
Alexander Lunev
774994b951 net/tcp: support for FIN+ACK case in tcp send event handlers 2022-02-13 03:20:18 +08:00
chao.an
98833affd0 net/can: remove psock reference from can connect
remove the psock back reference since timestamp
has been migrated to can_conn_s

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 21:22:55 +08:00
chao.an
369f7cc451 net/rpmsg: fix the NULL pointer reference on nonblock accept
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 21:22:45 +08:00
chao.an
e749f6ca7e net/tcp/monitor: do not migrate the state to close
1. remove the unnecessary interfaces tcp_close_monitor()

socket flags(s_flags) is a global state for net connection
remove the incorrect update for stop monitor

2. do not start the tcp monitor from duplicated psock

the tcp monitor has already registered in connect callback

------------------------------------------------------------
This patch also fix the telnet issue reported by:
https://github.com/apache/incubator-nuttx/pull/5434#issuecomment-1035600651

the orignal session fd is closed after dup, the connect state
has incorrectly migrated to close:

drivers/net/telnet.c:
 977 static int telnet_session(FAR struct telnet_session_s *session)
 ...
 1031   ret = psock_dup2(psock, &priv->td_psock);
 ...
 1082   nx_close(session->ts_sd);

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 18:56:40 +09:00
chao.an
eac13a113d net/udp: remove psock hook to avoid invalid reference
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
8fb2468785 net/tcp: remove the socket hook reference from netdev callback
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
0d19a3a248 net/inet: move socket timestamp into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
9317626c32 net/inet: move socket linger into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
3fce144aeb net/inet: move recv/send timeout into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
cc6add58dc net/inet: move socket options into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
1659513edb net/inet: move socket error into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
99cde13a11 net/inet: move socket flags into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
1b0f85c5bc net/ieee802154: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
43ca28da36 net/can: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
8366c87c5b net/bluetooth: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
8f63596063 net/tcp: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
af1cf5eaae net/local: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
3d62d5106d net/local: remove duplicate assert condition
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
63173dadbb net/pkt: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
e02711e114 net/icmpv6: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
2026450333 net/udp: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
1f4de9e13c net/icmp: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
f7bf28deac net/usrsock: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
69c4f6651e net/netlink: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
39e142243d net/tcp/udp: move the send callback into tcp/udp structure
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
b16e022ead netdev/lladdrsize: remove invalid duplicate case
error:
--------------------------------------
netdev/netdev_lladdrsize.c: In function ‘netdev_lladdrsize’:
netdev/netdev_lladdrsize.c:148:7: error: duplicate case value
  148 |       case NET_LL_BLUETOOTH:
      |       ^~~~
netdev/netdev_lladdrsize.c:119:7: note: previously used here
  119 |       case NET_LL_BLUETOOTH:
      |       ^~~~

BLUETOOTH_HDRLEN has been removed by:
---------------------------------
|commit aae0d92598
|Author: Gregory Nutt <gnutt@nuttx.org>
|Date:   Sun Apr 1 15:21:58 2018 -0600
|
|wireless/bluetooth and net/bluetooth:
|
|Clean up some garbage left in Kconfig file that broke 'make menuconfig'.
|Clean up some craziness with Bluetooth frame length definitions.

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 20:08:26 +08:00
chao.an
83f8996c39 net/sixlowpan: fix compile warning
sixlowpan/sixlowpan_input.c: In function ‘sixlowpan_dispatch’:
sixlowpan/sixlowpan_input.c:629:3: warning: implicit declaration of function ‘pkt_input’;
                                   did you mean ‘ipv6_input’? [-Wimplicit-function-declaration]
  629 |   pkt_input(&radio->r_dev);
      |   ^~~~~~~~~
      |   ipv6_input

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 19:22:25 +08:00
chao.an
7480cc2835 net/devif: remove invalid NET_IPv4_REASSEMBLY definition
NET_IPv4_REASSEMBLY has been removed by:
--------------------------------------------------------
|  commit 68b526b335
|  Author: Brennan Ashton <bashton@brennanashton.com>
|  Date:   Tue Dec 1 22:59:00 2020 -0800
|
|      tcp: Remove incomplete support for TCP reassembly
--------------------------------------------------------

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 18:31:31 +08:00
Xiang Xiao
108a5004c5 net/local: Rename NET_LOCAL_PATH_PREFIX to NET_LOCAL_VFS_PATH
align with other similiar config which suffix with _VFS_PATH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-06 19:42:00 +01:00
raiden00pl
bc178344a9 net/can: add an option to control CAN EXTID support 2022-02-06 17:09:11 +08:00
chao.an
56b5ae0640 net/tcp/netdev/mld: correct the netlock handling
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-03 11:09:18 -03:00
Alexander Lunev
b2f3cefe3d sim/netdev,tapdev: implemented emulation of TX done and RX ready interrupts
and removed two tcp_send_txnotify() calls from tcp_sendfile (they are not needed anymore).

As a result, the TX throughput of both the tcp_send_buffered and tcp_send_unbuffered
is significantly boosted in case of TUN/TAP network device.
2022-01-28 18:16:42 +08:00
Alexander Lunev
2a6de301ee net/tcp: transformed NET_TCP_FAST_RETRANSMIT_WATERMARK option to boolean.
According to RFC 5681 (3.2) the TCP Fast Retransmit algorithm should start
if the threshold of 3 duplicate ACKs is reached.
Thus the threshold should be a constant, not an integer option.
2022-01-26 11:50:48 +08:00
Alexander Lunev
8be9cb9f72 net/tcp/sendfile: notify the device driver of the availability of TX data on TCP retransmission
(as well as on sending normal TCP packets).
2022-01-26 02:01:25 +08:00
Alexander Lunev
7e748e63dd net/tcp/tcp_sendfile: optimized out sendfile_txnotify() function 2022-01-26 02:01:06 +08:00
Alexander Lunev
ad25c43983 net/tcp/sendfile: fast retransmit on duplicate acknowledgments (RFC 5681).
(the same as it was implemented in tcp_send_unbuffered.c)
2022-01-25 16:30:38 +08:00
Alexander Lunev
eec94132c4 net/tcp/sendfile: removed excessive overwrites of conn->sndseq
(conn->sndseq was updated in multiple places that was unreasonable and complicated).
This optimization is the same as it was done for tcp_send_unbuffered.
2022-01-22 00:43:53 +08:00
Alexander Lunev
338b122b2b net/tcp/sendfile: fixed an issue with unackseq calculation.
Wrong unackseq calculation locked conn->tx_unacked at non-zero values
even if all ACKs were received.
This issue is the same as it was with tcp_send_unbuffered.
2022-01-22 00:42:29 +08:00
Alexander Lunev
c9e32dd4a4 tcp: fixed warning: ISO C90 forbids mixed declarations and code 2022-01-22 00:41:42 +08:00
Alexander Lunev
64dd669749 net/tcp/sendfile: retransmit only one the earliest not acknowledged segment
(according to RFC 6298 (5.4)). The issue is the same as it was in tcp_send_unbuffered.c.
2022-01-20 18:37:39 +08:00
Petro Karashchenko
08043fb5bc net: unify FAR keyword usage for all net buffer memory mapped buffers
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-20 01:42:56 +08:00
chao.an
086fb829fd net/usrsock: fix build warning
usrsock/usrsock_sockif.c:72:3: warning:
initialization of ‘int (*)(struct socket **)’ from incompatible pointer type
‘int (*)(struct socket *, int,  void *, size_t)’ {aka ‘int (*)(struct socket *, int,  void *, long unsigned int)’} [-Wincompatible-pointer-types]
   72 |   usrsock_ioctl               /* si_ioctl */
      |   ^~~~~~~~~~~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-19 12:09:53 +01:00
Alexander Lunev
6bb7a92a9a net/tcp/tcp_send*: added debug asserts for TCP_ACKDATA, TCP_REXMIT and TCP_DISCONN_EVENTS flags 2022-01-19 10:45:38 +08:00
Alexander Lunev
79e609a8c8 net/tcp/sendfile: swapped the location of TCP_DISCONN_EVENTS and TCP_ACKDATA conditions towards tcp_send_unbuffered.c unification 2022-01-19 00:13:38 +08:00
Petro Karashchenko
9551de7115 net: use HTONS, NTOHS, HTONL, NTOHL macro in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-18 10:59:47 +01:00