nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

mm/iob: add iob_init method to support external buffer init as iob structure

Open zhhyu7 opened this issue 1 month ago • 4 comments

Summary

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.

Impact

Added an IOB allocation interface, The IOB allocated by this interface can flow and be release between the protocol stack and the network card driver just like a regular IOB.

Testing

sim:matter Added test code in arch/sim/src/sim/sim_netdriver.c to use a fixed buffer list as IOB to test this interface, and both ping and iperf can communicate normally.

zhhyu7 avatar Dec 06 '25 07:12 zhhyu7

@zhhyu7 I think it requires to update the Documentation https://nuttx.apache.org/docs/latest/components/mm/index.html#i-o-buffers to include this new IOB initialization. Otherwise it will be Another Hidden Feature of NuttX (AHFN).

OK, I will update the Documentation.

zhhyu7 avatar Dec 08 '25 01:12 zhhyu7

@zhhyu7 I think it requires to update the Documentation https://nuttx.apache.org/docs/latest/components/mm/index.html#i-o-buffers to include this new IOB initialization. Otherwise it will be Another Hidden Feature of NuttX (AHFN).

@acassis Done.

zhhyu7 avatar Dec 08 '25 03:12 zhhyu7

@zhhyu7 I think it requires to update the Documentation https://nuttx.apache.org/docs/latest/components/mm/index.html#i-o-buffers to include this new IOB initialization. Otherwise it will be Another Hidden Feature of NuttX (AHFN).

@acassis could you review again?

xiaoxiang781216 avatar Dec 10 '25 15:12 xiaoxiang781216

please add a commit message and sign the change

@jerpelea The current commit message is as follows, do I need to make any changes?

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 <[email protected]>

zhhyu7 avatar Dec 12 '25 02:12 zhhyu7

@zhhyu7 I think it requires to update the Documentation https://nuttx.apache.org/docs/latest/components/mm/index.html#i-o-buffers to include this new IOB initialization. Otherwise it will be Another Hidden Feature of NuttX (AHFN).

Done.

@acassis please review again.

xiaoxiang781216 avatar Dec 20 '25 03:12 xiaoxiang781216