jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40492?usp=email )
Change subject: Add multiple messages buffers to io_uring read operations
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40492?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: Ic4544b8fcbad5a266db748d6864d3ae93ee06bce
Gerrit-Change-Number: 40492
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:06:23 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40490?usp=email )
Change subject: Submit all SQEs to kernel if they don't fit in the io_uring
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40490?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: I476d9db285a1d257a4a5d43ee45ee0116c7d7009
Gerrit-Change-Number: 40490
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:06:17 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40493?usp=email )
Change subject: Add multiple messages buffers to io_uring write operations
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40493?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: I8c4e0a785cf66becd7fb5b2caf718c9724b56686
Gerrit-Change-Number: 40493
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:05:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40491?usp=email )
Change subject: Add multiple messages buffers to struct iofd_msghdr
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40491?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: I4fb1067de4615cc22cc6caf99b481491e7f2ef92
Gerrit-Change-Number: 40491
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:05:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40494?usp=email )
Change subject: Send multiple read/recvfrom SQEs in advance
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40494?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: Id50a8900fa2fe6de553e5025feae7e1e8d501e30
Gerrit-Change-Number: 40494
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:05:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40489?usp=email )
Change subject: Allow io_uring_submit batching just ahead of poll/select
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40489?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: Id34fe2ced32c63d15b14810e145744f7509064cc
Gerrit-Change-Number: 40489
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:05:36 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email )
Change subject: osmo-io: Append received message to pending message segment
......................................................................
osmo-io: Append received message to pending message segment
If there is pending data of an incomplete segmented message, received
data will be appended to this message to complete it. Previously, the
message buffer with incomplete data was reused for subsequent reading
of more data. This does not work, if multiple read elements and
buffers are submitted to an io_uring. This will be done in later
patches.
When the segmentation process finds incomplete message, it will allocate
a message buffer of maximum size + the size of the pending data. This
allows received data to be appended without the risk of buffer
overflows.
Change-Id: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
---
M src/core/osmo_io.c
M src/core/osmo_io_internal.h
M src/core/osmo_io_poll.c
M src/core/osmo_io_uring.c
4 files changed, 23 insertions(+), 29 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/40584/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index aaf7bcc..7de8479 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -174,36 +174,19 @@
talloc_free(msghdr);
}
-/*! convenience wrapper to call msgb_alloc with parameters from osmo_io_fd */
-struct msgb *iofd_msgb_alloc(struct osmo_io_fd *iofd)
+/*! convenience wrapper to call msgb_alloc with parameters from osmo_io_fd (with extra size) */
+struct msgb *iofd_msgb_alloc2(struct osmo_io_fd *iofd, size_t extra)
{
uint16_t headroom = iofd->msgb_alloc.headroom;
- OSMO_ASSERT(iofd->msgb_alloc.size <= 0xffff - headroom);
- return msgb_alloc_headroom_c(iofd, iofd->msgb_alloc.size + headroom, headroom, "osmo_io_msgb");
+ OSMO_ASSERT(iofd->msgb_alloc.size + extra <= 0xffff - headroom);
+ return msgb_alloc_headroom_c(iofd, iofd->msgb_alloc.size + extra + headroom, headroom, "osmo_io_msgb");
}
-/*! return the pending msgb in iofd or NULL if there is none*/
-struct msgb *iofd_msgb_pending(struct osmo_io_fd *iofd)
+/*! convenience wrapper to call msgb_alloc with parameters from osmo_io_fd */
+struct msgb *iofd_msgb_alloc(struct osmo_io_fd *iofd)
{
- struct msgb *msg = NULL;
-
- msg = iofd->pending;
- iofd->pending = NULL;
-
- return msg;
-}
-
-/*! Return the pending msgb or allocate and return a new one */
-struct msgb *iofd_msgb_pending_or_alloc(struct osmo_io_fd *iofd)
-{
- struct msgb *msg = NULL;
-
- msg = iofd_msgb_pending(iofd);
- if (!msg)
- msg = iofd_msgb_alloc(iofd);
-
- return msg;
+ return iofd_msgb_alloc2(iofd, 0);
}
/*! Enqueue a message to be sent.
@@ -317,7 +300,7 @@
/* msgb contains more than one segment */
/* Copy the trailing data over */
- msg_pending = iofd_msgb_alloc(iofd);
+ msg_pending = iofd_msgb_alloc2(iofd, extra_len);
memcpy(msgb_data(msg_pending), data + expected_len, extra_len);
msgb_put(msg_pending, extra_len);
*pending_out = msg_pending;
@@ -348,6 +331,18 @@
return;
}
+ /* If we have a pending message, append the received message.
+ * The pending message was allocated large enough so that a received
+ * message with maximum size can be appended. */
+ if (OSMO_UNLIKELY(iofd->pending)) {
+ OSMO_ASSERT(msgb_tailroom(iofd->pending) >= msgb_length(msg));
+ memcpy(iofd->pending->tail, msgb_data(msg), msgb_length(msg));
+ msgb_put(iofd->pending, msgb_length(msg));
+ msgb_free(msg);
+ msg = iofd->pending;
+ iofd->pending = NULL;
+ }
+
do {
pending = NULL;
res = iofd_handle_segmentation(iofd, msg, &pending);
diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h
index a4b0749..10c136b 100644
--- a/src/core/osmo_io_internal.h
+++ b/src/core/osmo_io_internal.h
@@ -153,9 +153,8 @@
struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg, size_t cmsg_size);
void iofd_msghdr_free(struct iofd_msghdr *msghdr);
+struct msgb *iofd_msgb_alloc2(struct osmo_io_fd *iofd, size_t extra);
struct msgb *iofd_msgb_alloc(struct osmo_io_fd *iofd);
-struct msgb *iofd_msgb_pending(struct osmo_io_fd *iofd);
-struct msgb *iofd_msgb_pending_or_alloc(struct osmo_io_fd *iofd);
void iofd_handle_recv(struct osmo_io_fd *iofd, struct msgb *msg, int rc, struct iofd_msghdr *msghdr);
void iofd_handle_send_completion(struct osmo_io_fd *iofd, int rc, struct iofd_msghdr *msghdr);
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index 8782adf..466973d 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -50,7 +50,7 @@
if (what & OSMO_FD_READ) {
struct iofd_msghdr hdr;
- msg = iofd_msgb_pending_or_alloc(iofd);
+ msg = iofd_msgb_alloc(iofd);
if (!msg) {
LOGPIO(iofd, LOGL_ERROR, "Could not allocate msgb for reading\n");
OSMO_ASSERT(0);
diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c
index fc60b51..26e89d7 100644
--- a/src/core/osmo_io_uring.c
+++ b/src/core/osmo_io_uring.c
@@ -147,7 +147,7 @@
struct iofd_msghdr *msghdr;
struct io_uring_sqe *sqe;
- msg = iofd_msgb_pending_or_alloc(iofd);
+ msg = iofd_msgb_alloc(iofd);
if (!msg) {
LOGPIO(iofd, LOGL_ERROR, "Could not allocate msgb for reading\n");
OSMO_ASSERT(0);
--
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: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
Gerrit-Change-Number: 40584
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40583?usp=email )
Change subject: sccp: Free connections of sccp_user when unbinding it
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40583?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ide694646e971043b60e232dcdc82b145af03dc91
Gerrit-Change-Number: 40583
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 04 Jul 2025 07:19:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40582?usp=email )
Change subject: sccp: Split sccp_instance code from sccp_user.c to its own file
......................................................................
Patch Set 3: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40582?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I632f1825fe696bf73c0f9220dc8e8463337d8ba8
Gerrit-Change-Number: 40582
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 04 Jul 2025 07:15:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes