From aa6f52584ea1aea170da578328cc35e567a5b0b4 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 25 Nov 2011 20:51:40 +0000 Subject: [PATCH] rx: Remove the unused packet skew code We don't (and haven't, since the release of OpenAFS) use the packet skew calculations for anything. However, maintaining them requires taking locks in some critical parts of the transmission code path. For both speed, and maintainability, reasons remove the skew code from the tree - it's in git if we ever want to go back to it. Change-Id: Idc6dc80fb06ca959ad02a85f2c536a94ca3d5c02 Reviewed-on: http://gerrit.openafs.org/7004 Reviewed-by: Derrick Brashear Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/rx/rx.c | 58 +++++----------------------------------------- src/rx/rx_conn.h | 1 - src/rx/rx_packet.c | 2 -- src/rx/rx_peer.h | 8 ------- 4 files changed, 6 insertions(+), 63 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index f6aa9ff6f..98473d11f 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -3028,8 +3028,6 @@ rxi_FindConnection(osi_socket socket, afs_uint32 host, conn->lastSendTime = clock_Sec(); /* don't GC immediately */ conn->epoch = epoch; conn->cid = cid & RX_CIDMASK; - /* conn->serial = conn->lastSerial = 0; */ - /* conn->timeout = 0; */ conn->ackRate = RX_FAST_ACK_RATE; conn->service = service; conn->serviceId = serviceId; @@ -3170,7 +3168,6 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, int channel; afs_uint32 currentCallNumber; int type; - int skew; #ifdef RXDEBUG char *packetType; #endif @@ -3509,31 +3506,6 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, /* Set remote user defined status from packet */ call->remoteStatus = np->header.userStatus; - /* Note the gap between the expected next packet and the actual - * packet that arrived, when the new packet has a smaller serial number - * than expected. Rioses frequently reorder packets all by themselves, - * so this will be quite important with very large window sizes. - * Skew is checked against 0 here to avoid any dependence on the type of - * inPacketSkew (which may be unsigned). In C, -1 > (unsigned) 0 is always - * true! - * The inPacketSkew should be a smoothed running value, not just a maximum. MTUXXX - * see CalculateRoundTripTime for an example of how to keep smoothed values. - * I think using a beta of 1/8 is probably appropriate. 93.04.21 - */ - MUTEX_ENTER(&conn->conn_data_lock); - skew = conn->lastSerial - np->header.serial; - conn->lastSerial = np->header.serial; - MUTEX_EXIT(&conn->conn_data_lock); - if (skew > 0) { - struct rx_peer *peer; - peer = conn->peer; - if (skew > peer->inPacketSkew) { - dpf(("*** In skew changed from %d to %d\n", - peer->inPacketSkew, skew)); - peer->inPacketSkew = skew; - } - } - /* Now do packet type-specific processing */ switch (np->header.type) { case RX_PACKET_TYPE_DATA: @@ -4231,8 +4203,6 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, afs_uint32 first; afs_uint32 prev; afs_uint32 serial; - /* because there are CM's that are bogus, sending weird values for this. */ - afs_uint32 skew = 0; int nbytes; int missing; int acked; @@ -4254,8 +4224,6 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, first = ntohl(ap->firstPacket); prev = ntohl(ap->previousPacket); serial = ntohl(ap->serial); - /* temporarily disabled -- needs to degrade over time - * skew = ntohs(ap->maxSkew); */ /* Ignore ack packets received out of order */ if (first < call->tfirst || @@ -4303,11 +4271,11 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, size_t len; len = _snprintf(msg, sizeof(msg), - "tid[%d] RACK: reason %s serial %u previous %u seq %u skew %d first %u acks %u space %u ", + "tid[%d] RACK: reason %s serial %u previous %u seq %u first %u acks %u space %u ", GetCurrentThreadId(), rx_ack_reason(ap->reason), ntohl(ap->serial), ntohl(ap->previousPacket), - (unsigned int)np->header.seq, (unsigned int)skew, - ntohl(ap->firstPacket), ap->nAcks, ntohs(ap->bufferSpace) ); + (unsigned int)np->header.seq, ntohl(ap->firstPacket), + ap->nAcks, ntohs(ap->bufferSpace) ); if (nAcks) { int offset; @@ -4321,10 +4289,10 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, #else /* AFS_NT40_ENV */ if (rx_Log) { fprintf(rx_Log, - "RACK: reason %x previous %u seq %u serial %u skew %d first %u", + "RACK: reason %x previous %u seq %u serial %u first %u", ap->reason, ntohl(ap->previousPacket), (unsigned int)np->header.seq, (unsigned int)serial, - (unsigned int)skew, ntohl(ap->firstPacket)); + ntohl(ap->firstPacket)); if (nAcks) { int offset; for (offset = 0; offset < nAcks; offset++) @@ -4355,13 +4323,6 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, } } - /* Update the outgoing packet skew value to the latest value of - * the peer's incoming packet skew value. The ack packet, of - * course, could arrive out of order, but that won't affect things - * much */ - peer->outPacketSkew = skew; - - clock_GetTime(&now); /* The transmit queue splits into 4 sections. @@ -7322,10 +7283,7 @@ rx_PrintPeerStats(FILE * file, struct rx_peer *peer) " Rtt %d, " "total sent %d, " "resent %d\n", peer->rtt, peer->nSent, peer->reSends); - fprintf(file, - " Packet size %d, " "max in packet skew %d, " - "max out packet skew %d\n", peer->ifMTU, (int)peer->inPacketSkew, - (int)peer->outPacketSkew); + fprintf(file, " Packet size %d\n", peer->ifMTU); } #endif @@ -7702,8 +7660,6 @@ rx_GetServerPeers(osi_socket socket, afs_uint32 remoteAddr, peer->timeout.usec = 0; peer->nSent = ntohl(peer->nSent); peer->reSends = ntohl(peer->reSends); - peer->inPacketSkew = ntohl(peer->inPacketSkew); - peer->outPacketSkew = ntohl(peer->outPacketSkew); peer->natMTU = ntohs(peer->natMTU); peer->maxMTU = ntohs(peer->maxMTU); peer->maxDgramPackets = ntohs(peer->maxDgramPackets); @@ -7760,8 +7716,6 @@ rx_GetLocalPeers(afs_uint32 peerHost, afs_uint16 peerPort, peerStats->timeout.usec = 0; peerStats->nSent = tp->nSent; peerStats->reSends = tp->reSends; - peerStats->inPacketSkew = tp->inPacketSkew; - peerStats->outPacketSkew = tp->outPacketSkew; peerStats->natMTU = tp->natMTU; peerStats->maxMTU = tp->maxMTU; peerStats->maxDgramPackets = tp->maxDgramPackets; diff --git a/src/rx/rx_conn.h b/src/rx/rx_conn.h index 82c764226..a54bb34e1 100644 --- a/src/rx/rx_conn.h +++ b/src/rx/rx_conn.h @@ -42,7 +42,6 @@ struct rx_connection { * RX_PACKET_TYPE_BUSY packet for this * call slot, or 0 if the slot is not busy */ afs_uint32 serial; /* Next outgoing packet serial number */ - afs_uint32 lastSerial; /* # of last packet received, for computing skew */ afs_int32 lastPacketSize; /* last >max attempt */ afs_int32 lastPacketSizeSeq; /* seq number of attempt */ afs_int32 lastPingSize; /* last MTU ping attempt */ diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index 20ec21a23..895354160 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -1983,8 +1983,6 @@ rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket, tpeer.rtt_dev = htonl(tp->rtt_dev); tpeer.nSent = htonl(tp->nSent); tpeer.reSends = htonl(tp->reSends); - tpeer.inPacketSkew = htonl(tp->inPacketSkew); - tpeer.outPacketSkew = htonl(tp->outPacketSkew); tpeer.natMTU = htons(tp->natMTU); tpeer.maxMTU = htons(tp->maxMTU); tpeer.maxDgramPackets = htons(tp->maxDgramPackets); diff --git a/src/rx/rx_peer.h b/src/rx/rx_peer.h index 90fe76bba..347361f72 100644 --- a/src/rx/rx_peer.h +++ b/src/rx/rx_peer.h @@ -43,14 +43,6 @@ struct rx_peer { int nSent; /* Total number of distinct data packets sent, not including retransmissions */ int reSends; /* Total number of retransmissions for this peer, since this structure was created */ -/* Skew: if a packet is received N packets later than expected (based - * on packet serial numbers), then we define it to have a skew of N. - * The maximum skew values allow us to decide when a packet hasn't - * been received yet because it is out-of-order, as opposed to when it - * is likely to have been dropped. */ - afs_uint32 inPacketSkew; /* Maximum skew on incoming packets */ - afs_uint32 outPacketSkew; /* Peer-reported max skew on our sent packets */ - /* the "natural" MTU, excluding IP,UDP headers, is negotiated by the endpoints */ u_short natMTU; u_short maxMTU; -- 2.39.5