nfs4: minor callback code simplification, comment
[safe/jmp/linux-2.6] / net / sctp / outqueue.c
index c9f20e2..abfc0b8 100644 (file)
@@ -50,6 +50,7 @@
 #include <linux/list.h>   /* For struct list_head */
 #include <linux/socket.h>
 #include <linux/ip.h>
+#include <linux/slab.h>
 #include <net/sock.h>    /* For skb_set_owner_w */
 
 #include <net/sctp/sctp.h>
@@ -191,8 +192,8 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary,
                                 __u32 tsn)
 {
        if (primary->cacc.changeover_active &&
-           (sctp_cacc_skip_3_1(primary, transport, count_of_newacks)
-            || sctp_cacc_skip_3_2(primary, tsn)))
+           (sctp_cacc_skip_3_1(primary, transport, count_of_newacks) ||
+            sctp_cacc_skip_3_2(primary, tsn)))
                return 1;
        return 0;
 }
@@ -423,16 +424,6 @@ void sctp_retransmit_mark(struct sctp_outq *q,
                if ((reason == SCTP_RTXR_FAST_RTX  &&
                            (chunk->fast_retransmit == SCTP_NEED_FRTX)) ||
                    (reason != SCTP_RTXR_FAST_RTX  && !chunk->tsn_gap_acked)) {
-                       /* If this chunk was sent less then 1 rto ago, do not
-                        * retransmit this chunk, but give the peer time
-                        * to acknowlege it.  Do this only when
-                        * retransmitting due to T3 timeout.
-                        */
-                       if (reason == SCTP_RTXR_T3_RTX &&
-                           time_before(jiffies, chunk->sent_at +
-                                                transport->last_rto))
-                               continue;
-
                        /* RFC 2960 6.2.1 Processing a Received SACK
                         *
                         * C) Any time a DATA chunk is marked for
@@ -931,6 +922,14 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
                                goto sctp_flush_out;
                }
 
+               /* Apply Max.Burst limitation to the current transport in
+                * case it will be used for new data.  We are going to
+                * rest it before we return, but we want to apply the limit
+                * to the currently queued data.
+                */
+               if (transport)
+                       sctp_transport_burst_limited(transport);
+
                /* Finally, transmit new packets.  */
                while ((chunk = sctp_outq_dequeue_data(q)) != NULL) {
                        /* RFC 2960 6.5 Every DATA chunk MUST carry a valid
@@ -976,6 +975,10 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
                                packet = &transport->packet;
                                sctp_packet_config(packet, vtag,
                                                   asoc->peer.ecn_capable);
+                               /* We've switched transports, so apply the
+                                * Burst limit to the new transport.
+                                */
+                               sctp_transport_burst_limited(transport);
                        }
 
                        SCTP_DEBUG_PRINTK("sctp_outq_flush(%p, %p[%s]), ",
@@ -1011,6 +1014,13 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
                                break;
 
                        case SCTP_XMIT_OK:
+                               /* The sender is in the SHUTDOWN-PENDING state,
+                                * The sender MAY set the I-bit in the DATA
+                                * chunk header.
+                                */
+                               if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING)
+                                       chunk->chunk_hdr->flags |= SCTP_DATA_SACK_IMM;
+
                                break;
 
                        default:
@@ -1063,6 +1073,9 @@ sctp_flush_out:
                packet = &t->packet;
                if (!sctp_packet_empty(packet))
                        error = sctp_packet_transmit(packet);
+
+               /* Clear the burst limited state, if any */
+               sctp_transport_burst_reset(t);
        }
 
        return error;