chao an
881c9d9fac
mm/iob: add support of partial bytes clone
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-14 21:37:20 +08:00
chao an
d6d56c3372
mm/iob: add support of nonblock iob_clone
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-14 21:37:20 +08:00
chao an
e2b00a9fcc
mm/iob: reserved bytes should be updated after each iteration
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-07 21:24:25 +08:00
Xiang Xiao
800fac05d9
mm: Change the default of MM_UBSAN_TRAP_ON_ERROR to n
...
let's give more information by default
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-06 19:01:25 +08:00
chao an
415fa25eb7
mm/ubsan: fix build warning
...
ubsan/ubsan.c: In function ‘get_signed_val’:
ubsan/ubsan.c:162:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
162 | uint64_t ret = (uint64_t)val & mask;
|
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-05 14:06:27 +08:00
chao an
34d2cde8a8
net/l2/l3/l4: add support of iob offload
...
1. Add new config CONFIG_NET_LL_GUARDSIZE to isolation of l2 stack,
which will benefit l3(IP) layer for multi-MAC(l2) implementation,
especially in some NICs such as celluler net driver.
new configuration options: CONFIG_NET_LL_GUARDSIZE
CONFIG_NET_LL_GUARDSIZE will reserved l2 buffer header size of
network buffer to isolate the L2/L3 (MAC/IP) data on network layer,
which will be beneficial to L3 network layer protocol transparent
transmission and forwarding
------------------------------------------------------------
Layout of frist iob entry:
iob_data (aligned by CONFIG_IOB_ALIGNMENT)
|
| io_offset(CONFIG_NET_LL_GUARDSIZE)
| |
-------------------------------------------------
iob | Reserved | io_len |
-------------------------------------------------
-------------------------------------------------------------
Layout of different NICs implementation:
iob_data (aligned by CONFIG_IOB_ALIGNMENT)
|
| io_offset(CONFIG_NET_LL_GUARDSIZE)
| |
-------------------------------------------------
Ethernet | Reserved | ETH_HDRLEN | io_len |
---------------------------------|---------------
8021Q | Reserved | ETH_8021Q_HDRLEN | io_len |
---------------------------------|---------------
ipforward | Reserved | io_len |
-------------------------------------------------
--------------------------------------------------------------------
2. Support iob offload to l2 driver to avoid unnecessary memory copy
Support send/receive iob vectors directly between the NICs and l3/l4
stack to avoid unnecessary memory copies, especially on hardware that
supports Scatter/gather, which can greatly improve performance.
new interface to support iob offload:
------------------------------------------
| IOB version | original |
|----------------------------------------|
| devif_iob_poll() | devif_poll() |
| ... | ... |
------------------------------------------
--------------------------------------------------------------------
1> NIC hardware support Scatter/gather transfer
TX:
tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
/ \
/ \
devif_poll_[l3|l4]_connections() devif_iob_send() (nocopy:udp/icmp/...)
/ \ (copy:tcp)
/ \
devif_iob_poll("NIC"_txpoll) callback() // "NIC"_txpoll
|
dev->d_iob: |
--------------- ---------------
io_data iob1 | | | iob3 | | |
\ --------------- ---------------
--------------- | --------------- |
iob0 | | | | iob2 | | | |
--------------- | --------------- |
\ | / /
\ | / /
----------------------------------------------
NICs io vector | | | | | | | | | |
----------------------------------------------
RX:
[tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
|
|
[tcp|udp|icmp|...]_ipv[4|6]_in()/...
|
|
pkt/ipv[4/6]_input()/...
|
|
NICs io vector receive(iov_base to each iobs)
--------------------------------------------------------------------
2> CONFIG_IOB_BUFSIZE is greater than MTU:
TX:
"(CONFIG_IOB_BUFSIZE) > (MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE + CONFIG_NET_LL_GUARDSIZE)"
tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
/ \
/ \
devif_poll_[l3|l4]_connections() devif_iob_send() (nocopy:udp/icmp/...)
/ \ (copy:tcp)
/ \
devif_iob_poll("NIC"_txpoll) callback() // "NIC"_txpoll
|
"NIC"_send()
(dev->d_iob->io_data[CONFIG_NET_LL_GUARDSIZE - NET_LL_HDRLEN(dev)])
RX:
[tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
|
|
[tcp|udp|icmp|...]_ipv[4|6]_in()/...
|
|
pkt/ipv[4/6]_input()/...
|
|
NICs io vector receive(iov_base to io_data)
--------------------------------------------------------------------
3> Compatible with all old flat buffer NICs
TX:
tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
/ \
/ \
devif_poll_[l3|l4]_connections() devif_iob_send() (nocopy:udp/icmp/...)
/ \ (copy:tcp)
/ \
devif_iob_poll(devif_poll_callback()) devif_poll_callback() /* new interface, gather iobs to flat buffer */
/ \
/ \
devif_poll("NIC"_txpoll) "NIC"_send()(dev->d_buf)
RX:
[tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
|
|
[tcp|udp|icmp|...]_ipv[4|6]_in()/...
|
|
netdev_input() /* new interface, Scatter/gather flat/iob buffer */
|
|
pkt/ipv[4|6]_input()/...
|
|
NICs io vector receive(Orignal flat buffer)
3. Iperf passthrough on NuttX simulator:
-------------------------------------------------
| Protocol | Server | Client | |
|-----------------------------------------------|
| TCP | 813 | 834 | Mbits/sec |
| TCP(Offload) | 1720 | 1100 | Mbits/sec |
| UDP | 22 | 757 | Mbits/sec |
| UDP(Offload) | 25 | 1250 | Mbits/sec |
-------------------------------------------------
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-03 11:47:04 +08:00
zouboan
eaea38e0f2
libc and mm/Makefile:Fix an error caused by backslash in Windows native build
...
libc and mm/Makefile:Fix an error caused by backslash in Windows native build
2022-12-01 01:47:46 +08:00
chao an
cdaa2ba8d4
mm/iob: new function iob_update_pktlen() to update packet length of the iob
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 13:16:23 +08:00
chao an
b452e2fddf
mm/iob: new function iob_reserve() to adjust headroom offset
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 13:16:23 +08:00
Ville Juven
39a567db20
mm/circbuf.c: Fix incorrect usage of void* arithmetics
2022-11-23 23:22:06 +08:00
wangbowen6
f7dec2c250
mm_size2ndx: using flsl to calculate the ndx
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-23 13:19:41 +08:00
Ville Juven
48b9a8d6f4
mm/shm: Move the vma allocators to separate functions
...
This will allow changing the underlying backend, i.e. granule allocator,
to something more efficient, if this is needed later.
Also, it gives easier access to the common SHM book keeping.
2022-11-22 08:54:34 +01:00
Ville Juven
458ff380e5
mm/gran: Allow run-time execution of gran_reserve
...
User can ask for specific granules to be allocated.
This is useful for one thing only: when mmap() is called for a specific
vaddr. The parameter itself is non-sensical, this is just to satisfy
the POSIX standard.
2022-11-22 08:54:34 +01:00
qinwei1
8021dfece6
sched/task/task_getpid: getpid should return process id not thread id
...
Summary:
implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id
Refer to:
https://github.com/apache/incubator-nuttx/issues/2499
https://github.com/apache/incubator-nuttx/pull/2518
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2022-11-17 17:58:08 +08:00
Ville Juven
192a639f8f
mm/shm: Fix several build errors with shm due to missing headers
2022-11-17 09:16:54 +08:00
Xiang Xiao
33dabe3c38
sim: Always enable full UBSan feature to catch more error
...
since the resource is plenty on simulator
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
d6b5a345a4
mm: Let MM_SMALL and MM_REGIONS depend on MM_DEFAULT_MANAGER
...
since these options are coupled with the default heap implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
38d1244751
mm/mempool: Remove MM_MEMPOOL option from Kconfig
...
since the linker can remove the unused object file from the final image
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
a446b5816f
mm/circbuf: Remove MM_CIRCBUF option from Kconfig
...
since the linker can remove the unused object file from the final image
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
7dcf35cf64
mm: Remove the unused macro MM_IS_ALLOCATED
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 14:57:48 +09:00
Xiang Xiao
85b4177913
mm: Remove mm_ prefix from mm_[add|free]_delaylist
...
follow the convention of other static mm functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-07 10:01:52 +01:00
Xiang Xiao
b567e09c3c
mm: Restore the return type of mm_lock from bool to int
...
Fix the issue reported here better:
https://github.com/apache/incubator-nuttx/pull/6995
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-07 10:01:52 +01:00
Xiang Xiao
4cc13c19c6
Revert "mm: Check the function result with suitable macro."
...
This reverts commit 460d94729a
.
2022-11-07 10:01:52 +01:00
yinshengkai
85f727f232
tools: replace INCDIR to Makefile variable
...
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables
In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
yinshengkai
95d9abcf58
tools: replace DEFINE script to Makefile variable
...
In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables
In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
ligd
8be4bca3eb
kasan: fix kasan race-condition
...
Change-Id: I1c729b8a85422a1f4326785e5d52cb0fc60d4822
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-03 08:58:16 +08:00
wangbowen6
fccda0c08b
mm_heap: add debug assert to check the alignment problem
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
2022-11-01 19:21:01 +08:00
Xiang Xiao
e08c296a8e
Change the type of tg_joinlock, mm_lock and md_lock from sem_t to mutex_t
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 10:35:53 +01:00
yinshengkai
65dc1fe0fc
mm: add kmm/umm_memdump
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-10-29 11:35:27 +08:00
dongjiuzhu1
579e47347e
mm/mm_heap: define MM_MASK_BIT as significant bits mask
...
using MM_MASK_BIT to expand different bits of preceding field to store the
block status.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-29 00:12:02 +08:00
dongjiuzhu1
5982cafbe0
mm/mm_heap: using LOG2_CEIL to generate MM_MIN_SHIFT at compile time
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-29 00:12:02 +08:00
dongjiuzhu1
96d8e833ed
mm/mempool: support kasan check for mempool alloc/free
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-28 21:31:35 +08:00
dongjiuzhu1
30bede7940
mm/mempool: fix bug about size mismatch and binary find
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-28 21:31:35 +08:00
dongjiuzhu1
5828e5bb88
mm/mempool: add new api: xx_realloc and xx_alloc_size
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-28 21:31:35 +08:00
dongjiuzhu1
4e179e8a85
mm/mempool: optimize alloc/free performance
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-28 21:31:35 +08:00
Jiuzhu Dong
8994c8efa2
mm/mempool: support specifying alloc and free function
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-28 21:31:35 +08:00
Jiuzhu Dong
a01f3beefd
mm/mempool: support multiple memory pool
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-10-28 21:31:35 +08:00
anjiahao
e1ca516488
use SEM_INITIALIZER inside of NXSEM_INITIALIZER
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao
5724c6b2e4
sem:remove sem default protocl
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
Xiang Xiao
b9a4bedc7f
fs/procfs: Change FS_PROCFS_EXCLUDE_xxx default value to DEFAULT_SMALL
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
anjiahao
d1d46335df
Replace nxsem API when used as a lock with nxmutex API
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Fotis Panagiotopoulos
c22c07ba29
Minor fix in UBSan.
2022-10-13 17:06:10 +02:00
Fotis Panagiotopoulos
eec7f5da00
Fixed undefined behavior in UBSan.
2022-10-13 01:40:32 +08:00
Xiang Xiao
8a265e274d
Kconfig: Remove EXPERIMENTAL for features which is been around a long time
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-19 11:39:22 -03:00
chao an
afaaa780eb
mm/ubsan: UBSan option should be turned on if SIM_UBSAN enabled
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-19 18:36:39 +08:00
Xiang Xiao
5253861e7e
mm: Fix minor style issue
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-16 15:24:49 +09:00
ligd
a1c9598fff
kasan: use init value to avoid kasan used before bss clear
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-10 10:31:16 +08:00
xiangdong6
460d94729a
mm: Check the function result with suitable macro.
...
The return value of function mm_takesemaphore will never below
than zero, DEBUGVERIFY make no effect to check it, use DEBUGASSERT
instead.
Signed-off-by: xiangdong6 <xiangdong6@xiaomi.com>
2022-09-05 21:11:01 +08:00
Huang Qi
274c085c4a
UBSan: Minor typo fix to align with other place
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-09-02 19:07:09 +08:00
Huang Qi
32a21a1b67
UBSan: Allow custom the sanitizer in Kconfig
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-09-02 19:07:09 +08:00