]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sctp/associola.c
vlan: clean up hard_start_xmit functions
[linux-2.6-omap-h63xx.git] / net / sctp / associola.c
index b4cd2b71953fdf66ae75bcc5c80d9e3e7d5558fb..35b6a023a6d0cc828a37694877262e32285ddc2c 100644 (file)
@@ -136,6 +136,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
 
        /* Set association default SACK delay */
        asoc->sackdelay = msecs_to_jiffies(sp->sackdelay);
+       asoc->sackfreq = sp->sackfreq;
 
        /* Set the association default flags controlling
         * Heartbeat, SACK delay, and Path MTU Discovery.
@@ -261,6 +262,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
         * already received one packet.]
         */
        asoc->peer.sack_needed = 1;
+       asoc->peer.sack_cnt = 0;
 
        /* Assume that the peer will tell us if he recognizes ASCONF
         * as part of INIT exchange.
@@ -474,6 +476,15 @@ static void sctp_association_destroy(struct sctp_association *asoc)
 void sctp_assoc_set_primary(struct sctp_association *asoc,
                            struct sctp_transport *transport)
 {
+       int changeover = 0;
+
+       /* it's a changeover only if we already have a primary path
+        * that we are changing
+        */
+       if (asoc->peer.primary_path != NULL &&
+           asoc->peer.primary_path != transport)
+               changeover = 1 ;
+
        asoc->peer.primary_path = transport;
 
        /* Set a default msg_name for events. */
@@ -499,12 +510,12 @@ void sctp_assoc_set_primary(struct sctp_association *asoc,
         * double switch to the same destination address.
         */
        if (transport->cacc.changeover_active)
-               transport->cacc.cycling_changeover = 1;
+               transport->cacc.cycling_changeover = changeover;
 
        /* 2) The sender MUST set CHANGEOVER_ACTIVE to indicate that
         * a changeover has occurred.
         */
-       transport->cacc.changeover_active = 1;
+       transport->cacc.changeover_active = changeover;
 
        /* 3) The sender MUST store the next TSN to be sent in
         * next_tsn_at_change.
@@ -615,6 +626,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
         * association configured value.
         */
        peer->sackdelay = asoc->sackdelay;
+       peer->sackfreq = asoc->sackfreq;
 
        /* Enable/disable heartbeat, SACK delay, and path MTU discovery
         * based on association setting.
@@ -1203,6 +1215,9 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
        struct list_head *head = &asoc->peer.transport_addr_list;
        struct list_head *pos;
 
+       if (asoc->peer.transport_count == 1)
+               return;
+
        /* Find the next transport in a round-robin fashion. */
        t = asoc->peer.retran_path;
        pos = &t->transports;
@@ -1217,6 +1232,15 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
 
                t = list_entry(pos, struct sctp_transport, transports);
 
+               /* We have exhausted the list, but didn't find any
+                * other active transports.  If so, use the next
+                * transport.
+                */
+               if (t == asoc->peer.retran_path) {
+                       t = next;
+                       break;
+               }
+
                /* Try to find an active transport. */
 
                if ((t->state == SCTP_ACTIVE) ||
@@ -1229,15 +1253,6 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
                        if (!next)
                                next = t;
                }
-
-               /* We have exhausted the list, but didn't find any
-                * other active transports.  If so, use the next
-                * transport.
-                */
-               if (t == asoc->peer.retran_path) {
-                       t = next;
-                       break;
-               }
        }
 
        asoc->peer.retran_path = t;