9
0
Fork 0

m2ua: Start link only after we had the emergency alignment

This should avoid us getting an error as we are sending the
SLTM too fast. In one way this makes sense, on the other hand
we already have too many states and should remove some variables
This commit is contained in:
Holger Hans Peter Freyther 2011-02-17 18:41:33 +01:00
parent 5e5758c783
commit 4cee7c0901
2 changed files with 8 additions and 3 deletions

View File

@ -49,6 +49,7 @@ struct mtp_m2ua_link {
* what will happen to it. For load-sharing we
* will need to turn this into a list.
*/
int active;
int asp_active;
int established;
struct sctp_m2ua_conn *conn;

View File

@ -66,6 +66,7 @@ static void m2ua_conn_destroy(struct sctp_m2ua_conn *conn)
link_down(link->base);
link->established = 0;
link->asp_active = 0;
link->active = 0;
link->conn = NULL;
}
@ -311,6 +312,10 @@ static int m2ua_handle_state_req(struct mtp_m2ua_link *link,
return -1;
}
m2ua_msg_free(conf);
LOGP(DINP, LOGL_NOTICE, "M2UA link-index %d is running.\n", link->link_index);
link->active = 1;
mtp_link_up(link->base);
break;
default:
LOGP(DINP, LOGL_ERROR, "Unknown STATE Request: %d\n", req);
@ -341,8 +346,6 @@ static int m2ua_handle_est_req(struct mtp_m2ua_link *link,
}
link->established = 1;
LOGP(DINP, LOGL_NOTICE, "M2UA/Link is established.\n");
mtp_link_up(link->base);
m2ua_msg_free(conf);
return 0;
}
@ -367,6 +370,7 @@ static int m2ua_handle_rel_req(struct mtp_m2ua_link *link,
}
link->established = 0;
link->active = 0;
LOGP(DINP, LOGL_NOTICE, "M2UA/Link is released.\n");
link_down(link->base);
m2ua_msg_free(conf);
@ -564,7 +568,7 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg)
goto clean;
}
if (!mlink->asp_active || !mlink->established) {
if (!mlink->asp_active || !mlink->established || !mlink->active) {
LOGP(DINP, LOGL_ERROR, "ASP not ready for %d/%s of %d/%s.\n",
link->nr, link->name, link->set->nr, link->set->name);
goto clean;