Commit Graph

48081 Commits

Author SHA1 Message Date
zhanghongyu
3e4e416786 tcp/udp_connect: If the remote addr is ANY, change it to LOOPBACK
Behavior alignment to Linux

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-29 13:46:43 +08:00
chao an
85a8249821 Revert "socket:return -EAGAIN if timeout happends in psock_tcp_send"
This reverts commit fbe641a916.

This issue already fixed by below change:

| commit 715785245c
| Author: chao an <anchao@xiaomi.com>
| Date:   Mon Jan 16 12:37:44 2023 +0800
|
|     net/tcp: fix potential busy loop in tcp_send_buffered.c
|
|     if the wrbuffer does not have enough space to send the rest of
|     the data, then the send function will loop infinitely in nonblock
|     mode, add send timeout check to avoid this issue.
|
|     Signed-off-by: chao an <anchao@xiaomi.com>

Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-29 13:46:01 +08:00
zhanghongyu
26286fd19e tcp: modify errno when connect raddr is ANY for ltp
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-29 13:45:49 +08:00
zhanghongyu
65e08b750c tcp_reset: check the conn is exist when tcp_reset
tcp_input:
If we didn't find an active connection that expected the packet,
If the SYN flag isn't set,
It is an old packet and we send a RST.
conn is NULL when this case

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-29 13:43:44 +08:00
梁超众
5012195bde support ipv4 ToS and ipv6 TrafficClass
Signed-off-by: 梁超众 <liangchaozhong@xiaomi.com>
2023-01-29 13:43:44 +08:00
梁超众
5e0af0ecfd add UDP compile option to avoid build error
The following build error happens when CONFIG_NET_IPv6 is enabled and CONFIG_NET_UDP is not enabled.

inet/ipv6_setsockopt.c:132:19: error: invalid use of undefined type 'struct udp_conn_s'
132 |               conn->flags |= _UDP_FLAG_PKTINFO;
|                   ^~
  inet/ipv6_setsockopt.c:132:30: error: '_UDP_FLAG_PKTINFO' undeclared (first use in this function)
    132 |               conn->flags |= _UDP_FLAG_PKTINFO;
        |                              ^~~~~~~~~~~~~~~~~
  inet/ipv6_setsockopt.c:132:30: note: each undeclared identifier is reported only once for each function it appears in
  inet/ipv6_setsockopt.c:136:19: error: invalid use of undefined type 'struct udp_conn_s'
    136 |               conn->flags &= ~_UDP_FLAG_PKTINFO;

Signed-off-by: 梁超众 <liangchaozhong@xiaomi.com>
2023-01-29 13:43:44 +08:00
Alan Carvalho de Assis
8564b49469 doc: Add USB RNDIS tutorial to documentation. 2023-01-29 10:09:13 +08:00
zhanghongyu
1857a4a3c8 udp: Ipv4/6 can be bound to the same port
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-28 23:28:33 +02:00
yintao
82e2e4124a net/local_connect:Align the returned error code with Linux
When using PIPE connect to a file, ENOTSOCK or ECONNREFUSED should be returned
and when using PIPE connect to invalid pipe name, ENOENT should be returned in libuv

Signed-off-by: yintao <yintao@xiaomi.com>
2023-01-28 23:27:58 +02:00
zhanghongyu
86d602f734 tcp_netpoll: add assert into tcp_pollsetup when pollinfo invalid
In order to expose similar problems quickly in the future

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-28 23:27:14 +02:00
anjiahao
fcdc7afcb5 libc:lib_psfa_dddup2,add return check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-28 23:23:47 +02:00
ligd
367fa640c1 asctime_r: add param check to asctime_r() 2023-01-28 23:23:12 +02:00
dongjiuzhu1
a161800214 mm/mm_heap: do this check in mm_size2ndx
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-28 23:22:20 +02:00
chao.an
ac8918345b mm/kasan: bypass link-time optimizer
To avoid lto alias with override __asan_* symbols

