anchao commented on code in PR #21031:
URL: https://github.com/apache/nuttx/pull/21031#discussion_r4396612388
##########
net/udp/udp_callback.c:
##########
@@ -166,27 +176,9 @@ static uint16_t udp_datahandler(FAR struct net_driver_s
*dev,
goto errout;
}
- offset -= sizeof(src_addr_size);
Review Comment:
The benefit is to reduce repeated IOB-chain operations. The metadata fields
are small, but each iob_trycopyin()/iob_copyout() still validates offsets and
walks the IOB chain to reach the target offset. Packing the fixed-size metadata
into a small stack buffer lets us copy it into/out of the IOB chain with one
call
instead of several small calls. The extra local memcpy is cheap compared
with repeating the IOB-chain copy path.
--
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]