Commit graph

60363 commits

Author SHA1 Message Date
zhanghongyu
8ef876562e net/icmpv6: replace net_lock with conn_lock and conn_lock_dev
Protect icmpv6 resources through netdev_lock, conn_lock, and icmpv6_list_lock

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
5032377c34 net/tcp: replace net_lock with conn_lock and conn_lock_dev
Protect tcp resources through netdev_lock, conn_lock, and tcp_list_lock

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
wangchen
6196550f8f tcp:add net_lock to protect tcp resource
add net_lock in the tcp_callback_cleanup & Set the devif_callback_s of
tcp_callback_s to a two-dimensional pointer.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
02e7ed7cc4 net/can: replace net_lock with conn_lock and conn_lock_dev
Protect can resources through netdev_lock, conn_lock, and can_list_lock

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
wangjinjing1
4fa74e4d18 net/can: add write_q free for callback alloc error handling
Release the corresponding resources held when the alloc fails

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2025-12-29 09:42:18 +08:00
wangjinjing1
99584588fc net/can: modify net_unlock location before txnotify for can_sendmsg_buffered.c
Release the lock early to reduce the number of thread switches.

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2025-12-29 09:42:18 +08:00
wangjinjing1
3bd4748bc3 net/can: repair callback alloc error handling
Release the corresponding resources held when the alloc fails

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2025-12-29 09:42:18 +08:00
wangjinjing1
a22f2a6123 net/socketcan: move rx filter down to can_input;
rx filter from recvmsg down to can_input, before packet delivery;

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
1d91a15820 net/icmp: replace net_lock with conn_lock and conn_lock_dev
Protect icmp resources through netdev_lock, conn_lock, and icmp_list_lock

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
e431cb00ca net/pkt: replace net_lock with netdev_lock
protect PKT resources through netdev_lock, conn_lock, and pkt_list_lock

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
9befb8ae4a net/udp: remove net_lock
protect UDP resources through netdev_lock, conn_lock, and udp_list_lock.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
wangchen
f8ecbd781c udp:Resolve UDP exit delay due to high CPU usage
Optimize the processing logic of UDP TXDrain, reduce thread switching,
and improve timeliness and CPU consumption.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
51743c55b2 net/arp/arp_send.c: replace net_lock with netdev_lock
use netdev_lock to protect the arp process

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
eb2bd58640 net/nat: replace net_lock with nat_lock(mutex)
add a new API to protect access and operations on the NAT table

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
eb60667561 net/utils/net_lock.c: add api to lock conn and netdev
add new api to protect access and operation to conn and dev

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
0af74a54bb net/netdev: separate netdev_list_lock from net_lock
use netdev_list_lock to protect all network card traversal, registration,
and deregistration operations.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
rovinyu
906279e37a Modify `do while` Statement typo
The following should be correct sample:
do
  {
    ready = !notready();
  }
while (!ready);

senddata();

do
  {
    ptr++;
  }
while (*ptr != '\0');
2025-12-29 09:40:54 +08:00
zhanghongyu
19dcd452ff net/tcp: add kconfig to support retransmission at a fixed time
the maximum retransmission interval allowed for car projects
cannot exceed 6 seconds, and allows for fixed retransmission intervals.
according to the previous algorithm, the retransmission interval
may be 0.5 * 2 ^ 4 = 8 seconds, which does not meet the requirements.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-27 21:35:00 +08:00
zhanghongyu
746d68916f net/tcp: add support for the CLOSE_WAIT state
CLOSE-WAIT - represents waiting for a connection termination request
             from the local user.
      TCP A                                                TCP B

  1.  ESTABLISHED                                          ESTABLISHED
  2.  (Close)
      FIN-WAIT-1  --> <SEQ=100><ACK=300><CTL=FIN,ACK>  --> CLOSE-WAIT
  3.  FIN-WAIT-2  <-- <SEQ=300><ACK=101><CTL=ACK>      <-- CLOSE-WAIT
  4.                                                       (Close)
      TIME-WAIT   <-- <SEQ=300><ACK=101><CTL=FIN,ACK>  <-- LAST-ACK
  5.  TIME-WAIT   --> <SEQ=101><ACK=301><CTL=ACK>      --> CLOSED
  6.  (2 MSL)
      CLOSED

