aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_sideeffect.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/sm_sideeffect.c')
-rw-r--r--net/sctp/sm_sideeffect.c96
1 files changed, 40 insertions, 56 deletions
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index ff91f47b0239..cf6f84518222 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -257,7 +257,7 @@ void sctp_generate_t3_rtx_event(unsigned long peer)
257 257
258 sctp_bh_lock_sock(asoc->base.sk); 258 sctp_bh_lock_sock(asoc->base.sk);
259 if (sock_owned_by_user(asoc->base.sk)) { 259 if (sock_owned_by_user(asoc->base.sk)) {
260 SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); 260 pr_debug("%s: sock is busy\n", __func__);
261 261
262 /* Try again later. */ 262 /* Try again later. */
263 if (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20))) 263 if (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20)))
@@ -297,9 +297,8 @@ static void sctp_generate_timeout_event(struct sctp_association *asoc,
297 297
298 sctp_bh_lock_sock(asoc->base.sk); 298 sctp_bh_lock_sock(asoc->base.sk);
299 if (sock_owned_by_user(asoc->base.sk)) { 299 if (sock_owned_by_user(asoc->base.sk)) {
300 SCTP_DEBUG_PRINTK("%s:Sock is busy: timer %d\n", 300 pr_debug("%s: sock is busy: timer %d\n", __func__,
301 __func__, 301 timeout_type);
302 timeout_type);
303 302
304 /* Try again later. */ 303 /* Try again later. */
305 if (!mod_timer(&asoc->timers[timeout_type], jiffies + (HZ/20))) 304 if (!mod_timer(&asoc->timers[timeout_type], jiffies + (HZ/20)))
@@ -377,7 +376,7 @@ void sctp_generate_heartbeat_event(unsigned long data)
377 376
378 sctp_bh_lock_sock(asoc->base.sk); 377 sctp_bh_lock_sock(asoc->base.sk);
379 if (sock_owned_by_user(asoc->base.sk)) { 378 if (sock_owned_by_user(asoc->base.sk)) {
380 SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); 379 pr_debug("%s: sock is busy\n", __func__);
381 380
382 /* Try again later. */ 381 /* Try again later. */
383 if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20))) 382 if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20)))
@@ -415,7 +414,7 @@ void sctp_generate_proto_unreach_event(unsigned long data)
415 414
416 sctp_bh_lock_sock(asoc->base.sk); 415 sctp_bh_lock_sock(asoc->base.sk);
417 if (sock_owned_by_user(asoc->base.sk)) { 416 if (sock_owned_by_user(asoc->base.sk)) {
418 SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); 417 pr_debug("%s: sock is busy\n", __func__);
419 418
420 /* Try again later. */ 419 /* Try again later. */
421 if (!mod_timer(&transport->proto_unreach_timer, 420 if (!mod_timer(&transport->proto_unreach_timer,
@@ -521,11 +520,9 @@ static void sctp_do_8_2_transport_strike(sctp_cmd_seq_t *commands,
521 520
522 if (transport->state != SCTP_INACTIVE && 521 if (transport->state != SCTP_INACTIVE &&
523 (transport->error_count > transport->pathmaxrxt)) { 522 (transport->error_count > transport->pathmaxrxt)) {
524 SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p", 523 pr_debug("%s: association:%p transport addr:%pISpc failed\n",
525 " transport IP: port:%d failed.\n", 524 __func__, asoc, &transport->ipaddr.sa);
526 asoc, 525
527 (&transport->ipaddr),
528 ntohs(transport->ipaddr.v4.sin_port));
529 sctp_assoc_control_transport(asoc, transport, 526 sctp_assoc_control_transport(asoc, transport,
530 SCTP_TRANSPORT_DOWN, 527 SCTP_TRANSPORT_DOWN,
531 SCTP_FAILED_THRESHOLD); 528 SCTP_FAILED_THRESHOLD);
@@ -804,8 +801,7 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
804 801
805 asoc->state = state; 802 asoc->state = state;
806 803
807 SCTP_DEBUG_PRINTK("sctp_cmd_new_state: asoc %p[%s]\n", 804 pr_debug("%s: asoc:%p[%s]\n", __func__, asoc, sctp_state_tbl[state]);
808 asoc, sctp_state_tbl[state]);
809 805
810 if (sctp_style(sk, TCP)) { 806 if (sctp_style(sk, TCP)) {
811 /* Change the sk->sk_state of a TCP-style socket that has 807 /* Change the sk->sk_state of a TCP-style socket that has
@@ -1017,15 +1013,11 @@ static void sctp_cmd_t1_timer_update(struct sctp_association *asoc,
1017 asoc->timeouts[timer] = asoc->max_init_timeo; 1013 asoc->timeouts[timer] = asoc->max_init_timeo;
1018 } 1014 }
1019 asoc->init_cycle++; 1015 asoc->init_cycle++;
1020 SCTP_DEBUG_PRINTK( 1016
1021 "T1 %s Timeout adjustment" 1017 pr_debug("%s: T1[%s] timeout adjustment init_err_counter:%d"
1022 " init_err_counter: %d" 1018 " cycle:%d timeout:%ld\n", __func__, name,
1023 " cycle: %d" 1019 asoc->init_err_counter, asoc->init_cycle,
1024 " timeout: %ld\n", 1020 asoc->timeouts[timer]);
1025 name,
1026 asoc->init_err_counter,
1027 asoc->init_cycle,
1028 asoc->timeouts[timer]);
1029 } 1021 }
1030 1022
1031} 1023}
@@ -1080,23 +1072,19 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)
1080 * main flow of sctp_do_sm() to keep attention focused on the real 1072 * main flow of sctp_do_sm() to keep attention focused on the real
1081 * functionality there. 1073 * functionality there.
1082 */ 1074 */
1083#define DEBUG_PRE \ 1075#define debug_pre_sfn() \
1084 SCTP_DEBUG_PRINTK("sctp_do_sm prefn: " \ 1076 pr_debug("%s[pre-fn]: ep:%p, %s, %s, asoc:%p[%s], %s\n", __func__, \
1085 "ep %p, %s, %s, asoc %p[%s], %s\n", \ 1077 ep, sctp_evttype_tbl[event_type], (*debug_fn)(subtype), \
1086 ep, sctp_evttype_tbl[event_type], \ 1078 asoc, sctp_state_tbl[state], state_fn->name)
1087 (*debug_fn)(subtype), asoc, \ 1079
1088 sctp_state_tbl[state], state_fn->name) 1080#define debug_post_sfn() \
1089 1081 pr_debug("%s[post-fn]: asoc:%p, status:%s\n", __func__, asoc, \
1090#define DEBUG_POST \ 1082 sctp_status_tbl[status])
1091 SCTP_DEBUG_PRINTK("sctp_do_sm postfn: " \ 1083
1092 "asoc %p, status: %s\n", \ 1084#define debug_post_sfx() \
1093 asoc, sctp_status_tbl[status]) 1085 pr_debug("%s[post-sfx]: error:%d, asoc:%p[%s]\n", __func__, error, \
1094 1086 asoc, sctp_state_tbl[(asoc && sctp_id2assoc(ep->base.sk, \
1095#define DEBUG_POST_SFX \ 1087 sctp_assoc2id(asoc))) ? asoc->state : SCTP_STATE_CLOSED])
1096 SCTP_DEBUG_PRINTK("sctp_do_sm post sfx: error %d, asoc %p[%s]\n", \
1097 error, asoc, \
1098 sctp_state_tbl[(asoc && sctp_id2assoc(ep->base.sk, \
1099 sctp_assoc2id(asoc)))?asoc->state:SCTP_STATE_CLOSED])
1100 1088
1101/* 1089/*
1102 * This is the master state machine processing function. 1090 * This is the master state machine processing function.
@@ -1116,7 +1104,6 @@ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
1116 sctp_disposition_t status; 1104 sctp_disposition_t status;
1117 int error = 0; 1105 int error = 0;
1118 typedef const char *(printfn_t)(sctp_subtype_t); 1106 typedef const char *(printfn_t)(sctp_subtype_t);
1119
1120 static printfn_t *table[] = { 1107 static printfn_t *table[] = {
1121 NULL, sctp_cname, sctp_tname, sctp_oname, sctp_pname, 1108 NULL, sctp_cname, sctp_tname, sctp_oname, sctp_pname,
1122 }; 1109 };
@@ -1129,21 +1116,18 @@ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
1129 1116
1130 sctp_init_cmd_seq(&commands); 1117 sctp_init_cmd_seq(&commands);
1131 1118
1132 DEBUG_PRE; 1119 debug_pre_sfn();
1133 status = (*state_fn->fn)(net, ep, asoc, subtype, event_arg, &commands); 1120 status = (*state_fn->fn)(net, ep, asoc, subtype, event_arg, &commands);
1134 DEBUG_POST; 1121 debug_post_sfn();
1135 1122
1136 error = sctp_side_effects(event_type, subtype, state, 1123 error = sctp_side_effects(event_type, subtype, state,
1137 ep, asoc, event_arg, status, 1124 ep, asoc, event_arg, status,
1138 &commands, gfp); 1125 &commands, gfp);
1139 DEBUG_POST_SFX; 1126 debug_post_sfx();
1140 1127
1141 return error; 1128 return error;
1142} 1129}
1143 1130
1144#undef DEBUG_PRE
1145#undef DEBUG_POST
1146
1147/***************************************************************** 1131/*****************************************************************
1148 * This the master state function side effect processing function. 1132 * This the master state function side effect processing function.
1149 *****************************************************************/ 1133 *****************************************************************/
@@ -1172,9 +1156,9 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
1172 1156
1173 switch (status) { 1157 switch (status) {
1174 case SCTP_DISPOSITION_DISCARD: 1158 case SCTP_DISPOSITION_DISCARD:
1175 SCTP_DEBUG_PRINTK("Ignored sctp protocol event - state %d, " 1159 pr_debug("%s: ignored sctp protocol event - state:%d, "
1176 "event_type %d, event_id %d\n", 1160 "event_type:%d, event_id:%d\n", __func__, state,
1177 state, event_type, subtype.chunk); 1161 event_type, subtype.chunk);
1178 break; 1162 break;
1179 1163
1180 case SCTP_DISPOSITION_NOMEM: 1164 case SCTP_DISPOSITION_NOMEM:
@@ -1425,18 +1409,18 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1425 1409
1426 case SCTP_CMD_CHUNK_ULP: 1410 case SCTP_CMD_CHUNK_ULP:
1427 /* Send a chunk to the sockets layer. */ 1411 /* Send a chunk to the sockets layer. */
1428 SCTP_DEBUG_PRINTK("sm_sideff: %s %p, %s %p.\n", 1412 pr_debug("%s: sm_sideff: chunk_up:%p, ulpq:%p\n",
1429 "chunk_up:", cmd->obj.chunk, 1413 __func__, cmd->obj.chunk, &asoc->ulpq);
1430 "ulpq:", &asoc->ulpq); 1414
1431 sctp_ulpq_tail_data(&asoc->ulpq, cmd->obj.chunk, 1415 sctp_ulpq_tail_data(&asoc->ulpq, cmd->obj.chunk,
1432 GFP_ATOMIC); 1416 GFP_ATOMIC);
1433 break; 1417 break;
1434 1418
1435 case SCTP_CMD_EVENT_ULP: 1419 case SCTP_CMD_EVENT_ULP:
1436 /* Send a notification to the sockets layer. */ 1420 /* Send a notification to the sockets layer. */
1437 SCTP_DEBUG_PRINTK("sm_sideff: %s %p, %s %p.\n", 1421 pr_debug("%s: sm_sideff: event_up:%p, ulpq:%p\n",
1438 "event_up:",cmd->obj.ulpevent, 1422 __func__, cmd->obj.ulpevent, &asoc->ulpq);
1439 "ulpq:",&asoc->ulpq); 1423
1440 sctp_ulpq_tail_event(&asoc->ulpq, cmd->obj.ulpevent); 1424 sctp_ulpq_tail_event(&asoc->ulpq, cmd->obj.ulpevent);
1441 break; 1425 break;
1442 1426
@@ -1601,7 +1585,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1601 break; 1585 break;
1602 1586
1603 case SCTP_CMD_REPORT_BAD_TAG: 1587 case SCTP_CMD_REPORT_BAD_TAG:
1604 SCTP_DEBUG_PRINTK("vtag mismatch!\n"); 1588 pr_debug("%s: vtag mismatch!\n", __func__);
1605 break; 1589 break;
1606 1590
1607 case SCTP_CMD_STRIKE: 1591 case SCTP_CMD_STRIKE: