aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sctp/Kconfig12
-rw-r--r--net/sctp/associola.c67
-rw-r--r--net/sctp/chunk.c5
-rw-r--r--net/sctp/debug.c4
-rw-r--r--net/sctp/endpointola.c5
-rw-r--r--net/sctp/input.c6
-rw-r--r--net/sctp/inqueue.c9
-rw-r--r--net/sctp/ipv6.c21
-rw-r--r--net/sctp/output.c40
-rw-r--r--net/sctp/outqueue.c160
-rw-r--r--net/sctp/protocol.c48
-rw-r--r--net/sctp/sm_make_chunk.c25
-rw-r--r--net/sctp/sm_sideeffect.c96
-rw-r--r--net/sctp/sm_statefuns.c77
-rw-r--r--net/sctp/socket.c168
-rw-r--r--net/sctp/transport.c49
16 files changed, 383 insertions, 409 deletions
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index cf4852814e0c..d80bf1aebaed 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -30,7 +30,8 @@ menuconfig IP_SCTP
30 homing at either or both ends of an association." 30 homing at either or both ends of an association."
31 31
32 To compile this protocol support as a module, choose M here: the 32 To compile this protocol support as a module, choose M here: the
33 module will be called sctp. 33 module will be called sctp. Debug messages are handeled by the
34 kernel's dynamic debugging framework.
34 35
35 If in doubt, say N. 36 If in doubt, say N.
36 37
@@ -48,13 +49,14 @@ config NET_SCTPPROBE
48 To compile this code as a module, choose M here: the 49 To compile this code as a module, choose M here: the
49 module will be called sctp_probe. 50 module will be called sctp_probe.
50 51
51config SCTP_DBG_MSG 52config SCTP_DBG_TSNS
52 bool "SCTP: Debug messages" 53 bool "SCTP: Debug transactions"
53 help 54 help
54 If you say Y, this will enable verbose debugging messages. 55 If you say Y, this will enable transaction debugging, visible
56 from the kernel's dynamic debugging framework.
55 57
56 If unsure, say N. However, if you are running into problems, use 58 If unsure, say N. However, if you are running into problems, use
57 this option to gather detailed trace information 59 this option to gather outqueue trace information.
58 60
59config SCTP_DBG_OBJCNT 61config SCTP_DBG_OBJCNT
60 bool "SCTP: Debug object counts" 62 bool "SCTP: Debug object counts"
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 9a383a8774e8..bce5b79662a6 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -357,7 +357,8 @@ struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep,
357 goto fail_init; 357 goto fail_init;
358 358
359 SCTP_DBG_OBJCNT_INC(assoc); 359 SCTP_DBG_OBJCNT_INC(assoc);
360 SCTP_DEBUG_PRINTK("Created asoc %p\n", asoc); 360
361 pr_debug("Created asoc %p\n", asoc);
361 362
362 return asoc; 363 return asoc;
363 364
@@ -455,7 +456,10 @@ void sctp_association_free(struct sctp_association *asoc)
455/* Cleanup and free up an association. */ 456/* Cleanup and free up an association. */
456static void sctp_association_destroy(struct sctp_association *asoc) 457static void sctp_association_destroy(struct sctp_association *asoc)
457{ 458{
458 SCTP_ASSERT(asoc->base.dead, "Assoc is not dead", return); 459 if (unlikely(!asoc->base.dead)) {
460 WARN(1, "Attempt to destroy undead association %p!\n", asoc);
461 return;
462 }
459 463
460 sctp_endpoint_put(asoc->ep); 464 sctp_endpoint_put(asoc->ep);
461 sock_put(asoc->base.sk); 465 sock_put(asoc->base.sk);
@@ -536,11 +540,8 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
536 struct list_head *pos; 540 struct list_head *pos;
537 struct sctp_transport *transport; 541 struct sctp_transport *transport;
538 542
539 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_rm_peer:association %p addr: ", 543 pr_debug("%s: association:%p addr:%pISpc\n",
540 " port: %d\n", 544 __func__, asoc, &peer->ipaddr.sa);
541 asoc,
542 (&peer->ipaddr),
543 ntohs(peer->ipaddr.v4.sin_port));
544 545
545 /* If we are to remove the current retran_path, update it 546 /* If we are to remove the current retran_path, update it
546 * to the next peer before removing this peer from the list. 547 * to the next peer before removing this peer from the list.
@@ -636,12 +637,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
636 /* AF_INET and AF_INET6 share common port field. */ 637 /* AF_INET and AF_INET6 share common port field. */
637 port = ntohs(addr->v4.sin_port); 638 port = ntohs(addr->v4.sin_port);
638 639
639 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_add_peer:association %p addr: ", 640 pr_debug("%s: association:%p addr:%pISpc state:%d\n", __func__,
640 " port: %d state:%d\n", 641 asoc, &addr->sa, peer_state);
641 asoc,
642 addr,
643 port,
644 peer_state);
645 642
646 /* Set the port if it has not been set yet. */ 643 /* Set the port if it has not been set yet. */
647 if (0 == asoc->peer.port) 644 if (0 == asoc->peer.port)
@@ -708,8 +705,9 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
708 else 705 else
709 asoc->pathmtu = peer->pathmtu; 706 asoc->pathmtu = peer->pathmtu;
710 707
711 SCTP_DEBUG_PRINTK("sctp_assoc_add_peer:association %p PMTU set to " 708 pr_debug("%s: association:%p PMTU set to %d\n", __func__, asoc,
712 "%d\n", asoc, asoc->pathmtu); 709 asoc->pathmtu);
710
713 peer->pmtu_pending = 0; 711 peer->pmtu_pending = 0;
714 712
715 asoc->frag_point = sctp_frag_point(asoc, asoc->pathmtu); 713 asoc->frag_point = sctp_frag_point(asoc, asoc->pathmtu);
@@ -1349,12 +1347,8 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
1349 else 1347 else
1350 t = asoc->peer.retran_path; 1348 t = asoc->peer.retran_path;
1351 1349
1352 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_update_retran_path:association" 1350 pr_debug("%s: association:%p addr:%pISpc\n", __func__, asoc,
1353 " %p addr: ", 1351 &t->ipaddr.sa);
1354 " port: %d\n",
1355 asoc,
1356 (&t->ipaddr),
1357 ntohs(t->ipaddr.v4.sin_port));
1358} 1352}
1359 1353
1360/* Choose the transport for sending retransmit packet. */ 1354/* Choose the transport for sending retransmit packet. */
@@ -1401,8 +1395,8 @@ void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc)
1401 asoc->frag_point = sctp_frag_point(asoc, pmtu); 1395 asoc->frag_point = sctp_frag_point(asoc, pmtu);
1402 } 1396 }
1403 1397
1404 SCTP_DEBUG_PRINTK("%s: asoc:%p, pmtu:%d, frag_point:%d\n", 1398 pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc,
1405 __func__, asoc, asoc->pathmtu, asoc->frag_point); 1399 asoc->pathmtu, asoc->frag_point);
1406} 1400}
1407 1401
1408/* Should we send a SACK to update our peer? */ 1402/* Should we send a SACK to update our peer? */
@@ -1454,9 +1448,9 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)
1454 asoc->rwnd_press -= change; 1448 asoc->rwnd_press -= change;
1455 } 1449 }
1456 1450
1457 SCTP_DEBUG_PRINTK("%s: asoc %p rwnd increased by %d to (%u, %u) " 1451 pr_debug("%s: asoc:%p rwnd increased by %d to (%u, %u) - %u\n",
1458 "- %u\n", __func__, asoc, len, asoc->rwnd, 1452 __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,
1459 asoc->rwnd_over, asoc->a_rwnd); 1453 asoc->a_rwnd);
1460 1454
1461 /* Send a window update SACK if the rwnd has increased by at least the 1455 /* Send a window update SACK if the rwnd has increased by at least the
1462 * minimum of the association's PMTU and half of the receive buffer. 1456 * minimum of the association's PMTU and half of the receive buffer.
@@ -1465,9 +1459,11 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)
1465 */ 1459 */
1466 if (sctp_peer_needs_update(asoc)) { 1460 if (sctp_peer_needs_update(asoc)) {
1467 asoc->a_rwnd = asoc->rwnd; 1461 asoc->a_rwnd = asoc->rwnd;
1468 SCTP_DEBUG_PRINTK("%s: Sending window update SACK- asoc: %p " 1462
1469 "rwnd: %u a_rwnd: %u\n", __func__, 1463 pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u "
1470 asoc, asoc->rwnd, asoc->a_rwnd); 1464 "a_rwnd:%u\n", __func__, asoc, asoc->rwnd,
1465 asoc->a_rwnd);
1466
1471 sack = sctp_make_sack(asoc); 1467 sack = sctp_make_sack(asoc);
1472 if (!sack) 1468 if (!sack)
1473 return; 1469 return;
@@ -1489,8 +1485,10 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
1489 int rx_count; 1485 int rx_count;
1490 int over = 0; 1486 int over = 0;
1491 1487
1492 SCTP_ASSERT(asoc->rwnd, "rwnd zero", return); 1488 if (unlikely(!asoc->rwnd || asoc->rwnd_over))
1493 SCTP_ASSERT(!asoc->rwnd_over, "rwnd_over not zero", return); 1489 pr_debug("%s: association:%p has asoc->rwnd:%u, "
1490 "asoc->rwnd_over:%u!\n", __func__, asoc,
1491 asoc->rwnd, asoc->rwnd_over);
1494 1492
1495 if (asoc->ep->rcvbuf_policy) 1493 if (asoc->ep->rcvbuf_policy)
1496 rx_count = atomic_read(&asoc->rmem_alloc); 1494 rx_count = atomic_read(&asoc->rmem_alloc);
@@ -1515,9 +1513,10 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
1515 asoc->rwnd_over = len - asoc->rwnd; 1513 asoc->rwnd_over = len - asoc->rwnd;
1516 asoc->rwnd = 0; 1514 asoc->rwnd = 0;
1517 } 1515 }
1518 SCTP_DEBUG_PRINTK("%s: asoc %p rwnd decreased by %d to (%u, %u, %u)\n", 1516
1519 __func__, asoc, len, asoc->rwnd, 1517 pr_debug("%s: asoc:%p rwnd decreased by %d to (%u, %u, %u)\n",
1520 asoc->rwnd_over, asoc->rwnd_press); 1518 __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,
1519 asoc->rwnd_press);
1521} 1520}
1522 1521
1523/* Build the bind address list for the association based on info from the 1522/* Build the bind address list for the association based on info from the
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 7135fc0c087a..5780565f5b7d 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -193,8 +193,9 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
193 msg->expires_at = jiffies + 193 msg->expires_at = jiffies +
194 msecs_to_jiffies(sinfo->sinfo_timetolive); 194 msecs_to_jiffies(sinfo->sinfo_timetolive);
195 msg->can_abandon = 1; 195 msg->can_abandon = 1;
196 SCTP_DEBUG_PRINTK("%s: msg:%p expires_at: %ld jiffies:%ld\n", 196
197 __func__, msg, msg->expires_at, jiffies); 197 pr_debug("%s: msg:%p expires_at:%ld jiffies:%ld\n", __func__,
198 msg, msg->expires_at, jiffies);
198 } 199 }
199 200
200 /* This is the biggest possible DATA chunk that can fit into 201 /* This is the biggest possible DATA chunk that can fit into
diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index ec997cfe0a7e..f4998780d6df 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -47,10 +47,6 @@
47 47
48#include <net/sctp/sctp.h> 48#include <net/sctp/sctp.h>
49 49
50#if SCTP_DEBUG
51int sctp_debug_flag = 1; /* Initially enable DEBUG */
52#endif /* SCTP_DEBUG */
53
54/* These are printable forms of Chunk ID's from section 3.1. */ 50/* These are printable forms of Chunk ID's from section 3.1. */
55static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = { 51static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
56 "DATA", 52 "DATA",
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index b26999d508ba..9e3d257de0e0 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -249,7 +249,10 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
249{ 249{
250 struct sock *sk; 250 struct sock *sk;
251 251
252 SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return); 252 if (unlikely(!ep->base.dead)) {
253 WARN(1, "Attempt to destroy undead endpoint %p!\n", ep);
254 return;
255 }
253 256
254 /* Free the digest buffer */ 257 /* Free the digest buffer */
255 kfree(ep->digest); 258 kfree(ep->digest);
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 4cfc74699a3f..3fa4d858c35a 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -454,8 +454,6 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
454 struct sctp_association *asoc, 454 struct sctp_association *asoc,
455 struct sctp_transport *t) 455 struct sctp_transport *t)
456{ 456{
457 SCTP_DEBUG_PRINTK("%s\n", __func__);
458
459 if (sock_owned_by_user(sk)) { 457 if (sock_owned_by_user(sk)) {
460 if (timer_pending(&t->proto_unreach_timer)) 458 if (timer_pending(&t->proto_unreach_timer))
461 return; 459 return;
@@ -464,10 +462,12 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
464 jiffies + (HZ/20))) 462 jiffies + (HZ/20)))
465 sctp_association_hold(asoc); 463 sctp_association_hold(asoc);
466 } 464 }
467
468 } else { 465 } else {
469 struct net *net = sock_net(sk); 466 struct net *net = sock_net(sk);
470 467
468 pr_debug("%s: unrecognized next header type "
469 "encountered!\n", __func__);
470
471 if (del_timer(&t->proto_unreach_timer)) 471 if (del_timer(&t->proto_unreach_timer))
472 sctp_association_put(asoc); 472 sctp_association_put(asoc);
473 473
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index 3221d073448c..cb25f040fed0 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -219,10 +219,10 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
219 chunk->end_of_packet = 1; 219 chunk->end_of_packet = 1;
220 } 220 }
221 221
222 SCTP_DEBUG_PRINTK("+++sctp_inq_pop+++ chunk %p[%s]," 222 pr_debug("+++sctp_inq_pop+++ chunk:%p[%s], length:%d, skb->len:%d\n",
223 " length %d, skb->len %d\n",chunk, 223 chunk, sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)),
224 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)), 224 ntohs(chunk->chunk_hdr->length), chunk->skb->len);
225 ntohs(chunk->chunk_hdr->length), chunk->skb->len); 225
226 return chunk; 226 return chunk;
227} 227}
228 228
@@ -238,4 +238,3 @@ void sctp_inq_set_th_handler(struct sctp_inq *q, work_func_t callback)
238{ 238{
239 INIT_WORK(&q->immediate, callback); 239 INIT_WORK(&q->immediate, callback);
240} 240}
241
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index adeaa0e64f52..09ffcc912d23 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -239,9 +239,8 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
239 fl6.daddr = *rt0->addr; 239 fl6.daddr = *rt0->addr;
240 } 240 }
241 241
242 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI6 dst:%pI6\n", 242 pr_debug("%s: skb:%p, len:%d, src:%pI6 dst:%pI6\n", __func__, skb,
243 __func__, skb, skb->len, 243 skb->len, &fl6.saddr, &fl6.daddr);
244 &fl6.saddr, &fl6.daddr);
245 244
246 SCTP_INC_STATS(sock_net(sk), SCTP_MIB_OUTSCTPPACKS); 245 SCTP_INC_STATS(sock_net(sk), SCTP_MIB_OUTSCTPPACKS);
247 246
@@ -276,7 +275,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
276 if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) 275 if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
277 fl6->flowi6_oif = daddr->v6.sin6_scope_id; 276 fl6->flowi6_oif = daddr->v6.sin6_scope_id;
278 277
279 SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl6->daddr); 278 pr_debug("%s: dst=%pI6 ", __func__, &fl6->daddr);
280 279
281 if (asoc) 280 if (asoc)
282 fl6->fl6_sport = htons(asoc->base.bind_addr.port); 281 fl6->fl6_sport = htons(asoc->base.bind_addr.port);
@@ -284,7 +283,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
284 if (saddr) { 283 if (saddr) {
285 fl6->saddr = saddr->v6.sin6_addr; 284 fl6->saddr = saddr->v6.sin6_addr;
286 fl6->fl6_sport = saddr->v6.sin6_port; 285 fl6->fl6_sport = saddr->v6.sin6_port;
287 SCTP_DEBUG_PRINTK("SRC=%pI6 - ", &fl6->saddr); 286
287 pr_debug("src=%pI6 - ", &fl6->saddr);
288 } 288 }
289 289
290 dst = ip6_dst_lookup_flow(sk, fl6, NULL, false); 290 dst = ip6_dst_lookup_flow(sk, fl6, NULL, false);
@@ -348,13 +348,16 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
348out: 348out:
349 if (!IS_ERR_OR_NULL(dst)) { 349 if (!IS_ERR_OR_NULL(dst)) {
350 struct rt6_info *rt; 350 struct rt6_info *rt;
351
351 rt = (struct rt6_info *)dst; 352 rt = (struct rt6_info *)dst;
352 t->dst = dst; 353 t->dst = dst;
353 SCTP_DEBUG_PRINTK("rt6_dst:%pI6 rt6_src:%pI6\n", 354
354 &rt->rt6i_dst.addr, &fl6->saddr); 355 pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr,
356 &fl6->saddr);
355 } else { 357 } else {
356 t->dst = NULL; 358 t->dst = NULL;
357 SCTP_DEBUG_PRINTK("NO ROUTE\n"); 359
360 pr_debug("no route\n");
358 } 361 }
359} 362}
360 363
@@ -377,7 +380,7 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
377 struct flowi6 *fl6 = &fl->u.ip6; 380 struct flowi6 *fl6 = &fl->u.ip6;
378 union sctp_addr *saddr = &t->saddr; 381 union sctp_addr *saddr = &t->saddr;
379 382
380 SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p\n", __func__, t->asoc, t->dst); 383 pr_debug("%s: asoc:%p dst:%p\n", __func__, t->asoc, t->dst);
381 384
382 if (t->dst) { 385 if (t->dst) {
383 saddr->v6.sin6_family = AF_INET6; 386 saddr->v6.sin6_family = AF_INET6;
diff --git a/net/sctp/output.c b/net/sctp/output.c
index bbef4a7a9b56..a46d1eb41762 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -93,8 +93,7 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet,
93{ 93{
94 struct sctp_chunk *chunk = NULL; 94 struct sctp_chunk *chunk = NULL;
95 95
96 SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__, 96 pr_debug("%s: packet:%p vtag:0x%x\n", __func__, packet, vtag);
97 packet, vtag);
98 97
99 packet->vtag = vtag; 98 packet->vtag = vtag;
100 99
@@ -119,8 +118,7 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet,
119 struct sctp_association *asoc = transport->asoc; 118 struct sctp_association *asoc = transport->asoc;
120 size_t overhead; 119 size_t overhead;
121 120
122 SCTP_DEBUG_PRINTK("%s: packet:%p transport:%p\n", __func__, 121 pr_debug("%s: packet:%p transport:%p\n", __func__, packet, transport);
123 packet, transport);
124 122
125 packet->transport = transport; 123 packet->transport = transport;
126 packet->source_port = sport; 124 packet->source_port = sport;
@@ -145,7 +143,7 @@ void sctp_packet_free(struct sctp_packet *packet)
145{ 143{
146 struct sctp_chunk *chunk, *tmp; 144 struct sctp_chunk *chunk, *tmp;
147 145
148 SCTP_DEBUG_PRINTK("%s: packet:%p\n", __func__, packet); 146 pr_debug("%s: packet:%p\n", __func__, packet);
149 147
150 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { 148 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) {
151 list_del_init(&chunk->list); 149 list_del_init(&chunk->list);
@@ -167,8 +165,7 @@ sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *packet,
167 sctp_xmit_t retval; 165 sctp_xmit_t retval;
168 int error = 0; 166 int error = 0;
169 167
170 SCTP_DEBUG_PRINTK("%s: packet:%p chunk:%p\n", __func__, 168 pr_debug("%s: packet:%p chunk:%p\n", __func__, packet, chunk);
171 packet, chunk);
172 169
173 switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) { 170 switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) {
174 case SCTP_XMIT_PMTU_FULL: 171 case SCTP_XMIT_PMTU_FULL:
@@ -334,8 +331,7 @@ sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *packet,
334{ 331{
335 sctp_xmit_t retval = SCTP_XMIT_OK; 332 sctp_xmit_t retval = SCTP_XMIT_OK;
336 333
337 SCTP_DEBUG_PRINTK("%s: packet:%p chunk:%p\n", __func__, packet, 334 pr_debug("%s: packet:%p chunk:%p\n", __func__, packet, chunk);
338 chunk);
339 335
340 /* Data chunks are special. Before seeing what else we can 336 /* Data chunks are special. Before seeing what else we can
341 * bundle into this packet, check to see if we are allowed to 337 * bundle into this packet, check to see if we are allowed to
@@ -402,7 +398,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
402 unsigned char *auth = NULL; /* pointer to auth in skb data */ 398 unsigned char *auth = NULL; /* pointer to auth in skb data */
403 __u32 cksum_buf_len = sizeof(struct sctphdr); 399 __u32 cksum_buf_len = sizeof(struct sctphdr);
404 400
405 SCTP_DEBUG_PRINTK("%s: packet:%p\n", __func__, packet); 401 pr_debug("%s: packet:%p\n", __func__, packet);
406 402
407 /* Do NOT generate a chunkless packet. */ 403 /* Do NOT generate a chunkless packet. */
408 if (list_empty(&packet->chunk_list)) 404 if (list_empty(&packet->chunk_list))
@@ -472,7 +468,9 @@ int sctp_packet_transmit(struct sctp_packet *packet)
472 * 468 *
473 * [This whole comment explains WORD_ROUND() below.] 469 * [This whole comment explains WORD_ROUND() below.]
474 */ 470 */
475 SCTP_DEBUG_PRINTK("***sctp_transmit_packet***\n"); 471
472 pr_debug("***sctp_transmit_packet***\n");
473
476 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { 474 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) {
477 list_del_init(&chunk->list); 475 list_del_init(&chunk->list);
478 if (sctp_chunk_is_data(chunk)) { 476 if (sctp_chunk_is_data(chunk)) {
@@ -505,16 +503,13 @@ int sctp_packet_transmit(struct sctp_packet *packet)
505 memcpy(skb_put(nskb, chunk->skb->len), 503 memcpy(skb_put(nskb, chunk->skb->len),
506 chunk->skb->data, chunk->skb->len); 504 chunk->skb->data, chunk->skb->len);
507 505
508 SCTP_DEBUG_PRINTK("%s %p[%s] %s 0x%x, %s %d, %s %d, %s %d\n", 506 pr_debug("*** Chunk:%p[%s] %s 0x%x, length:%d, chunk->skb->len:%d, "
509 "*** Chunk", chunk, 507 "rtt_in_progress:%d\n", chunk,
510 sctp_cname(SCTP_ST_CHUNK( 508 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)),
511 chunk->chunk_hdr->type)), 509 chunk->has_tsn ? "TSN" : "No TSN",
512 chunk->has_tsn ? "TSN" : "No TSN", 510 chunk->has_tsn ? ntohl(chunk->subh.data_hdr->tsn) : 0,
513 chunk->has_tsn ? 511 ntohs(chunk->chunk_hdr->length), chunk->skb->len,
514 ntohl(chunk->subh.data_hdr->tsn) : 0, 512 chunk->rtt_in_progress);
515 "length", ntohs(chunk->chunk_hdr->length),
516 "chunk->skb->len", chunk->skb->len,
517 "rtt_in_progress", chunk->rtt_in_progress);
518 513
519 /* 514 /*
520 * If this is a control chunk, this is our last 515 * If this is a control chunk, this is our last
@@ -606,8 +601,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
606 } 601 }
607 } 602 }
608 603
609 SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n", 604 pr_debug("***sctp_transmit_packet*** skb->len:%d\n", nskb->len);
610 nskb->len);
611 605
612 nskb->local_df = packet->ipfragok; 606 nskb->local_df = packet->ipfragok;
613 (*tp->af_specific->sctp_xmit)(nskb, tp); 607 (*tp->af_specific->sctp_xmit)(nskb, tp);
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index be35e2dbcc9a..511b3b35d609 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -299,10 +299,10 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
299 struct net *net = sock_net(q->asoc->base.sk); 299 struct net *net = sock_net(q->asoc->base.sk);
300 int error = 0; 300 int error = 0;
301 301
302 SCTP_DEBUG_PRINTK("sctp_outq_tail(%p, %p[%s])\n", 302 pr_debug("%s: outq:%p, chunk:%p[%s]\n", __func__, q, chunk,
303 q, chunk, chunk && chunk->chunk_hdr ? 303 chunk && chunk->chunk_hdr ?
304 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) 304 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) :
305 : "Illegal Chunk"); 305 "illegal chunk");
306 306
307 /* If it is data, queue it up, otherwise, send it 307 /* If it is data, queue it up, otherwise, send it
308 * immediately. 308 * immediately.
@@ -328,10 +328,10 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
328 break; 328 break;
329 329
330 default: 330 default:
331 SCTP_DEBUG_PRINTK("outqueueing (%p, %p[%s])\n", 331 pr_debug("%s: outqueueing: outq:%p, chunk:%p[%s])\n",
332 q, chunk, chunk && chunk->chunk_hdr ? 332 __func__, q, chunk, chunk && chunk->chunk_hdr ?
333 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) 333 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) :
334 : "Illegal Chunk"); 334 "illegal chunk");
335 335
336 sctp_outq_tail_data(q, chunk); 336 sctp_outq_tail_data(q, chunk);
337 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) 337 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
@@ -460,14 +460,10 @@ void sctp_retransmit_mark(struct sctp_outq *q,
460 } 460 }
461 } 461 }
462 462
463 SCTP_DEBUG_PRINTK("%s: transport: %p, reason: %d, " 463 pr_debug("%s: transport:%p, reason:%d, cwnd:%d, ssthresh:%d, "
464 "cwnd: %d, ssthresh: %d, flight_size: %d, " 464 "flight_size:%d, pba:%d\n", __func__, transport, reason,
465 "pba: %d\n", __func__, 465 transport->cwnd, transport->ssthresh, transport->flight_size,
466 transport, reason, 466 transport->partial_bytes_acked);
467 transport->cwnd, transport->ssthresh,
468 transport->flight_size,
469 transport->partial_bytes_acked);
470
471} 467}
472 468
473/* Mark all the eligible packets on a transport for retransmission and force 469/* Mark all the eligible packets on a transport for retransmission and force
@@ -1014,19 +1010,13 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
1014 sctp_transport_burst_limited(transport); 1010 sctp_transport_burst_limited(transport);
1015 } 1011 }
1016 1012
1017 SCTP_DEBUG_PRINTK("sctp_outq_flush(%p, %p[%s]), ", 1013 pr_debug("%s: outq:%p, chunk:%p[%s], tx-tsn:0x%x skb->head:%p "
1018 q, chunk, 1014 "skb->users:%d\n",
1019 chunk && chunk->chunk_hdr ? 1015 __func__, q, chunk, chunk && chunk->chunk_hdr ?
1020 sctp_cname(SCTP_ST_CHUNK( 1016 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) :
1021 chunk->chunk_hdr->type)) 1017 "illegal chunk", ntohl(chunk->subh.data_hdr->tsn),
1022 : "Illegal Chunk"); 1018 chunk->skb ? chunk->skb->head : NULL, chunk->skb ?
1023 1019 atomic_read(&chunk->skb->users) : -1);
1024 SCTP_DEBUG_PRINTK("TX TSN 0x%x skb->head "
1025 "%p skb->users %d.\n",
1026 ntohl(chunk->subh.data_hdr->tsn),
1027 chunk->skb ?chunk->skb->head : NULL,
1028 chunk->skb ?
1029 atomic_read(&chunk->skb->users) : -1);
1030 1020
1031 /* Add the chunk to the packet. */ 1021 /* Add the chunk to the packet. */
1032 status = sctp_packet_transmit_chunk(packet, chunk, 0); 1022 status = sctp_packet_transmit_chunk(packet, chunk, 0);
@@ -1038,10 +1028,10 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
1038 /* We could not append this chunk, so put 1028 /* We could not append this chunk, so put
1039 * the chunk back on the output queue. 1029 * the chunk back on the output queue.
1040 */ 1030 */
1041 SCTP_DEBUG_PRINTK("sctp_outq_flush: could " 1031 pr_debug("%s: could not transmit tsn:0x%x, status:%d\n",
1042 "not transmit TSN: 0x%x, status: %d\n", 1032 __func__, ntohl(chunk->subh.data_hdr->tsn),
1043 ntohl(chunk->subh.data_hdr->tsn), 1033 status);
1044 status); 1034
1045 sctp_outq_head_data(q, chunk); 1035 sctp_outq_head_data(q, chunk);
1046 goto sctp_flush_out; 1036 goto sctp_flush_out;
1047 break; 1037 break;
@@ -1284,11 +1274,10 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
1284 1274
1285 sctp_generate_fwdtsn(q, sack_ctsn); 1275 sctp_generate_fwdtsn(q, sack_ctsn);
1286 1276
1287 SCTP_DEBUG_PRINTK("%s: sack Cumulative TSN Ack is 0x%x.\n", 1277 pr_debug("%s: sack cumulative tsn ack:0x%x\n", __func__, sack_ctsn);
1288 __func__, sack_ctsn); 1278 pr_debug("%s: cumulative tsn ack of assoc:%p is 0x%x, "
1289 SCTP_DEBUG_PRINTK("%s: Cumulative TSN Ack of association, " 1279 "advertised peer ack point:0x%x\n", __func__, asoc, ctsn,
1290 "%p is 0x%x. Adv peer ack point: 0x%x\n", 1280 asoc->adv_peer_ack_point);
1291 __func__, asoc, ctsn, asoc->adv_peer_ack_point);
1292 1281
1293 /* See if all chunks are acked. 1282 /* See if all chunks are acked.
1294 * Make sure the empty queue handler will get run later. 1283 * Make sure the empty queue handler will get run later.
@@ -1304,7 +1293,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
1304 goto finish; 1293 goto finish;
1305 } 1294 }
1306 1295
1307 SCTP_DEBUG_PRINTK("sack queue is empty.\n"); 1296 pr_debug("%s: sack queue is empty\n", __func__);
1308finish: 1297finish:
1309 return q->empty; 1298 return q->empty;
1310} 1299}
@@ -1348,7 +1337,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1348 1337
1349 /* These state variables are for coherent debug output. --xguo */ 1338 /* These state variables are for coherent debug output. --xguo */
1350 1339
1351#if SCTP_DEBUG 1340#ifdef CONFIG_SCTP_DBG_TSNS
1352 __u32 dbg_ack_tsn = 0; /* An ACKed TSN range starts here... */ 1341 __u32 dbg_ack_tsn = 0; /* An ACKed TSN range starts here... */
1353 __u32 dbg_last_ack_tsn = 0; /* ...and finishes here. */ 1342 __u32 dbg_last_ack_tsn = 0; /* ...and finishes here. */
1354 __u32 dbg_kept_tsn = 0; /* An un-ACKed range starts here... */ 1343 __u32 dbg_kept_tsn = 0; /* An un-ACKed range starts here... */
@@ -1359,7 +1348,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1359 * -1: We need to initialize. 1348 * -1: We need to initialize.
1360 */ 1349 */
1361 int dbg_prt_state = -1; 1350 int dbg_prt_state = -1;
1362#endif /* SCTP_DEBUG */ 1351#endif /* CONFIG_SCTP_DBG_TSNS */
1363 1352
1364 sack_ctsn = ntohl(sack->cum_tsn_ack); 1353 sack_ctsn = ntohl(sack->cum_tsn_ack);
1365 1354
@@ -1483,7 +1472,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1483 list_add_tail(lchunk, &tlist); 1472 list_add_tail(lchunk, &tlist);
1484 } 1473 }
1485 1474
1486#if SCTP_DEBUG 1475#ifdef CONFIG_SCTP_DBG_TSNS
1487 switch (dbg_prt_state) { 1476 switch (dbg_prt_state) {
1488 case 0: /* last TSN was ACKed */ 1477 case 0: /* last TSN was ACKed */
1489 if (dbg_last_ack_tsn + 1 == tsn) { 1478 if (dbg_last_ack_tsn + 1 == tsn) {
@@ -1497,42 +1486,39 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1497 /* Display the end of the 1486 /* Display the end of the
1498 * current range. 1487 * current range.
1499 */ 1488 */
1500 SCTP_DEBUG_PRINTK_CONT("-%08x", 1489 pr_cont("-%08x", dbg_last_ack_tsn);
1501 dbg_last_ack_tsn);
1502 } 1490 }
1503 1491
1504 /* Start a new range. */ 1492 /* Start a new range. */
1505 SCTP_DEBUG_PRINTK_CONT(",%08x", tsn); 1493 pr_cont(",%08x", tsn);
1506 dbg_ack_tsn = tsn; 1494 dbg_ack_tsn = tsn;
1507 break; 1495 break;
1508 1496
1509 case 1: /* The last TSN was NOT ACKed. */ 1497 case 1: /* The last TSN was NOT ACKed. */
1510 if (dbg_last_kept_tsn != dbg_kept_tsn) { 1498 if (dbg_last_kept_tsn != dbg_kept_tsn) {
1511 /* Display the end of current range. */ 1499 /* Display the end of current range. */
1512 SCTP_DEBUG_PRINTK_CONT("-%08x", 1500 pr_cont("-%08x", dbg_last_kept_tsn);
1513 dbg_last_kept_tsn);
1514 } 1501 }
1515 1502
1516 SCTP_DEBUG_PRINTK_CONT("\n"); 1503 pr_cont("\n");
1517
1518 /* FALL THROUGH... */ 1504 /* FALL THROUGH... */
1519 default: 1505 default:
1520 /* This is the first-ever TSN we examined. */ 1506 /* This is the first-ever TSN we examined. */
1521 /* Start a new range of ACK-ed TSNs. */ 1507 /* Start a new range of ACK-ed TSNs. */
1522 SCTP_DEBUG_PRINTK("ACKed: %08x", tsn); 1508 pr_debug("ACKed: %08x", tsn);
1509
1523 dbg_prt_state = 0; 1510 dbg_prt_state = 0;
1524 dbg_ack_tsn = tsn; 1511 dbg_ack_tsn = tsn;
1525 } 1512 }
1526 1513
1527 dbg_last_ack_tsn = tsn; 1514 dbg_last_ack_tsn = tsn;
1528#endif /* SCTP_DEBUG */ 1515#endif /* CONFIG_SCTP_DBG_TSNS */
1529 1516
1530 } else { 1517 } else {
1531 if (tchunk->tsn_gap_acked) { 1518 if (tchunk->tsn_gap_acked) {
1532 SCTP_DEBUG_PRINTK("%s: Receiver reneged on " 1519 pr_debug("%s: receiver reneged on data TSN:0x%x\n",
1533 "data TSN: 0x%x\n", 1520 __func__, tsn);
1534 __func__, 1521
1535 tsn);
1536 tchunk->tsn_gap_acked = 0; 1522 tchunk->tsn_gap_acked = 0;
1537 1523
1538 if (tchunk->transport) 1524 if (tchunk->transport)
@@ -1552,7 +1538,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1552 1538
1553 list_add_tail(lchunk, &tlist); 1539 list_add_tail(lchunk, &tlist);
1554 1540
1555#if SCTP_DEBUG 1541#ifdef CONFIG_SCTP_DBG_TSNS
1556 /* See the above comments on ACK-ed TSNs. */ 1542 /* See the above comments on ACK-ed TSNs. */
1557 switch (dbg_prt_state) { 1543 switch (dbg_prt_state) {
1558 case 1: 1544 case 1:
@@ -1560,50 +1546,47 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1560 break; 1546 break;
1561 1547
1562 if (dbg_last_kept_tsn != dbg_kept_tsn) 1548 if (dbg_last_kept_tsn != dbg_kept_tsn)
1563 SCTP_DEBUG_PRINTK_CONT("-%08x", 1549 pr_cont("-%08x", dbg_last_kept_tsn);
1564 dbg_last_kept_tsn);
1565 1550
1566 SCTP_DEBUG_PRINTK_CONT(",%08x", tsn); 1551 pr_cont(",%08x", tsn);
1567 dbg_kept_tsn = tsn; 1552 dbg_kept_tsn = tsn;
1568 break; 1553 break;
1569 1554
1570 case 0: 1555 case 0:
1571 if (dbg_last_ack_tsn != dbg_ack_tsn) 1556 if (dbg_last_ack_tsn != dbg_ack_tsn)
1572 SCTP_DEBUG_PRINTK_CONT("-%08x", 1557 pr_cont("-%08x", dbg_last_ack_tsn);
1573 dbg_last_ack_tsn);
1574 SCTP_DEBUG_PRINTK_CONT("\n");
1575 1558
1559 pr_cont("\n");
1576 /* FALL THROUGH... */ 1560 /* FALL THROUGH... */
1577 default: 1561 default:
1578 SCTP_DEBUG_PRINTK("KEPT: %08x",tsn); 1562 pr_debug("KEPT: %08x", tsn);
1563
1579 dbg_prt_state = 1; 1564 dbg_prt_state = 1;
1580 dbg_kept_tsn = tsn; 1565 dbg_kept_tsn = tsn;
1581 } 1566 }
1582 1567
1583 dbg_last_kept_tsn = tsn; 1568 dbg_last_kept_tsn = tsn;
1584#endif /* SCTP_DEBUG */ 1569#endif /* CONFIG_SCTP_DBG_TSNS */
1585 } 1570 }
1586 } 1571 }
1587 1572
1588#if SCTP_DEBUG 1573#ifdef CONFIG_SCTP_DBG_TSNS
1589 /* Finish off the last range, displaying its ending TSN. */ 1574 /* Finish off the last range, displaying its ending TSN. */
1590 switch (dbg_prt_state) { 1575 switch (dbg_prt_state) {
1591 case 0: 1576 case 0:
1592 if (dbg_last_ack_tsn != dbg_ack_tsn) { 1577 if (dbg_last_ack_tsn != dbg_ack_tsn)
1593 SCTP_DEBUG_PRINTK_CONT("-%08x\n", dbg_last_ack_tsn); 1578 pr_cont("-%08x\n", dbg_last_ack_tsn);
1594 } else { 1579 else
1595 SCTP_DEBUG_PRINTK_CONT("\n"); 1580 pr_cont("\n");
1596 } 1581 break;
1597 break;
1598
1599 case 1: 1582 case 1:
1600 if (dbg_last_kept_tsn != dbg_kept_tsn) { 1583 if (dbg_last_kept_tsn != dbg_kept_tsn)
1601 SCTP_DEBUG_PRINTK_CONT("-%08x\n", dbg_last_kept_tsn); 1584 pr_cont("-%08x\n", dbg_last_kept_tsn);
1602 } else { 1585 else
1603 SCTP_DEBUG_PRINTK_CONT("\n"); 1586 pr_cont("\n");
1604 } 1587 break;
1605 } 1588 }
1606#endif /* SCTP_DEBUG */ 1589#endif /* CONFIG_SCTP_DBG_TSNS */
1607 if (transport) { 1590 if (transport) {
1608 if (bytes_acked) { 1591 if (bytes_acked) {
1609 struct sctp_association *asoc = transport->asoc; 1592 struct sctp_association *asoc = transport->asoc;
@@ -1676,9 +1659,9 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1676 !list_empty(&tlist) && 1659 !list_empty(&tlist) &&
1677 (sack_ctsn+2 == q->asoc->next_tsn) && 1660 (sack_ctsn+2 == q->asoc->next_tsn) &&
1678 q->asoc->state < SCTP_STATE_SHUTDOWN_PENDING) { 1661 q->asoc->state < SCTP_STATE_SHUTDOWN_PENDING) {
1679 SCTP_DEBUG_PRINTK("%s: SACK received for zero " 1662 pr_debug("%s: sack received for zero window "
1680 "window probe: %u\n", 1663 "probe:%u\n", __func__, sack_ctsn);
1681 __func__, sack_ctsn); 1664
1682 q->asoc->overall_error_count = 0; 1665 q->asoc->overall_error_count = 0;
1683 transport->error_count = 0; 1666 transport->error_count = 0;
1684 } 1667 }
@@ -1739,10 +1722,8 @@ static void sctp_mark_missing(struct sctp_outq *q,
1739 count_of_newacks, tsn)) { 1722 count_of_newacks, tsn)) {
1740 chunk->tsn_missing_report++; 1723 chunk->tsn_missing_report++;
1741 1724
1742 SCTP_DEBUG_PRINTK( 1725 pr_debug("%s: tsn:0x%x missing counter:%d\n",
1743 "%s: TSN 0x%x missing counter: %d\n", 1726 __func__, tsn, chunk->tsn_missing_report);
1744 __func__, tsn,
1745 chunk->tsn_missing_report);
1746 } 1727 }
1747 } 1728 }
1748 /* 1729 /*
@@ -1762,11 +1743,10 @@ static void sctp_mark_missing(struct sctp_outq *q,
1762 if (do_fast_retransmit) 1743 if (do_fast_retransmit)
1763 sctp_retransmit(q, transport, SCTP_RTXR_FAST_RTX); 1744 sctp_retransmit(q, transport, SCTP_RTXR_FAST_RTX);
1764 1745
1765 SCTP_DEBUG_PRINTK("%s: transport: %p, cwnd: %d, " 1746 pr_debug("%s: transport:%p, cwnd:%d, ssthresh:%d, "
1766 "ssthresh: %d, flight_size: %d, pba: %d\n", 1747 "flight_size:%d, pba:%d\n", __func__, transport,
1767 __func__, transport, transport->cwnd, 1748 transport->cwnd, transport->ssthresh,
1768 transport->ssthresh, transport->flight_size, 1749 transport->flight_size, transport->partial_bytes_acked);
1769 transport->partial_bytes_acked);
1770 } 1750 }
1771} 1751}
1772 1752
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 1de49c802d83..4a17494d736c 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -451,8 +451,8 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
451 fl4->fl4_sport = saddr->v4.sin_port; 451 fl4->fl4_sport = saddr->v4.sin_port;
452 } 452 }
453 453
454 SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", 454 pr_debug("%s: dst:%pI4, src:%pI4 - ", __func__, &fl4->daddr,
455 __func__, &fl4->daddr, &fl4->saddr); 455 &fl4->saddr);
456 456
457 rt = ip_route_output_key(sock_net(sk), fl4); 457 rt = ip_route_output_key(sock_net(sk), fl4);
458 if (!IS_ERR(rt)) 458 if (!IS_ERR(rt))
@@ -513,10 +513,10 @@ out_unlock:
513out: 513out:
514 t->dst = dst; 514 t->dst = dst;
515 if (dst) 515 if (dst)
516 SCTP_DEBUG_PRINTK("rt_dst:%pI4, rt_src:%pI4\n", 516 pr_debug("rt_dst:%pI4, rt_src:%pI4\n",
517 &fl4->daddr, &fl4->saddr); 517 &fl4->daddr, &fl4->saddr);
518 else 518 else
519 SCTP_DEBUG_PRINTK("NO ROUTE\n"); 519 pr_debug("no route\n");
520} 520}
521 521
522/* For v4, the source address is cached in the route entry(dst). So no need 522/* For v4, the source address is cached in the route entry(dst). So no need
@@ -604,9 +604,9 @@ static void sctp_addr_wq_timeout_handler(unsigned long arg)
604 spin_lock_bh(&net->sctp.addr_wq_lock); 604 spin_lock_bh(&net->sctp.addr_wq_lock);
605 605
606 list_for_each_entry_safe(addrw, temp, &net->sctp.addr_waitq, list) { 606 list_for_each_entry_safe(addrw, temp, &net->sctp.addr_waitq, list) {
607 SCTP_DEBUG_PRINTK_IPADDR("sctp_addrwq_timo_handler: the first ent in wq %p is ", 607 pr_debug("%s: the first ent in wq:%p is addr:%pISc for cmd:%d at "
608 " for cmd %d at entry %p\n", &net->sctp.addr_waitq, &addrw->a, addrw->state, 608 "entry:%p\n", __func__, &net->sctp.addr_waitq, &addrw->a.sa,
609 addrw); 609 addrw->state, addrw);
610 610
611#if IS_ENABLED(CONFIG_IPV6) 611#if IS_ENABLED(CONFIG_IPV6)
612 /* Now we send an ASCONF for each association */ 612 /* Now we send an ASCONF for each association */
@@ -623,8 +623,10 @@ static void sctp_addr_wq_timeout_handler(unsigned long arg)
623 addrw->state == SCTP_ADDR_NEW) { 623 addrw->state == SCTP_ADDR_NEW) {
624 unsigned long timeo_val; 624 unsigned long timeo_val;
625 625
626 SCTP_DEBUG_PRINTK("sctp_timo_handler: this is on DAD, trying %d sec later\n", 626 pr_debug("%s: this is on DAD, trying %d sec "
627 SCTP_ADDRESS_TICK_DELAY); 627 "later\n", __func__,
628 SCTP_ADDRESS_TICK_DELAY);
629
628 timeo_val = jiffies; 630 timeo_val = jiffies;
629 timeo_val += msecs_to_jiffies(SCTP_ADDRESS_TICK_DELAY); 631 timeo_val += msecs_to_jiffies(SCTP_ADDRESS_TICK_DELAY);
630 mod_timer(&net->sctp.addr_wq_timer, timeo_val); 632 mod_timer(&net->sctp.addr_wq_timer, timeo_val);
@@ -641,7 +643,7 @@ static void sctp_addr_wq_timeout_handler(unsigned long arg)
641 continue; 643 continue;
642 sctp_bh_lock_sock(sk); 644 sctp_bh_lock_sock(sk);
643 if (sctp_asconf_mgmt(sp, addrw) < 0) 645 if (sctp_asconf_mgmt(sp, addrw) < 0)
644 SCTP_DEBUG_PRINTK("sctp_addrwq_timo_handler: sctp_asconf_mgmt failed\n"); 646 pr_debug("%s: sctp_asconf_mgmt failed\n", __func__);
645 sctp_bh_unlock_sock(sk); 647 sctp_bh_unlock_sock(sk);
646 } 648 }
647#if IS_ENABLED(CONFIG_IPV6) 649#if IS_ENABLED(CONFIG_IPV6)
@@ -707,9 +709,10 @@ void sctp_addr_wq_mgmt(struct net *net, struct sctp_sockaddr_entry *addr, int cm
707 addrw = sctp_addr_wq_lookup(net, addr); 709 addrw = sctp_addr_wq_lookup(net, addr);
708 if (addrw) { 710 if (addrw) {
709 if (addrw->state != cmd) { 711 if (addrw->state != cmd) {
710 SCTP_DEBUG_PRINTK_IPADDR("sctp_addr_wq_mgmt offsets existing entry for %d ", 712 pr_debug("%s: offsets existing entry for %d, addr:%pISc "
711 " in wq %p\n", addrw->state, &addrw->a, 713 "in wq:%p\n", __func__, addrw->state, &addrw->a.sa,
712 &net->sctp.addr_waitq); 714 &net->sctp.addr_waitq);
715
713 list_del(&addrw->list); 716 list_del(&addrw->list);
714 kfree(addrw); 717 kfree(addrw);
715 } 718 }
@@ -725,8 +728,9 @@ void sctp_addr_wq_mgmt(struct net *net, struct sctp_sockaddr_entry *addr, int cm
725 } 728 }
726 addrw->state = cmd; 729 addrw->state = cmd;
727 list_add_tail(&addrw->list, &net->sctp.addr_waitq); 730 list_add_tail(&addrw->list, &net->sctp.addr_waitq);
728 SCTP_DEBUG_PRINTK_IPADDR("sctp_addr_wq_mgmt add new entry for cmd:%d ", 731
729 " in wq %p\n", addrw->state, &addrw->a, &net->sctp.addr_waitq); 732 pr_debug("%s: add new entry for cmd:%d, addr:%pISc in wq:%p\n",
733 __func__, addrw->state, &addrw->a.sa, &net->sctp.addr_waitq);
730 734
731 if (!timer_pending(&net->sctp.addr_wq_timer)) { 735 if (!timer_pending(&net->sctp.addr_wq_timer)) {
732 timeo_val = jiffies; 736 timeo_val = jiffies;
@@ -952,15 +956,14 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
952{ 956{
953 struct inet_sock *inet = inet_sk(skb->sk); 957 struct inet_sock *inet = inet_sk(skb->sk);
954 958
955 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", 959 pr_debug("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", __func__, skb,
956 __func__, skb, skb->len, 960 skb->len, &transport->fl.u.ip4.saddr, &transport->fl.u.ip4.daddr);
957 &transport->fl.u.ip4.saddr,
958 &transport->fl.u.ip4.daddr);
959 961
960 inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? 962 inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ?
961 IP_PMTUDISC_DO : IP_PMTUDISC_DONT; 963 IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
962 964
963 SCTP_INC_STATS(sock_net(&inet->sk), SCTP_MIB_OUTSCTPPACKS); 965 SCTP_INC_STATS(sock_net(&inet->sk), SCTP_MIB_OUTSCTPPACKS);
966
964 return ip_queue_xmit(skb, &transport->fl); 967 return ip_queue_xmit(skb, &transport->fl);
965} 968}
966 969
@@ -1321,9 +1324,8 @@ static __init int sctp_init(void)
1321 int max_share; 1324 int max_share;
1322 int order; 1325 int order;
1323 1326
1324 /* SCTP_DEBUG sanity check. */ 1327 BUILD_BUG_ON(sizeof(struct sctp_ulpevent) >
1325 if (!sctp_sanity_check()) 1328 sizeof(((struct sk_buff *) 0)->cb));
1326 goto out;
1327 1329
1328 /* Allocate bind_bucket and chunk caches. */ 1330 /* Allocate bind_bucket and chunk caches. */
1329 status = -ENOBUFS; 1331 status = -ENOBUFS;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index dd71f1f9ba10..362ae6e2fd93 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -741,7 +741,8 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc)
741 741
742 memset(gabs, 0, sizeof(gabs)); 742 memset(gabs, 0, sizeof(gabs));
743 ctsn = sctp_tsnmap_get_ctsn(map); 743 ctsn = sctp_tsnmap_get_ctsn(map);
744 SCTP_DEBUG_PRINTK("sackCTSNAck sent: 0x%x.\n", ctsn); 744
745 pr_debug("%s: sackCTSNAck sent:0x%x\n", __func__, ctsn);
745 746
746 /* How much room is needed in the chunk? */ 747 /* How much room is needed in the chunk? */
747 num_gabs = sctp_tsnmap_num_gabs(map, gabs); 748 num_gabs = sctp_tsnmap_num_gabs(map, gabs);
@@ -1287,10 +1288,8 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
1287 1288
1288 if (!retval) 1289 if (!retval)
1289 goto nodata; 1290 goto nodata;
1290 1291 if (!sk)
1291 if (!sk) { 1292 pr_debug("%s: chunkifying skb:%p w/o an sk\n", __func__, skb);
1292 SCTP_DEBUG_PRINTK("chunkifying skb %p w/o an sk\n", skb);
1293 }
1294 1293
1295 INIT_LIST_HEAD(&retval->list); 1294 INIT_LIST_HEAD(&retval->list);
1296 retval->skb = skb; 1295 retval->skb = skb;
@@ -2191,8 +2190,9 @@ static sctp_ierror_t sctp_verify_param(struct net *net,
2191 break; 2190 break;
2192fallthrough: 2191fallthrough:
2193 default: 2192 default:
2194 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", 2193 pr_debug("%s: unrecognized param:%d for chunk:%d\n",
2195 ntohs(param.p->type), cid); 2194 __func__, ntohs(param.p->type), cid);
2195
2196 retval = sctp_process_unk_param(asoc, param, chunk, err_chunk); 2196 retval = sctp_process_unk_param(asoc, param, chunk, err_chunk);
2197 break; 2197 break;
2198 } 2198 }
@@ -2516,7 +2516,7 @@ do_addr_param:
2516 break; 2516 break;
2517 2517
2518 case SCTP_PARAM_HOST_NAME_ADDRESS: 2518 case SCTP_PARAM_HOST_NAME_ADDRESS:
2519 SCTP_DEBUG_PRINTK("unimplemented SCTP_HOST_NAME_ADDRESS\n"); 2519 pr_debug("%s: unimplemented SCTP_HOST_NAME_ADDRESS\n", __func__);
2520 break; 2520 break;
2521 2521
2522 case SCTP_PARAM_SUPPORTED_ADDRESS_TYPES: 2522 case SCTP_PARAM_SUPPORTED_ADDRESS_TYPES:
@@ -2662,8 +2662,8 @@ fall_through:
2662 * called prior to this routine. Simply log the error 2662 * called prior to this routine. Simply log the error
2663 * here. 2663 * here.
2664 */ 2664 */
2665 SCTP_DEBUG_PRINTK("Ignoring param: %d for association %p.\n", 2665 pr_debug("%s: ignoring param:%d for association:%p.\n",
2666 ntohs(param.p->type), asoc); 2666 __func__, ntohs(param.p->type), asoc);
2667 break; 2667 break;
2668 } 2668 }
2669 2669
@@ -2805,7 +2805,10 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc,
2805 totallen += paramlen; 2805 totallen += paramlen;
2806 totallen += addr_param_len; 2806 totallen += addr_param_len;
2807 del_pickup = 1; 2807 del_pickup = 1;
2808 SCTP_DEBUG_PRINTK("mkasconf_update_ip: picked same-scope del_pending addr, totallen for all addresses is %d\n", totallen); 2808
2809 pr_debug("%s: picked same-scope del_pending addr, "
2810 "totallen for all addresses is %d\n",
2811 __func__, totallen);
2809 } 2812 }
2810 } 2813 }
2811 2814
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:
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index b3d186856513..f6b7109195a6 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1179,9 +1179,9 @@ sctp_disposition_t sctp_sf_backbeat_8_3(struct net *net,
1179 /* Check if the timestamp looks valid. */ 1179 /* Check if the timestamp looks valid. */
1180 if (time_after(hbinfo->sent_at, jiffies) || 1180 if (time_after(hbinfo->sent_at, jiffies) ||
1181 time_after(jiffies, hbinfo->sent_at + max_interval)) { 1181 time_after(jiffies, hbinfo->sent_at + max_interval)) {
1182 SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp " 1182 pr_debug("%s: HEARTBEAT ACK with invalid timestamp received "
1183 "received for transport: %p\n", 1183 "for transport:%p\n", __func__, link);
1184 __func__, link); 1184
1185 return SCTP_DISPOSITION_DISCARD; 1185 return SCTP_DISPOSITION_DISCARD;
1186 } 1186 }
1187 1187
@@ -2562,7 +2562,8 @@ static sctp_disposition_t sctp_stop_t1_and_abort(struct net *net,
2562 const struct sctp_association *asoc, 2562 const struct sctp_association *asoc,
2563 struct sctp_transport *transport) 2563 struct sctp_transport *transport)
2564{ 2564{
2565 SCTP_DEBUG_PRINTK("ABORT received (INIT).\n"); 2565 pr_debug("%s: ABORT received (INIT)\n", __func__);
2566
2566 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 2567 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
2567 SCTP_STATE(SCTP_STATE_CLOSED)); 2568 SCTP_STATE(SCTP_STATE_CLOSED));
2568 SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS); 2569 SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS);
@@ -2572,6 +2573,7 @@ static sctp_disposition_t sctp_stop_t1_and_abort(struct net *net,
2572 /* CMD_INIT_FAILED will DELETE_TCB. */ 2573 /* CMD_INIT_FAILED will DELETE_TCB. */
2573 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, 2574 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
2574 SCTP_PERR(error)); 2575 SCTP_PERR(error));
2576
2575 return SCTP_DISPOSITION_ABORT; 2577 return SCTP_DISPOSITION_ABORT;
2576} 2578}
2577 2579
@@ -2637,8 +2639,9 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(struct net *net,
2637 ctsn = ntohl(sdh->cum_tsn_ack); 2639 ctsn = ntohl(sdh->cum_tsn_ack);
2638 2640
2639 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) { 2641 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) {
2640 SCTP_DEBUG_PRINTK("ctsn %x\n", ctsn); 2642 pr_debug("%s: ctsn:%x, ctsn_ack_point:%x\n", __func__, ctsn,
2641 SCTP_DEBUG_PRINTK("ctsn_ack_point %x\n", asoc->ctsn_ack_point); 2643 asoc->ctsn_ack_point);
2644
2642 return SCTP_DISPOSITION_DISCARD; 2645 return SCTP_DISPOSITION_DISCARD;
2643 } 2646 }
2644 2647
@@ -2721,8 +2724,9 @@ sctp_disposition_t sctp_sf_do_9_2_shut_ctsn(struct net *net,
2721 ctsn = ntohl(sdh->cum_tsn_ack); 2724 ctsn = ntohl(sdh->cum_tsn_ack);
2722 2725
2723 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) { 2726 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) {
2724 SCTP_DEBUG_PRINTK("ctsn %x\n", ctsn); 2727 pr_debug("%s: ctsn:%x, ctsn_ack_point:%x\n", __func__, ctsn,
2725 SCTP_DEBUG_PRINTK("ctsn_ack_point %x\n", asoc->ctsn_ack_point); 2728 asoc->ctsn_ack_point);
2729
2726 return SCTP_DISPOSITION_DISCARD; 2730 return SCTP_DISPOSITION_DISCARD;
2727 } 2731 }
2728 2732
@@ -3174,8 +3178,9 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(struct net *net,
3174 * Point indicates an out-of-order SACK. 3178 * Point indicates an out-of-order SACK.
3175 */ 3179 */
3176 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) { 3180 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) {
3177 SCTP_DEBUG_PRINTK("ctsn %x\n", ctsn); 3181 pr_debug("%s: ctsn:%x, ctsn_ack_point:%x\n", __func__, ctsn,
3178 SCTP_DEBUG_PRINTK("ctsn_ack_point %x\n", asoc->ctsn_ack_point); 3182 asoc->ctsn_ack_point);
3183
3179 return SCTP_DISPOSITION_DISCARD; 3184 return SCTP_DISPOSITION_DISCARD;
3180 } 3185 }
3181 3186
@@ -3859,7 +3864,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(struct net *net,
3859 skb_pull(chunk->skb, len); 3864 skb_pull(chunk->skb, len);
3860 3865
3861 tsn = ntohl(fwdtsn_hdr->new_cum_tsn); 3866 tsn = ntohl(fwdtsn_hdr->new_cum_tsn);
3862 SCTP_DEBUG_PRINTK("%s: TSN 0x%x.\n", __func__, tsn); 3867 pr_debug("%s: TSN 0x%x\n", __func__, tsn);
3863 3868
3864 /* The TSN is too high--silently discard the chunk and count on it 3869 /* The TSN is too high--silently discard the chunk and count on it
3865 * getting retransmitted later. 3870 * getting retransmitted later.
@@ -3927,7 +3932,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(
3927 skb_pull(chunk->skb, len); 3932 skb_pull(chunk->skb, len);
3928 3933
3929 tsn = ntohl(fwdtsn_hdr->new_cum_tsn); 3934 tsn = ntohl(fwdtsn_hdr->new_cum_tsn);
3930 SCTP_DEBUG_PRINTK("%s: TSN 0x%x.\n", __func__, tsn); 3935 pr_debug("%s: TSN 0x%x\n", __func__, tsn);
3931 3936
3932 /* The TSN is too high--silently discard the chunk and count on it 3937 /* The TSN is too high--silently discard the chunk and count on it
3933 * getting retransmitted later. 3938 * getting retransmitted later.
@@ -4166,7 +4171,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net,
4166 struct sctp_chunk *err_chunk; 4171 struct sctp_chunk *err_chunk;
4167 sctp_chunkhdr_t *hdr; 4172 sctp_chunkhdr_t *hdr;
4168 4173
4169 SCTP_DEBUG_PRINTK("Processing the unknown chunk id %d.\n", type.chunk); 4174 pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk);
4170 4175
4171 if (!sctp_vtag_verify(unk_chunk, asoc)) 4176 if (!sctp_vtag_verify(unk_chunk, asoc))
4172 return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); 4177 return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
@@ -4256,7 +4261,8 @@ sctp_disposition_t sctp_sf_discard_chunk(struct net *net,
4256 return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, 4261 return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
4257 commands); 4262 commands);
4258 4263
4259 SCTP_DEBUG_PRINTK("Chunk %d is discarded\n", type.chunk); 4264 pr_debug("%s: chunk:%d is discarded\n", __func__, type.chunk);
4265
4260 return SCTP_DISPOSITION_DISCARD; 4266 return SCTP_DISPOSITION_DISCARD;
4261} 4267}
4262 4268
@@ -5184,7 +5190,9 @@ sctp_disposition_t sctp_sf_ignore_primitive(
5184 void *arg, 5190 void *arg,
5185 sctp_cmd_seq_t *commands) 5191 sctp_cmd_seq_t *commands)
5186{ 5192{
5187 SCTP_DEBUG_PRINTK("Primitive type %d is ignored.\n", type.primitive); 5193 pr_debug("%s: primitive type:%d is ignored\n", __func__,
5194 type.primitive);
5195
5188 return SCTP_DISPOSITION_DISCARD; 5196 return SCTP_DISPOSITION_DISCARD;
5189} 5197}
5190 5198
@@ -5379,7 +5387,9 @@ sctp_disposition_t sctp_sf_ignore_other(struct net *net,
5379 void *arg, 5387 void *arg,
5380 sctp_cmd_seq_t *commands) 5388 sctp_cmd_seq_t *commands)
5381{ 5389{
5382 SCTP_DEBUG_PRINTK("The event other type %d is ignored\n", type.other); 5390 pr_debug("%s: the event other type:%d is ignored\n",
5391 __func__, type.other);
5392
5383 return SCTP_DISPOSITION_DISCARD; 5393 return SCTP_DISPOSITION_DISCARD;
5384} 5394}
5385 5395
@@ -5527,7 +5537,8 @@ sctp_disposition_t sctp_sf_t1_init_timer_expire(struct net *net,
5527 struct sctp_bind_addr *bp; 5537 struct sctp_bind_addr *bp;
5528 int attempts = asoc->init_err_counter + 1; 5538 int attempts = asoc->init_err_counter + 1;
5529 5539
5530 SCTP_DEBUG_PRINTK("Timer T1 expired (INIT).\n"); 5540 pr_debug("%s: timer T1 expired (INIT)\n", __func__);
5541
5531 SCTP_INC_STATS(net, SCTP_MIB_T1_INIT_EXPIREDS); 5542 SCTP_INC_STATS(net, SCTP_MIB_T1_INIT_EXPIREDS);
5532 5543
5533 if (attempts <= asoc->max_init_attempts) { 5544 if (attempts <= asoc->max_init_attempts) {
@@ -5546,9 +5557,10 @@ sctp_disposition_t sctp_sf_t1_init_timer_expire(struct net *net,
5546 5557
5547 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); 5558 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
5548 } else { 5559 } else {
5549 SCTP_DEBUG_PRINTK("Giving up on INIT, attempts: %d" 5560 pr_debug("%s: giving up on INIT, attempts:%d "
5550 " max_init_attempts: %d\n", 5561 "max_init_attempts:%d\n", __func__, attempts,
5551 attempts, asoc->max_init_attempts); 5562 asoc->max_init_attempts);
5563
5552 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, 5564 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
5553 SCTP_ERROR(ETIMEDOUT)); 5565 SCTP_ERROR(ETIMEDOUT));
5554 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, 5566 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
@@ -5588,7 +5600,8 @@ sctp_disposition_t sctp_sf_t1_cookie_timer_expire(struct net *net,
5588 struct sctp_chunk *repl = NULL; 5600 struct sctp_chunk *repl = NULL;
5589 int attempts = asoc->init_err_counter + 1; 5601 int attempts = asoc->init_err_counter + 1;
5590 5602
5591 SCTP_DEBUG_PRINTK("Timer T1 expired (COOKIE-ECHO).\n"); 5603 pr_debug("%s: timer T1 expired (COOKIE-ECHO)\n", __func__);
5604
5592 SCTP_INC_STATS(net, SCTP_MIB_T1_COOKIE_EXPIREDS); 5605 SCTP_INC_STATS(net, SCTP_MIB_T1_COOKIE_EXPIREDS);
5593 5606
5594 if (attempts <= asoc->max_init_attempts) { 5607 if (attempts <= asoc->max_init_attempts) {
@@ -5636,7 +5649,8 @@ sctp_disposition_t sctp_sf_t2_timer_expire(struct net *net,
5636{ 5649{
5637 struct sctp_chunk *reply = NULL; 5650 struct sctp_chunk *reply = NULL;
5638 5651
5639 SCTP_DEBUG_PRINTK("Timer T2 expired.\n"); 5652 pr_debug("%s: timer T2 expired\n", __func__);
5653
5640 SCTP_INC_STATS(net, SCTP_MIB_T2_SHUTDOWN_EXPIREDS); 5654 SCTP_INC_STATS(net, SCTP_MIB_T2_SHUTDOWN_EXPIREDS);
5641 5655
5642 ((struct sctp_association *)asoc)->shutdown_retries++; 5656 ((struct sctp_association *)asoc)->shutdown_retries++;
@@ -5777,7 +5791,8 @@ sctp_disposition_t sctp_sf_t5_timer_expire(struct net *net,
5777{ 5791{
5778 struct sctp_chunk *reply = NULL; 5792 struct sctp_chunk *reply = NULL;
5779 5793
5780 SCTP_DEBUG_PRINTK("Timer T5 expired.\n"); 5794 pr_debug("%s: timer T5 expired\n", __func__);
5795
5781 SCTP_INC_STATS(net, SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS); 5796 SCTP_INC_STATS(net, SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS);
5782 5797
5783 reply = sctp_make_abort(asoc, NULL, 0); 5798 reply = sctp_make_abort(asoc, NULL, 0);
@@ -5892,7 +5907,8 @@ sctp_disposition_t sctp_sf_timer_ignore(struct net *net,
5892 void *arg, 5907 void *arg,
5893 sctp_cmd_seq_t *commands) 5908 sctp_cmd_seq_t *commands)
5894{ 5909{
5895 SCTP_DEBUG_PRINTK("Timer %d ignored.\n", type.chunk); 5910 pr_debug("%s: timer %d ignored\n", __func__, type.chunk);
5911
5896 return SCTP_DISPOSITION_CONSUME; 5912 return SCTP_DISPOSITION_CONSUME;
5897} 5913}
5898 5914
@@ -6102,7 +6118,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
6102 skb_pull(chunk->skb, sizeof(sctp_datahdr_t)); 6118 skb_pull(chunk->skb, sizeof(sctp_datahdr_t));
6103 6119
6104 tsn = ntohl(data_hdr->tsn); 6120 tsn = ntohl(data_hdr->tsn);
6105 SCTP_DEBUG_PRINTK("eat_data: TSN 0x%x.\n", tsn); 6121 pr_debug("%s: TSN 0x%x\n", __func__, tsn);
6106 6122
6107 /* ASSERT: Now skb->data is really the user data. */ 6123 /* ASSERT: Now skb->data is really the user data. */
6108 6124
@@ -6179,12 +6195,12 @@ static int sctp_eat_data(const struct sctp_association *asoc,
6179 */ 6195 */
6180 if (sctp_tsnmap_has_gap(map) && 6196 if (sctp_tsnmap_has_gap(map) &&
6181 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) { 6197 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) {
6182 SCTP_DEBUG_PRINTK("Reneging for tsn:%u\n", tsn); 6198 pr_debug("%s: reneging for tsn:%u\n", __func__, tsn);
6183 deliver = SCTP_CMD_RENEGE; 6199 deliver = SCTP_CMD_RENEGE;
6184 } else { 6200 } else {
6185 SCTP_DEBUG_PRINTK("Discard tsn: %u len: %Zd, " 6201 pr_debug("%s: discard tsn:%u len:%zu, rwnd:%d\n",
6186 "rwnd: %d\n", tsn, datalen, 6202 __func__, tsn, datalen, asoc->rwnd);
6187 asoc->rwnd); 6203
6188 return SCTP_IERROR_IGNORE_TSN; 6204 return SCTP_IERROR_IGNORE_TSN;
6189 } 6205 }
6190 } 6206 }
@@ -6199,7 +6215,8 @@ static int sctp_eat_data(const struct sctp_association *asoc,
6199 if (*sk->sk_prot_creator->memory_pressure) { 6215 if (*sk->sk_prot_creator->memory_pressure) {
6200 if (sctp_tsnmap_has_gap(map) && 6216 if (sctp_tsnmap_has_gap(map) &&
6201 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) { 6217 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) {
6202 SCTP_DEBUG_PRINTK("Under Pressure! Reneging for tsn:%u\n", tsn); 6218 pr_debug("%s: under pressure, reneging for tsn:%u\n",
6219 __func__, tsn);
6203 deliver = SCTP_CMD_RENEGE; 6220 deliver = SCTP_CMD_RENEGE;
6204 } 6221 }
6205 } 6222 }
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 66fcdcfe1b74..d5c6a2870473 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -281,8 +281,8 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len)
281 281
282 sctp_lock_sock(sk); 282 sctp_lock_sock(sk);
283 283
284 SCTP_DEBUG_PRINTK("sctp_bind(sk: %p, addr: %p, addr_len: %d)\n", 284 pr_debug("%s: sk:%p, addr:%p, addr_len:%d\n", __func__, sk,
285 sk, addr, addr_len); 285 addr, addr_len);
286 286
287 /* Disallow binding twice. */ 287 /* Disallow binding twice. */
288 if (!sctp_sk(sk)->ep->base.bind_addr.port) 288 if (!sctp_sk(sk)->ep->base.bind_addr.port)
@@ -342,19 +342,15 @@ static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
342 /* Common sockaddr verification. */ 342 /* Common sockaddr verification. */
343 af = sctp_sockaddr_af(sp, addr, len); 343 af = sctp_sockaddr_af(sp, addr, len);
344 if (!af) { 344 if (!af) {
345 SCTP_DEBUG_PRINTK("sctp_do_bind(sk: %p, newaddr: %p, len: %d) EINVAL\n", 345 pr_debug("%s: sk:%p, newaddr:%p, len:%d EINVAL\n",
346 sk, addr, len); 346 __func__, sk, addr, len);
347 return -EINVAL; 347 return -EINVAL;
348 } 348 }
349 349
350 snum = ntohs(addr->v4.sin_port); 350 snum = ntohs(addr->v4.sin_port);
351 351
352 SCTP_DEBUG_PRINTK_IPADDR("sctp_do_bind(sk: %p, new addr: ", 352 pr_debug("%s: sk:%p, new addr:%pISc, port:%d, new port:%d, len:%d\n",
353 ", port: %d, new port: %d, len: %d)\n", 353 __func__, sk, &addr->sa, bp->port, snum, len);
354 sk,
355 addr,
356 bp->port, snum,
357 len);
358 354
359 /* PF specific bind() address verification. */ 355 /* PF specific bind() address verification. */
360 if (!sp->pf->bind_verify(sp, addr)) 356 if (!sp->pf->bind_verify(sp, addr))
@@ -368,9 +364,8 @@ static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
368 if (!snum) 364 if (!snum)
369 snum = bp->port; 365 snum = bp->port;
370 else if (snum != bp->port) { 366 else if (snum != bp->port) {
371 SCTP_DEBUG_PRINTK("sctp_do_bind:" 367 pr_debug("%s: new port %d doesn't match existing port "
372 " New port %d does not match existing port " 368 "%d\n", __func__, snum, bp->port);
373 "%d.\n", snum, bp->port);
374 return -EINVAL; 369 return -EINVAL;
375 } 370 }
376 } 371 }
@@ -468,8 +463,8 @@ static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt)
468 struct sockaddr *sa_addr; 463 struct sockaddr *sa_addr;
469 struct sctp_af *af; 464 struct sctp_af *af;
470 465
471 SCTP_DEBUG_PRINTK("sctp_bindx_add (sk: %p, addrs: %p, addrcnt: %d)\n", 466 pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n", __func__, sk,
472 sk, addrs, addrcnt); 467 addrs, addrcnt);
473 468
474 addr_buf = addrs; 469 addr_buf = addrs;
475 for (cnt = 0; cnt < addrcnt; cnt++) { 470 for (cnt = 0; cnt < addrcnt; cnt++) {
@@ -535,11 +530,10 @@ static int sctp_send_asconf_add_ip(struct sock *sk,
535 sp = sctp_sk(sk); 530 sp = sctp_sk(sk);
536 ep = sp->ep; 531 ep = sp->ep;
537 532
538 SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", 533 pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n",
539 __func__, sk, addrs, addrcnt); 534 __func__, sk, addrs, addrcnt);
540 535
541 list_for_each_entry(asoc, &ep->asocs, asocs) { 536 list_for_each_entry(asoc, &ep->asocs, asocs) {
542
543 if (!asoc->peer.asconf_capable) 537 if (!asoc->peer.asconf_capable)
544 continue; 538 continue;
545 539
@@ -646,8 +640,8 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
646 union sctp_addr *sa_addr; 640 union sctp_addr *sa_addr;
647 struct sctp_af *af; 641 struct sctp_af *af;
648 642
649 SCTP_DEBUG_PRINTK("sctp_bindx_rem (sk: %p, addrs: %p, addrcnt: %d)\n", 643 pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n",
650 sk, addrs, addrcnt); 644 __func__, sk, addrs, addrcnt);
651 645
652 addr_buf = addrs; 646 addr_buf = addrs;
653 for (cnt = 0; cnt < addrcnt; cnt++) { 647 for (cnt = 0; cnt < addrcnt; cnt++) {
@@ -740,8 +734,8 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
740 sp = sctp_sk(sk); 734 sp = sctp_sk(sk);
741 ep = sp->ep; 735 ep = sp->ep;
742 736
743 SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", 737 pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n",
744 __func__, sk, addrs, addrcnt); 738 __func__, sk, addrs, addrcnt);
745 739
746 list_for_each_entry(asoc, &ep->asocs, asocs) { 740 list_for_each_entry(asoc, &ep->asocs, asocs) {
747 741
@@ -808,9 +802,11 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
808 sin6 = (struct sockaddr_in6 *)addrs; 802 sin6 = (struct sockaddr_in6 *)addrs;
809 asoc->asconf_addr_del_pending->v6.sin6_addr = sin6->sin6_addr; 803 asoc->asconf_addr_del_pending->v6.sin6_addr = sin6->sin6_addr;
810 } 804 }
811 SCTP_DEBUG_PRINTK_IPADDR("send_asconf_del_ip: keep the last address asoc: %p ", 805
812 " at %p\n", asoc, asoc->asconf_addr_del_pending, 806 pr_debug("%s: keep the last address asoc:%p %pISc at %p\n",
813 asoc->asconf_addr_del_pending); 807 __func__, asoc, &asoc->asconf_addr_del_pending->sa,
808 asoc->asconf_addr_del_pending);
809
814 asoc->src_out_of_asoc_ok = 1; 810 asoc->src_out_of_asoc_ok = 1;
815 stored = 1; 811 stored = 1;
816 goto skip_mkasconf; 812 goto skip_mkasconf;
@@ -972,8 +968,8 @@ static int sctp_setsockopt_bindx(struct sock* sk,
972 void *addr_buf; 968 void *addr_buf;
973 struct sctp_af *af; 969 struct sctp_af *af;
974 970
975 SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p" 971 pr_debug("%s: sk:%p addrs:%p addrs_size:%d opt:%d\n",
976 " addrs_size %d opt %d\n", sk, addrs, addrs_size, op); 972 __func__, sk, addrs, addrs_size, op);
977 973
978 if (unlikely(addrs_size <= 0)) 974 if (unlikely(addrs_size <= 0))
979 return -EINVAL; 975 return -EINVAL;
@@ -1231,10 +1227,9 @@ static int __sctp_connect(struct sock* sk,
1231 asoc = NULL; 1227 asoc = NULL;
1232 1228
1233out_free: 1229out_free:
1230 pr_debug("%s: took out_free path with asoc:%p kaddrs:%p err:%d\n",
1231 __func__, asoc, kaddrs, err);
1234 1232
1235 SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p"
1236 " kaddrs: %p err: %d\n",
1237 asoc, kaddrs, err);
1238 if (asoc) { 1233 if (asoc) {
1239 /* sctp_primitive_ASSOCIATE may have added this association 1234 /* sctp_primitive_ASSOCIATE may have added this association
1240 * To the hash table, try to unhash it, just in case, its a noop 1235 * To the hash table, try to unhash it, just in case, its a noop
@@ -1316,8 +1311,8 @@ static int __sctp_setsockopt_connectx(struct sock* sk,
1316 int err = 0; 1311 int err = 0;
1317 struct sockaddr *kaddrs; 1312 struct sockaddr *kaddrs;
1318 1313
1319 SCTP_DEBUG_PRINTK("%s - sk %p addrs %p addrs_size %d\n", 1314 pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n",
1320 __func__, sk, addrs, addrs_size); 1315 __func__, sk, addrs, addrs_size);
1321 1316
1322 if (unlikely(addrs_size <= 0)) 1317 if (unlikely(addrs_size <= 0))
1323 return -EINVAL; 1318 return -EINVAL;
@@ -1468,7 +1463,7 @@ static void sctp_close(struct sock *sk, long timeout)
1468 struct list_head *pos, *temp; 1463 struct list_head *pos, *temp;
1469 unsigned int data_was_unread; 1464 unsigned int data_was_unread;
1470 1465
1471 SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout); 1466 pr_debug("%s: sk:%p, timeout:%ld\n", __func__, sk, timeout);
1472 1467
1473 sctp_lock_sock(sk); 1468 sctp_lock_sock(sk);
1474 sk->sk_shutdown = SHUTDOWN_MASK; 1469 sk->sk_shutdown = SHUTDOWN_MASK;
@@ -1594,14 +1589,12 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1594 struct sctp_datamsg *datamsg; 1589 struct sctp_datamsg *datamsg;
1595 int msg_flags = msg->msg_flags; 1590 int msg_flags = msg->msg_flags;
1596 1591
1597 SCTP_DEBUG_PRINTK("sctp_sendmsg(sk: %p, msg: %p, msg_len: %zu)\n",
1598 sk, msg, msg_len);
1599
1600 err = 0; 1592 err = 0;
1601 sp = sctp_sk(sk); 1593 sp = sctp_sk(sk);
1602 ep = sp->ep; 1594 ep = sp->ep;
1603 1595
1604 SCTP_DEBUG_PRINTK("Using endpoint: %p.\n", ep); 1596 pr_debug("%s: sk:%p, msg:%p, msg_len:%zu ep:%p\n", __func__, sk,
1597 msg, msg_len, ep);
1605 1598
1606 /* We cannot send a message over a TCP-style listening socket. */ 1599 /* We cannot send a message over a TCP-style listening socket. */
1607 if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) { 1600 if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) {
@@ -1611,9 +1604,8 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1611 1604
1612 /* Parse out the SCTP CMSGs. */ 1605 /* Parse out the SCTP CMSGs. */
1613 err = sctp_msghdr_parse(msg, &cmsgs); 1606 err = sctp_msghdr_parse(msg, &cmsgs);
1614
1615 if (err) { 1607 if (err) {
1616 SCTP_DEBUG_PRINTK("msghdr parse err = %x\n", err); 1608 pr_debug("%s: msghdr parse err:%x\n", __func__, err);
1617 goto out_nounlock; 1609 goto out_nounlock;
1618 } 1610 }
1619 1611
@@ -1645,8 +1637,8 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1645 associd = sinfo->sinfo_assoc_id; 1637 associd = sinfo->sinfo_assoc_id;
1646 } 1638 }
1647 1639
1648 SCTP_DEBUG_PRINTK("msg_len: %zu, sinfo_flags: 0x%x\n", 1640 pr_debug("%s: msg_len:%zu, sinfo_flags:0x%x\n", __func__,
1649 msg_len, sinfo_flags); 1641 msg_len, sinfo_flags);
1650 1642
1651 /* SCTP_EOF or SCTP_ABORT cannot be set on a TCP-style socket. */ 1643 /* SCTP_EOF or SCTP_ABORT cannot be set on a TCP-style socket. */
1652 if (sctp_style(sk, TCP) && (sinfo_flags & (SCTP_EOF | SCTP_ABORT))) { 1644 if (sctp_style(sk, TCP) && (sinfo_flags & (SCTP_EOF | SCTP_ABORT))) {
@@ -1675,7 +1667,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1675 1667
1676 transport = NULL; 1668 transport = NULL;
1677 1669
1678 SCTP_DEBUG_PRINTK("About to look up association.\n"); 1670 pr_debug("%s: about to look up association\n", __func__);
1679 1671
1680 sctp_lock_sock(sk); 1672 sctp_lock_sock(sk);
1681 1673
@@ -1705,7 +1697,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1705 } 1697 }
1706 1698
1707 if (asoc) { 1699 if (asoc) {
1708 SCTP_DEBUG_PRINTK("Just looked up association: %p.\n", asoc); 1700 pr_debug("%s: just looked up association:%p\n", __func__, asoc);
1709 1701
1710 /* We cannot send a message on a TCP-style SCTP_SS_ESTABLISHED 1702 /* We cannot send a message on a TCP-style SCTP_SS_ESTABLISHED
1711 * socket that has an association in CLOSED state. This can 1703 * socket that has an association in CLOSED state. This can
@@ -1718,8 +1710,9 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1718 } 1710 }
1719 1711
1720 if (sinfo_flags & SCTP_EOF) { 1712 if (sinfo_flags & SCTP_EOF) {
1721 SCTP_DEBUG_PRINTK("Shutting down association: %p\n", 1713 pr_debug("%s: shutting down association:%p\n",
1722 asoc); 1714 __func__, asoc);
1715
1723 sctp_primitive_SHUTDOWN(net, asoc, NULL); 1716 sctp_primitive_SHUTDOWN(net, asoc, NULL);
1724 err = 0; 1717 err = 0;
1725 goto out_unlock; 1718 goto out_unlock;
@@ -1732,7 +1725,9 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1732 goto out_unlock; 1725 goto out_unlock;
1733 } 1726 }
1734 1727
1735 SCTP_DEBUG_PRINTK("Aborting association: %p\n", asoc); 1728 pr_debug("%s: aborting association:%p\n",
1729 __func__, asoc);
1730
1736 sctp_primitive_ABORT(net, asoc, chunk); 1731 sctp_primitive_ABORT(net, asoc, chunk);
1737 err = 0; 1732 err = 0;
1738 goto out_unlock; 1733 goto out_unlock;
@@ -1741,7 +1736,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1741 1736
1742 /* Do we need to create the association? */ 1737 /* Do we need to create the association? */
1743 if (!asoc) { 1738 if (!asoc) {
1744 SCTP_DEBUG_PRINTK("There is no association yet.\n"); 1739 pr_debug("%s: there is no association yet\n", __func__);
1745 1740
1746 if (sinfo_flags & (SCTP_EOF | SCTP_ABORT)) { 1741 if (sinfo_flags & (SCTP_EOF | SCTP_ABORT)) {
1747 err = -EINVAL; 1742 err = -EINVAL;
@@ -1840,7 +1835,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1840 } 1835 }
1841 1836
1842 /* ASSERT: we have a valid association at this point. */ 1837 /* ASSERT: we have a valid association at this point. */
1843 SCTP_DEBUG_PRINTK("We have a valid association.\n"); 1838 pr_debug("%s: we have a valid association\n", __func__);
1844 1839
1845 if (!sinfo) { 1840 if (!sinfo) {
1846 /* If the user didn't specify SNDRCVINFO, make up one with 1841 /* If the user didn't specify SNDRCVINFO, make up one with
@@ -1909,7 +1904,8 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1909 err = sctp_primitive_ASSOCIATE(net, asoc, NULL); 1904 err = sctp_primitive_ASSOCIATE(net, asoc, NULL);
1910 if (err < 0) 1905 if (err < 0)
1911 goto out_free; 1906 goto out_free;
1912 SCTP_DEBUG_PRINTK("We associated primitively.\n"); 1907
1908 pr_debug("%s: we associated primitively\n", __func__);
1913 } 1909 }
1914 1910
1915 /* Break the message into multiple chunks of maximum size. */ 1911 /* Break the message into multiple chunks of maximum size. */
@@ -1936,17 +1932,15 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1936 */ 1932 */
1937 err = sctp_primitive_SEND(net, asoc, datamsg); 1933 err = sctp_primitive_SEND(net, asoc, datamsg);
1938 /* Did the lower layer accept the chunk? */ 1934 /* Did the lower layer accept the chunk? */
1939 if (err) 1935 if (err) {
1940 sctp_datamsg_free(datamsg); 1936 sctp_datamsg_free(datamsg);
1941 else 1937 goto out_free;
1942 sctp_datamsg_put(datamsg); 1938 }
1943 1939
1944 SCTP_DEBUG_PRINTK("We sent primitively.\n"); 1940 pr_debug("%s: we sent primitively\n", __func__);
1945 1941
1946 if (err) 1942 sctp_datamsg_put(datamsg);
1947 goto out_free; 1943 err = msg_len;
1948 else
1949 err = msg_len;
1950 1944
1951 /* If we are already past ASSOCIATE, the lower 1945 /* If we are already past ASSOCIATE, the lower
1952 * layers are responsible for association cleanup. 1946 * layers are responsible for association cleanup.
@@ -2041,10 +2035,9 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk,
2041 int err = 0; 2035 int err = 0;
2042 int skb_len; 2036 int skb_len;
2043 2037
2044 SCTP_DEBUG_PRINTK("sctp_recvmsg(%s: %p, %s: %p, %s: %zd, %s: %d, %s: " 2038 pr_debug("%s: sk:%p, msghdr:%p, len:%zd, noblock:%d, flags:0x%x, "
2045 "0x%x, %s: %p)\n", "sk", sk, "msghdr", msg, 2039 "addr_len:%p)\n", __func__, sk, msg, len, noblock, flags,
2046 "len", len, "knoblauch", noblock, 2040 addr_len);
2047 "flags", flags, "addr_len", addr_len);
2048 2041
2049 sctp_lock_sock(sk); 2042 sctp_lock_sock(sk);
2050 2043
@@ -3086,7 +3079,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
3086 3079
3087 err = sctp_send_asconf(asoc, chunk); 3080 err = sctp_send_asconf(asoc, chunk);
3088 3081
3089 SCTP_DEBUG_PRINTK("We set peer primary addr primitively.\n"); 3082 pr_debug("%s: we set peer primary addr primitively\n", __func__);
3090 3083
3091 return err; 3084 return err;
3092} 3085}
@@ -3561,8 +3554,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
3561{ 3554{
3562 int retval = 0; 3555 int retval = 0;
3563 3556
3564 SCTP_DEBUG_PRINTK("sctp_setsockopt(sk: %p... optname: %d)\n", 3557 pr_debug("%s: sk:%p, optname:%d\n", __func__, sk, optname);
3565 sk, optname);
3566 3558
3567 /* I can hardly begin to describe how wrong this is. This is 3559 /* I can hardly begin to describe how wrong this is. This is
3568 * so broken as to be worse than useless. The API draft 3560 * so broken as to be worse than useless. The API draft
@@ -3724,8 +3716,8 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr,
3724 3716
3725 sctp_lock_sock(sk); 3717 sctp_lock_sock(sk);
3726 3718
3727 SCTP_DEBUG_PRINTK("%s - sk: %p, sockaddr: %p, addr_len: %d\n", 3719 pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk,
3728 __func__, sk, addr, addr_len); 3720 addr, addr_len);
3729 3721
3730 /* Validate addr_len before calling common connect/connectx routine. */ 3722 /* Validate addr_len before calling common connect/connectx routine. */
3731 af = sctp_get_af_specific(addr->sa_family); 3723 af = sctp_get_af_specific(addr->sa_family);
@@ -3855,7 +3847,7 @@ static int sctp_init_sock(struct sock *sk)
3855 struct net *net = sock_net(sk); 3847 struct net *net = sock_net(sk);
3856 struct sctp_sock *sp; 3848 struct sctp_sock *sp;
3857 3849
3858 SCTP_DEBUG_PRINTK("sctp_init_sock(sk: %p)\n", sk); 3850 pr_debug("%s: sk:%p\n", __func__, sk);
3859 3851
3860 sp = sctp_sk(sk); 3852 sp = sctp_sk(sk);
3861 3853
@@ -3990,7 +3982,7 @@ static void sctp_destroy_sock(struct sock *sk)
3990{ 3982{
3991 struct sctp_sock *sp; 3983 struct sctp_sock *sp;
3992 3984
3993 SCTP_DEBUG_PRINTK("sctp_destroy_sock(sk: %p)\n", sk); 3985 pr_debug("%s: sk:%p\n", __func__, sk);
3994 3986
3995 /* Release our hold on the endpoint. */ 3987 /* Release our hold on the endpoint. */
3996 sp = sctp_sk(sk); 3988 sp = sctp_sk(sk);
@@ -4123,9 +4115,9 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
4123 goto out; 4115 goto out;
4124 } 4116 }
4125 4117
4126 SCTP_DEBUG_PRINTK("sctp_getsockopt_sctp_status(%d): %d %d %d\n", 4118 pr_debug("%s: len:%d, state:%d, rwnd:%d, assoc_id:%d\n",
4127 len, status.sstat_state, status.sstat_rwnd, 4119 __func__, len, status.sstat_state, status.sstat_rwnd,
4128 status.sstat_assoc_id); 4120 status.sstat_assoc_id);
4129 4121
4130 if (copy_to_user(optval, &status, len)) { 4122 if (copy_to_user(optval, &status, len)) {
4131 retval = -EFAULT; 4123 retval = -EFAULT;
@@ -4333,8 +4325,8 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
4333 return PTR_ERR(newfile); 4325 return PTR_ERR(newfile);
4334 } 4326 }
4335 4327
4336 SCTP_DEBUG_PRINTK("%s: sk: %p newsk: %p sd: %d\n", 4328 pr_debug("%s: sk:%p, newsk:%p, sd:%d\n", __func__, sk, newsock->sk,
4337 __func__, sk, newsock->sk, retval); 4329 retval);
4338 4330
4339 /* Return the fd mapped to the new socket. */ 4331 /* Return the fd mapped to the new socket. */
4340 if (put_user(len, optlen)) { 4332 if (put_user(len, optlen)) {
@@ -4467,7 +4459,7 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
4467 trans = sctp_addr_id2transport(sk, &params.spp_address, 4459 trans = sctp_addr_id2transport(sk, &params.spp_address,
4468 params.spp_assoc_id); 4460 params.spp_assoc_id);
4469 if (!trans) { 4461 if (!trans) {
4470 SCTP_DEBUG_PRINTK("Failed no transport\n"); 4462 pr_debug("%s: failed no transport\n", __func__);
4471 return -EINVAL; 4463 return -EINVAL;
4472 } 4464 }
4473 } 4465 }
@@ -4478,7 +4470,7 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
4478 */ 4470 */
4479 asoc = sctp_id2assoc(sk, params.spp_assoc_id); 4471 asoc = sctp_id2assoc(sk, params.spp_assoc_id);
4480 if (!asoc && params.spp_assoc_id && sctp_style(sk, UDP)) { 4472 if (!asoc && params.spp_assoc_id && sctp_style(sk, UDP)) {
4481 SCTP_DEBUG_PRINTK("Failed no association\n"); 4473 pr_debug("%s: failed no association\n", __func__);
4482 return -EINVAL; 4474 return -EINVAL;
4483 } 4475 }
4484 4476
@@ -5698,8 +5690,7 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len,
5698 if (put_user(len, optlen)) 5690 if (put_user(len, optlen))
5699 return -EFAULT; 5691 return -EFAULT;
5700 5692
5701 SCTP_DEBUG_PRINTK("sctp_getsockopt_assoc_stat(%d): %d\n", 5693 pr_debug("%s: len:%d, assoc_id:%d\n", __func__, len, sas.sas_assoc_id);
5702 len, sas.sas_assoc_id);
5703 5694
5704 if (copy_to_user(optval, &sas, len)) 5695 if (copy_to_user(optval, &sas, len))
5705 return -EFAULT; 5696 return -EFAULT;
@@ -5713,8 +5704,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname,
5713 int retval = 0; 5704 int retval = 0;
5714 int len; 5705 int len;
5715 5706
5716 SCTP_DEBUG_PRINTK("sctp_getsockopt(sk: %p... optname: %d)\n", 5707 pr_debug("%s: sk:%p, optname:%d\n", __func__, sk, optname);
5717 sk, optname);
5718 5708
5719 /* I can hardly begin to describe how wrong this is. This is 5709 /* I can hardly begin to describe how wrong this is. This is
5720 * so broken as to be worse than useless. The API draft 5710 * so broken as to be worse than useless. The API draft
@@ -5894,7 +5884,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5894 5884
5895 snum = ntohs(addr->v4.sin_port); 5885 snum = ntohs(addr->v4.sin_port);
5896 5886
5897 SCTP_DEBUG_PRINTK("sctp_get_port() begins, snum=%d\n", snum); 5887 pr_debug("%s: begins, snum:%d\n", __func__, snum);
5888
5898 sctp_local_bh_disable(); 5889 sctp_local_bh_disable();
5899 5890
5900 if (snum == 0) { 5891 if (snum == 0) {
@@ -5960,7 +5951,8 @@ pp_found:
5960 int reuse = sk->sk_reuse; 5951 int reuse = sk->sk_reuse;
5961 struct sock *sk2; 5952 struct sock *sk2;
5962 5953
5963 SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n"); 5954 pr_debug("%s: found a possible match\n", __func__);
5955
5964 if (pp->fastreuse && sk->sk_reuse && 5956 if (pp->fastreuse && sk->sk_reuse &&
5965 sk->sk_state != SCTP_SS_LISTENING) 5957 sk->sk_state != SCTP_SS_LISTENING)
5966 goto success; 5958 goto success;
@@ -5990,7 +5982,8 @@ pp_found:
5990 goto fail_unlock; 5982 goto fail_unlock;
5991 } 5983 }
5992 } 5984 }
5993 SCTP_DEBUG_PRINTK("sctp_get_port(): Found a match\n"); 5985
5986 pr_debug("%s: found a match\n", __func__);
5994 } 5987 }
5995pp_not_found: 5988pp_not_found:
5996 /* If there was a hash table miss, create a new port. */ 5989 /* If there was a hash table miss, create a new port. */
@@ -6479,8 +6472,8 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
6479 6472
6480 timeo = sock_rcvtimeo(sk, noblock); 6473 timeo = sock_rcvtimeo(sk, noblock);
6481 6474
6482 SCTP_DEBUG_PRINTK("Timeout: timeo: %ld, MAX: %ld.\n", 6475 pr_debug("%s: timeo:%ld, max:%ld\n", __func__, timeo,
6483 timeo, MAX_SCHEDULE_TIMEOUT); 6476 MAX_SCHEDULE_TIMEOUT);
6484 6477
6485 do { 6478 do {
6486 /* Again only user level code calls this function, 6479 /* Again only user level code calls this function,
@@ -6611,8 +6604,8 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
6611 long current_timeo = *timeo_p; 6604 long current_timeo = *timeo_p;
6612 DEFINE_WAIT(wait); 6605 DEFINE_WAIT(wait);
6613 6606
6614 SCTP_DEBUG_PRINTK("wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%zu\n", 6607 pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc,
6615 asoc, (long)(*timeo_p), msg_len); 6608 *timeo_p, msg_len);
6616 6609
6617 /* Increment the association's refcnt. */ 6610 /* Increment the association's refcnt. */
6618 sctp_association_hold(asoc); 6611 sctp_association_hold(asoc);
@@ -6718,8 +6711,7 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)
6718 long current_timeo = *timeo_p; 6711 long current_timeo = *timeo_p;
6719 DEFINE_WAIT(wait); 6712 DEFINE_WAIT(wait);
6720 6713
6721 SCTP_DEBUG_PRINTK("%s: asoc=%p, timeo=%ld\n", __func__, asoc, 6714 pr_debug("%s: asoc:%p, timeo:%ld\n", __func__, asoc, *timeo_p);
6722 (long)(*timeo_p));
6723 6715
6724 /* Increment the association's refcnt. */ 6716 /* Increment the association's refcnt. */
6725 sctp_association_hold(asoc); 6717 sctp_association_hold(asoc);
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 5d3c71bbd197..bdbbc3fd7c14 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -176,7 +176,10 @@ static void sctp_transport_destroy_rcu(struct rcu_head *head)
176 */ 176 */
177static void sctp_transport_destroy(struct sctp_transport *transport) 177static void sctp_transport_destroy(struct sctp_transport *transport)
178{ 178{
179 SCTP_ASSERT(transport->dead, "Transport is not dead", return); 179 if (unlikely(!transport->dead)) {
180 WARN(1, "Attempt to destroy undead transport %p!\n", transport);
181 return;
182 }
180 183
181 call_rcu(&transport->rcu, sctp_transport_destroy_rcu); 184 call_rcu(&transport->rcu, sctp_transport_destroy_rcu);
182 185
@@ -317,11 +320,9 @@ void sctp_transport_put(struct sctp_transport *transport)
317/* Update transport's RTO based on the newly calculated RTT. */ 320/* Update transport's RTO based on the newly calculated RTT. */
318void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) 321void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
319{ 322{
320 /* Check for valid transport. */ 323 if (unlikely(!tp->rto_pending))
321 SCTP_ASSERT(tp, "NULL transport", return); 324 /* We should not be doing any RTO updates unless rto_pending is set. */
322 325 pr_debug("%s: rto_pending not set on transport %p!\n", __func__, tp);
323 /* We should not be doing any RTO updates unless rto_pending is set. */
324 SCTP_ASSERT(tp->rto_pending, "rto_pending not set", return);
325 326
326 if (tp->rttvar || tp->srtt) { 327 if (tp->rttvar || tp->srtt) {
327 struct net *net = sock_net(tp->asoc->base.sk); 328 struct net *net = sock_net(tp->asoc->base.sk);
@@ -377,9 +378,8 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
377 */ 378 */
378 tp->rto_pending = 0; 379 tp->rto_pending = 0;
379 380
380 SCTP_DEBUG_PRINTK("%s: transport: %p, rtt: %d, srtt: %d " 381 pr_debug("%s: transport:%p, rtt:%d, srtt:%d rttvar:%d, rto:%ld\n",
381 "rttvar: %d, rto: %ld\n", __func__, 382 __func__, tp, rtt, tp->srtt, tp->rttvar, tp->rto);
382 tp, rtt, tp->srtt, tp->rttvar, tp->rto);
383} 383}
384 384
385/* This routine updates the transport's cwnd and partial_bytes_acked 385/* This routine updates the transport's cwnd and partial_bytes_acked
@@ -433,12 +433,11 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
433 cwnd += pmtu; 433 cwnd += pmtu;
434 else 434 else
435 cwnd += bytes_acked; 435 cwnd += bytes_acked;
436 SCTP_DEBUG_PRINTK("%s: SLOW START: transport: %p, " 436
437 "bytes_acked: %d, cwnd: %d, ssthresh: %d, " 437 pr_debug("%s: slow start: transport:%p, bytes_acked:%d, "
438 "flight_size: %d, pba: %d\n", 438 "cwnd:%d, ssthresh:%d, flight_size:%d, pba:%d\n",
439 __func__, 439 __func__, transport, bytes_acked, cwnd, ssthresh,
440 transport, bytes_acked, cwnd, 440 flight_size, pba);
441 ssthresh, flight_size, pba);
442 } else { 441 } else {
443 /* RFC 2960 7.2.2 Whenever cwnd is greater than ssthresh, 442 /* RFC 2960 7.2.2 Whenever cwnd is greater than ssthresh,
444 * upon each SACK arrival that advances the Cumulative TSN Ack 443 * upon each SACK arrival that advances the Cumulative TSN Ack
@@ -459,12 +458,12 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
459 cwnd += pmtu; 458 cwnd += pmtu;
460 pba = ((cwnd < pba) ? (pba - cwnd) : 0); 459 pba = ((cwnd < pba) ? (pba - cwnd) : 0);
461 } 460 }
462 SCTP_DEBUG_PRINTK("%s: CONGESTION AVOIDANCE: " 461
463 "transport: %p, bytes_acked: %d, cwnd: %d, " 462 pr_debug("%s: congestion avoidance: transport:%p, "
464 "ssthresh: %d, flight_size: %d, pba: %d\n", 463 "bytes_acked:%d, cwnd:%d, ssthresh:%d, "
465 __func__, 464 "flight_size:%d, pba:%d\n", __func__,
466 transport, bytes_acked, cwnd, 465 transport, bytes_acked, cwnd, ssthresh,
467 ssthresh, flight_size, pba); 466 flight_size, pba);
468 } 467 }
469 468
470 transport->cwnd = cwnd; 469 transport->cwnd = cwnd;
@@ -558,10 +557,10 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
558 } 557 }
559 558
560 transport->partial_bytes_acked = 0; 559 transport->partial_bytes_acked = 0;
561 SCTP_DEBUG_PRINTK("%s: transport: %p reason: %d cwnd: " 560
562 "%d ssthresh: %d\n", __func__, 561 pr_debug("%s: transport:%p, reason:%d, cwnd:%d, ssthresh:%d\n",
563 transport, reason, 562 __func__, transport, reason, transport->cwnd,
564 transport->cwnd, transport->ssthresh); 563 transport->ssthresh);
565} 564}
566 565
567/* Apply Max.Burst limit to the congestion window: 566/* Apply Max.Burst limit to the congestion window: