pespin submitted this change.

View Change

Approvals: laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
xua_find_as_for_asp(): Optimize lookup

Instead of looking up on all AS configured in an instance, look up on
the subset associated to the ASP we are looking up for.
Since we are also not looking a 2nd pass to then validate if ASP and
returned AS is related, in worst case this would split lookup complexity
by half.

Change-Id: If85ad27ad5e55be0c22e2716fa7329409a7b85b5
---
M src/xua_shared.c
1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/xua_shared.c b/src/xua_shared.c
index 0fa94c4..51cbbf2 100644
--- a/src/xua_shared.c
+++ b/src/xua_shared.c
@@ -58,21 +58,14 @@
*as = NULL;

if (rctx_ie) {
- uint32_t rctx = xua_msg_part_get_u32(rctx_ie);
/* Use routing context IE to look up the AS for which the
* message was received. */
- *as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ uint32_t rctx = xua_msg_part_get_u32(rctx_ie);
+ *as = ss7_asp_find_as_by_rctx(asp, rctx);
if (!*as) {
- LOGPASP(asp, log_ss, LOGL_ERROR, "%s(): invalid routing context: %u\n",
- __func__, rctx);
- return M3UA_ERR_INVAL_ROUT_CTX;
- }
-
- /* Verify that this ASP is part of the AS. */
- if (!osmo_ss7_as_has_asp(*as, asp)) {
LOGPASP(asp, log_ss, LOGL_ERROR,
- "%s(): This Application Server Process is not part of the AS %s "
- "resolved by routing context %u\n", __func__, (*as)->cfg.name, rctx);
+ "%s(): This Application Server Process is not serving any AS with routing context: %u\n",
+ __func__, rctx);
return M3UA_ERR_NO_CONFGD_AS_FOR_ASP;
}
} else {

To view, visit change 42532. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: If85ad27ad5e55be0c22e2716fa7329409a7b85b5
Gerrit-Change-Number: 42532
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>