[S] Change in libosmo-sigtran[master]: ss7_as: Optimize ASP Tx selection in Override traffic mode
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42108?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: ss7_as: Optimize ASP Tx selection in Override traffic mode ...................................................................... ss7_as: Optimize ASP Tx selection in Override traffic mode Cache the last selected ASP, and expect it to still be the active ASP most of the time until it changes. Change-Id: I3d480d23591f4bd216293be60b22389b182fd8f3 --- M src/ss7_as.c 1 file changed, 10 insertions(+), 2 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified daniel: Looks good to me, approved diff --git a/src/ss7_as.c b/src/ss7_as.c index 4090d4a..8a5c1a1 100644 --- a/src/ss7_as.c +++ b/src/ss7_as.c @@ -404,8 +404,16 @@ { struct ss7_as_asp_assoc *assoc; - llist_for_each_entry(assoc, &as->assoc_asp_list, as_entry) { - if (osmo_ss7_asp_active(assoc->asp)) + /* Hot path: Override traffic mode has only max 1 active ASP at a time. + * Unless there's a change in state, the last ASP used to transmit is most + * probably the active one: */ + if (as->last_asp_idx_sent && osmo_ss7_asp_active(as->last_asp_idx_sent->asp)) + return as->last_asp_idx_sent->asp; + + /* Slow path: Active ASP changed, look it up: */ + for (unsigned int i = 0; i < as->num_assoc_asps; i++) { + assoc = ss7_as_asp_assoc_llist_round_robin(as, &as->last_asp_idx_sent); + if (assoc && osmo_ss7_asp_active(assoc->asp)) return assoc->asp; } return NULL; -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42108?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: I3d480d23591f4bd216293be60b22389b182fd8f3 Gerrit-Change-Number: 42108 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de>
participants (1)
-
pespin