mmc: s3c6410: enable ADMA feature in 6410 sdhci controller
[safe/jmp/linux-2.6] / net / sctp / output.c
index e47398c..a646681 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/icmp.h>
@@ -69,6 +70,17 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet,
                                        struct sctp_chunk *chunk,
                                        u16 chunk_len);
 
+static void sctp_packet_reset(struct sctp_packet *packet)
+{
+       packet->size = packet->overhead;
+       packet->has_cookie_echo = 0;
+       packet->has_sack = 0;
+       packet->has_data = 0;
+       packet->has_auth = 0;
+       packet->ipfragok = 0;
+       packet->auth = NULL;
+}
+
 /* Config a packet.
  * This appears to be a followup set of initializations.
  */
@@ -80,13 +92,8 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet,
        SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__,
                          packet, vtag);
 
+       sctp_packet_reset(packet);
        packet->vtag = vtag;
-       packet->has_cookie_echo = 0;
-       packet->has_sack = 0;
-       packet->has_auth = 0;
-       packet->has_data = 0;
-       packet->ipfragok = 0;
-       packet->auth = NULL;
 
        if (ecn_capable && sctp_packet_empty(packet)) {
                chunk = sctp_get_ecne_prepend(packet->transport->asoc);
@@ -124,29 +131,12 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet,
        }
        overhead += sizeof(struct sctphdr);
        packet->overhead = overhead;
-       packet->size = overhead;
+       sctp_packet_reset(packet);
        packet->vtag = 0;
-       packet->has_cookie_echo = 0;
-       packet->has_sack = 0;
-       packet->has_auth = 0;
-       packet->has_data = 0;
-       packet->ipfragok = 0;
        packet->malloced = 0;
-       packet->auth = NULL;
        return packet;
 }
 
-static void sctp_packet_reset(struct sctp_packet *packet)
-{
-       packet->size = packet->overhead;
-       packet->has_cookie_echo = 0;
-       packet->has_sack = 0;
-       packet->has_data = 0;
-       packet->has_auth = 0;
-       packet->ipfragok = 0;
-       packet->auth = NULL;
-}
-
 /* Free a packet.  */
 void sctp_packet_free(struct sctp_packet *packet)
 {
@@ -439,11 +429,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
        list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) {
                list_del_init(&chunk->list);
                if (sctp_chunk_is_data(chunk)) {
-
-                       if (!chunk->has_tsn) {
-                               sctp_chunk_assign_ssn(chunk);
-                               sctp_chunk_assign_tsn(chunk);
-
                        /* 6.3.1 C4) When data is in flight and when allowed
                         * by rule C5, a new RTT measurement MUST be made each
                         * round trip.  Furthermore, new RTT measurements
@@ -451,13 +436,10 @@ int sctp_packet_transmit(struct sctp_packet *packet)
                         * for a given destination transport address.
                         */
 
-                               if (!tp->rto_pending) {
-                                       chunk->rtt_in_progress = 1;
-                                       tp->rto_pending = 1;
-                               }
-                       } else
-                               chunk->resent = 1;
-
+                       if (!tp->rto_pending) {
+                               chunk->rtt_in_progress = 1;
+                               tp->rto_pending = 1;
+                       }
                        has_data = 1;
                }
 
@@ -568,8 +550,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
                struct timer_list *timer;
                unsigned long timeout;
 
-               tp->last_time_used = jiffies;
-
                /* Restart the AUTOCLOSE timer when sending data. */
                if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
                        timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
@@ -628,7 +608,6 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
        sctp_xmit_t retval = SCTP_XMIT_OK;
        size_t datasize, rwnd, inflight, flight_size;
        struct sctp_transport *transport = packet->transport;
-       __u32 max_burst_bytes;
        struct sctp_association *asoc = transport->asoc;
        struct sctp_outq *q = &asoc->outqueue;
 
@@ -661,28 +640,6 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
                }
        }
 
-       /* sctpimpguide-05 2.14.2
-        * D) When the time comes for the sender to
-        * transmit new DATA chunks, the protocol parameter Max.Burst MUST
-        * first be applied to limit how many new DATA chunks may be sent.
-        * The limit is applied by adjusting cwnd as follows:
-        *      if ((flightsize + Max.Burst * MTU) < cwnd)
-        *              cwnd = flightsize + Max.Burst * MTU
-        */
-       max_burst_bytes = asoc->max_burst * asoc->pathmtu;
-       if ((flight_size + max_burst_bytes) < transport->cwnd) {
-               transport->cwnd = flight_size + max_burst_bytes;
-               SCTP_DEBUG_PRINTK("%s: cwnd limited by max_burst: "
-                                 "transport: %p, cwnd: %d, "
-                                 "ssthresh: %d, flight_size: %d, "
-                                 "pba: %d\n",
-                                 __func__, transport,
-                                 transport->cwnd,
-                                 transport->ssthresh,
-                                 transport->flight_size,
-                                 transport->partial_bytes_acked);
-       }
-
        /* RFC 2960 6.1  Transmission of DATA Chunks
         *
         * B) At any given time, the sender MUST NOT transmit new data
@@ -717,7 +674,7 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
                 * Don't delay large message writes that may have been
                 * fragmeneted into small peices.
                 */
-               if ((len < max) && (chunk->msg->msg_size < max)) {
+               if ((len < max) && chunk->msg->can_delay) {
                        retval = SCTP_XMIT_NAGLE_DELAY;
                        goto finish;
                }
@@ -758,6 +715,8 @@ static void sctp_packet_append_data(struct sctp_packet *packet,
        /* Has been accepted for transmission. */
        if (!asoc->peer.prsctp_capable)
                chunk->msg->can_abandon = 0;
+       sctp_chunk_assign_tsn(chunk);
+       sctp_chunk_assign_ssn(chunk);
 }
 
 static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet,