rx: Use native 64bit data counters
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 13 Apr 2012 13:49:59 +0000 (14:49 +0100)
committerDerrick Brashear <shadow@dementix.org>
Tue, 17 Apr 2012 23:21:31 +0000 (16:21 -0700)
Modify the peer, call and rpc_stats structures to use native 64 bit
types for the bytesSent and bytesRcvd data counters. All of our
platforms support native 64bit quantities now, so there's absolutely
no value in rolling our own.

Change-Id: I7c51de73be17821c6472eea535c8476fe0d7a23e
Reviewed-on: http://gerrit.openafs.org/7205
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 files changed:
src/libadmin/adminutil/afs_utilAdmin.c
src/libadmin/samples/rxstat_get_peer.c
src/libadmin/samples/rxstat_get_process.c
src/libadmin/test/client.c
src/rx/rx.c
src/rx/rx.h
src/rx/rx_call.c
src/rx/rx_call.h
src/rx/rx_internal.h
src/rx/rx_packet.c
src/rx/rx_peer.h
src/rx/rx_rdwr.c

index 75c4ccb..e6f577c 100644 (file)
@@ -1205,13 +1205,13 @@ UnmarshallRPCStats(afs_uint32 serverVersion, afs_uint32 ** ptrP,
     s->stats_v1.func_index = *(ptr++);
     hi = *(ptr++);
     lo = *(ptr++);
-    hset64(s->stats_v1.invocations, hi, lo);
+    s->stats_v1.invocations = ((afs_uint64) hi << 32) + lo;
     hi = *(ptr++);
     lo = *(ptr++);
-    hset64(s->stats_v1.bytes_sent, hi, lo);
+    s->stats_v1.bytes_sent = ((afs_uint64) hi << 32) + lo;
     hi = *(ptr++);
     lo = *(ptr++);
-    hset64(s->stats_v1.bytes_rcvd, hi, lo);
+    s->stats_v1.bytes_rcvd = ((afs_uint64) hi << 32) + lo;
     s->stats_v1.queue_time_sum.sec = *(ptr++);
     s->stats_v1.queue_time_sum.usec = *(ptr++);
     s->stats_v1.queue_time_sum_sqr.sec = *(ptr++);
index fb860a0..cc4bd7a 100644 (file)
@@ -221,14 +221,13 @@ main(int argc, char *argv[])
            printf("    %s\n", funcList[index]);
        }
 