in the current state, we can continue to send data until the user
calls shutdown or close, then directly enter the TCP_LAST_ACK state

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-27 21:06:23 +08:00
gaohedong
292276101b net/vlan: make a judgment before calling fuction
Make a judgment before calling fuction.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-27 20:46:04 +08:00
gaohedong
5ba6d3c4eb net/udp: Validate UDP length field against actual packet size
According to RFC768 page 2, length feild is the length  in octets  of this user datagram  including  this header  and the data.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-27 20:44:52 +08:00
Matteo Golin
18a5ec8410 docs/testing/nuts: Include preliminary documentation for NUTS
Documentation for the NuttX Unit Test Selection (NUTS) app. Includes
information about the configuration options, build dependencies,
currently included test cases and how to extend the test collection with
new unit tests.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-12-27 20:43:32 +08:00
gaohedong
4d525505e4 net/udp: Support zero-length UDP datagrams
According to RFC768 page2 and referring to the Linux implementation, the message with udp length of 0 is supported.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-27 20:38:47 +08:00
gaohedong
c72ae882da net/ethernet: change struct ifreq to consistent with Linux
In order to fix compilation issue, the struct ifreq structure is modified.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-27 20:34:17 +08:00
Justin Erenkrantz
f10cf58d6b risc-v/litex: Implement up_flush_dcache_all when CONFIG_ARCH_DCACHE is defined.
This duplicates the up_invalidate_dcache_all as vexriscv's DBUS cache
does not distinguish between flushing and invalidation.

Signed-off-by: Justin Erenkrantz <justin@erenkrantz.com>
2025-12-27 07:00:29 -03:00
Laczen JMS
8896242b9d espressif: improve esp-hal-3rdparty handling
Reduce the downloads of esp-hal-3rdparty when using nxtmpdir to store
esp-hal-3rdparty and speedup compilation after `make distclean`.

Usage:
```
~/nuttxspace/nuttx/make distclean
~/nuttxspace/nuttx/./tools/configure.sh -l -S esp32-devkitc:nsh
~/nuttxspace/nuttx/make flash -j 8 ESPTOOL_PORT=/dev/ttyUSB0
~/nuttxspace/nuttx/picocom /dev/ttyUSB0 --baud 115200
```

Result:
```
load:0x40080000,len:30516
entry 0x40082880
*** Booting NuttX ***
dram: lma 0x00001020 vma 0x3ffb2020 len 0xe30    (3632)
iram: lma 0x00001e58 vma 0x40080000 len 0x7734   (30516)
padd: lma 0x00009598 vma 0x00000000 len 0x6a60   (27232)
imap: lma 0x00010000 vma 0x400e0000 len 0x11e50  (73296)
padd: lma 0x00021e58 vma 0x00000000 len 0xe1a0   (57760)
dmap: lma 0x00030000 vma 0x3f410000 len 0x2d3c   (11580)
total segments stored 6
WARNING: NuttX supports ESP32 chip revision >= v3.0 (chip is v1.0).
Ignoring this error and continuing because `ESP32_IGNORE_CHIP_REVISION_CHECK` is set...
THIS MAY NOT WORK! DON'T USE THIS CHIP IN PRODUCTION!

NuttShell (NSH) NuttX-12.8.0
nsh> uname -a
NuttX 12.8.0 edf89ddedd-dirty Dec 22 2025 09:21:37 xtensa esp32-devkitc
nsh>
Terminating...
```

