lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2022

  • 2 participants
  • 1860 discussions
Change in osmo-bts[master]: osmux: Drop logging of osmux internal counters
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/29532 ) Change subject: osmux: Drop logging of osmux internal counters ...................................................................... osmux: Drop logging of osmux internal counters This way we have no more access to internal osmux structures. If those counters are needed in the future they can be counted by osmo-bts by means of adding rate counters to the caller of osmux_xfrm_input() and deliver_cb. Change-Id: Ib952437ea3aa2770c96bddb667491e7675a6a06e --- M src/common/osmux.c 1 file changed, 0 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/32/29532/1 diff --git a/src/common/osmux.c b/src/common/osmux.c index caea4ec..cacc3aa 100644 --- a/src/common/osmux.c +++ b/src/common/osmux.c @@ -130,13 +130,6 @@ LOGP(DOSMUX, LOGL_INFO, "Releasing unused osmux handle for %s\n", osmo_sockaddr_to_str(&h->rem_addr)); - LOGP(DOSMUX, LOGL_INFO, "Stats: " - "input RTP msgs: %u bytes: %" PRIu64 " " - "output osmux msgs: %u bytes: %" PRIu64 "\n", - in->stats.input_rtp_msgs, - in->stats.input_rtp_bytes, - in->stats.output_osmux_msgs, - in->stats.output_osmux_bytes); llist_del(&h->head); TALLOC_FREE(h->in); talloc_free(h); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/29532 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ib952437ea3aa2770c96bddb667491e7675a6a06e Gerrit-Change-Number: 29532 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: osmux: Drop logging of osmux internal counters
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29531 ) Change subject: osmux: Drop logging of osmux internal counters ...................................................................... osmux: Drop logging of osmux internal counters This way we have no more access to internal osmux structures. Moreover, we already have similar information in our rate_ctrs, so there's no need to print those there. Change-Id: I853e118f843070ea29b19e1b0fe56b52f267437a --- M src/libosmo-mgcp/mgcp_osmux.c 1 file changed, 0 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/31/29531/1 diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index d151cb1..0dfd2e4 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -136,13 +136,6 @@ LOGP(DOSMUX, LOGL_INFO, "Releasing unused osmux handle for %s\n", osmo_sockaddr_to_str(&h->rem_addr)); - LOGP(DOSMUX, LOGL_INFO, "Stats: " - "input RTP msgs: %u bytes: %"PRIu64" " - "output osmux msgs: %u bytes: %"PRIu64"\n", - in->stats.input_rtp_msgs, - in->stats.input_rtp_bytes, - in->stats.output_osmux_msgs, - in->stats.output_osmux_bytes); llist_del(&h->head); TALLOC_FREE(h->in); talloc_free(h); -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29531 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I853e118f843070ea29b19e1b0fe56b52f267437a Gerrit-Change-Number: 29531 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bts[master]: Allocate struct osmux_in_handle through new libosmo-netif APIs
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/29530 ) Change subject: Allocate struct osmux_in_handle through new libosmo-netif APIs ...................................................................... Allocate struct osmux_in_handle through new libosmo-netif APIs Depends: libosmo-netif.git I752ab031f935f04731bb1a354333f1682a1aa5bd Change-Id: I132a7c03213cb20dfe118616c8cfd7032b075507 --- M TODO-RELEASE M src/common/osmux.c 2 files changed, 8 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/30/29530/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index d0ab49f..84937cf 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,5 +8,5 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmocore >1.7.0 BTS_FEAT_OSMUX, RSL_IE_OSMO_OSMUX_CID -libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT +libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT, new osmux APIs libosmo-abis >1.3.0 e1inp_ipa_bts_rsl_close_n() diff --git a/src/common/osmux.c b/src/common/osmux.c index e443d1d..caea4ec 100644 --- a/src/common/osmux.c +++ b/src/common/osmux.c @@ -138,7 +138,7 @@ in->stats.output_osmux_msgs, in->stats.output_osmux_bytes); llist_del(&h->head); - osmux_xfrm_input_fini(h->in); + TALLOC_FREE(h->in); talloc_free(h); } return; @@ -159,22 +159,17 @@ h->rem_addr = *rem_addr; h->refcnt++; - h->in = talloc_zero(h, struct osmux_in_handle); + h->in = osmux_xfrm_input_alloc(h); if (!h->in) { talloc_free(h); return NULL; } - /* sequence number to start OSMUX message from */ - h->in->osmux_seq = 0; - - h->in->batch_factor = bts->osmux.batch_factor; - - /* If batch size is zero, the library defaults to 1470 bytes. */ - h->in->batch_size = bts->osmux.batch_size; - h->in->deliver = osmux_deliver_cb; - osmux_xfrm_input_init(h->in); - h->in->data = h; + osmux_xfrm_input_set_initial_seqnum(h->in, 0); + osmux_xfrm_input_set_batch_factor(h->in, bts->osmux.batch_factor); + /* If batch size is zero, the library defaults to 1472 bytes. */ + osmux_xfrm_input_set_batch_size(h->in, bts->osmux.batch_size); + osmux_xfrm_input_set_deliver_cb(h->in, osmux_deliver_cb, h); llist_add(&h->head, &bts->osmux.osmux_handle_list); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/29530 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I132a7c03213cb20dfe118616c8cfd7032b075507 Gerrit-Change-Number: 29530 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: osmux: Allocate struct osmux_out_handle through API
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29528 ) Change subject: osmux: Allocate struct osmux_out_handle through API ...................................................................... osmux: Allocate struct osmux_out_handle through API Until now, the osmux_in_handle was allocated by the client, and passed to the API to initialize it. This makes it really hard to improve the implementation without breaking the ABI. Let's break the ABI now one last time (hopefully) by allocating the struct through an API. With only this change, the already built users (osmo-mgw, openbsci, osmo-bts) can still work fine, since there's no change on the struct osmux_in_handle. However, they will somehow break next time thestruct is changed until they are ported to the same API (easy to do). Change-Id: I752ab031f935f04731bb1a354333f1682a1aa5bd Related: SYS#5987 --- M TODO-RELEASE M include/osmocom/netif/osmux.h M src/osmux_input.c 3 files changed, 88 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/28/29528/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 52a8c49..e7fab50 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,3 +8,4 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmo-netif osmux new osmux_xfrm_output_* APIs +libosmo-netif osmux new osmux_xfrm_input_* APIs diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h index 6e200cc..e02c5cd 100644 --- a/include/osmocom/netif/osmux.h +++ b/include/osmocom/netif/osmux.h @@ -103,8 +103,13 @@ /* 1500 - sizeof(iphdr) = 20 bytes - sizeof(udphdr) = 8 bytes. */ #define OSMUX_BATCH_DEFAULT_MAX 1472 -void osmux_xfrm_input_init(struct osmux_in_handle *h); -void osmux_xfrm_input_fini(struct osmux_in_handle *h); +struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx); +void osmux_xfrm_input_init(struct osmux_in_handle *h) OSMO_DEPRECATED("Use osmux_xfrm_input_alloc() instead"); +void osmux_xfrm_input_fini(struct osmux_in_handle *h) OSMO_DEPRECATED("Use talloc_free() instead"); +int osmux_xfrm_input_set_batch_factor(struct osmux_in_handle *h, uint8_t batch_factor); +void osmux_xfrm_input_set_batch_size(struct osmux_in_handle *h, uint16_t batch_size); +void osmux_xfrm_input_set_initial_seqnum(struct osmux_in_handle *h, uint8_t osmux_seqnum); +void osmux_xfrm_input_set_deliver_cb(struct osmux_in_handle *h, void (*deliver_cb)(struct msgb *msg, void *data), void *data); int osmux_xfrm_input_open_circuit(struct osmux_in_handle *h, int ccid, int dummy); void osmux_xfrm_input_close_circuit(struct osmux_in_handle *h, int ccid); diff --git a/src/osmux_input.c b/src/osmux_input.c index 2706b11..f177ea9 100644 --- a/src/osmux_input.c +++ b/src/osmux_input.c @@ -587,6 +587,56 @@ return ret; } +static int osmux_xfrm_input_talloc_destructor(struct osmux_in_handle *h) +{ + struct osmux_batch *batch = (struct osmux_batch *)h->internal_data; + struct osmux_circuit *circuit, *next; + + llist_for_each_entry_safe(circuit, next, &batch->circuit_list, head) + osmux_batch_del_circuit(batch, circuit); + + osmo_timer_del(&batch->timer); + talloc_free(batch); + return 0; +} + +/*! \brief Allocate a new osmux in handle (osmux source, tx side) + * \param[in] ctx talloc context to use when allocating the returned struct + * \return Allocated osmux in handle + * + * This object contains configuration and state to handle a group of circuits (trunk), + * receiving RTP packets from the upper layer (API user) and sending batched & + * trunked Osmux messages containing all the data of those circuits down the + * stack outgoing network Osmux messages. + * Returned pointer can be freed with regular talloc_free, all pending messages + * in queue and all internal data will be freed. */ +struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx) +{ + struct osmux_in_handle *h; + + h = talloc_zero(ctx, struct osmux_in_handle); + OSMO_ASSERT(h); + + struct osmux_batch *batch; + + h->batch_size = OSMUX_BATCH_DEFAULT_MAX; + + batch = talloc_zero(h, struct osmux_batch); + OSMO_ASSERT(batch); + + INIT_LLIST_HEAD(&batch->circuit_list); + batch->remaining_bytes = h->batch_size; + osmo_timer_setup(&batch->timer, osmux_batch_timer_expired, h); + + h->internal_data = (void *)batch; + + LOGP(DLMUX, LOGL_DEBUG, "initialized osmux input converter\n"); + + talloc_set_destructor(h, osmux_xfrm_input_talloc_destructor); + return h; +} + +/* DEPRECATED: Use osmux_xfrm_input_alloc() instead */ void osmux_xfrm_input_init(struct osmux_in_handle *h) { struct osmux_batch *batch; @@ -608,6 +658,34 @@ LOGP(DLMUX, LOGL_DEBUG, "initialized osmux input converter\n"); } +int osmux_xfrm_input_set_batch_factor(struct osmux_in_handle *h, uint8_t batch_factor) +{ + if (batch_factor > 8) + return -1; + h->batch_factor = batch_factor; + return 0; +} + +void osmux_xfrm_input_set_batch_size(struct osmux_in_handle *h, uint16_t batch_size) +{ + if (batch_size == 0) + h->batch_size = OSMUX_BATCH_DEFAULT_MAX; + else + h->batch_size = batch_size; +} + +void osmux_xfrm_input_set_initial_seqnum(struct osmux_in_handle *h, uint8_t osmux_seqnum) +{ + h->osmux_seq = osmux_seqnum; +} + +void osmux_xfrm_input_set_deliver_cb(struct osmux_in_handle *h, + void (*deliver_cb)(struct msgb *msg, void *data), void *data) +{ + h->deliver = deliver_cb; + h->data = data; +} + int osmux_xfrm_input_open_circuit(struct osmux_in_handle *h, int ccid, int dummy) { @@ -656,16 +734,10 @@ osmux_batch_del_circuit(batch, circuit); } +/* DEPRECATED: Use talloc_free() instead (will call osmux_xfrm_input_talloc_destructor()) */ void osmux_xfrm_input_fini(struct osmux_in_handle *h) { - struct osmux_batch *batch = (struct osmux_batch *)h->internal_data; - struct osmux_circuit *circuit, *next; - - llist_for_each_entry_safe(circuit, next, &batch->circuit_list, head) - osmux_batch_del_circuit(batch, circuit); - - osmo_timer_del(&batch->timer); - talloc_free(batch); + (void)osmux_xfrm_input_talloc_destructor(h); } /*! @} */ -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29528 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I752ab031f935f04731bb1a354333f1682a1aa5bd Gerrit-Change-Number: 29528 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: osmux: Replace deprecated osmux_xfrm_input_* APIs in examples & tests
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29529 ) Change subject: osmux: Replace deprecated osmux_xfrm_input_* APIs in examples & tests ...................................................................... osmux: Replace deprecated osmux_xfrm_input_* APIs in examples & tests Change-Id: I7f3f8d40f89ffdd135a73316ee60fd429ba2a5b0 --- M examples/osmux-test-input.c M tests/osmo-pcap-test/osmux_test.c M tests/osmux/osmux_input_test.c M tests/osmux/osmux_test.c 4 files changed, 81 insertions(+), 81 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/29/29529/1 diff --git a/examples/osmux-test-input.c b/examples/osmux-test-input.c index 57e199c..d91ee15 100644 --- a/examples/osmux-test-input.c +++ b/examples/osmux-test-input.c @@ -83,11 +83,7 @@ * This is the input handle for osmux. It stores the last osmux sequence that * has been used and the deliver function that sends the osmux batch. */ -struct osmux_in_handle h_input = { - .osmux_seq = 0, /* sequence number to start OSmux message from */ - .batch_factor = 4, /* batch up to 4 RTP messages */ - .deliver = osmux_deliver, -}; +struct osmux_in_handle *h_input; #define MAX_CONCURRENT_CALLS 8 @@ -165,9 +161,9 @@ if (ccid < 0) register_ccid(rtph->ssrc); - while ((ret = osmux_xfrm_input(&h_input, msg, ccid)) > 0) { + while ((ret = osmux_xfrm_input(h_input, msg, ccid)) > 0) { /* batch full, deliver it */ - osmux_xfrm_input_deliver(&h_input); + osmux_xfrm_input_deliver(h_input); } if (ret == -1) printf("something is wrong\n"); @@ -217,7 +213,10 @@ /* * initialize OSMUX handlers. */ - osmux_xfrm_input_init(&h_input); + h_input = osmux_xfrm_input_alloc(tall_test); + osmux_xfrm_input_set_initial_seqnum(h_input, 0); + osmux_xfrm_input_set_batch_factor(h_input, 4); + osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL); /* * initialize datagram server. diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c index bbb395c..891743a 100644 --- a/tests/osmo-pcap-test/osmux_test.c +++ b/tests/osmo-pcap-test/osmux_test.c @@ -65,11 +65,7 @@ * This is the input handle for osmux. It stores the last osmux sequence that * has been used and the deliver function that sends the osmux batch. */ -struct osmux_in_handle h_input = { - .osmux_seq = 0, /* sequence number to start OSmux message from */ - .batch_factor = 4, /* batch up to 4 RTP messages */ - .deliver = deliver, -}; +struct osmux_in_handle *h_input; #define MAX_CONCURRENT_CALLS 8 @@ -124,9 +120,9 @@ if (ccid < 0) register_ccid(rtph->ssrc); - while ((ret = osmux_xfrm_input(&h_input, msg, ccid)) > 0) { + while ((ret = osmux_xfrm_input(h_input, msg, ccid)) > 0) { /* batch full, deliver it */ - osmux_xfrm_input_deliver(&h_input); + osmux_xfrm_input_deliver(h_input); } if (ret == -1) printf("something is wrong\n"); @@ -189,7 +185,10 @@ osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb; - osmux_xfrm_input_init(&h_input); + h_input = osmux_xfrm_input_alloc(tall_test); + osmux_xfrm_input_set_initial_seqnum(h_input, 0); + osmux_xfrm_input_set_batch_factor(h_input, 4); + osmux_xfrm_input_set_deliver_cb(h_input, deliver, NULL); h_output = osmux_xfrm_output_alloc(tall_test); osmux_xfrm_output_set_rtp_ssrc(h_output, 0); diff --git a/tests/osmux/osmux_input_test.c b/tests/osmux/osmux_input_test.c index 5a311c8..8645929 100644 --- a/tests/osmux/osmux_input_test.c +++ b/tests/osmux/osmux_input_test.c @@ -33,6 +33,8 @@ static uint16_t rtp_next_seq; static uint16_t rtp_next_ts; +void *tall_ctx; + #define TIME_RTP_PKT_MS 20 #define BATCH_FACTOR 6 /* ----------------------------- */ @@ -194,6 +196,7 @@ int rc; const uint8_t cid = 30; bool osmux_transmitted = false; + struct osmux_in_handle *h_input; printf("===%s===\n", __func__); @@ -202,27 +205,25 @@ clock_override_set(0, 0); rtp_init(0, 0); - struct osmux_in_handle h_input = { - .osmux_seq = 0, /* sequence number to start OSmux message from */ - .batch_factor = 4, /* batch up to 4 RTP messages */ - .deliver = test_amr_ft_change_middle_batch_osmux_deliver_cb, - .data = &osmux_transmitted, - }; - - osmux_xfrm_input_init(&h_input); - osmux_xfrm_input_open_circuit(&h_input, cid, false); + h_input = osmux_xfrm_input_alloc(tall_ctx); + osmux_xfrm_input_set_initial_seqnum(h_input, 0); + osmux_xfrm_input_set_batch_factor(h_input, 4); + osmux_xfrm_input_set_deliver_cb(h_input, + test_amr_ft_change_middle_batch_osmux_deliver_cb, + &osmux_transmitted); + osmux_xfrm_input_open_circuit(h_input, cid, false); /* First RTP frame at t=0 */ msg = rtp_next(); rtp_append_amr(msg, AMR_FT_2); - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* Second RTP frame at t=20 */ clock_override_add(0, TIME_RTP_PKT_MS*1000); msg = rtp_next(); rtp_append_amr(msg, AMR_FT_2); - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* Third RTP frame at t=40, AMR FT changes: */ @@ -230,7 +231,7 @@ clock_override_add(0, TIME_RTP_PKT_MS*1000); msg = rtp_next(); rtp_append_amr(msg, AMR_FT_6); - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* Forth RTP frame at t=60, AMR FT changes again: */ @@ -238,7 +239,7 @@ clock_override_add(0, TIME_RTP_PKT_MS*1000); msg = rtp_next(); rtp_append_amr(msg, AMR_FT_1); - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* t=80, osmux batch is scheduled to be transmitted: */ @@ -248,8 +249,8 @@ OSMO_ASSERT(osmux_transmitted == true); clock_debug("Closing circuit"); - osmux_xfrm_input_close_circuit(&h_input, cid); - osmux_xfrm_input_fini(&h_input); + osmux_xfrm_input_close_circuit(h_input, cid); + talloc_free(h_input); } static void test_last_amr_cmr_f_q_used_osmux_deliver_cb(struct msgb *batch_msg, void *data) @@ -285,6 +286,7 @@ const uint8_t cid = 32; bool osmux_transmitted = false; struct amr_hdr *amrh; + struct osmux_in_handle *h_input; printf("===%s===\n", __func__); @@ -294,15 +296,13 @@ clock_override_set(0, 0); rtp_init(0, 0); - struct osmux_in_handle h_input = { - .osmux_seq = 0, /* sequence number to start OSmux message from */ - .batch_factor = 3, /* batch up to 3 RTP messages */ - .deliver = test_last_amr_cmr_f_q_used_osmux_deliver_cb, - .data = &osmux_transmitted, - }; - - osmux_xfrm_input_init(&h_input); - osmux_xfrm_input_open_circuit(&h_input, cid, false); + h_input = osmux_xfrm_input_alloc(tall_ctx); + osmux_xfrm_input_set_initial_seqnum(h_input, 0); + osmux_xfrm_input_set_batch_factor(h_input, 3); + osmux_xfrm_input_set_deliver_cb(h_input, + test_last_amr_cmr_f_q_used_osmux_deliver_cb, + &osmux_transmitted); + osmux_xfrm_input_open_circuit(h_input, cid, false); /* First RTP frame at t=0 */ msg = rtp_next(); @@ -310,7 +310,7 @@ amrh->f = 1; amrh->q = 1; amrh->cmr = 0; - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* Second RTP frame at t=20, CMR changes 0->1 */ @@ -321,7 +321,7 @@ amrh->f = 1; amrh->q = 1; amrh->cmr = 1; - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* Third RTP frame at t=40, q changes 1->0, CMR changes 1->2: */ @@ -332,7 +332,7 @@ amrh->f = 0; amrh->q = 0; amrh->cmr = 2; - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* t=60, osmux batch is scheduled to be transmitted: */ @@ -342,8 +342,8 @@ OSMO_ASSERT(osmux_transmitted == true); clock_debug("Closing circuit"); - osmux_xfrm_input_close_circuit(&h_input, cid); - osmux_xfrm_input_fini(&h_input); + osmux_xfrm_input_close_circuit(h_input, cid); + talloc_free(h_input); } static void test_initial_osmux_seqnum_osmux_deliver_cb(struct msgb *batch_msg, void *data) @@ -375,6 +375,7 @@ const uint8_t cid = 33; bool osmux_transmitted = false; struct amr_hdr *amrh; + struct osmux_in_handle *h_input; printf("===%s===\n", __func__); @@ -384,15 +385,13 @@ clock_override_set(0, 0); rtp_init(0, 0); - struct osmux_in_handle h_input = { - .osmux_seq = 123, /* sequence number to start OSmux message from */ - .batch_factor = 1, /* batch up to 1 RTP messages */ - .deliver = test_initial_osmux_seqnum_osmux_deliver_cb, - .data = &osmux_transmitted, - }; - - osmux_xfrm_input_init(&h_input); - osmux_xfrm_input_open_circuit(&h_input, cid, false); + h_input = osmux_xfrm_input_alloc(tall_ctx); + osmux_xfrm_input_set_initial_seqnum(h_input, 123); + osmux_xfrm_input_set_batch_factor(h_input, 1); + osmux_xfrm_input_set_deliver_cb(h_input, + test_initial_osmux_seqnum_osmux_deliver_cb, + &osmux_transmitted); + osmux_xfrm_input_open_circuit(h_input, cid, false); /* First RTP frame at t=0 */ msg = rtp_next(); @@ -400,7 +399,7 @@ amrh->f = 1; amrh->q = 1; amrh->cmr = 0; - rc = osmux_xfrm_input(&h_input, msg, cid); + rc = osmux_xfrm_input(h_input, msg, cid); OSMO_ASSERT(rc == 0); /* t=20, osmux batch is scheduled to be transmitted: */ @@ -410,8 +409,8 @@ OSMO_ASSERT(osmux_transmitted == true); clock_debug("Closing circuit"); - osmux_xfrm_input_close_circuit(&h_input, cid); - osmux_xfrm_input_fini(&h_input); + osmux_xfrm_input_close_circuit(h_input, cid); + talloc_free(h_input); } int main(int argc, char **argv) @@ -422,7 +421,7 @@ exit(EXIT_FAILURE); } - void *tall_ctx = talloc_named_const(NULL, 1, "Root context"); + tall_ctx = talloc_named_const(NULL, 1, "Root context"); msgb_talloc_ctx_init(tall_ctx, 0); osmo_init_logging2(tall_ctx, &log_info); log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c index d6b7040..8edb3fd 100644 --- a/tests/osmux/osmux_test.c +++ b/tests/osmux/osmux_test.c @@ -120,11 +120,7 @@ msgb_free(batch_msg); } -struct osmux_in_handle h_input = { - .osmux_seq = 0, /* sequence number to start OSmux message from */ - .batch_factor = 4, /* batch up to 4 RTP messages */ - .deliver = osmux_deliver, -}; +struct osmux_in_handle *h_input; static void sigalarm_handler(int foo) { @@ -161,8 +157,8 @@ } rtp_pkts++; - while (osmux_xfrm_input(&h_input, msg, j) > 0) { - osmux_xfrm_input_deliver(&h_input); + while (osmux_xfrm_input(h_input, msg, j) > 0) { + osmux_xfrm_input_deliver(h_input); } } clock_override_add(0, PKT_TIME_USEC); @@ -215,13 +211,13 @@ * gaps between two messages to test the osmux replaying * feature. */ - osmux_xfrm_input(&h_input, msg, (i % 2) + ccid); + osmux_xfrm_input(h_input, msg, (i % 2) + ccid); if (i % 4 == 0) { /* After four RTP messages, squash them into the OSMUX * batch and call the routine to deliver it. */ - osmux_xfrm_input_deliver(&h_input); + osmux_xfrm_input_deliver(h_input); /* The first two RTP message (one per circuit ID batch) * are delivered immediately, wait until the three RTP @@ -280,22 +276,29 @@ alarm(10); /* Check if marker bit features work correctly */ - osmux_xfrm_input_init(&h_input); + h_input = osmux_xfrm_input_alloc(tall_ctx); + osmux_xfrm_input_set_initial_seqnum(h_input, 0); + osmux_xfrm_input_set_batch_factor(h_input, 4); + osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL); + for (i = 0; i < 4; i++) - osmux_xfrm_input_open_circuit(&h_input, i, 0); + osmux_xfrm_input_open_circuit(h_input, i, 0); osmux_test_marker(4); for (i = 0; i < 4; i++) - osmux_xfrm_input_close_circuit(&h_input, i); - osmux_xfrm_input_fini(&h_input); + osmux_xfrm_input_close_circuit(h_input, i); + TALLOC_FREE(h_input); - osmux_xfrm_input_init(&h_input); + h_input = osmux_xfrm_input_alloc(tall_ctx); + osmux_xfrm_input_set_initial_seqnum(h_input, 0); + osmux_xfrm_input_set_batch_factor(h_input, 4); + osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL); for (i = 0; i < 2; i++) - osmux_xfrm_input_open_circuit(&h_input, i, 0); + osmux_xfrm_input_open_circuit(h_input, i, 0); /* Add two circuits with dummy padding */ - osmux_xfrm_input_open_circuit(&h_input, 2, 1); - osmux_xfrm_input_open_circuit(&h_input, 3, 1); + osmux_xfrm_input_open_circuit(h_input, 2, 1); + osmux_xfrm_input_open_circuit(h_input, 3, 1); /* Wait 10 times to make sure dummy padding timer works fine */ for (i = 0; i < 10; i++) @@ -309,16 +312,16 @@ osmux_test_loop(2); for (i = 0; i < 4; i++) - osmux_xfrm_input_close_circuit(&h_input, i); + osmux_xfrm_input_close_circuit(h_input, i); /* Reopen with two circuits and retest */ - osmux_xfrm_input_open_circuit(&h_input, 0, 0); - osmux_xfrm_input_open_circuit(&h_input, 1, 1); + osmux_xfrm_input_open_circuit(h_input, 0, 0); + osmux_xfrm_input_open_circuit(h_input, 1, 1); osmux_test_loop(0); - osmux_xfrm_input_close_circuit(&h_input, 0); - osmux_xfrm_input_close_circuit(&h_input, 1); + osmux_xfrm_input_close_circuit(h_input, 0); + osmux_xfrm_input_close_circuit(h_input, 1); - osmux_xfrm_input_fini(&h_input); + TALLOC_FREE(h_input); for (i = 0; i < ARRAY_SIZE(h_output); i++) { clock_debug("Flushing CID %u\n", i); -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29529 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I7f3f8d40f89ffdd135a73316ee60fd429ba2a5b0 Gerrit-Change-Number: 29529 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: tests/osmo-pcap/osmux: Replace deprecatd API osmux_xfrm_output_init2()
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29527 ) Change subject: tests/osmo-pcap/osmux: Replace deprecatd API osmux_xfrm_output_init2() ...................................................................... tests/osmo-pcap/osmux: Replace deprecatd API osmux_xfrm_output_init2() Replacing this one with the newer API was missed a few commits ago when this API was marked as deprectated. Do it now. Change-Id: Ia0958dfae951d82feafe427eff2112d327d3b0a4 --- M tests/osmo-pcap-test/osmux_test.c 1 file changed, 9 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/27/29527/1 diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c index a1aa199..bbb395c 100644 --- a/tests/osmo-pcap-test/osmux_test.c +++ b/tests/osmo-pcap-test/osmux_test.c @@ -37,7 +37,7 @@ * This is the output handle for osmux, it stores last RTP sequence and * timestamp that has been used. There should be one per circuit ID. */ -static struct osmux_out_handle h_output; +static struct osmux_out_handle *h_output; static void tx_cb(struct msgb *msg, void *data) { @@ -57,7 +57,7 @@ /* This code below belongs to the osmux receiver */ while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) - osmux_xfrm_output_sched(&h_output, osmuxh); + osmux_xfrm_output_sched(h_output, osmuxh); msgb_free(batch_msg); } @@ -190,8 +190,11 @@ osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb; osmux_xfrm_input_init(&h_input); - osmux_xfrm_output_init2(&h_output, 0, 98); - osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL); + + h_output = osmux_xfrm_output_alloc(tall_test); + osmux_xfrm_output_set_rtp_ssrc(h_output, 0); + osmux_xfrm_output_set_rtp_pl_type(h_output, 98); + osmux_xfrm_output_set_tx_cb(h_output, tx_cb, NULL); /* first run */ osmo_pcap_pkt_timer_cb(NULL); @@ -200,5 +203,7 @@ osmo_select_main(0); } + talloc_free(h_output); + return ret; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29527 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ia0958dfae951d82feafe427eff2112d327d3b0a4 Gerrit-Change-Number: 29527 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: Allocate struct osmux_in_handle through new libosmo-netif APIs
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29526 ) Change subject: Allocate struct osmux_in_handle through new libosmo-netif APIs ...................................................................... Allocate struct osmux_in_handle through new libosmo-netif APIs Change-Id: I013c99d1f915279684ce278648e9c69e39b94266 Depends: libosmo-netif.git I752ab031f935f04731bb1a354333f1682a1aa5bd --- M TODO-RELEASE M src/libosmo-mgcp/mgcp_osmux.c 2 files changed, 8 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/26/29526/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index e8029f9..3e8b2ee 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -24,4 +24,4 @@ # If any interfaces have been removed or changed since the last public release, a=0. # #library what description / commit summary line -libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT, osmux_xfrm_output_alloc, osmux_xfrm_output_set_rtp_* +libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT, osmux_xfrm_output_*, osmux_xfrm_input_* diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 706de07..d151cb1 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -144,7 +144,7 @@ in->stats.output_osmux_msgs, in->stats.output_osmux_bytes); llist_del(&h->head); - osmux_xfrm_input_fini(h->in); + TALLOC_FREE(h->in); talloc_free(h); } return; @@ -167,22 +167,17 @@ h->rem_addr = *rem_addr; h->refcnt++; - h->in = talloc_zero(h, struct osmux_in_handle); + h->in = osmux_xfrm_input_alloc(h); if (!h->in) { talloc_free(h); return NULL; } - /* sequence number to start OSMUX message from */ - h->in->osmux_seq = 0; - - h->in->batch_factor = cfg->osmux_batch; - - /* If batch size is zero, the library defaults to 1470 bytes. */ - h->in->batch_size = cfg->osmux_batch_size; - h->in->deliver = osmux_deliver_cb; - osmux_xfrm_input_init(h->in); - h->in->data = h; + osmux_xfrm_input_set_initial_seqnum(h->in, 0); + osmux_xfrm_input_set_batch_factor(h->in, cfg->osmux_batch); + /* If batch size is zero, the library defaults to 1472 bytes. */ + osmux_xfrm_input_set_batch_size(h->in, cfg->osmux_batch_size); + osmux_xfrm_input_set_deliver_cb(h->in, osmux_deliver_cb, h); llist_add(&h->head, &osmux_handle_list); -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29526 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I013c99d1f915279684ce278648e9c69e39b94266 Gerrit-Change-Number: 29526 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: osmux: Split input and output code into separate files
by pespin 29 Sep '22