-       if (!hiszero(stats.s.stats_v1.invocations)) {
-           printf("\tinvoc (%u.%u) bytes_sent (%u.%u) bytes_rcvd (%u.%u)\n",
-                  hgethi(stats.s.stats_v1.invocations),
-                  hgetlo(stats.s.stats_v1.invocations),
-                  hgethi(stats.s.stats_v1.bytes_sent),
-                  hgetlo(stats.s.stats_v1.bytes_sent),
-                  hgethi(stats.s.stats_v1.bytes_rcvd),
-                  hgetlo(stats.s.stats_v1.bytes_rcvd));
+       if (stats.s.stats_v1.invocations != 0) {
+           printf("\tinvoc %"AFS_UINT64_FMT
+                  " bytes_sent %"AFS_UINT64_FMT
+                  " bytes_rcvd %"AFS_UINT64_FMT"\n",
+                  stats.s.stats_v1.invocations,
+                  stats.s.stats_v1.bytes_sent,
+                  stats.s.stats_v1.bytes_rcvd);
            printf("\tqsum %d.%06d qsqr %d.%06d"
                   " qmin %d.%06d qmax %d.%06d\n",
                   stats.s.stats_v1.queue_time_sum.sec,
index b8bdc30..2e53dac 100644 (file)
@@ -213,14 +213,13 @@ main(int argc, char *argv[])
            printf("    %s\n", funcList[index]);
        }
 
-       if (!hiszero(stats.s.stats_v1.invocations)) {
-           printf("\tinvoc (%u.%u) bytes_sent (%u.%u) bytes_rcvd (%u.%u)\n",
-                  hgethi(stats.s.stats_v1.invocations),
-                  hgetlo(stats.s.stats_v1.invocations),
-                  hgethi(stats.s.stats_v1.bytes_sent),
-                  hgetlo(stats.s.stats_v1.bytes_sent),
-                  hgethi(stats.s.stats_v1.bytes_rcvd),
-                  hgetlo(stats.s.stats_v1.bytes_rcvd));
+       if (stats.s.stats_v1.invocations != 0) {
+           printf("\tinvoc %"AFS_UINT64_FMT
+                  " bytes_sent %"AFS_UINT64_FMT
+                  " bytes_rcvd %"AFS_UINT64_FMT"\n",
+                  stats.s.stats_v1.invocations,
+                  stats.s.stats_v1.bytes_sent,
+                  stats.s.stats_v1.bytes_rcvd);
            printf("\tqsum %d.%06d qsqr %d.%06d"
                   " qmin %d.%06d qmax %d.%06d\n",
                   stats.s.stats_v1.queue_time_sum.sec,
index 86fb30e..58c0be5 100644 (file)
@@ -641,15 +641,15 @@ Print_afs_RPCStats_p(afs_RPCStats_p stat, interface_function_list_p f_list,
               f_list->functionList[stat->s.stats_v1.func_index]);
     }
 
-    if (!hiszero(stat->s.stats_v1.invocations)) {
-       printf("%sinvoc (%u.%u) bytes_sent (%u.%u) bytes_rcvd (%u.%u)\n",
-              prefix, hgethi(stat->s.stats_v1.invocations),
-              hgetlo(stat->s.stats_v1.invocations),
-              hgethi(stat->s.stats_v1.bytes_sent),
-              hgetlo(stat->s.stats_v1.bytes_sent),
-              hgethi(stat->s.stats_v1.bytes_rcvd),
-              hgetlo(stat->s.stats_v1.bytes_rcvd)
-           );
+    if (stat->s.stats_v1.invocations != 0) {
+       printf("%sinvoc %"AFS_UINT64_FMT
+              " bytes_sent %"AFS_UINT64_FMT
+              " bytes_rcvd %"AFS_UINT64_FMT"\n",
+              prefix,
+              stat->s.stats_v1.invocations,
+              stat->s.stats_v1.bytes_sent,
+              stat->s.stats_v1.bytes_rcvd
+             );
        printf("\tqsum %d.%06d\tqsqr %d.%06d"
               "\tqmin %d.%06d\tqmax %d.%06d\n",
               stat->s.stats_v1.queue_time_sum.sec,
index ca563f7..f24fe2f 100644 (file)
@@ -1628,8 +1628,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);
-    hzero(call->bytesSent);
-    hzero(call->bytesRcvd);
+    call->bytesSent = 0;
+    call->bytesRcvd = 0;
 
     /* Turn on busy protocol. */
     rxi_KeepAliveOn(call);
@@ -3200,7 +3200,7 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
 
        if (peer && (peer->refCount > 0)) {
            MUTEX_ENTER(&peer->peer_lock);
-           hadd32(peer->bytesReceived, np->length);
+           peer->bytesReceived += np->length;
            MUTEX_EXIT(&peer->peer_lock);
        }
     }
@@ -3254,7 +3254,7 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
     /* If we're doing statistics, then account for the incoming packet */
     if (rx_stats_active) {
        MUTEX_ENTER(&conn->peer->peer_lock);
-       hadd32(conn->peer->bytesReceived, np->length);
+       conn->peer->bytesReceived += np->length;
        MUTEX_EXIT(&conn->peer->peer_lock);
     }
 
@@ -3335,8 +3335,8 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
 #endif
             call->state = RX_STATE_PRECALL;
             clock_GetTime(&call->queueTime);
-            hzero(call->bytesSent);
-            hzero(call->bytesRcvd);
+            call->bytesSent = 0;
+            call->bytesRcvd = 0;
             /*
              * If the number of queued calls exceeds the overload
              * threshold then abort this call.
@@ -3427,8 +3427,8 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
 #endif
            call->state = RX_STATE_PRECALL;
            clock_GetTime(&call->queueTime);
-           hzero(call->bytesSent);
-           hzero(call->bytesRcvd);
+           call->bytesSent = 0;
+           call->bytesRcvd = 0;
            /*
             * If the number of queued calls exceeds the overload
             * threshold then abort this call.
@@ -7745,10 +7745,11 @@ rx_GetLocalPeers(afs_uint32 peerHost, afs_uint16 peerPort,
                peerStats->cwind = tp->cwind;
                peerStats->nDgramPackets = tp->nDgramPackets;
                peerStats->congestSeq = tp->congestSeq;
-               peerStats->bytesSent.high = tp->bytesSent.high;
-               peerStats->bytesSent.low = tp->bytesSent.low;
-               peerStats->bytesReceived.high = tp->bytesReceived.high;
-               peerStats->bytesReceived.low = tp->bytesReceived.low;
+               peerStats->bytesSent.high = tp->bytesSent >> 32;
+               peerStats->bytesSent.low = tp->bytesSent & MAX_AFS_UINT32;
+               peerStats->bytesReceived.high = tp->bytesReceived >> 32;
+               peerStats->bytesReceived.low
+                               = tp->bytesReceived & MAX_AFS_UINT32;
                 MUTEX_EXIT(&tp->peer_lock);
 
                 MUTEX_ENTER(&rx_peerHashTable_lock);
@@ -8040,49 +8041,57 @@ static int rxi_monitor_processStats = 0;
 
 static int rxi_monitor_peerStats = 0;
 
-/*
- * rxi_AddRpcStat - given all of the information for a particular rpc
+/*!
+ * Given all of the information for a particular rpc
  * call, create (if needed) and update the stat totals for the rpc.
  *
- * PARAMETERS
- *
- * IN stats - the queue of stats that will be updated with the new value
+ * @param stats
+ *     the queue of stats that will be updated with the new value
  *
- * IN rxInterface - a unique number that identifies the rpc interface
+ * @param rxInterface
+ *     a unique number that identifies the rpc interface
  *
- * IN currentFunc - the index of the function being invoked
+ * @param currentFunc
+ *     the index of the function being invoked
  *
- * IN totalFunc - the total number of functions in this interface
+ * @param totalFunc
+ *     the total number of functions in this interface
  *
- * IN queueTime - the amount of time this function waited for a thread
+ * @param queueTime
+ *     the amount of time this function waited for a thread
  *
- * IN execTime - the amount of time this function invocation took to execute
+ * @param execTime
+ *     the amount of time this function invocation took to execute
  *
- * IN bytesSent - the number bytes sent by this invocation
+ * @param bytesSent
+ *     the number bytes sent by this invocation
  *
- * IN bytesRcvd - the number bytes received by this invocation
+ * @param bytesRcvd
+ *     the number bytes received by this invocation
  *
- * IN isServer - if true, this invocation was made to a server
+ * @param isServer
+ *     if true, this invocation was made to a server
  *
- * IN remoteHost - the ip address of the remote host
+ * @param remoteHost
+ *     the ip address of the remote host
  *
- * IN remotePort - the port of the remote host
+ * @param remotePort
+ *     the port of the remote host
  *
- * IN addToPeerList - if != 0, add newly created stat to the global peer list
+ * @param addToPeerList
+ *     if != 0, add newly created stat to the global peer list
  *
- * INOUT counter - if a new stats structure is allocated, the counter will
- * be updated with the new number of allocated stat structures
+ * @param counter
+ *     if a new stats structure is allocated, the counter will
+ *     be updated with the new number of allocated stat structures
  *
- * RETURN CODES
- *
- * Returns void.
  */
 
 static int
 rxi_AddRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
               afs_uint32 currentFunc, afs_uint32 totalFunc,
               struct clock *queueTime, struct clock *execTime,
-              afs_hyper_t * bytesSent, afs_hyper_t * bytesRcvd, int isServer,
+              afs_uint64 bytesSent, afs_uint64 bytesRcvd, int isServer,
               afs_uint32 remoteHost, afs_uint32 remotePort,
               int addToPeerList, unsigned int *counter)
 {
@@ -8127,9 +8136,9 @@ rxi_AddRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
            rpc_stat->stats[i].interfaceId = rxInterface;
            rpc_stat->stats[i].func_total = totalFunc;
            rpc_stat->stats[i].func_index = i;
-           hzero(rpc_stat->stats[i].invocations);
-           hzero(rpc_stat->stats[i].bytes_sent);
-           hzero(rpc_stat->stats[i].bytes_rcvd);
+           rpc_stat->stats[i].invocations = 0;
+           rpc_stat->stats[i].bytes_sent = 0;
+           rpc_stat->stats[i].bytes_rcvd = 0;
            rpc_stat->stats[i].queue_time_sum.sec = 0;
            rpc_stat->stats[i].queue_time_sum.usec = 0;
            rpc_stat->stats[i].queue_time_sum_sqr.sec = 0;
@@ -8157,9 +8166,9 @@ rxi_AddRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
      * Increment the stats for this function
      */
 
-    hadd32(rpc_stat->stats[currentFunc].invocations, 1);
-    hadd(rpc_stat->stats[currentFunc].bytes_sent, *bytesSent);
-    hadd(rpc_stat->stats[currentFunc].bytes_rcvd, *bytesRcvd);
+    rpc_stat->stats[currentFunc].invocations++;
+    rpc_stat->stats[currentFunc].bytes_sent += bytesSent;
+    rpc_stat->stats[currentFunc].bytes_rcvd += bytesRcvd;
     clock_Add(&rpc_stat->stats[currentFunc].queue_time_sum, queueTime);
     clock_AddSq(&rpc_stat->stats[currentFunc].queue_time_sum_sqr, queueTime);
     if (clock_Lt(queueTime, &rpc_stat->stats[currentFunc].queue_time_min)) {
@@ -8182,41 +8191,12 @@ rxi_AddRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
     return rc;
 }
 
-/*
- * rx_IncrementTimeAndCount - increment the times and count for a particular
- * rpc function.
- *
- * PARAMETERS
- *
- * IN peer - the peer who invoked the rpc
- *
- * IN rxInterface - a unique number that identifies the rpc interface
- *
- * IN currentFunc - the index of the function being invoked
- *
- * IN totalFunc - the total number of functions in this interface
- *
- * IN queueTime - the amount of time this function waited for a thread
- *
- * IN execTime - the amount of time this function invocation took to execute
- *
- * IN bytesSent - the number bytes sent by this invocation
- *
- * IN bytesRcvd - the number bytes received by this invocation
- *
- * IN isServer - if true, this invocation was made to a server
- *
- * RETURN CODES
- *
- * Returns void.
- */
-
 void
-rx_IncrementTimeAndCount(struct rx_peer *peer, afs_uint32 rxInterface,
-                        afs_uint32 currentFunc, afs_uint32 totalFunc,
-                        struct clock *queueTime, struct clock *execTime,
-                        afs_hyper_t * bytesSent, afs_hyper_t * bytesRcvd,
-                        int isServer)
+rxi_IncrementTimeAndCount(struct rx_peer *peer, afs_uint32 rxInterface,
+                         afs_uint32 currentFunc, afs_uint32 totalFunc,
+                         struct clock *queueTime, struct clock *execTime,
+                         afs_uint64 bytesSent, afs_uint64 bytesRcvd,
+                         int isServer)
 {
 
     if (!(rxi_monitor_peerStats || rxi_monitor_processStats))
@@ -8239,9 +8219,63 @@ rx_IncrementTimeAndCount(struct rx_peer *peer, afs_uint32 rxInterface,
     }
 
     MUTEX_EXIT(&rx_rpc_stats);
+}
 
+/*!
+ * Increment the times and count for a particular rpc function.
+ *
+ * Traditionally this call was invoked from rxgen stubs. Modern stubs
+ * call rx_RecordCallStatistics instead, so the public version of this
+ * function is left purely for legacy callers.
+ *
+ * @param peer
+ *     The peer who invoked the rpc
+ *
+ * @param rxInterface
+ *     A unique number that identifies the rpc interface
+ *
+ * @param currentFunc
+ *     The index of the function being invoked
+ *
+ * @param totalFunc
+ *     The total number of functions in this interface
+ *
+ * @param queueTime
+ *     The amount of time this function waited for a thread
+ *
+ * @param execTime
+ *     The amount of time this function invocation took to execute
+ *
+ * @param bytesSent
+ *     The number bytes sent by this invocation
+ *
+ * @param bytesRcvd
+ *     The number bytes received by this invocation
+ *
+ * @param isServer
+ *     If true, this invocation was made to a server
+ *
+ */
+void
+rx_IncrementTimeAndCount(struct rx_peer *peer, afs_uint32 rxInterface,
+                        afs_uint32 currentFunc, afs_uint32 totalFunc,
+                        struct clock *queueTime, struct clock *execTime,
+                        afs_hyper_t * bytesSent, afs_hyper_t * bytesRcvd,
+                        int isServer)
+{
+    afs_uint64 sent64;
+    afs_uint64 rcvd64;
+
+    sent64 = ((afs_uint64)bytesSent->high << 32) + bytesSent->low;
+    rcvd64 = ((afs_uint64)bytesRcvd->high << 32) + bytesRcvd->low;
+
+    rxi_IncrementTimeAndCount(peer, rxInterface, currentFunc, totalFunc,
+                             queueTime, execTime, sent64, rcvd64,
+                             isServer);
 }
 
+
+
 /*
  * rx_MarshallProcessRPCStats - marshall an array of rpc statistics
  *
@@ -8276,12 +8310,12 @@ rx_MarshallProcessRPCStats(afs_uint32 callerVersion, int count,
        *(ptr++) = stats->interfaceId;
        *(ptr++) = stats->func_total;
        *(ptr++) = stats->func_index;
-       *(ptr++) = hgethi(stats->invocations);
-       *(ptr++) = hgetlo(stats->invocations);
-       *(ptr++) = hgethi(stats->bytes_sent);
-       *(ptr++) = hgetlo(stats->bytes_sent);
-       *(ptr++) = hgethi(stats->bytes_rcvd);
-       *(ptr++) = hgetlo(stats->bytes_rcvd);
+       *(ptr++) = stats->invocations >> 32;
+       *(ptr++) = stats->invocations & MAX_AFS_UINT32;
+       *(ptr++) = stats->bytes_sent >> 32;
+       *(ptr++) = stats->bytes_sent & MAX_AFS_UINT32;
+       *(ptr++) = stats->bytes_rcvd >> 32;
+       *(ptr++) = stats->bytes_rcvd & MAX_AFS_UINT32;
        *(ptr++) = stats->queue_time_sum.sec;
        *(ptr++) = stats->queue_time_sum.usec;
        *(ptr++) = stats->queue_time_sum_sqr.sec;
@@ -8771,13 +8805,13 @@ rx_clearProcessRPCStats(afs_uint32 clearFlag)
        num_funcs = rpc_stat->stats[0].func_total;
        for (i = 0; i < num_funcs; i++) {
            if (clearFlag & AFS_RX_STATS_CLEAR_INVOCATIONS) {
-               hzero(rpc_stat->stats[i].invocations);
+               rpc_stat->stats[i].invocations = 0;
            }
            if (clearFlag & AFS_RX_STATS_CLEAR_BYTES_SENT) {
-               hzero(rpc_stat->stats[i].bytes_sent);
+               rpc_stat->stats[i].bytes_sent = 0;
            }
            if (clearFlag & AFS_RX_STATS_CLEAR_BYTES_RCVD) {
-               hzero(rpc_stat->stats[i].bytes_rcvd);
+               rpc_stat->stats[i].bytes_rcvd = 0;
            }
            if (clearFlag & AFS_RX_STATS_CLEAR_QUEUE_TIME_SUM) {
                rpc_stat->stats[i].queue_time_sum.sec = 0;
@@ -8857,13 +8891,13 @@ rx_clearPeerRPCStats(afs_uint32 clearFlag)
        num_funcs = rpc_stat->stats[0].func_total;
        for (i = 0; i < num_funcs; i++) {
            if (clearFlag & AFS_RX_STATS_CLEAR_INVOCATIONS) {
-               hzero(rpc_stat->stats[i].invocations);
+               rpc_stat->stats[i].invocations = 0;
            }
            if (clearFlag & AFS_RX_STATS_CLEAR_BYTES_SENT) {
-               hzero(rpc_stat->stats[i].bytes_sent);
+               rpc_stat->stats[i].bytes_sent = 0;
            }
            if (clearFlag & AFS_RX_STATS_CLEAR_BYTES_RCVD) {
-               hzero(rpc_stat->stats[i].bytes_rcvd);
+               rpc_stat->stats[i].bytes_rcvd = 0;
            }
            if (clearFlag & AFS_RX_STATS_CLEAR_QUEUE_TIME_SUM) {
                rpc_stat->stats[i].queue_time_sum.sec = 0;
index 45f40c7..74deffc 100644 (file)
@@ -845,9 +845,9 @@ typedef struct rx_function_entry_v1 {
     afs_uint32 interfaceId;
     afs_uint32 func_total;
     afs_uint32 func_index;
-    afs_hyper_t invocations;
-    afs_hyper_t bytes_sent;
-    afs_hyper_t bytes_rcvd;
+    afs_uint64 invocations;
+    afs_uint64 bytes_sent;
+    afs_uint64 bytes_rcvd;
     struct clock queue_time_sum;
     struct clock queue_time_sum_sqr;
     struct clock queue_time_min;
index 2124d85..0804b81 100644 (file)
@@ -16,6 +16,8 @@
 #include "rx.h"
 #include "rx_call.h"
 #include "rx_conn.h"
+#include "rx_atomic.h"
+#include "rx_internal.h"
 
 struct rx_connection *
 rx_ConnectionOf(struct rx_call *call)
@@ -66,7 +68,7 @@ rx_RecordCallStatistics(struct rx_call *call, unsigned int rxInterface,
     queue = call->startTime;
     clock_Sub(&queue, &call->queueTime);
 
-    rx_IncrementTimeAndCount(call->conn->peer, rxInterface, currentFunc,
-                            totalFunc, &queue, &exec, &call->bytesSent,
-                            &call->bytesRcvd, 1);
+    rxi_IncrementTimeAndCount(call->conn->peer, rxInterface, currentFunc,
+                            totalFunc, &queue, &exec, call->bytesSent,
+                            call->bytesRcvd, 1);
 }
index 08fc1f0..e873eb4 100644 (file)
@@ -139,8 +139,8 @@ struct rx_call {
 
     struct clock queueTime;    /* time call was queued */
     struct clock startTime;    /* time call was started */
-    afs_hyper_t bytesSent;     /* Number bytes sent */
-    afs_hyper_t bytesRcvd;     /* Number bytes received */
+    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 */
index 3ad9bcb..e54d10c 100644 (file)
@@ -33,6 +33,15 @@ extern struct rx_packet *rxi_SendAck(struct rx_call *call,
 extern struct rx_packet *rxi_SendConnectionAbort(struct rx_connection *conn,
                                                 struct rx_packet *packet,
                                                 int istack, int force);
+extern void rxi_IncrementTimeAndCount(struct rx_peer *peer,
+                                     afs_uint32 rxInterface,
+                                     afs_uint32 currentFunc,
+                                     afs_uint32 totalFunc,
+                                     struct clock *queueTime,
+                                     struct clock *execTime,
+                                     afs_uint64 bytesSent,
+                                     afs_uint64 bytesRcvd,
+                                     int isServer);
 
 /* rx_packet.h */
 
index 94e7482..646b963 100644 (file)
@@ -1969,12 +1969,14 @@ rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket,
                        tpeer.cwind = htons(tp->cwind);
                        tpeer.nDgramPackets = htons(tp->nDgramPackets);
                        tpeer.congestSeq = htons(tp->congestSeq);
-                       tpeer.bytesSent.high = htonl(tp->bytesSent.high);
-                       tpeer.bytesSent.low = htonl(tp->bytesSent.low);
+                       tpeer.bytesSent.high =
+                           htonl(tp->bytesSent >> 32);
+                       tpeer.bytesSent.low =
+                           htonl(tp->bytesSent & MAX_AFS_UINT32);
                        tpeer.bytesReceived.high =
-                           htonl(tp->bytesReceived.high);
+                           htonl(tp->bytesReceived >> 32);
                        tpeer.bytesReceived.low =
-                           htonl(tp->bytesReceived.low);
+                           htonl(tp->bytesReceived & MAX_AFS_UINT32);
                         MUTEX_EXIT(&tp->peer_lock);
 
                         MUTEX_ENTER(&rx_peerHashTable_lock);
@@ -2293,7 +2295,7 @@ rxi_SendPacket(struct rx_call *call, struct rx_connection *conn,
     if (rx_stats_active) {
         rx_atomic_inc(&rx_stats.packetsSent[p->header.type - 1]);
         MUTEX_ENTER(&peer->peer_lock);
-        hadd32(peer->bytesSent, p->length);
+        peer->bytesSent += p->length;
         MUTEX_EXIT(&peer->peer_lock);
     }
 }
@@ -2497,7 +2499,7 @@ rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn,
     if (rx_stats_active) {
         rx_atomic_inc(&rx_stats.packetsSent[p->header.type - 1]);
         MUTEX_ENTER(&peer->peer_lock);
-        hadd32(peer->bytesSent, p->length);
+        peer->bytesSent += p->length;
         MUTEX_EXIT(&peer->peer_lock);
     }
 }
index 0331e4c..318cbe8 100644 (file)
@@ -58,8 +58,8 @@ struct rx_peer {
     u_short cwind;             /* congestion window */
     u_short nDgramPackets;     /* number packets per AFS 3.5 jumbogram */
     u_short congestSeq;                /* Changed when a call retransmits */
-    afs_hyper_t bytesSent;     /* Number of bytes sent to this peer */
-    afs_hyper_t bytesReceived; /* Number of bytes received from this peer */
+    afs_uint64 bytesSent;      /* Number of bytes sent to this peer */
+    afs_uint64 bytesReceived;  /* Number of bytes received from this peer */
     struct rx_queue rpcStats;  /* rpc statistic list */
     int lastReachTime;         /* Last time we verified reachability */
     afs_int32 maxPacketSize;    /* peer packetsize hint */
index b95bb6f..344cbcc 100644 (file)
@@ -147,7 +147,7 @@ rxi_GetNextPacket(struct rx_call *call) {
                   call->conn->securityHeaderSize;
 
     call->nLeft = call->currentPacket->length;
-    hadd32(call->bytesRcvd, call->currentPacket->length);
+    call->bytesRcvd += call->currentPacket->length;
 
     call->nHardAcks++;
 
@@ -640,7 +640,7 @@ rxi_WriteProc(struct rx_call *call, char *buf,
                 * there will be others. PrepareSendPacket may
                 * alter the packet length by up to
                 * conn->securityMaxTrailerSize */
-               hadd32(call->bytesSent, call->currentPacket->length);
+               call->bytesSent += call->currentPacket->length;
                rxi_PrepareSendPacket(call, call->currentPacket, 0);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
                 /* PrepareSendPacket drops the call lock */
@@ -1076,7 +1076,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 */
-           hadd32(call->bytesSent, call->currentPacket->length);
+           call->bytesSent += call->currentPacket->length;
            rxi_PrepareSendPacket(call, call->currentPacket, 0);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
             /* PrepareSendPacket drops the call lock */
@@ -1288,7 +1288,7 @@ rxi_FlushWrite(struct rx_call *call)
        }
 
        /* The 1 specifies that this is the last packet */
-       hadd32(call->bytesSent, cp->length);
+       call->bytesSent += cp->length;
        rxi_PrepareSendPacket(call, cp, 1);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
         /* PrepareSendPacket drops the call lock */