Any new `make distclean` and configure for a different espressif device
no longer requires the downloading of modules or patching.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-12-27 11:38:13 +08:00
gaohedong
44bc5ed635 net/vlan: add some macro for vlan
Refer:
https://github.com/torvalds/linux/blob/v6.8/include/linux/if_vlan.h#L73-L76

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-27 11:36:39 +08:00
gaohedong
3f553999da com/can: attempt to release invalid resources when sender is full
Attempt to release invalid resources when sender is full.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-26 22:23:18 +08:00
wangchengdong
ae59225898 arch/tricore: enable CONFIG_SYSTEM_TIME64 for TC397
Enable CONFIG_SYSTEM_TIME64 for tricore/TC397, as this platform uses a 64-bit timer.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-12-26 21:35:14 +08:00
Alin Jerpelea
4a069358b6 LICENSE: update NuttX-PublicDomain SPDX identifier
According to the feedback from SPDX community we should use
LicenseRef-NuttX-PublicDomain because NuttX-PublicDomain
is not a valid SPDX id, so it will fail tests for SPDX spec compliance.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2025-12-26 19:46:12 +08:00
ouyangxiangzhen
dfdbf4dcf9 sched: Simplify the timer_start/cancel in sched_timerexpiration.
This commit simplified the timer_start/cancel in sched_timerexpiration.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-12-26 11:51:38 +08:00
ouyangxiangzhen
299ece7cbe sched: Simplify the interval adjustment in nxsched_timer_start.
This commit simplified the interval adjustment in nxsched_timer_start.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-12-26 11:51:38 +08:00
chao an
6300bc5522 sched/wdog: fix race condition in wd_gettime()
Move WDOG_ISACTIVE check inside critical section protection to avoid race condition

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-12-26 11:51:02 +08:00
zhangshuai39
c44834fb92 nuttx/net: Expose the net_ipv6addr_maskcmp interface to user-mode calls
This interface needs to be called in the libc library, but the interface is implemented in the kernel, so this interface needs to be exposed

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2025-12-25 22:13:43 +08:00
zhanghongyu
6144b51848 netdev_upperhalf.c: support alloc iob from CAN buffer pool
when the network card type is NET_LL_CAN, packets are defaultly
allocated from the can buffer.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:56:12 -03:00
zhanghongyu
3e025b5a03 net/can: can protocol uses a separate buffer to cache can data
To avoid memory waste, can add support for using an independent iob buffer
The IP protocol often configures CONFIG_IOB_BUFSIZE to be relatively large,
such as 512, for higher throughput. However, the buffer required by CAN is
fixed at a length of 16 or 64. If the system's IOB is directly used,
a lot of memory will be wasted.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:56:12 -03:00
zhanghongyu
48e9b4fc7a mm/iob: limit the alignment length of IOB to no less than sizeof(uinptr_t)
avoid crashes caused by four-byte alignment issues.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:40:02 -03:00
zhangshuai39
776a6a5d0b netlib: Add IOB statistics interface description
Includes an introduction to the interface, and details about the input parameters and return values.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2025-12-25 08:37:26 -03:00
zhanghongyu
cdaf4ee653 arp_poll: skip arp_out when arp_send flow
there is no need to call arp_out again to perform layer 2 header filling
in the arp_send process, so we should directly call the driver's callback.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:36:47 -03:00
zhanghongyu
a0bd741387 mld: free all mld group when netdev unregister
otherwise, if the mld timers are not cancelled, an illegal address will
be accessed after timeout. to avoid this scenario, when the network card
is unregistered, all MLD timers must be attempted to be synchronously
cancelled.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:35:04 -03:00
zhanghongyu
c2a4899941 net/ipfrag: fix ip fragment assert when iob not enough
insufficient IOB during IP fragment is a normal scenario and should
not crash directly. The assert needs to be removed and corresponding
error handling needs to be added.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:34:01 -03:00
zhanghongyu
908596dde3 net/bufpool: fix typo
A previous spelling mistake has been detected. fix it

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:33:13 -03:00
gaohedong
07372c12ec net/icmp: fix icmp checksum bug
Use the new cheksum interface to avoid checksum errors caused by IoB discontinuity

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-25 18:09:03 +08:00
gaohedong
267df3a120 net/icmp: check the checksum field when recieve icmp message
According to RFC 792 page 4, do the icmp checksum if CONFIG_NET_ICMP_CHECKSUMS is set.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-25 18:09:03 +08:00
gaohedong
51681a6a8b net/wireless: fix compile warning
fix tasking compile warning isssue
warnning log: unused variable "IEEE802154_STATUS_STRING"

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-25 18:05:33 +08:00
wangchen
c825404a2b net/icmp: Return -ENOPROTOOPT for SOL_SOCKET to avoid misleading logs
When SOL_SOCKET options (e.g., SO_BINDTODEVICE via ping -I) hit ICMP sockets, icmp_{get,set}sockopt logged “Unrecognized ICMP option: 17” before fallback. Handle SOL_SOCKET explicitly by returning -ENOPROTOOPT so psock_* routes to the socket-level handler. Removes noisy logs without changing behavior (invalid devices still return -ENODEV).

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-25 14:09:12 +08:00
zhangshuai39
1ec63f72ac paho_mqtt: Add paho_mqtt repository description file
The description includes an introduction to paho_mqtt, configuration management, tool usage, etc.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2025-12-25 13:14:50 +08:00
gaohedong
23013b33ce net/ethernet: ARP can be configured on interface
ARP can be configured on interface.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-25 12:23:38 +08:00
zhanghongyu
6ad864ff0c mm/iob: add iob_init method to support external buffer init as iob structure
This interface allows different protocol modules to use their own unique IOB
buffer sources and allocation strategies without interfering with each other.
Representative examples are the IP protocol and the CAN protocol. The IP
protocol generally transmits packets of varying lengths and requires
relatively high peak throughput. In this case, to ensure higher performance,
IOB_BUFSIZE is often configured to be relatively large, such as greater than
500. The CAN protocol generally transmits short packets of fixed length.
In this case, to improve memory utilization, IOB_BUFSIZE is often configured
to be relatively small, such as 16 or 64. To optimize the memory utilization
when the IP protocol and the CAN protocol share the same core,
this interface was added.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 10:08:49 +08:00
wangchen
c5bb75441c net/tcp: modify the return value when dev is down in tcp_pollsetup
when dev is down, tcp_pollsetup returns the value 'OK' and sets the connection status to 'down' and eventset to POLLERR & POLLUP

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-25 10:06:49 +08:00