Attention is currently required from: laforge, pespin.
jolly has posted comments on this change by jolly. (
https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email )
Change subject: Avoid reusing pending buffer; append incoming data instead
......................................................................
Patch Set 4:
(5 comments)
Commit Message:
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/ff2050e4_17cbe464?… :
PS3, Line 17: This change ensures that newly received data is appended to the existing
First you say we don't want to reuse the pending
buffer, but here you say "This change ensures that […]
Maybe I should state
that I don't want to reuse the pending buffer for the read operation. Instead I copy
from the buffer that was used for the read operation to the pending buffer.
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/2b7b3610_96fc97ba?… :
PS3, Line 177: /*! convenience wrapper to call msgb_alloc with parameters from osmo_io_fd
(with extra size) */
"with extra size" here doesn't apply
anymore?
Done
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/d54ad17c_59b4ea84?… :
PS3, Line 178: struct msgb *iofd_msgb_alloc2(struct osmo_io_fd *iofd, size_t size)
This is probably breaking the promise that msgb passed
to the app are at least of a certain size con […]
In case the pending buffer is
used, the size may be larger, but never smaller. I don't see any problem with that. It
happens when reading/receiing. The application should only care about the length of data
in the buffer not the size.
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/3ca7bf60_cd0f8648?… :
PS3, Line 335: * If the pending message is not large enough, create a larger message.
*/
I may be wrong, but I'd expect user to configure
iofd with a max_size big enough to allow whatever s […]
Imagine the pending buffer
is almost full. Now we read extra data that is larger than the remaining space of the
pending buffer. In order to merge them, a larger buffer is needed.
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/f6d10647_ee937061?… :
PS3, Line 344: memcpy(msgb_put(iofd->pending, msgb_length(msg)), msgb_data(msg),
msgb_length(msg));
Can we avoid 2 memcpys (here and above) in the
specific code path?
How? The fist memcopy is used, if the pending buffer must be
enlarged. The second memcopy will append the newly received data to the pending buffer.
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
Gerrit-Change-Number: 40584
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Jul 2025 10:46:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>