This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Hoernchen gerrit-no-reply at lists.osmocom.orgHoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/25425 ) Change subject: e1: one thread per e1 trunk == e1 line ...................................................................... e1: one thread per e1 trunk == e1 line There is only one thread per trunk, and one trunk can only have one line, so saving the trunk pointer is sufficient to know which line we are. Change-Id: Iabee6375dc521397d605549e3d869d5c8048fac3 --- M src/libosmo-mgcp/mgcp_e1.c M src/libosmo-mgcp/mgcp_trunk.c 2 files changed, 7 insertions(+), 27 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/25/25425/1 diff --git a/src/libosmo-mgcp/mgcp_e1.c b/src/libosmo-mgcp/mgcp_e1.c index e88b8c5..16f78f1 100644 --- a/src/libosmo-mgcp/mgcp_e1.c +++ b/src/libosmo-mgcp/mgcp_e1.c @@ -48,7 +48,7 @@ #define E1_TRAU_BITS 320 #define E1_TRAU_BITS_MSGB 2048 -static struct mgcp_config *cfg; +static __thread struct mgcp_trunk *this_trunk; static const struct e1inp_line_ops dummy_e1_line_ops = { .sign_link_up = NULL, @@ -332,33 +332,29 @@ /* Callback function to handle incoming E1 traffic */ static void e1_recv_cb(struct e1inp_ts *ts, struct msgb *msg) { - struct mgcp_trunk *trunk; - - /* Find associated trunk */ - trunk = mgcp_trunk_by_line_num(cfg, ts->line->num); - if (!trunk) { + if (!this_trunk) { LOGP(DE1, LOGL_ERROR, "E1-RX: unable to find a trunk for E1-line %u!\n", ts->line->num); return; } /* Check if the incoming data looks sane */ if (msgb_length(msg) != E1_TS_BYTES) { - LOGPTRUNK(trunk, DE1, LOGL_NOTICE, + LOGPTRUNK(this_trunk, DE1, LOGL_NOTICE, "E1-RX: (ts:%u) expected length is %u, actual length is %u!\n", ts->num, E1_TS_BYTES, msgb_length(msg)); } #if DEBUG_E1_TS == 1 - LOGPTRUNK(trunk, DE1, LOGL_DEBUG, "E1-RX: (ts:%u) receiving %u bytes: %s...\n", ts->num, + LOGPTRUNK(this_trunk, DE1, LOGL_DEBUG, "E1-RX: (ts:%u) receiving %u bytes: %s...\n", ts->num, msgb_length(msg), osmo_hexdump_nospc(msgb_data(msg), msgb_length(msg) > DEBUG_BYTES_MAX ? DEBUG_BYTES_MAX : msgb_length(msg))); #endif /* Hand data over to the I.460 demultiplexer. */ - osmo_i460_demux_in(&trunk->e1.i460_ts[ts->num - 1], msgb_data(msg), msgb_length(msg)); + osmo_i460_demux_in(&this_trunk->e1.i460_ts[ts->num - 1], msgb_data(msg), msgb_length(msg)); /* Trigger sending of pending E1 traffic */ - e1_send(ts, trunk); + e1_send(ts, this_trunk); } static int e1_init(struct mgcp_trunk *trunk, uint8_t ts_nr) @@ -373,7 +369,7 @@ int rc; OSMO_ASSERT(ts_nr > 0 || ts_nr < NUM_E1_TS); - cfg = trunk->cfg; + this_trunk = trunk; if (trunk->e1.ts_in_use[ts_nr - 1]) { LOGPTRUNK(trunk, DE1, LOGL_INFO, "E1 timeslot %u already set up, skipping...\n", ts_nr); diff --git a/src/libosmo-mgcp/mgcp_trunk.c b/src/libosmo-mgcp/mgcp_trunk.c index c69c242..8bdef94 100644 --- a/src/libosmo-mgcp/mgcp_trunk.c +++ b/src/libosmo-mgcp/mgcp_trunk.c @@ -290,19 +290,3 @@ LOGP(DLMGCP, LOGL_ERROR, "unable to find trunk for endpoint name \"%s\"!\n", epname); return NULL; } - -/*! Find a trunk (E1) by its associated E1 line number. - * \param[in] num e1 line number. - * \returns trunk or NULL if trunk was not found. */ -struct mgcp_trunk *mgcp_trunk_by_line_num(const struct mgcp_config *cfg, unsigned int num) -{ - /*! When used on trunks other than E1, the result will always be NULL. */ - struct mgcp_trunk *trunk; - - llist_for_each_entry(trunk, &cfg->trunks, entry) { - if (trunk->trunk_type == MGCP_TRUNK_E1 && trunk->e1.vty_line_nr == num) - return trunk; - } - - return NULL; -} -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/25425 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Iabee6375dc521397d605549e3d869d5c8048fac3 Gerrit-Change-Number: 25425 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210909/04c685c7/attachment.htm>