From c00c0effd18dd508051ebc4c7c8983b800f8a973 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 23 Oct 2012 19:21:09 +0100 Subject: [PATCH] rx: Move bytesSent + bytesRcvd into app only data The call->bytesSent and call->bytesRcvd counters are only manipulated by the application thread in running calls. Move them into the app-only section of the call structure so this is clear. Change-Id: Ib7929a8e34bcb70c8cb9c1f89544adce0d627299 Reviewed-on: http://gerrit.openafs.org/8288 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- src/rx/rx.c | 12 ++++++------ src/rx/rx_call.c | 4 ++-- src/rx/rx_call.h | 6 +++--- src/rx/rx_rdwr.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index adc19c8..e984eac 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -1649,8 +1649,8 @@ rx_NewCall(struct rx_connection *conn) /* remember start time for call in case we have hard dead time limit */ call->queueTime = queueTime; clock_GetTime(&call->startTime); - call->bytesSent = 0; - call->bytesRcvd = 0; + call->app.bytesSent = 0; + call->app.bytesRcvd = 0; /* Turn on busy protocol. */ rxi_KeepAliveOn(call); @@ -3429,8 +3429,8 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, #endif call->state = RX_STATE_PRECALL; clock_GetTime(&call->queueTime); - call->bytesSent = 0; - call->bytesRcvd = 0; + call->app.bytesSent = 0; + call->app.bytesRcvd = 0; /* * If the number of queued calls exceeds the overload * threshold then abort this call. @@ -3521,8 +3521,8 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, #endif call->state = RX_STATE_PRECALL; clock_GetTime(&call->queueTime); - call->bytesSent = 0; - call->bytesRcvd = 0; + call->app.bytesSent = 0; + call->app.bytesRcvd = 0; /* * If the number of queued calls exceeds the overload * threshold then abort this call. diff --git a/src/rx/rx_call.c b/src/rx/rx_call.c index 0804b81..43d6034 100644 --- a/src/rx/rx_call.c +++ b/src/rx/rx_call.c @@ -69,6 +69,6 @@ rx_RecordCallStatistics(struct rx_call *call, unsigned int rxInterface, clock_Sub(&queue, &call->queueTime); rxi_IncrementTimeAndCount(call->conn->peer, rxInterface, currentFunc, - totalFunc, &queue, &exec, call->bytesSent, - call->bytesRcvd, 1); + totalFunc, &queue, &exec, call->app.bytesSent, + call->app.bytesRcvd, 1); } diff --git a/src/rx/rx_call.h b/src/rx/rx_call.h index 7179c1e..66ed5d1 100644 --- a/src/rx/rx_call.h +++ b/src/rx/rx_call.h @@ -30,6 +30,8 @@ struct rx_call_appl { char *curpos; /* current position in curvec */ int mode; /* Mode of call */ int padding; /* Pad to double word */ + afs_uint64 bytesSent; /* Number bytes sent */ + afs_uint64 bytesRcvd; /* Number bytes received */ }; /* Call structure: only instantiated for active calls and dallying @@ -37,7 +39,6 @@ struct rx_call_appl { * well as state shared with other calls associated with this * connection) is maintained in the connection structure. */ - #ifdef KDUMP_RX_LOCK struct rx_call_rx_lock { #else @@ -142,8 +143,7 @@ struct rx_call { struct clock queueTime; /* time call was queued */ struct clock startTime; /* time call was started */ - afs_uint64 bytesSent; /* Number bytes sent */ - afs_uint64 bytesRcvd; /* Number bytes received */ + u_short tqWaiters; struct rx_packet *xmitList[RX_MAXACKS]; /* Can't xmit more than we ack */ diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 98c0c85..c0a5116 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -147,7 +147,7 @@ rxi_GetNextPacket(struct rx_call *call) { call->conn->securityHeaderSize; call->app.nLeft = call->app.currentPacket->length; - call->bytesRcvd += call->app.currentPacket->length; + call->app.bytesRcvd += call->app.currentPacket->length; call->nHardAcks++; @@ -642,7 +642,7 @@ rxi_WriteProc(struct rx_call *call, char *buf, * there will be others. PrepareSendPacket may * alter the packet length by up to * conn->securityMaxTrailerSize */ - call->bytesSent += call->app.currentPacket->length; + call->app.bytesSent += call->app.currentPacket->length; rxi_PrepareSendPacket(call, call->app.currentPacket, 0); #ifdef AFS_GLOBAL_RXLOCK_KERNEL /* PrepareSendPacket drops the call lock */ @@ -1080,7 +1080,7 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes) * there will be others. PrepareSendPacket may * alter the packet length by up to * conn->securityMaxTrailerSize */ - call->bytesSent += call->app.currentPacket->length; + call->app.bytesSent += call->app.currentPacket->length; rxi_PrepareSendPacket(call, call->app.currentPacket, 0); #ifdef AFS_GLOBAL_RXLOCK_KERNEL /* PrepareSendPacket drops the call lock */ @@ -1297,7 +1297,7 @@ rxi_FlushWrite(struct rx_call *call) } /* The 1 specifies that this is the last packet */ - call->bytesSent += cp->length; + call->app.bytesSent += cp->length; rxi_PrepareSendPacket(call, cp, 1); #ifdef AFS_GLOBAL_RXLOCK_KERNEL /* PrepareSendPacket drops the call lock */ -- 1.9.4