zhhyu7 opened a new pull request, #22332:
URL: https://github.com/apache/nuttx/pull/22332
## Summary
`net_bufpool` and `mm/mempool` are two implementations of the same thing: a
pool of fixed-size blocks over a free list, with a preallocated array,
optional dynamic expansion and a blocking allocation with a timeout.
`mempool` has since gained `mempool_zallocate()`, which was the only piece
the `net_bufpool` users still needed, so the duplicate can be removed.
This moves the three remaining users (`net/can/can_raw.c`,
`net/can/can_isotp.c`, `net/can/can_bufpool.c`) to `mempool` and deletes
`net/utils/net_bufpool.c` together with its macros, its `struct
net_bufpool_s` and its prototypes in `net/utils/utils.h`. After this patch
there is no `net_bufpool` left in the tree.
depends-on: https://github.com/apache/nuttx-apps/pull/4142
## Impact
No functional change intended, and no change to any Kconfig option or
default. The pool sizes stay bound to the same
`CONFIG_NET_CAN_PREALLOC_CONNS` / `_ALLOC_CONNS` / `_MAX_CONNS` /
`CONFIG_NET_CAN_NBUFFERS` settings as before.
`net_bufpool` was internal to `net/`: the macros and the `net_bufpool_*()`
functions were declared in the private `net/utils/utils.h`, never in
`include/`. The three files changed here are the only users in nuttx.
There was one more user in nuttx-apps, `testing/nettest/others/
test_others_bufpool.c`, which reached into `net/utils/utils.h` through
`-I$(TOPDIR)/net`. It is removed by the nuttx-apps PR this one depends on,
and that one has to merge first: with the test still in place, any
configuration with `CONFIG_TESTING_NET_OTHERS=y` fails to build once
`net_bufpool` is gone.
`NET_BUFPOOL_TEST()` has no entry in the table above because that test was
its only user anywhere; `mempool_navail() > 0` is the equivalent, so no new
mempool API is needed.
Out-of-tree code that includes `net/utils/utils.h` and calls these macros
has to move to `mempool` as well; the table above plus `NET_BUFPOOL_TEST()`
is the whole mapping. `git grep` in `Documentation/` finds no mention of
`net_bufpool` outside two release-note entries.
Diffstat: 7 files changed, 23 insertions(+), 450 deletions(-).
## Testing
Host: Linux x86_64, sim. Config: sim:dynconns with CONFIG_SIM_NET_BRIDGE=y,
CONFIG_NET_CAN disabled, NET_IPv4/IPv6, NET_TCP, NET_UDP, NET_ICMP,
NET_IPFRAG, NET_IPFORWARD and NET_ROUTE enabled, DEBUG_ASSERTIONS=y,
IOB_NBUFFERS=256, IOB_BUFSIZE=1536.
This patch changes no code outside net/can except dropping net_bufpool.c
from the net/utils build (Make.defs and CMakeLists.txt). No code outside
net/can used NET_BUFPOOL_*, which was checked with git grep. The runs
below are regression checks of the non-CAN network paths with CAN
disabled. They do not exercise the replaced code.
Build: sim builds and links cleanly. The only warnings are a
-Wstringop-overread note in tcp_send.c and a #warning in
bluetooth/bt_queue.h, both in files this patch does not touch.
Runtime (sim, host bridge nuttx0 10.0.1.1/24, target 10.0.1.2/24):
ping -c 4 4/4 received, 0% loss
TCP echo, 4 conns x 256 KiB sent=262144 recv=262144 on all 4
UDP server, 256 x 96 B datagrams all 256 received, payload and
offset checks passed
ping -f -c 500 500/500 received
ping -c 20 -s 4000 (fragmented) 20/20 received
ping -c 10 -s 8000 (fragmented) 10/10 received
ping -f -c 200 -s 4000 200/200 received
No assertion or crash, sim still alive after the runs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]