undefined reference to `__asan_load4_noabort'
undefined reference to `__asan_load1_noabort'
undefined reference to `__asan_store1_noabort'
undefined reference to `__asan_load1_noabort'
undefined reference to `__asan_store1_noabort'
undefined reference to `__asan_load4_noabort'
undefined reference to `__asan_store4_noabort'

Signed-off-by: chao.an <anchao@xiaomi.com>
2023-01-28 23:21:02 +02:00
zhangchengqi
76bdfcc9d9 include/nuttx/timers/pwm: Add user provided argument in struct pwm_info_s
Here is a case how to use arg:
If application need do the ADC conversion as the same frequency and phase
of PWM, he can pass a semaphore as arg and then PWM driver will post the
semaphore in he start point of every period.

Signed-off-by: zhangchengqi <zhangchengqi@xiaomi.com>
2023-01-28 19:55:46 +02:00
xueyanhong
be90b8a385 motor: Add calibration and selftest
Signed-off-by: xueyanhong <xueyanhong@xiaomi.com>
2023-01-28 19:54:35 +02:00
xueyanhong
b88160084e motor: Add pattern control mode
Signed-off-by: xueyanhong <xueyanhong@xiaomi.com>
2023-01-28 19:54:35 +02:00
Xiang Xiao
7d66a16c53 Minor style clean up
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 19:53:20 +02:00
chao an
94db8a9414 wireless/ieee80211: update ieee80211 header
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-29 00:34:26 +08:00
Jukka Laitinen
7d54d04613 arch/arm/src/stm32f7/stm32_i2c.c: Round up stm32_i2c_toticks return value
When sending small number of bytes with larger CONFIG_USEC_PER_TICK
this function should return at least 1. Solve this by rounding
up the result.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-28 12:11:33 -03:00
chao an
d96189ce26 tools/version: generate dummy version without breakout
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-28 12:10:15 -03:00
Xiang Xiao
c137abf4b0 drivers/wireless: Remove the duplicated bc_bifup check from bcmf_wl_auth_event_handler
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 11:31:28 -03:00
Xiang Xiao
964a41283c arm/tlsr82: Fix warning: "IC_TAG_CACHE_ADDR_EQU_EN" is not defined
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 11:30:33 -03:00
Xiang Xiao
adc8cfc2be boards/tlsr82: Enable CONFIG_LIBM since the toolchain doesn't provide libm
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 11:30:33 -03:00
chao an
45e4bc5f33 sched/semaphore: correct the return value of sem_post()
sem_post() should return EOVERFLOW if maximum allowable value for
a semaphore would be exceeded.

Reference:
https://man7.org/linux/man-pages/man3/sem_post.3.html

Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-28 21:45:10 +09:00
chao an
b9d70365a1 sched/wqueue: semaphore count should be consistent with the number of work entries.
The number of work entries will be inconsistent with semaphore count
if the work is canceled, in extreme case, semaphore count will overflow
and fallback to 0 the workqueue will stop scheduling the enqueue work.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-28 21:45:10 +09:00
zhangyuan21
8c52633bd0 fs: unlock tmpfs before free the file object
tcb will hold an invalid semaphore when CONFIG_PRIORITY_INHERITANCE is enabled

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-28 19:35:45 +08:00
liangchaozhong
7e80879f88 usrsock: Output the log if usrsock_request return error
Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2023-01-28 16:27:21 +09:00
liangchaozhong
cc940e8f69 net_lock:fix deadlock issue when running iperf tx test on usrsock
Issue Description:
deadlock happens when runnging iperf TCP tx on usrsock with the
following commands:
device command: iperf2 -c <PC IP address> -u -i 1 -p 1122  -t 10
PC command: iperf -s -u -i 1 -p 1122

iperf's thread holds net_lock before call usrsock_setup_request_callback
and waits for conn->resp.sem by calling
nxsem_wait_uninterruptible(&conn->resp.sem), while conn->resp.sem
can only be signaled in usrsock_response, who is waiting for net_lock in
tptun's thread.

Solution:
call net_lockedwait_uninterruptible to make sure net_lock can be
released when conn->resp.sem is not available.

Here's the backtrace:
up_block_task
nuttx/arch/arm/src/common/arm_blocktask.c:151
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:185 (discriminator 2)
nxsem_wait_uninterruptible
nuttx/sched/semaphore/sem_wait.c:223 (discriminator 1)
usrsock_setup_request_callback
nuttx/net/usrsock/usrsock_conn.c:228
usrsock_setup_data_request_callback
nuttx/net/usrsock/usrsock_conn.c:257
usrsock_getsockopt
nuttx/net/usrsock/usrsock_getsockopt.c:202
psock_getsockopt
nuttx/net/socket/getsockopt.c:448
getsockopt
nuttx/net/socket/getsockopt.c:515
getsock_tcp_windowsize
external/iperf2/iperf2/src/tcp_window_size.c:165
reporter_reportsettings
external/iperf2/iperf2/src/ReportDefault.c:384
reporter_print
external/iperf2/iperf2/src/Reporter.c:1402
reporter_process_report
external/iperf2/iperf2/src/Reporter.c:860
reporter_process_report
external/iperf2/iperf2/src/Reporter.c:828
reporter_spawn
external/iperf2/iperf2/src/Reporter.c:720
thread_run_wrapper
external/iperf2/iperf2/compat/Thread.c:270
pthread_startup
nuttx/libs/libc/pthread/pthread_create.c:59 (discriminator 2)
pthread_start
nuttx/sched/pthread/pthread_create.c:182 (discriminator 4)

up_block_task
nuttx/arch/arm/src/common/arm_blocktask.c:151
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:185 (discriminator 2)
sem_wait
nuttx/sched/semaphore/sem_wait.c:271
nxmutex_lock
nuttx/include/nuttx/mutex.h:165
nxrmutex_lock
nuttx/include/nuttx/mutex.h:369
usrsock_handle_req_response
nuttx/net/usrsock/usrsock_devif.c:466
usrsockdev_write
nuttx/drivers/usrsock/usrsock_dev.c:304
file_write
nuttx/fs/vfs/fs_write.c:90
usrsock_rpmsg_default_handler
apps/netutils/usrsock_rpmsg/usrsock_rpmsg_client.c:137
rpmsg_virtio_rx_callback
nuttx/openamp/open-amp/lib/rpmsg/rpmsg_virtio.c:371
virtqueue_notification
nuttx/openamp/open-amp/lib/virtio/virtqueue.c:706
rproc_virtio_notified
nuttx/openamp/open-amp/lib/remoteproc/remoteproc_virtio.c:337 (discriminator 2)
remoteproc_get_notification
nuttx/openamp/open-amp/lib/remoteproc/remoteproc.c:999
rptun_worker
nuttx/drivers/rptun/rptun.c:333
rptun_thread
nuttx/drivers/rptun/rptun.c:364 (discriminator 1)
nxtask_start
nuttx/sched/task/task_start.c:144

Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2023-01-28 16:27:21 +09:00
yintao
beec3e4d80 fix run ltp_interfaces_sched_setscheduler_17_1 fail
The policy has changed when sched_setscheduler called invalid args.

Signed-off-by: yintao <yintao@xiaomi.com>
2023-01-28 09:10:23 +02:00
Xiang Xiao
69da13c86d sched/signal: Fix typo error in Kconfig(SIG_SEGA->SIG_SEGV)
Made by https://github.com/apache/nuttx/pull/8286

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 09:07:23 +02:00
haopengxiang
fc81bb8b36 nuttx: increase MAX_BUFFER to 10240 for CI build
01:28:16  ERROR: CFLAG string is too long [8194/8192]: '-nostdinc++' '-fno-exceptions' '-fcheck-new' '-std=c++17' '-pipe' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '-fstack-protector-all' '-mthumb' '-Wa,-mthumb' '-Wa,-mimplicit-it=always' '-fno-common' '-Wall' '-Wshadow' '-Wundef' '-ffunction-sections' '-fdata-sections' '-g' '-mlittle-endian' '-march=armv8-m.main+dsp' '-mtune=cortex-m33' '-mfpu=fpv5-sp-d16' '-mfloat-abi=hard' '-isystem' '/home/work/ssd1/workspace/MiRTOS-Dev-Daily-Build/out/86v1/ap_test/.unionfs/nuttx/include/libcxx' '-isystem' '/home/work/ssd1/workspace/MiRTOS-Dev-Daily-Build/out/86v1/ap_test/.unionfs/nuttx/include' '-D__NuttX__' '-D__KERNEL__' '-Wno-cpp' '-I' '/home/work/ssd1/workspace/MiRTOS-Dev-Daily-Build/out/86v1/ap_test/.unionfs/apps/crypto' '-I' '/home/work/ssd1/workspace/MiRTOS-Dev-Daily-Build/out/86v1/ap_test/.unionfs/apps/crypto/mbedtls/mbedtls/include' '-I' '/home/work/ssd1/workspace/MiRTOS-Dev-Daily-Build/out/86v1/ap_test/.unionfs/apps/system/uorb/' '-I' '/home/work/ssd1/workspace/MiRTOS-Dev-Daily-Build/out/86v1/ap_test/.unionfs/apps/system/libuv/libuv/include' '-I'

Signed-off-by: haopengxiang <haopengxiang@xiaomi.com>
2023-01-28 09:05:06 +02:00
nietingting
5d45ec6d03 update MAX_SHQUOTE to 4096
Signed-off-by: nietingting <nietingting@xiaomi.com>
2023-01-28 09:05:06 +02:00
zhanghongyu
99c2d2009a udp: remove DEBUGASSERT for ip6_is_ipv4addr
fix build break if enable CONFIG_NET_IPv6 only

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-28 09:04:29 +02:00
zhanghongyu
c1521b2ef2 tcp: add TCP_ACKDATA flag to close event callback
The close package cannot be sent in time without TCP_ACKDATA

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-28 09:02:42 +02:00
zhanghongyu
3725fe28fb tcp: fix trans data error when fast retrans
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-28 09:02:14 +02:00
anjiahao
ed89d7252b minidumpserver: add arm-a support
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-28 09:00:59 +02:00
liangchaozhong
fbe641a916 socket:return -EAGAIN if timeout happends in psock_tcp_send
psock_tcp_send will enter busyloop state when no IOB keeps at unavailable state
when the socket is blocking socket and this will cause WDT.
According to socket's manpage, -1 should be returned while errno set to EAGAIN
if send/recv timeout was set.

Here's the description:
SO_RCVTIMEO and SO_SNDTIMEO
Specify the receiving or sending timeouts until reporting an error. The argument is a struct timeval. If an input or output function blocks for this period of time, and data has been sent or received, the return value of that function will be the amount of data transferred; if no data has been transferred and the timeout has been reached then -1 is returned with errno set to EAGAIN or EWOULDBLOCK, or EINPROGRESS (for connect(2)) just as if the socket was specified to be nonblocking. If the timeout is set to zero (the default) then the operation will never timeout. Timeouts only have effect for system calls that perform socket I/O (e.g., read(2), recvmsg(2), send(2), sendmsg(2)); timeouts have no effect for select(2), poll(2), epoll_wait(2), and so on.

Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2023-01-28 08:06:57 +02:00
Peter Bee
fa17262e5d Doc/rp2040: fix typo
Missing blank line in waveshare-rp2040-lcd-1.28

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2023-01-28 13:19:16 +08:00
anjiahao
287467b81b netdb: Add return check in rexec_af
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-27 15:31:28 -03:00
dongjiuzhu1
f325ed7180 sys/epool.h: add EPOLLET (edge-triggered) flag to fix compile break
dbus/dbus/dbus-pollable-set-epoll.c:258:18: error: ‘EPOLLET’ undeclared
(first use in this function); did you mean ‘EPOLLERR’?
  258 |   event.events = EPOLLET;
      |                  ^~~~~~~
      |                  EPOLLERR

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-27 15:30:55 -03:00
Xiang Xiao
ac3a667860 Fix chip/intel64_handlers.c:136: error: "SIGFPE" redefined [-Werror]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-27 13:21:49 -03:00
dongjiuzhu1
937bb44c45 signal: add marco _NSIG
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-27 13:21:49 -03:00
yintao
739be67744 sched: Add SIGFPE, SIGILL and SIGSEGV definition
Signed-off-by: yintao <yintao@xiaomi.com>
2023-01-27 13:21:49 -03:00
Ville Juven
42d0e356c2 arch/addrenv: Change group_addrenv_t to arch_addrenv_t
This is preparation for moving address environments out of the group
structure into the tcb.

Why move ? Because the group is destroyed very early in the exit phase,
but the MMU mappings are needed until the context switch to the next
process is complete. Otherwise the MMU will lose its mappings and the
system will crash.
2023-01-27 23:17:01 +08:00
David
22feaeeebb Bugfixed the SocketCAN send via setting the dev->d_len to dev->d_sndlen. The dev->d_len wouldn't be assigned otherwise. 2023-01-27 23:08:05 +08:00
Max Kriegleder
8c465a64b9 stm32h7: add lower half timer driver 2023-01-27 13:29:10 +08:00
Petro Karashchenko
8e72b07a62 nuttx: Add missing FAR and CODE
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-27 13:23:25 +08:00
Alan Carvalho de Assis
e0cb643545 Update arch/xtensa/src/esp32s3/esp32s3_rng.c
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-27 13:16:35 +08:00
Alan Carvalho de Assis
2d635be05f Update arch/xtensa/src/esp32s3/esp32s3_rng.c
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-27 13:16:35 +08:00