29 Sep '22
Attention is currently required from: pespin. pespin has removed a vote from this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29524 ) Change subject: osmux: Split input and output code into separate files ...................................................................... Removed Verified-1 by Jenkins Builder (1000002) -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29524 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ia72995092a36ca50147611e617cb88c4dcf231d5 Gerrit-Change-Number: 29524 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: deleteVote
1 0
0 0
Change in libosmo-netif[master]: cosmetic: osmux: Make linter happy
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/libosmo-netif/+/29525 ) Change subject: cosmetic: osmux: Make linter happy ...................................................................... cosmetic: osmux: Make linter happy Change-Id: I8472e1b508babfa231c7e0ecc75b4fe63e090a0d --- M src/osmux_input.c M src/osmux_output.c 2 files changed, 29 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/25/29525/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29525 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I8472e1b508babfa231c7e0ecc75b4fe63e090a0d Gerrit-Change-Number: 29525 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
Change in libosmo-netif[master]: cosmetic: osmux: Make litner happy
by pespin 29 Sep '22

29 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29525 ) Change subject: cosmetic: osmux: Make litner happy ...................................................................... cosmetic: osmux: Make litner happy Change-Id: I8472e1b508babfa231c7e0ecc75b4fe63e090a0d --- M src/osmux_input.c M src/osmux_output.c 2 files changed, 29 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/25/29525/1 diff --git a/src/osmux_input.c b/src/osmux_input.c index 2b388f2..2706b11 100644 --- a/src/osmux_input.c +++ b/src/osmux_input.c @@ -178,7 +178,7 @@ osmuxh->ft = OSMUX_FT_DUMMY; osmuxh->ctr = batch_factor - 1; osmuxh->amr_f = 0; - osmuxh->amr_q= 0; + osmuxh->amr_q = 0; osmuxh->seq = 0; osmuxh->circuit_id = state->circuit->ccid; osmuxh->amr_cmr = 0; @@ -370,7 +370,7 @@ /* If diff between last RTP packet seen and this one is > 1, * then we lost several RTP packets, let's replay them. */ - for (i=1; i<diff; i++) { + for (i = 1; i < diff; i++) { struct msgb *clone; /* Clone last RTP packet seen */ @@ -556,33 +556,33 @@ return -1; } - switch(rtph->payload_type) { - case RTP_PT_RTCP: - LOGP(DLMUX, LOGL_INFO, "Dropping RTCP packet\n"); + switch (rtph->payload_type) { + case RTP_PT_RTCP: + LOGP(DLMUX, LOGL_INFO, "Dropping RTCP packet\n"); + msgb_free(msg); + return 0; + default: + /* The RTP payload type is dynamically allocated, + * although we use static ones. Assume that we always + * receive AMR traffic. + */ + + /* Add this RTP to the OSMUX batch */ + ret = osmux_batch_add(batch, h->batch_factor, + msg, rtph, ccid); + if (ret < 0) { + /* Cannot put this message into the batch. + * Malformed, duplicated, OOM. Drop it and tell + * the upper layer that we have digest it. + */ + LOGP(DLMUX, LOGL_DEBUG, "Dropping RTP packet instead of adding to batch\n"); msgb_free(msg); - return 0; - default: - /* The RTP payload type is dynamically allocated, - * although we use static ones. Assume that we always - * receive AMR traffic. - */ + return ret; + } - /* Add this RTP to the OSMUX batch */ - ret = osmux_batch_add(batch, h->batch_factor, - msg, rtph, ccid); - if (ret < 0) { - /* Cannot put this message into the batch. - * Malformed, duplicated, OOM. Drop it and tell - * the upper layer that we have digest it. - */ - LOGP(DLMUX, LOGL_DEBUG, "Dropping RTP packet instead of adding to batch\n"); - msgb_free(msg); - return ret; - } - - h->stats.input_rtp_msgs++; - h->stats.input_rtp_bytes += msg->len; - break; + h->stats.input_rtp_msgs++; + h->stats.input_rtp_bytes += msg->len; + break; } return ret; } diff --git a/src/osmux_output.c b/src/osmux_output.c index 069bdd9..a6e6513 100644 --- a/src/osmux_output.c +++ b/src/osmux_output.c @@ -203,7 +203,7 @@ } /*! \brief Generate RTP packets from osmux frame AMR payload set and schedule - * them for transmission at appropiate time. + * them for transmission at appropriate time. * \param[in] h the osmux out handle handling a specific CID * \param[in] osmuxh Buffer pointing to osmux frame header structure and AMR payload * \return Number of generated RTP packets @@ -252,7 +252,7 @@ h->osmux_seq_ack = osmuxh->seq; /* In case list is still empty after parsing messages, no need to rearm */ - if(was_empty && !llist_empty(&h->list)) + if (was_empty && !llist_empty(&h->list)) osmux_xfrm_output_trigger(h); return i; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29525 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I8472e1b508babfa231c7e0ecc75b4fe63e090a0d Gerrit-Change-Number: 29525 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • ...
  • 186
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.