aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r--net/sctp/associola.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index d29f792e0529..b4cd2b71953f 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -718,12 +718,11 @@ struct sctp_transport *sctp_assoc_lookup_paddr(
718 const union sctp_addr *address) 718 const union sctp_addr *address)
719{ 719{
720 struct sctp_transport *t; 720 struct sctp_transport *t;
721 struct list_head *pos;
722 721
723 /* Cycle through all transports searching for a peer address. */ 722 /* Cycle through all transports searching for a peer address. */
724 723
725 list_for_each(pos, &asoc->peer.transport_addr_list) { 724 list_for_each_entry(t, &asoc->peer.transport_addr_list,
726 t = list_entry(pos, struct sctp_transport, transports); 725 transports) {
727 if (sctp_cmp_addr_exact(address, &t->ipaddr)) 726 if (sctp_cmp_addr_exact(address, &t->ipaddr))
728 return t; 727 return t;
729 } 728 }
@@ -762,7 +761,6 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
762 struct sctp_transport *second; 761 struct sctp_transport *second;
763 struct sctp_ulpevent *event; 762 struct sctp_ulpevent *event;
764 struct sockaddr_storage addr; 763 struct sockaddr_storage addr;
765 struct list_head *pos;
766 int spc_state = 0; 764 int spc_state = 0;
767 765
768 /* Record the transition on the transport. */ 766 /* Record the transition on the transport. */
@@ -814,8 +812,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
814 */ 812 */
815 first = NULL; second = NULL; 813 first = NULL; second = NULL;
816 814
817 list_for_each(pos, &asoc->peer.transport_addr_list) { 815 list_for_each_entry(t, &asoc->peer.transport_addr_list,
818 t = list_entry(pos, struct sctp_transport, transports); 816 transports) {
819 817
820 if ((t->state == SCTP_INACTIVE) || 818 if ((t->state == SCTP_INACTIVE) ||
821 (t->state == SCTP_UNCONFIRMED)) 819 (t->state == SCTP_UNCONFIRMED))
@@ -932,7 +930,6 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
932{ 930{
933 struct sctp_transport *active; 931 struct sctp_transport *active;
934 struct sctp_transport *match; 932 struct sctp_transport *match;
935 struct list_head *entry, *pos;
936 struct sctp_transport *transport; 933 struct sctp_transport *transport;
937 struct sctp_chunk *chunk; 934 struct sctp_chunk *chunk;
938 __be32 key = htonl(tsn); 935 __be32 key = htonl(tsn);
@@ -956,8 +953,8 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
956 953
957 active = asoc->peer.active_path; 954 active = asoc->peer.active_path;
958 955
959 list_for_each(entry, &active->transmitted) { 956 list_for_each_entry(chunk, &active->transmitted,
960 chunk = list_entry(entry, struct sctp_chunk, transmitted_list); 957 transmitted_list) {
961 958
962 if (key == chunk->subh.data_hdr->tsn) { 959 if (key == chunk->subh.data_hdr->tsn) {
963 match = active; 960 match = active;
@@ -966,14 +963,13 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
966 } 963 }
967 964
968 /* If not found, go search all the other transports. */ 965 /* If not found, go search all the other transports. */
969 list_for_each(pos, &asoc->peer.transport_addr_list) { 966 list_for_each_entry(transport, &asoc->peer.transport_addr_list,
970 transport = list_entry(pos, struct sctp_transport, transports); 967 transports) {
971 968
972 if (transport == active) 969 if (transport == active)
973 break; 970 break;
974 list_for_each(entry, &transport->transmitted) { 971 list_for_each_entry(chunk, &transport->transmitted,
975 chunk = list_entry(entry, struct sctp_chunk, 972 transmitted_list) {
976 transmitted_list);
977 if (key == chunk->subh.data_hdr->tsn) { 973 if (key == chunk->subh.data_hdr->tsn) {
978 match = transport; 974 match = transport;
979 goto out; 975 goto out;
@@ -1154,9 +1150,8 @@ void sctp_assoc_update(struct sctp_association *asoc,
1154 1150
1155 } else { 1151 } else {
1156 /* Add any peer addresses from the new association. */ 1152 /* Add any peer addresses from the new association. */
1157 list_for_each(pos, &new->peer.transport_addr_list) { 1153 list_for_each_entry(trans, &new->peer.transport_addr_list,
1158 trans = list_entry(pos, struct sctp_transport, 1154 transports) {
1159 transports);
1160 if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) 1155 if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
1161 sctp_assoc_add_peer(asoc, &trans->ipaddr, 1156 sctp_assoc_add_peer(asoc, &trans->ipaddr,
1162 GFP_ATOMIC, trans->state); 1157 GFP_ATOMIC, trans->state);
@@ -1306,15 +1301,14 @@ struct sctp_transport *sctp_assoc_choose_shutdown_transport(
1306void sctp_assoc_sync_pmtu(struct sctp_association *asoc) 1301void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
1307{ 1302{
1308 struct sctp_transport *t; 1303 struct sctp_transport *t;
1309 struct list_head *pos;
1310 __u32 pmtu = 0; 1304 __u32 pmtu = 0;
1311 1305
1312 if (!asoc) 1306 if (!asoc)
1313 return; 1307 return;
1314 1308
1315 /* Get the lowest pmtu of all the transports. */ 1309 /* Get the lowest pmtu of all the transports. */
1316 list_for_each(pos, &asoc->peer.transport_addr_list) { 1310 list_for_each_entry(t, &asoc->peer.transport_addr_list,
1317 t = list_entry(pos, struct sctp_transport, transports); 1311 transports) {
1318 if (t->pmtu_pending && t->dst) { 1312 if (t->pmtu_pending && t->dst) {
1319 sctp_transport_update_pmtu(t, dst_mtu(t->dst)); 1313 sctp_transport_update_pmtu(t, dst_mtu(t->dst));
1320 t->pmtu_pending = 0; 1314 t->pmtu_pending = 0;
@@ -1330,7 +1324,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
1330 } 1324 }
1331 1325
1332 SCTP_DEBUG_PRINTK("%s: asoc:%p, pmtu:%d, frag_point:%d\n", 1326 SCTP_DEBUG_PRINTK("%s: asoc:%p, pmtu:%d, frag_point:%d\n",
1333 __FUNCTION__, asoc, asoc->pathmtu, asoc->frag_point); 1327 __func__, asoc, asoc->pathmtu, asoc->frag_point);
1334} 1328}
1335 1329
1336/* Should we send a SACK to update our peer? */ 1330/* Should we send a SACK to update our peer? */
@@ -1370,7 +1364,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned len)
1370 } 1364 }
1371 1365
1372 SCTP_DEBUG_PRINTK("%s: asoc %p rwnd increased by %d to (%u, %u) " 1366 SCTP_DEBUG_PRINTK("%s: asoc %p rwnd increased by %d to (%u, %u) "
1373 "- %u\n", __FUNCTION__, asoc, len, asoc->rwnd, 1367 "- %u\n", __func__, asoc, len, asoc->rwnd,
1374 asoc->rwnd_over, asoc->a_rwnd); 1368 asoc->rwnd_over, asoc->a_rwnd);
1375 1369
1376 /* Send a window update SACK if the rwnd has increased by at least the 1370 /* Send a window update SACK if the rwnd has increased by at least the
@@ -1381,7 +1375,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned len)
1381 if (sctp_peer_needs_update(asoc)) { 1375 if (sctp_peer_needs_update(asoc)) {
1382 asoc->a_rwnd = asoc->rwnd; 1376 asoc->a_rwnd = asoc->rwnd;
1383 SCTP_DEBUG_PRINTK("%s: Sending window update SACK- asoc: %p " 1377 SCTP_DEBUG_PRINTK("%s: Sending window update SACK- asoc: %p "
1384 "rwnd: %u a_rwnd: %u\n", __FUNCTION__, 1378 "rwnd: %u a_rwnd: %u\n", __func__,
1385 asoc, asoc->rwnd, asoc->a_rwnd); 1379 asoc, asoc->rwnd, asoc->a_rwnd);
1386 sack = sctp_make_sack(asoc); 1380 sack = sctp_make_sack(asoc);
1387 if (!sack) 1381 if (!sack)
@@ -1410,7 +1404,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len)
1410 asoc->rwnd = 0; 1404 asoc->rwnd = 0;
1411 } 1405 }
1412 SCTP_DEBUG_PRINTK("%s: asoc %p rwnd decreased by %d to (%u, %u)\n", 1406 SCTP_DEBUG_PRINTK("%s: asoc %p rwnd decreased by %d to (%u, %u)\n",
1413 __FUNCTION__, asoc, len, asoc->rwnd, 1407 __func__, asoc, len, asoc->rwnd,
1414 asoc->rwnd_over); 1408 asoc->rwnd_over);
1415} 1409}
1416 1410