9
0
Fork 0

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.
This commit is contained in:
Holger Hans Peter Freyther 2011-01-02 18:11:37 +01:00
parent 45738887be
commit 346e1c4bc4
5 changed files with 11 additions and 4 deletions

View File

@ -46,6 +46,8 @@ struct mtp_link {
int running;
int sccp_up;
int last_sls;
/* misc data */
uint8_t test_ptrn[14];

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);
}