Remove support for Solaris pre-8
[openafs.git] / src / rx / rx.c
index 6e50c22..3ce5178 100644 (file)
 #   include "h/socket.h"
 #  endif
 #  include "netinet/in.h"
-#  ifdef AFS_SUN58_ENV
+#  ifdef AFS_SUN5_ENV
 #   include "netinet/ip6.h"
-#  endif
-#  ifdef AFS_SUN57_ENV
 #   include "inet/common.h"
 #   include "inet/ip.h"
 #   include "inet/ip_ire.h"
@@ -4096,23 +4094,8 @@ rxi_ReceiveDataPacket(struct rx_call *call,
      * Send an ack when requested by the peer, or once every
      * rxi_SoftAckRate packets until the last packet has been
      * received. Always send a soft ack for the last packet in
-     * the server's reply.
-     *
-     * If there was more than one packet received for the call
-     * and we have received all of them, immediately send an
-     * RX_PACKET_TYPE_ACKALL packet so that the peer can empty
-     * its packet transmit queue and cancel all resend events.
-     *
-     * When there is only one packet in the call there is a
-     * chance that we can race with Ping ACKs sent as part of
-     * connection establishment if the udp packets are delivered
-     * out of order.  When the race occurs, a two second delay
-     * will occur while waiting for a new Ping ACK to be sent.
-     */
-    if (!isFirst && (call->flags & RX_CALL_RECEIVE_DONE)) {
-        rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
-        rxi_AckAll(NULL, call, 0);
-    } else if (ackNeeded) {
+     * the server's reply. */
+    if (ackNeeded) {
        rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
        np = rxi_SendAck(call, np, serial, ackNeeded, istack);
     } else if (call->nSoftAcks > (u_short) rxi_SoftAckRate) {
@@ -4136,6 +4119,8 @@ rxi_ReceiveDataPacket(struct rx_call *call,
            call->delayedAckEvent =
                rxevent_PostNow(&when, &now, rxi_SendDelayedAck, call, 0);
        }
+    } else if (call->flags & RX_CALL_RECEIVE_DONE) {
+       rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
     }
 
     return np;
@@ -4630,7 +4615,7 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np,
        rxi_rto_packet_acked(call, istack);
 
     if (call->flags & RX_CALL_FAST_RECOVER) {
-       if (nNacked) {
+       if (newAckCount == 0) {
            call->cwind = MIN((int)(call->cwind + 1), rx_maxSendWindow);
        } else {
            call->flags &= ~RX_CALL_FAST_RECOVER;
@@ -4641,17 +4626,6 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np,
        call->nCwindAcks = 0;
     } else if (nNacked && call->nNacks >= (u_short) rx_nackThreshold) {
        /* Three negative acks in a row trigger congestion recovery */
-#ifdef  AFS_GLOBAL_RXLOCK_KERNEL
-       MUTEX_EXIT(&peer->peer_lock);
-       if (call->flags & RX_CALL_FAST_RECOVER_WAIT) {
-           /* someone else is waiting to start recovery */
-           return np;
-       }
-       call->flags |= RX_CALL_FAST_RECOVER_WAIT;
-       rxi_WaitforTQBusy(call);
-       MUTEX_ENTER(&peer->peer_lock);
-#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
-       call->flags &= ~RX_CALL_FAST_RECOVER_WAIT;
        call->flags |= RX_CALL_FAST_RECOVER;
        call->ssthresh = MAX(4, MIN((int)call->cwind, (int)call->twind)) >> 1;
        call->cwind =
@@ -5818,6 +5792,7 @@ rxi_SendXmitList(struct rx_call *call, struct rx_packet **list, int len,
                 int istack)
 {
     int i;
+    int recovery;
     struct xmitlist working;
     struct xmitlist last;
 
@@ -5829,6 +5804,8 @@ rxi_SendXmitList(struct rx_call *call, struct rx_packet **list, int len,
     working.len = 0;
     working.resending = 0;
 
+    recovery = call->flags & RX_CALL_FAST_RECOVER;
+
     for (i = 0; i < len; i++) {
        /* Does the current packet force us to flush the current list? */
        if (working.len > 0
@@ -5842,7 +5819,8 @@ rxi_SendXmitList(struct rx_call *call, struct rx_packet **list, int len,
                rxi_SendList(call, &last, istack, 1);
                /* If the call enters an error state stop sending, or if
                 * we entered congestion recovery mode, stop sending */
-               if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
+               if (call->error
+                   || (!recovery && (call->flags & RX_CALL_FAST_RECOVER)))
                    return;
            }
            last = working;
@@ -5869,7 +5847,7 @@ rxi_SendXmitList(struct rx_call *call, struct rx_packet **list, int len,
                    /* If the call enters an error state stop sending, or if
                     * we entered congestion recovery mode, stop sending */
                    if (call->error
-                       || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
+                       || (!recovery && (call->flags & RX_CALL_FAST_RECOVER)))
                        return;
                }
                last = working;
@@ -5902,7 +5880,8 @@ rxi_SendXmitList(struct rx_call *call, struct rx_packet **list, int len,
            rxi_SendList(call, &last, istack, morePackets);
            /* If the call enters an error state stop sending, or if
             * we entered congestion recovery mode, stop sending */
-           if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
+           if (call->error
+               || (!recovery && (call->flags & RX_CALL_FAST_RECOVER)))
                return;
        }
        if (morePackets) {
@@ -5947,18 +5926,6 @@ rxi_Resend(struct rxevent *event, void *arg0, void *arg1, int istack)
        goto out;
     }
 
-#ifdef AFS_GLOBAL_RXLOCK_KERNEL
-    if (call->flags & RX_CALL_FAST_RECOVER_WAIT) {
-       /* Someone else is waiting to start recovery */
-       goto out;
-    }
-    call->flags |= RX_CALL_FAST_RECOVER_WAIT;
-    rxi_WaitforTQBusy(call);
-    call->flags &= ~RX_CALL_FAST_RECOVER_WAIT;
-    if (call->error)
-       goto out;
-#endif
-
     /* We're in loss recovery */
     call->flags |= RX_CALL_FAST_RECOVER;
 
@@ -6054,20 +6021,6 @@ rxi_Start(struct rx_call *call, int istack)
                nXmitPackets = 0;
                maxXmitPackets = MIN(call->twind, call->cwind);
                for (queue_Scan(&call->tq, p, nxp, rx_packet)) {
-                   if (call->flags & RX_CALL_FAST_RECOVER_WAIT) {
-                       /* We shouldn't be sending packets if a thread is waiting
-                        * to initiate congestion recovery */
-                       dpf(("call %d waiting to initiate fast recovery\n",
-                            *(call->callNumber)));
-                       break;
-                   }
-                   if ((nXmitPackets)
-                       && (call->flags & RX_CALL_FAST_RECOVER)) {
-                       /* Only send one packet during fast recovery */
-                       dpf(("call %d restricted to one packet per send during fast recovery\n",
-                            *(call->callNumber)));
-                       break;
-                   }
 #ifdef RX_TRACK_PACKETS
                    if ((p->flags & RX_PKTFLAG_FREE)
                        || (!queue_IsEnd(&call->tq, nxp)
@@ -6123,15 +6076,6 @@ rxi_Start(struct rx_call *call, int istack)
                }
 
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
-               /*
-                * TQ references no longer protected by this flag; they must remain
-                * protected by the global lock.
-                */
-               if (call->flags & RX_CALL_FAST_RECOVER_WAIT) {
-                   call->flags &= ~RX_CALL_TQ_BUSY;
-                   rxi_WakeUpTransmitQueue(call);
-                   return;
-               }
                if (call->error) {
                    /* We went into the error state while sending packets. Now is
                     * the time to reset the call. This will also inform the using
@@ -6278,7 +6222,7 @@ rxi_CheckCall(struct rx_call *call)
     if (now > (call->lastReceiveTime + deadTime)) {
        if (call->state == RX_STATE_ACTIVE) {
 #ifdef ADAPT_PMTU
-#if defined(KERNEL) && defined(AFS_SUN57_ENV)
+#if defined(KERNEL) && defined(AFS_SUN5_ENV)
            ire_t *ire;
 #if defined(AFS_SUN510_ENV) && defined(GLOBAL_NETSTACKID)
            netstack_t *ns =  netstack_find_by_stackid(GLOBAL_NETSTACKID);