if (peer->ifMTU < OLD_MAX_PACKET_SIZE)
peer->maxDgramPackets = 1;
/* We no longer have valid peer packet information */
- if (peer->maxPacketSize-RX_IPUDP_SIZE > peer->ifMTU)
+ if (peer->maxPacketSize + RX_HEADER_SIZE > peer->ifMTU)
peer->maxPacketSize = 0;
MUTEX_EXIT(&peer->peer_lock);
* but we are clearly receiving.
*/
if (!peer->maxPacketSize)
- peer->maxPacketSize = RX_MIN_PACKET_SIZE+RX_IPUDP_SIZE;
+ peer->maxPacketSize = RX_MIN_PACKET_SIZE - RX_HEADER_SIZE;
if (pktsize > peer->maxPacketSize) {
peer->maxPacketSize = pktsize;
- if ((pktsize-RX_IPUDP_SIZE > peer->ifMTU)) {
- peer->ifMTU=pktsize-RX_IPUDP_SIZE;
+ if ((pktsize + RX_HEADER_SIZE > peer->ifMTU)) {
+ peer->ifMTU = pktsize + RX_HEADER_SIZE;
peer->natMTU = rxi_AdjustIfMTU(peer->ifMTU);
rxi_ScheduleGrowMTUEvent(call, 1);
}
*/
if (call->conn->peer->maxPacketSize &&
(call->conn->peer->maxPacketSize < OLD_MAX_PACKET_SIZE
- +RX_IPUDP_SIZE))
+ - RX_HEADER_SIZE))
padbytes = call->conn->peer->maxPacketSize+16;
else
padbytes = call->conn->peer->maxMTU + 128;
call->lastReceiveTime) {
int oldMTU = conn->peer->ifMTU;
- /* if we thought we could send more, perhaps things got worse */
- if (conn->peer->maxPacketSize > conn->lastPacketSize)
- /* maxpacketsize will be cleared in rxi_SetPeerMtu */
- newmtu = MAX(conn->peer->maxPacketSize-RX_IPUDP_SIZE,
- conn->lastPacketSize-(128+RX_IPUDP_SIZE));
+ /* If we thought we could send more, perhaps things got worse.
+ * Shrink by 128 bytes and try again. */
+ if (conn->peer->maxPacketSize < conn->lastPacketSize)
+ /* maxPacketSize will be cleared in rxi_SetPeerMtu */
+ newmtu = MAX(conn->peer->maxPacketSize + RX_HEADER_SIZE,
+ conn->lastPacketSize - 128 + RX_HEADER_SIZE);
else
- newmtu = conn->lastPacketSize-(128+RX_IPUDP_SIZE);
+ newmtu = conn->lastPacketSize - 128 + RX_HEADER_SIZE;
/* minimum capped in SetPeerMtu */
rxi_SetPeerMtu(conn->peer, 0, 0, newmtu);
* 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_int32 lastPacketSize; /* last >max attempt */
+ afs_int32 lastPacketSize; /* size of last >max attempt, excludes headers */
afs_int32 lastPacketSizeSeq; /* seq number of attempt */
- afs_int32 lastPingSize; /* last MTU ping attempt */
+ afs_int32 lastPingSize; /* size of last MTU ping attempt, w/o headers */
afs_int32 lastPingSizeSer; /* serial of last MTU ping attempt */
struct rxevent *challengeEvent; /* Scheduled when the server is challenging a */
struct rxevent *delayedAbortEvent; /* Scheduled to throttle looping client */
u_short port; /* Remote UDP port, in net byte order */
/* interface mtu probably used for this host - includes RX Header */
- u_short ifMTU; /* doesn't include IP header */
+ u_short ifMTU; /* doesn't include IP/UDP header */
/* For garbage collection */
afs_uint32 idleWhen; /* When the refcountwent to zero */
int reSends; /* Total number of retransmissions for this peer, since this structure was created */
/* the "natural" MTU, excluding IP,UDP headers, is negotiated by the endpoints */
- u_short natMTU;
+ u_short natMTU; /* includes rx header */
u_short maxMTU;
/* negotiated maximum number of packets to send in a single datagram. */
u_short maxDgramPackets;
afs_uint64 bytesReceived; /* Number of bytes received from this peer */
struct opr_queue rpcStats; /* rpc statistic list */
int lastReachTime; /* Last time we verified reachability */
- afs_int32 maxPacketSize; /* peer packetsize hint */
+ afs_int32 maxPacketSize; /* Max size we sent that got acked (w/o hdrs) */
#ifdef AFS_RXERRQ_ENV
rx_atomic_t neterrs;