aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-02 18:11:37 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 11:21:10 +0100
commit346e1c4bc4266ad645aab88d6357518e17055fb3 (patch)
tree7c57a91a277e0d2fd0a2ec1e03cd8ce1ebb7b530 /src
parent45738887be2299cf5fca19b1f94c6054cca41239 (diff)
mtp: Attempt to select the sls properly in the round robin fashion
When we call the submit method with a SLS of -1 we will try to find the next SLS to do things in a round robin way.
Diffstat (limited to 'src')
-rw-r--r--src/bsc_sccp.c2
-rw-r--r--src/main.c4
-rw-r--r--src/msc_conn.c2
-rw-r--r--src/mtp_layer3.c5
4 files changed, 9 insertions, 4 deletions
diff --git a/src/bsc_sccp.c b/src/bsc_sccp.c
index 69e2262..ea13c43 100644
--- a/src/bsc_sccp.c
+++ b/src/bsc_sccp.c
@@ -86,7 +86,7 @@ unsigned int sls_for_src_ref(struct sccp_source_reference *ref)
con = find_con_by_src_ref(ref);
if (!con)
- return 13;
+ return -1;
return con->sls;
}
diff --git a/src/main.c b/src/main.c
index c922474..a4e502c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -224,7 +224,7 @@ static void bsc_reset_timeout(void *_data)
}
++bsc->reset_count;
- mtp_link_submit_sccp_data(bsc->link.the_link, 13, msg->l2h, msgb_l2len(msg));
+ mtp_link_submit_sccp_data(bsc->link.the_link, -1, msg->l2h, msgb_l2len(msg));
msgb_free(msg);
bsc_schedule_timer(&bsc->reset_timeout, 20, 0);
}
@@ -351,7 +351,7 @@ static void handle_rlsd(struct sccp_connection_released *rlsd, int from_msc)
&rlsd->source_local_reference);
}
} else {
- unsigned int sls = 13;
+ unsigned int sls = -1;
con = find_con_by_src_dest_ref(&rlsd->source_local_reference,
&rlsd->destination_local_reference);
if (con) {
diff --git a/src/msc_conn.c b/src/msc_conn.c
index 5d1b329..62459ec 100644
--- a/src/msc_conn.c
+++ b/src/msc_conn.c
@@ -168,7 +168,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd)
/* we can not forward it right now */
if (bsc->forward_only && link->sccp_up) {
- if (send_or_queue_bsc_msg(link, 13, msg) != 1)
+ if (send_or_queue_bsc_msg(link, -1, msg) != 1)
msgb_free(msg);
return 0;
}
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index 91d3f07..e756440 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -510,6 +510,11 @@ int mtp_link_submit_sccp_data(struct mtp_link *link, int sls, const uint8_t *dat
return -1;
}
+ if (sls == -1) {
+ sls = link->last_sls;
+ link->last_sls = (link->last_sls + 1) % 16;
+ }
+
return mtp_int_submit(link, link->sccp_opc, sls, MTP_SI_MNT_SCCP, data, length);
}