pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/41434?usp=email )
Change subject: stream: Support overwriting tx_queue_max_length per srv conn
......................................................................
stream: Support overwriting tx_queue_max_length per srv conn
This allows setting different tx_queue_max_length per server connection.
This is useful where known clients (eg. matching specific addresses) may
have totally different link properties among them towards the server.
Related: SYS#7693
Change-Id: Ibc68612bd8dee4f9b8031ce2c3f5c7ff6bb639e3
---
M TODO-RELEASE
M include/osmocom/netif/stream.h
M src/stream_srv.c
3 files changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/34/41434/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 6340cdf..87e1b95 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
stream add OSMO_STREAM_{CLI,SRV,SRV_LINK}_TCP_SOCKOPT_KEEP*, osmo_stream_srv_set_param()
stream add OSMO_STREAM_{CLI,SRV,SRV_LINK}_TCP_SOCKOPT_USER_TIMEOUT
+stream add osmo_stream_srv_set_tx_queue_max_length()
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 8c3fad5..b04ebb9 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -137,6 +137,7 @@
void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, osmo_stream_srv_read_cb2_t read_cb);
void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, osmo_stream_srv_closed_cb_t close_cb);
void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn);
+int osmo_stream_srv_set_tx_queue_max_length(struct osmo_stream_srv *conn, unsigned int size);
struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *conn);
const char *osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn);
struct osmo_fd *osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv);
diff --git a/src/stream_srv.c b/src/stream_srv.c
index cc32dc7..695a46f 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -743,6 +743,7 @@
};
struct llist_head tx_queue; /* osmo_ofd mode (only): Queue of msgbs */
unsigned int tx_queue_count; /* osmo_ofd mode (only): Current amount of msgbs queued */
+ unsigned int tx_queue_max_length; /* Max amount of msgbs which can be enqueued */
osmo_stream_srv_closed_cb_t closed_cb;
osmo_stream_srv_read_cb_t read_cb;
osmo_stream_srv_read_cb2_t iofd_read_cb;
@@ -996,6 +997,8 @@
osmo_sock_get_name_buf(conn->sockname, sizeof(conn->sockname), fd);
+ conn->tx_queue_max_length = conn->srv->tx_queue_max_length;
+
if (osmo_fd_register(&conn->ofd) < 0) {
LOGSSRV(conn, LOGL_ERROR, "could not register FD\n");
talloc_free(conn);
@@ -1049,7 +1052,8 @@
return NULL;
}
- osmo_iofd_set_txqueue_max_length(conn->iofd, conn->srv->tx_queue_max_length);
+ conn->tx_queue_max_length = conn->srv->tx_queue_max_length;
+ osmo_iofd_set_txqueue_max_length(conn->iofd, conn->tx_queue_max_length);
if (conn->srv->msgb_alloc.set_by_user)
osmo_iofd_set_alloc_info(conn->iofd, conn->srv->msgb_alloc.size, conn->srv->msgb_alloc.headroom);
@@ -1233,6 +1237,21 @@
return conn->data;
}
+/*! Set the maximum length queue of the stream server connection.
+ * \param[in] conn Stream Server to modify
+ * \param[in] size maximum amount of msgbs which can be queued in the internal tx queue.
+ * \returns 0 on success, negative on error.
+ *
+ * The default queue size of a osmo_stream_srv is inherited during creation time from
+ * osmo_stream_srv_link. */
+int osmo_stream_srv_set_tx_queue_max_length(struct osmo_stream_srv *conn, unsigned int size)
+{
+ conn->tx_queue_max_length = size;
+ if (conn->mode == OSMO_STREAM_MODE_OSMO_IO && conn->iofd)
+ osmo_iofd_set_txqueue_max_length(conn->iofd, conn->tx_queue_max_length);
+ return 0;
+}
+
/*! Retrieve the stream server socket description.
* The returned name is stored in a static buffer; it is hence not re-entrant or thread-safe!
* \param[in] conn Stream Server to examine
@@ -1341,7 +1360,7 @@
switch (conn->mode) {
case OSMO_STREAM_MODE_OSMO_FD:
- if (conn->tx_queue_count >= conn->srv->tx_queue_max_length) {
+ if (conn->tx_queue_count >= conn->tx_queue_max_length) {
LOGSSRV(conn, LOGL_ERROR, "send: tx queue full, dropping msg!\n");
msgb_free(msg);
return;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/41434?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ibc68612bd8dee4f9b8031ce2c3f5c7ff6bb639e3
Gerrit-Change-Number: 41434
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410?usp=email )
Change subject: mtp: Support MTP-TRANSFER.req/ind of raw IPA messages
......................................................................
Patch Set 6:
(1 comment)
File include/osmocom/sigtran/protocol/mtp.h:
https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410/comment/cae8f2f5_5e4d9… :
PS5, Line 30: *
> Note we could also decide to set up a different SI for each IPA protocol we handle, similar to the e […]
See how osmo-bsc (SCCPlite) uses it here:
https://gerrit.osmocom.org/c/osmo-bsc/+/41400
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410?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: I9fedb26ccd3434fc7f272feb3c45cf4bdb80c7ae
Gerrit-Change-Number: 41410
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 14 Nov 2025 18:48:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: daniel, fixeria, laforge, osmith.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-bsc/+/41400?usp=email )
Change subject: sccplite: Handle MGCP/CTRL over SCCPLite multiplex using MTP-TRANSFER.req/ind
......................................................................
Patch Set 4:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/41400?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I567ed206eab1add21836bfd937f3790d3d7a00d7
Gerrit-Change-Number: 41400
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 14 Nov 2025 18:47:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Attention is currently required from: laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410?usp=email )
Change subject: mtp: Support MTP-TRANSFER.req/ind of raw IPA messages
......................................................................
Patch Set 6:
(1 comment)
File include/osmocom/sigtran/protocol/mtp.h:
https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410/comment/3bd29a43_506dc… :
PS5, Line 30: *
> See newest version of this patch with updated commit description. […]
Note we could also decide to set up a different SI for each IPA protocol we handle, similar to the existing SCCP one, for instance one SI for MGCP, one SI for CTRL, etc. but in the end it's more work to maintain, so having 1 for RAW IPA messages sounds better.
Ideally the SI/NI specification would be easier to extend, but this is what we got...
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410?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: I9fedb26ccd3434fc7f272feb3c45cf4bdb80c7ae
Gerrit-Change-Number: 41410
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 14 Nov 2025 18:40:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410?usp=email )
Change subject: mtp: Support MTP-TRANSFER.req/ind of raw IPA messages
......................................................................
Patch Set 6:
(1 comment)
File include/osmocom/sigtran/protocol/mtp.h:
https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410/comment/f0fc855c_cce32… :
PS5, Line 30: *
> does this mean we can no longer use libosmo-sigtran in national networks that use ni11 in routed MTP […]
See newest version of this patch with updated commit description.
Regarding your question, several pointers:
* This only really adds specific logic and is relevant for IPA ASPs, meaning for other kind of ASPs there's no behavior change here, and this SI can mean nothing there if we want to.
* Since this is only used for IPA ASPs, this means that this SI is never really forwarded over the wire since IPA ASP doesn't forward any kind of SI information. Hence, this is only relevant in the local libosmo-sigtran stack for the user to be able to manage such traffic.
Then, we can differentiate between 2 scenarios:
* endpoint (ASP, local distribution): Only picked/handled if the MTP user (app) registers a ss7_user for that SI. The SI value 2 (reserved) is picked on purpose to avoid colliding with other existing protocols (over IPA, which is anyway not standarized...).
* STP (SG, routing): With the provided patch we actually improve the situation by allowing routing IPA messages (other than SCCP); before this patch they could only be picked through the dirty ss7_rx_nknown_cb() by the app, and otherwise they were always discarded. Now non-SCCP IPA messages are routed based on MTP, which I'd say is the expected behavior.
Ideally, somebody using SCCPLite would configure the NI with "Reserved for national use", since in the end it's using other SIs (MGCP, CTRL) which are not specified in the International network. In practice it doesn't matter since we are using IPA in those scenarios, where the SI is never sent over the network...In the end, this becomes another IPA particularity imho.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41410?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: I9fedb26ccd3434fc7f272feb3c45cf4bdb80c7ae
Gerrit-Change-Number: 41410
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 14 Nov 2025 18:37:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>