Change in libosmo-sccp[master]: ss7: Implement AS traffic mode loadshare using round robin ASP selection

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/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Oct 28 19:16:32 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/15802 )

Change subject: ss7: Implement AS traffic mode loadshare using round robin ASP selection
......................................................................

ss7: Implement AS traffic mode loadshare using round robin ASP selection

Related: OS#4220
Change-Id: I98144dde237672df2e78c7c92923e6f4cb77a271
---
M TODO-RELEASE
M include/osmocom/sigtran/osmo_ss7.h
M src/xua_as_fsm.c
3 files changed, 46 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/TODO-RELEASE b/TODO-RELEASE
index 98b3b88..224f6bc 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-sigtran osmo_ss7_asp_peer	ABI breakage (host is now an array of strings)
+libosmo-sigtran osmo_ss7_as		ABI breakage (added field last_asp_idx_sent)
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 12aeea4..4f3d6f5 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -322,6 +322,7 @@
 		} pc_override;
 
 		struct osmo_ss7_asp *asps[16];
+		uint8_t last_asp_idx_sent; /* used for load-sharing traffic mode (round robin implementation) */
 	} cfg;
 };
 
diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index 541e52c..cf75ef3 100644
--- a/src/xua_as_fsm.c
+++ b/src/xua_as_fsm.c
@@ -71,14 +71,12 @@
 	return sent;
 }
 
-/* actually transmit a message through this AS */
-int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg)
+static struct osmo_ss7_asp *xua_as_select_asp_override(struct osmo_ss7_as *as)
 {
 	struct osmo_ss7_asp *asp;
 	unsigned int i;
 
-	/* FIXME: proper selection of the ASP based on the SLS and the
-	 * traffic mode type! */
+	/* FIXME: proper selection of the ASP based on the SLS! */
 	for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
 		asp = as->cfg.asps[i];
 		if (!asp)
@@ -86,6 +84,48 @@
 		if (asp)
 			break;
 	}
+	return asp;
+}
+
+static struct osmo_ss7_asp *xua_as_select_asp_roundrobin(struct osmo_ss7_as *as)
+{
+	struct osmo_ss7_asp *asp;
+	unsigned int i;
+	unsigned int first_idx;
+
+	first_idx = (as->cfg.last_asp_idx_sent + 1) % ARRAY_SIZE(as->cfg.asps);
+	i = first_idx;
+	do {
+		asp = as->cfg.asps[i];
+		if (asp)
+			break;
+		i = (i + 1) % ARRAY_SIZE(as->cfg.asps);
+	} while (i != first_idx);
+	as->cfg.last_asp_idx_sent = i;
+
+	return asp;
+}
+
+/* actually transmit a message through this AS */
+int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg)
+{
+	struct osmo_ss7_asp *asp = NULL;
+
+	switch (as->cfg.mode) {
+	case OSMO_SS7_AS_TMOD_OVERRIDE:
+		asp = xua_as_select_asp_override(as);
+		break;
+	case OSMO_SS7_AS_TMOD_LOADSHARE:
+	case OSMO_SS7_AS_TMOD_ROUNDROBIN:
+		asp = xua_as_select_asp_roundrobin(as);
+		break;
+	case OSMO_SS7_AS_TMOD_BCAST:
+		LOGPFSM(as->fi, "Traffic mode broadcast not implemented, dropping message\n");
+		msgb_free(msg);
+		return -1;
+	case _NUM_OSMO_SS7_ASP_TMOD:
+		OSMO_ASSERT(false);
+	}
 
 	if (!asp) {
 		LOGPFSM(as->fi, "No ASP in AS, dropping message\n");

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/15802
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I98144dde237672df2e78c7c92923e6f4cb77a271
Gerrit-Change-Number: 15802
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191028/d67a6088/attachment.htm>


More information about the gerrit-log mailing list