]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
rx: Make the rx_call structure private
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 20 Nov 2011 14:58:28 +0000 (14:58 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 4 Dec 2011 04:44:39 +0000 (20:44 -0800)
Hide the rx_call structure for public view. Provide accessors for
those elements which are currently accessed by applications.

Note that this change as it currently stands removes the visibility
of the last sent time, and sequence number information, from the
VolMonitor function.

Change-Id: Ib25ab5635126f893ae43acb684d92a78278d6ca6
Reviewed-on: http://gerrit.openafs.org/6181
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
26 files changed:
src/WINNT/afsd/cm_dcache.c
src/auth/userok.c
src/bozo/bosoprocs.c
src/kauth/kaprocs.c
src/libafs/Makefile.common.in
src/libafsrpc/Makefile.in
src/libafsrpc/NTMakefile
src/libafsrpc/afsrpc.def
src/libuafs/Makefile.common.in
src/ptserver/ptprocs.c
src/rx/Makefile.in
src/rx/NTMakefile
src/rx/rx.c
src/rx/rx.h
src/rx/rx_call.c [new file with mode: 0644]
src/rx/rx_call.h [new file with mode: 0644]
src/rx/rx_event.c
src/rx/rx_packet.c
src/rx/rx_rdwr.c
src/rx/rx_trace.c
src/rxgen/rpc_parse.c
src/shlibafsrpc/Makefile.in
src/shlibafsrpc/libafsrpc.map
src/sys/rmtsyss.c
src/update/server.c
src/volser/volprocs.c

index 0fdee23dc3ac5a9f62cad75f8db5741bcf8cc70f..8b14ba431a104abedf8fc70f1ed2e3e19d7685f4 100644 (file)
@@ -275,7 +275,7 @@ long cm_BufWrite(void *vscp, osi_hyper_t *offsetp, long length, long flags,
                 temp = rx_Writev(rxcallp, tiov, tnio, vbytes);
                 if (temp != vbytes) {
                     osi_Log3(afsd_logp, "rx_Writev failed bp 0x%p, %d != %d", bufp, temp, vbytes);
-                    code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                    code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
                     break;
                 }
 
@@ -1847,7 +1847,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp
                     nbytes_hi = ntohl(nbytes_hi);
                 } else {
                     nbytes_hi = 0;
-                   code = rxcallp->error;
+                   code = rx_Error(rxcallp);
                     code1 = rx_EndCall(rxcallp, code);
                     rxcallp = NULL;
                 }
@@ -1896,7 +1896,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp
                 }
             } else {
                 osi_Log1(afsd_logp, "cm_GetBuffer rx_Read32 returns %d != 4", temp);
-                code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
             }
         }
         /* for the moment, nbytes_hi will always be 0 if code == 0
@@ -1937,7 +1937,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp
                     if (fs_fetchdata_offset_bug && first_read)
                         length_found = 0;
                     else
-                        code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                        code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
                     break;
                 }
 
@@ -2014,7 +2014,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp
                     if (fs_fetchdata_offset_bug && first_read)
                         length_found = 0;
                     else
-                        code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                        code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
                     break;
                 }
                 first_read = 0;
@@ -2303,7 +2303,7 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le
                     nbytes_hi = ntohl(nbytes_hi);
                 } else {
                     nbytes_hi = 0;
-                   code = rxcallp->error;
+                   code = rx_Error(rxcallp);
                     code1 = rx_EndCall(rxcallp, code);
                     rxcallp = NULL;
                 }
@@ -2351,7 +2351,7 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le
                 }
             } else {
                 osi_Log1(afsd_logp, "cm_GetData rx_Read32 returns %d != 4", temp);
-                code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
             }
         }
         /* for the moment, nbytes_hi will always be 0 if code == 0
@@ -2383,7 +2383,7 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le
                     if (fs_fetchdata_offset_bug && first_read)
                         length_found = 0;
                     else
-                        code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                        code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
                     break;
                 }
 
@@ -2430,7 +2430,7 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le
                     if (fs_fetchdata_offset_bug && first_read)
                         length_found = 0;
                     else
-                        code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
+                        code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR;
                     break;
                 }
                 first_read = 0;
index 3630e7cdbdbe5aaab87319e14f478d0380b25780..43a32e295758f9fbb9a9b6bc8cd1d3d5178f69e2 100644 (file)
@@ -697,8 +697,8 @@ rxkadSuperUser(struct afsconf_dir *adir, struct rx_call *acall,
     int code;
 
     /* get auth details from server connection */
-    code = rxkad_GetServerInfo(acall->conn, NULL, &exp, tname, tinst, tcell,
-                              NULL);
+    code = rxkad_GetServerInfo(rx_ConnectionOf(acall), NULL, &exp, tname,
+                              tinst, tcell, NULL);
     if (code)
        return 0;               /* bogus connection/other error */
 
index 2ec18a6f3f674a5850a66210b89420821aba8299..0cd5a7f7938c56b173e97597a3c06b9e6e0d04e3 100644 (file)
@@ -601,7 +601,7 @@ SBOZO_ListKeys(struct rx_call *acall, afs_int32 an, afs_int32 *akvno,
     memset(akeyinfo, 0, sizeof(struct bozo_keyInfo));
 
     noauth = afsconf_GetNoAuthFlag(bozo_confdir);
-    rxkad_GetServerInfo(acall->conn, &enc_level, 0, 0, 0, 0, 0);
+    rxkad_GetServerInfo(rx_ConnectionOf(acall), &enc_level, 0, 0, 0, 0, 0);
     /*
      * only return actual keys in noauth or if this is an encrypted connection
      */
@@ -638,7 +638,7 @@ SBOZO_AddKey(struct rx_call *acall, afs_int32 an, struct bozo_key *akey)
        goto fail;
     }
     noauth = afsconf_GetNoAuthFlag(bozo_confdir);
-    rxkad_GetServerInfo(acall->conn, &enc_level, 0, 0, 0, 0, 0);
+    rxkad_GetServerInfo(rx_ConnectionOf(acall), &enc_level, 0, 0, 0, 0, 0);
     if ((!noauth) && (enc_level != rxkad_crypt)) {
        code = BZENCREQ;
        goto fail;
index 43fb48107661c0cb848a0e24b6f315596ba0c667..71a834d12c34584d9c3ef03d97bce4ed355bfa3c 100644 (file)
@@ -647,8 +647,8 @@ kamCreateUser(struct rx_call *call, char *aname, char *ainstance,
        return code;
     }
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
-         LOG_CRUSER);
+    KALOG(aname, ainstance, NULL, NULL, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_CRUSER);
     return code;
 }
 
@@ -923,8 +923,8 @@ kamSetPassword(struct rx_call *call, char *aname, char *ainstance,
        goto abort;
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
-         LOG_CHPASSWD);
+    KALOG(aname, ainstance, NULL, NULL, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_CHPASSWD);
     return code;
 
   abort:
@@ -1246,15 +1246,15 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance,
     DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen,
                     &user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT);
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, sname, sinst, NULL, rx_PeerOf(call->conn)->host,
-         LOG_AUTHENTICATE);
+    KALOG(aname, ainstance, sname, sinst, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_AUTHENTICATE);
     return code;
 
   abort:
     COUNT_ABO;
     ubik_AbortTrans(tt);
-    KALOG(aname, ainstance, sname, sinst, NULL, rx_PeerOf(call->conn)->host,
-         LOG_AUTHFAILED);
+    KALOG(aname, ainstance, sname, sinst, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_AUTHFAILED);
     return code;
 }
 
@@ -1455,8 +1455,8 @@ kamSetFields(struct rx_call *call,
        goto abort;
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
-         LOG_SETFIELDS);
+    KALOG(aname, ainstance, NULL, NULL, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_SETFIELDS);
     return code;
 
   abort:
@@ -1528,8 +1528,8 @@ kamDeleteUser(struct rx_call *call, char *aname, char *ainstance)
        goto abort;
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
-         LOG_DELUSER);
+    KALOG(aname, ainstance, NULL, NULL, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_DELUSER);
     return code;
 }
 
@@ -1631,7 +1631,7 @@ kamGetEntry(struct rx_call *call,
      * only return user's key if security disabled or if admin and
      * we have an encrypted connection to the user
      */
-    rxkad_GetServerInfo(call->conn, &enc_level, 0, 0, 0, 0, 0);
+    rxkad_GetServerInfo(rx_ConnectionOf(call), &enc_level, 0, 0, 0, 0, 0);
     if ((noAuthenticationRequired)
        || (callerIsAdmin && enc_level == rxkad_crypt))
        memcpy(&aentry->key, &tentry.key, sizeof(struct ktc_encryptionKey));
@@ -1932,7 +1932,7 @@ GetTicket(int version,
                     &schedule, ktc_to_cblockptr(&authSessionKey), ENCRYPT);
     code = ubik_EndTrans(tt);
     KALOG(name, instance, sname, sinstance, (import ? authDomain : NULL),
-         rx_PeerOf(call->conn)->host, LOG_GETTICKET);
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_GETTICKET);
     return code;
 
   abort:
@@ -2258,8 +2258,8 @@ SKAM_Unlock(struct rx_call *call,
     kaux_write(to, 0, 0);      /* zero failure counters at this offset */
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
-         LOG_UNLOCK);
+    KALOG(aname, ainstance, NULL, NULL, NULL,
+         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_UNLOCK);
     goto exit;
 
   abort:
index d91a8f7414557450b4f161b3b16bd2733bd2dbe8..346c70d4724651a2f416d9e58a6c7f11fd9c7db7 100644 (file)
@@ -136,6 +136,7 @@ AFSAOBJS = \
        Kvice.cs.o      \
        fcrypt.o                \
        rx.o            \
+       rx_call.o       \
        rx_conn.o       \
        rx_rdwr.o       \
        rx_clock.o      \
@@ -230,6 +231,7 @@ AFSPAGOBJS = \
        xdr_int32.o     \
        xdr_int64.o     \
        rx.o            \
+       rx_call.o       \
        rx_conn.o       \
        rx_rdwr.o       \
        rx_clock.o      \
@@ -358,6 +360,8 @@ afs_vnop_write.o: $(TOP_SRC_VNOPS)/afs_vnop_write.c
        $(CRULE_NOOPT) $(TOP_SRC_VNOPS)/afs_vnop_write.c
 afs_volume.o: $(TOP_SRC_AFS)/afs_volume.c
        $(CRULE_OPT) $(TOP_SRC_AFS)/afs_volume.c
+rx_call.o: $(TOP_SRC_RX)/rx_call.c
+       $(CRULE_OPT) $(TOP_SRC_RX)/rx_call.c
 rx_conn.o: $(TOP_SRC_RX)/rx_conn.c
        $(CRULE_OPT) $(TOP_SRC_RX)/rx_conn.c
 rx_rdwr.o: $(TOP_SRC_RX)/rx_rdwr.c
index 35f3cc6d447b710425b3c5c90badb8f19ab0f37f..67864f4f192ac16535a1de4bd724028fe621db42 100644 (file)
@@ -63,6 +63,7 @@ RXOBJS =\
        rx.o \
        rx_null.o \
        rx_opaque.o \
+       rx_call.o \
        rx_conn.o \
        rx_conncache.o \
        rx_globals.o \
@@ -145,6 +146,9 @@ rx_conncache.o: ${RX}/rx_conncache.c
 rx_conn.o: ${RX}/rx_conn.c
        $(AFS_CCRULE) $(RX)/rx_conn.c
 
+rx_call.o: ${RX}/rx_call.c
+       $(AFS_CCRULE) $(RX)/rx_call.c
+
 rx_null.o: ${RX}/rx_null.c
        $(AFS_CCRULE) $(RX)/rx_null.c
 
index 311f80f677e62d256396c099cdb144935a52fee7..f567127b07c1d2bf61f1a0e9d7b1afa46f33f1ca 100644 (file)
@@ -38,7 +38,7 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_user.obj $(OUT)\rx_pthread.obj \
         $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \
         $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj $(OUT)\rx_opaque.obj \
         $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \
-         $(OUT)\rx_conn.obj
+         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj
 
 RXSTATBJS = $(OUT)\rxstat.obj $(OUT)\rxstat.ss.obj $(OUT)\rxstat.xdr.obj $(OUT)\rxstat.cs.obj
 
index 91bff88c5136bb76d08d644c42a93414acacd785..45f502e093a7eb42411143bd8d26b555b320b398 100755 (executable)
@@ -319,6 +319,15 @@ EXPORTS
         rx_ServiceOf                            @326
         rx_ConnError                            @327
 
+        rx_ConnectionOf                         @328
+        rx_Error                                @329
+        rx_GetRemoteStatus                      @330
+        rx_SetLocalStatus                       @331
+        rx_GetCallAbortCode                     @332
+        rx_SetCallAbortCode                     @333
+        rx_RecordCallStatistics                 @334
+
+
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
         rx_TSFPQLocalMax                        @2002 DATA
index 6eda73b428ea320d5bd12e987296b2915b86db71..571aaf3e14b6c9ca73588e91cc811f65159b8985 100644 (file)
@@ -201,6 +201,7 @@ UAFSOBJ = \
        $(UOBJ)/rx_stats.o \
        $(UOBJ)/rx_packet.o \
        $(UOBJ)/rx_conncache.o \
+       $(UOBJ)/rx_call.o \
        $(UOBJ)/rx_conn.o \
        $(UOBJ)/xdr_rx.o \
        $(UOBJ)/Kvldbint.cs.o \
@@ -347,6 +348,7 @@ PICUAFSOBJ = \
        $(PICOBJ)/rx_stats.o \
        $(PICOBJ)/rx_packet.o \
        $(PICOBJ)/rx_conncache.o \
+       $(PICOBJ)/rx_call.o \
        $(PICOBJ)/rx_conn.o \
        $(PICOBJ)/xdr_rx.o \
        $(PICOBJ)/Kvldbint.cs.o \
@@ -493,6 +495,7 @@ AFSWEBOBJ = \
        $(WEBOBJ)/rx_stats.o \
        $(WEBOBJ)/rx_packet.o \
        $(WEBOBJ)/rx_conncache.o \
+       $(WEBOBJ)/rx_call.o \
        $(WEBOBJ)/rx_conn.o \
        $(WEBOBJ)/xdr_rx.o \
        $(WEBOBJ)/Kvldbint.cs.o \
@@ -633,6 +636,7 @@ AFSWEBOBJKRB = \
        $(WEBOBJ)/rx_stats.o \
        $(WEBOBJ)/rx_packet.o \
        $(WEBOBJ)/rx_conncache.o \
+       $(WEBOBJ)/rx_call.o \
        $(WEBOBJ)/rx_conn.o \
        $(WEBOBJ)/xdr_rx.o \
        $(WEBOBJ)/Kvldbint.cs.o \
@@ -777,6 +781,7 @@ JUAFSOBJ = \
        $(JUAFS)/rx_stats.o \
        $(JUAFS)/rx_packet.o \
        $(JUAFS)/rx_conncache.o \
+       $(JUAFS)/rx_call.o \
        $(JUAFS)/rx_conn.o \
        $(JUAFS)/xdr_rx.o \
        $(JUAFS)/Kvldbint.cs.o \
@@ -979,6 +984,8 @@ $(UOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULE1)
 $(UOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE1)
+$(UOBJ)/rx_call.o: $(TOP_SRCDIR)/rx/rx_call.c
+       $(CRULE1)
 $(UOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
        $(CRULE1)
 $(UOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
@@ -1278,6 +1285,8 @@ $(PICOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULEPIC)
 $(PICOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULEPIC)
+$(PICOBJ)/rx_call.o: $(TOP_SRCDIR)/rx/rx_call.c
+       $(CRULEPIC)
 $(PICOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
        $(CRULEPIC)
 $(PICOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
@@ -1579,6 +1588,8 @@ $(WEBOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULE2)
 $(WEBOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE2)
+$(WEBOBJ)/rx_call.o: $(TOP_SRCDIR)/rx_rx_call.c
+       $(CRULE2)
 $(WEBOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
        $(CRULE2)
 $(WEBOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
@@ -1884,6 +1895,8 @@ $(JUAFS)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULE1)
 $(JUAFS)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE1)
+$(JUAFS)/rx_call.o: $(TOP_SRC_RX)/rx_call.c
+       $(CRULE1)
 $(JUAFS)/rx_conn.o: $(TOP_SRC_RX)/rx_conn.c
        $(CRULE1)
 $(JUAFS)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
index 35a844d88053051f6fd99fa2dd6cb80feec28ffb..ee0971847bc178d152292d8fcef41f450ca1aa6d 100644 (file)
@@ -2122,7 +2122,7 @@ WhoIsThisWithName(struct rx_call *acall, struct ubik_trans *at, afs_int32 *aid,
     else if (code == 1) {      /* vab class */
        goto done;              /* no longer supported */
     } else if (code == 2) {    /* kad class */
-       if ((code = rxkad_GetServerInfo(acall->conn, NULL, NULL,
+       if ((code = rxkad_GetServerInfo(rx_ConnectionOf(acall), NULL, NULL,
                                        name, inst, tcell, NULL)))
            goto done;
 
index ef783f5a5391aad9a4c6ec3e651ab403097ac842..8a2dc2257787f00bcbd263d8ae76b049ef24423c 100644 (file)
@@ -20,10 +20,10 @@ XDROBJS_common = xdr.o xdr_array.o xdr_rx.o xdr_mem.o xdr_len.o xdr_afsuuid.o
 
 XDROBJS = xdr_arrayn.o ${XDROBJS_common}
 
-RXOBJS_common = rx_clock.o rx_conn.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o \
-       rx_globals.o rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o rx_trace.o \
-       rx_conncache.o rx_opaque.o rx_identity.o rx_stats.o \
-       xdr_int32.o xdr_int64.o xdr_update.o xdr_refernce.o
+RXOBJS_common = rx_clock.o rx_call.o rx_conn.o rx_event.o rx_user.o rx_lwp.o \
+               rx.o rx_null.o rx_globals.o rx_getaddr.o rx_misc.o rx_packet.o \
+               rx_rdwr.o rx_trace.o rx_conncache.o rx_opaque.o rx_identity.o \
+               rx_stats.o xdr_int32.o xdr_int64.o xdr_update.o xdr_refernce.o
 
 RXOBJS = ${RXOBJS_common} 
 
index 4b1f6dbd74f86deba3afbbf6de75f56f881e3167..0e579aa4f65355170f9ac69ab2db2e1105279b11 100644 (file)
@@ -36,7 +36,7 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_clock_nt.obj $(OUT)\rx_user.obj \
         $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \
         $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj \
         $(OUT)\rx_opaque.obj $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \
-         $(OUT)\rx_conn.obj
+         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj
 
 MULTIOBJS = $(OUT)\rx_multi.obj
 
index 735c3de0d4e359795899005dabbe31661a6fde3d..241ec72bf658d3fd495ee969d79f31de3a4c547d 100644 (file)
@@ -81,6 +81,7 @@ extern afs_int32 afs_termState;
 #include "rx_event.h"
 
 #include "rx_conn.h"
+#include "rx_call.h"
 
 #include <afs/rxgen_consts.h>
 
index c0d26100c9a2e3329961b23f27773fc5e7e8d95e..5668ebad98f2d490911a7ce4fdcd125486de7987 100644 (file)
@@ -87,6 +87,63 @@ extern int rx_SecurityClassOf(struct rx_connection *);
 extern struct rx_service *rx_ServiceOf(struct rx_connection *);
 extern int rx_ConnError(struct rx_connection *);
 
+/* Call management */
+extern struct rx_connection *rx_ConnectionOf(struct rx_call *call);
+extern int rx_Error(struct rx_call *call);
+extern int rx_GetRemoteStatus(struct rx_call *call);
+extern void rx_SetLocalStatus(struct rx_call *call, int status);
+extern int rx_GetCallAbortCode(struct rx_call *call);
+extern void rx_SetCallAbortCode(struct rx_call *call, int code);
+
+extern void rx_RecordCallStatistics(struct rx_call *call,
+                                   unsigned int rxInterface,
+                                   unsigned int currentFunc,
+                                   unsigned int totalFunc,
+                                   int isServer);
+
+
+/* Debugging */
+
+/* Call flags, states and modes are exposed by the debug interface */
+#ifndef KDUMP_RX_LOCK
+/* Major call states */
+#define        RX_STATE_NOTINIT  0     /* Call structure has never been initialized */
+#define        RX_STATE_PRECALL  1     /* Server-only:  call is not in progress, but packets have arrived */
+#define        RX_STATE_ACTIVE   2     /* An active call; a process is dealing with this call */
+#define        RX_STATE_DALLY    3     /* Dallying after process is done with call */
+#define        RX_STATE_HOLD     4     /* Waiting for acks on reply data packets */
+#define RX_STATE_RESET    5     /* Call is being reset */
+
+/* Call modes:  the modes of a call in RX_STATE_ACTIVE state (process attached) */
+#define        RX_MODE_SENDING   1     /* Sending or ready to send */
+#define        RX_MODE_RECEIVING 2     /* Receiving or ready to receive */
+#define        RX_MODE_ERROR     3     /* Something in error for current conversation */
+#define        RX_MODE_EOF       4     /* Server has flushed (or client has read) last reply packet */
+
+/* Flags */
+#define        RX_CALL_READER_WAIT        1    /* Reader is waiting for next packet */
+#define        RX_CALL_WAIT_WINDOW_ALLOC  2    /* Sender is waiting for window to allocate buffers */
+#define        RX_CALL_WAIT_WINDOW_SEND   4    /* Sender is waiting for window to send buffers */
+#define        RX_CALL_WAIT_PACKETS       8    /* Sender is waiting for packet buffers */
+#define        RX_CALL_WAIT_PROC         16    /* Waiting for a process to be assigned */
+#define        RX_CALL_RECEIVE_DONE      32    /* All packets received on this call */
+#define        RX_CALL_CLEARED           64    /* Receive queue cleared in precall state */
+#define        RX_CALL_TQ_BUSY          128    /* Call's Xmit Queue is busy; don't modify */
+#define        RX_CALL_TQ_CLEARME       256    /* Need to clear this call's TQ later */
+#define RX_CALL_TQ_SOME_ACKED    512   /* rxi_Start needs to discard ack'd packets. */
+#define RX_CALL_TQ_WAIT                1024    /* Reader is waiting for TQ_BUSY to be reset */
+#define RX_CALL_FAST_RECOVER    2048   /* call is doing congestion recovery */
+/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
+#define RX_CALL_SLOW_START_OK   8192   /* receiver acks every other packet */
+#define RX_CALL_IOVEC_WAIT     16384   /* waiting thread is using an iovec */
+#define RX_CALL_HAVE_LAST      32768   /* Last packet has been received */
+#define RX_CALL_NEED_START     0x10000 /* tells rxi_Start to start again */
+#define RX_CALL_PEER_BUSY      0x20000 /* the last packet we received on this call was a
+                                         * BUSY packet; i.e. the channel for this call is busy */
+#define RX_CALL_ACKALL_SENT     0x40000 /* ACKALL has been sent on the call */
+
+#endif
+
 /* Configurable parameters */
 #define        RX_IDLE_DEAD_TIME       60      /* default idle dead time */
 #define        RX_MAX_SERVICES         20      /* Maximum number of services that may be installed */
@@ -122,13 +179,10 @@ int ntoh_syserr_conv(int error);
 #define        RX_WAIT     1
 #define        RX_DONTWAIT 0
 
-#define        rx_ConnectionOf(call)           ((call)->conn)
 #define        rx_HostOf(peer)                 ((peer)->host)
 #define        rx_PortOf(peer)                 ((peer)->port)
-#define        rx_SetLocalStatus(call, status) ((call)->localStatus = (status))
 #define rx_GetLocalStatus(call, status) ((call)->localStatus)
-#define        rx_GetRemoteStatus(call)        ((call)->remoteStatus)
-#define        rx_Error(call)                  ((call)->error)
+
 
 static_inline int
 rx_IsLoopbackAddr(afs_uint32 addr)
@@ -198,8 +252,7 @@ returned with an error code of RX_CALL_DEAD ( transient error ) */
 #define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
 #define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))
 
-#define rx_GetCallAbortCode(call) ((call)->abortCode)
-#define rx_SetCallAbortCode(call, code) ((call)->abortCode = (code))
+
 
 #define cpspace(call) ((call)->curlen)
 #define cppos(call) ((call)->curpos)
@@ -394,188 +447,7 @@ struct rx_peer {
 /* Maximum number of acknowledgements in an acknowledge packet */
 #define        RX_MAXACKS          255
 
-/* Call structure:  only instantiated for active calls and dallying server calls.  The permanent call state (i.e. the call number as 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
-struct rx_call {
-#endif
-    struct rx_queue queue_item_header; /* Call can be on various queues (one-at-a-time) */
-    struct rx_queue tq;                /* Transmit packet queue */
-    struct rx_queue rq;                /* Receive packet queue */
-    /*
-     * The following fields are accessed while the call is unlocked.
-     * These fields are used by the caller/server thread to marshall
-     * and unmarshall RPC data. The only time they may be changed by
-     * other threads is when the RX_CALL_IOVEC_WAIT flag is set.
-     *
-     * NOTE: Be sure that these fields start and end on a double
-     *       word boundary. Otherwise threads that are changing
-     *       adjacent fields will cause problems.
-     */
-    struct rx_queue iovq;      /* readv/writev packet queue */
-    u_short nLeft;             /* Number bytes left in first receive packet */
-    u_short curvec;            /* current iovec in currentPacket */
-    u_short curlen;            /* bytes remaining in curvec */
-    u_short nFree;             /* Number bytes free in last send packet */
-    struct rx_packet *currentPacket;   /* Current packet being assembled or being read */
-    char *curpos;              /* current position in curvec */
-    /*
-     * End of fields accessed with call unlocked
-     */
-    u_char channel;            /* Index of call, within connection */
-    u_char state;              /* Current call state as defined below */
-    u_char mode;               /* Current mode of a call in ACTIVE state */
-#ifdef RX_ENABLE_LOCKS
-    afs_kmutex_t lock;         /* lock covers data as well as mutexes. */
-    afs_kmutex_t *call_queue_lock;     /* points to lock for queue we're on,
-                                        * if any. */
-    afs_kcondvar_t cv_twind;
-    afs_kcondvar_t cv_rq;
-    afs_kcondvar_t cv_tq;
-#endif
-#ifdef KDUMP_RX_LOCK
-    struct rx_connection_rx_lock *conn;        /* Parent connection for call */
-#else
-    struct rx_connection *conn;        /* Parent connection for this call */
-#endif
-    afs_uint32 *callNumber;    /* Pointer to call number field within connection */
-    afs_uint32 flags;          /* Some random flags */
-    u_char localStatus;                /* Local user status sent out of band */
-    u_char remoteStatus;       /* Remote user status received out of band */
-    afs_int32 error;           /* Error condition for this call */
-    afs_uint32 timeout;                /* High level timeout for this call */
-    afs_uint32 rnext;          /* Next sequence number expected to be read by rx_ReadData */
-    afs_uint32 rprev;          /* Previous packet received; used for deciding what the next packet to be received should be, in order to decide whether a negative acknowledge should be sent */
-    afs_uint32 rwind;          /* The receive window:  the peer must not send packets with sequence numbers >= rnext+rwind */
-    afs_uint32 tfirst;         /* First unacknowledged transmit packet number */
-    afs_uint32 tnext;          /* Next transmit sequence number to use */
-    afs_uint32 tprev;          /* Last packet that we saw an ack for */
-    u_short twind;             /* The transmit window:  we cannot assign a sequence number to a packet >= tfirst + twind */
-    u_short cwind;             /* The congestion window */
-    u_short nSoftAcked;                /* Number soft acked transmit packets */
-    u_short nextCwind;         /* The congestion window after recovery */
-    u_short nCwindAcks;                /* Number acks received at current cwind */
-    u_short ssthresh;          /* The slow start threshold */
-    u_short nDgramPackets;     /* Packets per AFS 3.5 jumbogram */
-    u_short nAcks;             /* The number of consecutive acks */
-    u_short nNacks;            /* Number packets acked that follow the
-                                * first negatively acked packet */
-    u_short nSoftAcks;         /* The number of delayed soft acks */
-    u_short nHardAcks;         /* The number of delayed hard acks */
-    u_short congestSeq;                /* Peer's congestion sequence counter */
-    int rtt;
-    int rtt_dev;
-    struct clock rto;          /* The round trip timeout calculated for this call */
-    struct rxevent *resendEvent;       /* If this is non-Null, there is a retransmission event pending */
-    struct rxevent *timeoutEvent;      /* If this is non-Null, then there is an overall timeout for this call */
-    struct rxevent *keepAliveEvent;    /* Scheduled periodically in active calls to keep call alive */
-    struct rxevent *growMTUEvent;      /* Scheduled periodically in active calls to discover true maximum MTU */
-    struct rxevent *delayedAckEvent;   /* Scheduled after all packets are received to send an ack if a reply or new call is not generated soon */
-    struct clock delayedAckTime;        /* Time that next delayed ack was scheduled  for */
-    struct rxevent *delayedAbortEvent; /* Scheduled to throttle looping client */
-    int abortCode;             /* error code from last RPC */
-    int abortCount;            /* number of times last error was sent */
-    u_int lastSendTime;                /* Last time a packet was sent on this call */
-    u_int lastReceiveTime;     /* Last time a packet was received for this call */
-    u_int lastSendData;                /* Last time a nonping was sent on this call */
-    void (*arrivalProc) (struct rx_call * call, void * mh, int index); /* Procedure to call when reply is received */
-    void *arrivalProcHandle;   /* Handle to pass to replyFunc */
-    int arrivalProcArg;         /* Additional arg to pass to reply Proc */
-    afs_uint32 lastAcked;      /* last packet "hard" acked by receiver */
-    afs_uint32 startWait;      /* time server began waiting for input data/send quota */
-    struct clock traceWait;    /* time server began waiting for input data/send quota */
-    struct clock traceStart;   /* time the call started running */
-    u_short MTU;               /* size of packets currently sending */
-#ifdef RX_ENABLE_LOCKS
-    short refCount;            /* Used to keep calls from disappearring
-                                * when we get them from a queue. (rx_refcnt_lock) */
-#endif                          /* RX_ENABLE_LOCKS */
-/* Call refcount modifiers */
-#define RX_CALL_REFCOUNT_BEGIN  0      /* GetCall/NewCall/EndCall */
-#define RX_CALL_REFCOUNT_RESEND 1      /* resend event */
-#define RX_CALL_REFCOUNT_DELAY  2      /* delayed ack */
-#define RX_CALL_REFCOUNT_ALIVE  3      /* keep alive event */
-#define RX_CALL_REFCOUNT_PACKET 4      /* waiting for packets. */
-#define RX_CALL_REFCOUNT_SEND   5      /* rxi_Send */
-#define RX_CALL_REFCOUNT_ACKALL 6      /* rxi_AckAll */
-#define RX_CALL_REFCOUNT_ABORT  7      /* delayed abort */
-#define RX_CALL_REFCOUNT_MAX    8      /* array size. */
-#ifdef RX_REFCOUNT_CHECK
-    short refCDebug[RX_CALL_REFCOUNT_MAX];
-#endif                         /* RX_REFCOUNT_CHECK */
-
-    /*
-     * iov, iovNBytes, iovMax, and iovNext are set in rxi_ReadvProc()
-     * and adjusted by rxi_FillReadVec().  iov does not own the buffers
-     * it refers to.  The buffers belong to the packets stored in iovq.
-     * Only one call to rx_ReadvProc() can be active at a time.
-     */
-
-    int iovNBytes;             /* byte count for current iovec */
-    int iovMax;                        /* number elements in current iovec */
-    int iovNext;               /* next entry in current iovec */
-    struct iovec *iov;         /* current iovec */
-
-    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 */
-    u_short tqWaiters;
-
-    struct rx_packet *xmitList[RX_MAXACKS]; /* Can't xmit more than we ack */
-                                /* Protected by setting RX_CALL_TQ_BUSY */
-#ifdef RXDEBUG_PACKET
-    u_short tqc;                /* packet count in tq */
-    u_short rqc;                /* packet count in rq */
-    u_short iovqc;              /* packet count in iovq */
-
-#ifdef KDUMP_RX_LOCK
-    struct rx_call_rx_lock *allNextp;
-#else
-    struct rx_call *allNextp;
-#endif
-    afs_uint32 call_id;
-#endif
-};
-
 #ifndef KDUMP_RX_LOCK
-/* Major call states */
-#define        RX_STATE_NOTINIT  0     /* Call structure has never been initialized */
-#define        RX_STATE_PRECALL  1     /* Server-only:  call is not in progress, but packets have arrived */
-#define        RX_STATE_ACTIVE   2     /* An active call; a process is dealing with this call */
-#define        RX_STATE_DALLY    3     /* Dallying after process is done with call */
-#define        RX_STATE_HOLD     4     /* Waiting for acks on reply data packets */
-#define RX_STATE_RESET    5     /* Call is being reset */
-
-/* Call modes:  the modes of a call in RX_STATE_ACTIVE state (process attached) */
-#define        RX_MODE_SENDING   1     /* Sending or ready to send */
-#define        RX_MODE_RECEIVING 2     /* Receiving or ready to receive */
-#define        RX_MODE_ERROR     3     /* Something in error for current conversation */
-#define        RX_MODE_EOF       4     /* Server has flushed (or client has read) last reply packet */
-
-/* Flags */
-#define        RX_CALL_READER_WAIT        1    /* Reader is waiting for next packet */
-#define        RX_CALL_WAIT_WINDOW_ALLOC  2    /* Sender is waiting for window to allocate buffers */
-#define        RX_CALL_WAIT_WINDOW_SEND   4    /* Sender is waiting for window to send buffers */
-#define        RX_CALL_WAIT_PACKETS       8    /* Sender is waiting for packet buffers */
-#define        RX_CALL_WAIT_PROC         16    /* Waiting for a process to be assigned */
-#define        RX_CALL_RECEIVE_DONE      32    /* All packets received on this call */
-#define        RX_CALL_CLEARED           64    /* Receive queue cleared in precall state */
-#define        RX_CALL_TQ_BUSY          128    /* Call's Xmit Queue is busy; don't modify */
-#define        RX_CALL_TQ_CLEARME       256    /* Need to clear this call's TQ later */
-#define RX_CALL_TQ_SOME_ACKED    512   /* rxi_Start needs to discard ack'd packets. */
-#define RX_CALL_TQ_WAIT                1024    /* Reader is waiting for TQ_BUSY to be reset */
-#define RX_CALL_FAST_RECOVER    2048   /* call is doing congestion recovery */
-/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
-#define RX_CALL_SLOW_START_OK   8192   /* receiver acks every other packet */
-#define RX_CALL_IOVEC_WAIT     16384   /* waiting thread is using an iovec */
-#define RX_CALL_HAVE_LAST      32768   /* Last packet has been received */
-#define RX_CALL_NEED_START     0x10000 /* tells rxi_Start to start again */
-#define RX_CALL_PEER_BUSY      0x20000 /* the last packet we received on this call was a
-                                         * BUSY packet; i.e. the channel for this call is busy */
-#define RX_CALL_ACKALL_SENT     0x40000 /* ACKALL has been sent on the call */
-
 
 /* The structure of the data portion of an acknowledge packet: An acknowledge
  * packet is in network byte order at all times.  An acknowledgement is always
@@ -956,46 +828,6 @@ struct rx_debugPeer {
 #define        RX_OTHER_IN     1       /* packets avail in in queue */
 #define        RX_OTHER_OUT    2       /* packets avail in out queue */
 
-
-
-/* Only include this once, even when re-loading for kdump. */
-#ifndef _CALL_REF_DEFINED_
-#define _CALL_REF_DEFINED_
-
-#ifdef RX_ENABLE_LOCKS
-#ifdef RX_REFCOUNT_CHECK
-/* RX_REFCOUNT_CHECK is used to test for call refcount leaks by event
- * type.
- */
-extern int rx_callHoldType;
-#define CALL_HOLD(call, type) do { \
-                                call->refCount++; \
-                                call->refCDebug[type]++; \
-                                if (call->refCDebug[type] > 50)  {\
-                                    rx_callHoldType = type; \
-                                    osi_Panic("Huge call refCount"); \
-                                                              } \
-                            } while (0)
-#define CALL_RELE(call, type) do { \
-                                call->refCount--; \
-                                call->refCDebug[type]--; \
-                                if (call->refCDebug[type] > 50) {\
-                                    rx_callHoldType = type; \
-                                    osi_Panic("Negative call refCount"); \
-                                                             } \
-                            } while (0)
-#else /* RX_REFCOUNT_CHECK */
-#define CALL_HOLD(call, type)   call->refCount++
-#define CALL_RELE(call, type)   call->refCount--
-#endif /* RX_REFCOUNT_CHECK */
-
-#else /* RX_ENABLE_LOCKS */
-#define CALL_HOLD(call, type)
-#define CALL_RELE(call, type)
-#endif /* RX_ENABLE_LOCKS */
-
-#endif /* _CALL_REF_DEFINED_ */
-
 #define RX_SERVER_DEBUG_SEC_STATS              0x1
 #define RX_SERVER_DEBUG_ALL_CONN               0x2
 #define RX_SERVER_DEBUG_RX_STATS               0x4
diff --git a/src/rx/rx_call.c b/src/rx/rx_call.c
new file mode 100644 (file)
index 0000000..2124d85
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * Copyright 2011, Your File System Inc
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <roken.h>
+
+#include "rx.h"
+#include "rx_call.h"
+#include "rx_conn.h"
+
+struct rx_connection *
+rx_ConnectionOf(struct rx_call *call)
+{
+    return call->conn;
+}
+
+int
+rx_Error(struct rx_call *call)
+{
+    return call->error;
+}
+
+int
+rx_GetRemoteStatus(struct rx_call *call)
+{
+    return call->remoteStatus;
+}
+
+void
+rx_SetLocalStatus(struct rx_call *call, int status)
+{
+    call->localStatus = status;
+}
+
+int
+rx_GetCallAbortCode(struct rx_call *call)
+{
+    return call->abortCode;
+}
+
+void
+rx_SetCallAbortCode(struct rx_call *call, int code)
+{
+    call->abortCode = code;
+}
+
+void
+rx_RecordCallStatistics(struct rx_call *call, unsigned int rxInterface,
+                       unsigned int currentFunc, unsigned int totalFunc,
+                       int isServer)
+{
+    struct clock queue;
+    struct clock exec;
+
+    clock_GetTime(&exec);
+    clock_Sub(&exec, &call->startTime);
+    queue = call->startTime;
+    clock_Sub(&queue, &call->queueTime);
+
+    rx_IncrementTimeAndCount(call->conn->peer, rxInterface, currentFunc,
+                            totalFunc, &queue, &exec, &call->bytesSent,
+                            &call->bytesRcvd, 1);
+}
diff --git a/src/rx/rx_call.h b/src/rx/rx_call.h
new file mode 100644 (file)
index 0000000..8bc50b3
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#ifndef OPENAFS_RX_CALL_H
+#define OPENAFS_RX_CALL_H 1
+
+/* Call structure:  only instantiated for active calls and dallying
+ * server calls.  The permanent call state (i.e. the call number as
+ * 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
+struct rx_call {
+#endif
+    struct rx_queue queue_item_header; /* Call can be on various queues (one-at-a-time) */
+    struct rx_queue tq;                /* Transmit packet queue */
+    struct rx_queue rq;                /* Receive packet queue */
+    /*
+     * The following fields are accessed while the call is unlocked.
+     * These fields are used by the caller/server thread to marshall
+     * and unmarshall RPC data. The only time they may be changed by
+     * other threads is when the RX_CALL_IOVEC_WAIT flag is set.
+     *
+     * NOTE: Be sure that these fields start and end on a double
+     *       word boundary. Otherwise threads that are changing
+     *       adjacent fields will cause problems.
+     */
+    struct rx_queue iovq;      /* readv/writev packet queue */
+    u_short nLeft;             /* Number bytes left in first receive packet */
+    u_short curvec;            /* current iovec in currentPacket */
+    u_short curlen;            /* bytes remaining in curvec */
+    u_short nFree;             /* Number bytes free in last send packet */
+    struct rx_packet *currentPacket;   /* Current packet being assembled or being read */
+    char *curpos;              /* current position in curvec */
+    /*
+     * End of fields accessed with call unlocked
+     */
+    u_char channel;            /* Index of call, within connection */
+    u_char state;              /* Current call state as defined below */
+    u_char mode;               /* Current mode of a call in ACTIVE state */
+#ifdef RX_ENABLE_LOCKS
+    afs_kmutex_t lock;         /* lock covers data as well as mutexes. */
+    afs_kmutex_t *call_queue_lock;     /* points to lock for queue we're on,
+                                        * if any. */
+    afs_kcondvar_t cv_twind;
+    afs_kcondvar_t cv_rq;
+    afs_kcondvar_t cv_tq;
+#endif
+#ifdef KDUMP_RX_LOCK
+    struct rx_connection_rx_lock *conn;        /* Parent connection for call */
+#else
+    struct rx_connection *conn;        /* Parent connection for this call */
+#endif
+    afs_uint32 *callNumber;    /* Pointer to call number field within connection */
+    afs_uint32 flags;          /* Some random flags */
+    u_char localStatus;                /* Local user status sent out of band */
+    u_char remoteStatus;       /* Remote user status received out of band */
+    afs_int32 error;           /* Error condition for this call */
+    afs_uint32 timeout;                /* High level timeout for this call */
+    afs_uint32 rnext;          /* Next sequence number expected to be read by rx_ReadData */
+    afs_uint32 rprev;          /* Previous packet received; used for deciding what the next packet to be received should be, in order to decide whether a negative acknowledge should be sent */
+    afs_uint32 rwind;          /* The receive window:  the peer must not send packets with sequence numbers >= rnext+rwind */
+    afs_uint32 tfirst;         /* First unacknowledged transmit packet number */
+    afs_uint32 tnext;          /* Next transmit sequence number to use */
+    afs_uint32 tprev;          /* Last packet that we saw an ack for */
+    u_short twind;             /* The transmit window:  we cannot assign a sequence number to a packet >= tfirst + twind */
+    u_short cwind;             /* The congestion window */
+    u_short nSoftAcked;                /* Number soft acked transmit packets */
+    u_short nextCwind;         /* The congestion window after recovery */
+    u_short nCwindAcks;                /* Number acks received at current cwind */
+    u_short ssthresh;          /* The slow start threshold */
+    u_short nDgramPackets;     /* Packets per AFS 3.5 jumbogram */
+    u_short nAcks;             /* The number of consecutive acks */
+    u_short nNacks;            /* Number packets acked that follow the
+                                * first negatively acked packet */
+    u_short nSoftAcks;         /* The number of delayed soft acks */
+    u_short nHardAcks;         /* The number of delayed hard acks */
+    u_short congestSeq;                /* Peer's congestion sequence counter */
+    int rtt;
+    int rtt_dev;
+    struct clock rto;          /* The round trip timeout calculated for this call */
+    struct rxevent *resendEvent;       /* If this is non-Null, there is a retransmission event pending */
+    struct rxevent *timeoutEvent;      /* If this is non-Null, then there is an overall timeout for this call */
+    struct rxevent *keepAliveEvent;    /* Scheduled periodically in active calls to keep call alive */
+    struct rxevent *growMTUEvent;      /* Scheduled periodically in active calls to discover true maximum MTU */
+    struct rxevent *delayedAckEvent;   /* Scheduled after all packets are received to send an ack if a reply or new call is not generated soon */
+    struct clock delayedAckTime;        /* Time that next delayed ack was scheduled  for */
+    struct rxevent *delayedAbortEvent; /* Scheduled to throttle looping client */
+    int abortCode;             /* error code from last RPC */
+    int abortCount;            /* number of times last error was sent */
+    u_int lastSendTime;                /* Last time a packet was sent on this call */
+    u_int lastReceiveTime;     /* Last time a packet was received for this call */
+    u_int lastSendData;                /* Last time a nonping was sent on this call */
+    void (*arrivalProc) (struct rx_call * call, void * mh, int index); /* Procedure to call when reply is received */
+    void *arrivalProcHandle;   /* Handle to pass to replyFunc */
+    int arrivalProcArg;         /* Additional arg to pass to reply Proc */
+    afs_uint32 lastAcked;      /* last packet "hard" acked by receiver */
+    afs_uint32 startWait;      /* time server began waiting for input data/send quota */
+    struct clock traceWait;    /* time server began waiting for input data/send quota */
+    struct clock traceStart;   /* time the call started running */
+    u_short MTU;               /* size of packets currently sending */
+#ifdef RX_ENABLE_LOCKS
+    short refCount;            /* Used to keep calls from disappearring
+                                * when we get them from a queue. (rx_refcnt_lock) */
+#endif                          /* RX_ENABLE_LOCKS */
+/* Call refcount modifiers */
+#define RX_CALL_REFCOUNT_BEGIN  0      /* GetCall/NewCall/EndCall */
+#define RX_CALL_REFCOUNT_RESEND 1      /* resend event */
+#define RX_CALL_REFCOUNT_DELAY  2      /* delayed ack */
+#define RX_CALL_REFCOUNT_ALIVE  3      /* keep alive event */
+#define RX_CALL_REFCOUNT_PACKET 4      /* waiting for packets. */
+#define RX_CALL_REFCOUNT_SEND   5      /* rxi_Send */
+#define RX_CALL_REFCOUNT_ACKALL 6      /* rxi_AckAll */
+#define RX_CALL_REFCOUNT_ABORT  7      /* delayed abort */
+#define RX_CALL_REFCOUNT_MAX    8      /* array size. */
+#ifdef RX_REFCOUNT_CHECK
+    short refCDebug[RX_CALL_REFCOUNT_MAX];
+#endif                         /* RX_REFCOUNT_CHECK */
+
+    /*
+     * iov, iovNBytes, iovMax, and iovNext are set in rxi_ReadvProc()
+     * and adjusted by rxi_FillReadVec().  iov does not own the buffers
+     * it refers to.  The buffers belong to the packets stored in iovq.
+     * Only one call to rx_ReadvProc() can be active at a time.
+     */
+
+    int iovNBytes;             /* byte count for current iovec */
+    int iovMax;                        /* number elements in current iovec */
+    int iovNext;               /* next entry in current iovec */
+    struct iovec *iov;         /* current iovec */
+
+    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 */
+    u_short tqWaiters;
+
+    struct rx_packet *xmitList[RX_MAXACKS]; /* Can't xmit more than we ack */
+                                /* Protected by setting RX_CALL_TQ_BUSY */
+#ifdef RXDEBUG_PACKET
+    u_short tqc;                /* packet count in tq */
+    u_short rqc;                /* packet count in rq */
+    u_short iovqc;              /* packet count in iovq */
+
+#ifdef KDUMP_RX_LOCK
+    struct rx_call_rx_lock *allNextp;
+#else
+    struct rx_call *allNextp;
+#endif
+    afs_uint32 call_id;
+#endif
+};
+
+/* Only include this once, even when re-loading for kdump. */
+#ifndef _CALL_REF_DEFINED_
+#define _CALL_REF_DEFINED_
+
+#ifdef RX_ENABLE_LOCKS
+#ifdef RX_REFCOUNT_CHECK
+/* RX_REFCOUNT_CHECK is used to test for call refcount leaks by event
+ * type.
+ */
+extern int rx_callHoldType;
+#define CALL_HOLD(call, type) do { \
+                                call->refCount++; \
+                                call->refCDebug[type]++; \
+                                if (call->refCDebug[type] > 50)  {\
+                                    rx_callHoldType = type; \
+                                    osi_Panic("Huge call refCount"); \
+                                                              } \
+                            } while (0)
+#define CALL_RELE(call, type) do { \
+                                call->refCount--; \
+                                call->refCDebug[type]--; \
+                                if (call->refCDebug[type] > 50) {\
+                                    rx_callHoldType = type; \
+                                    osi_Panic("Negative call refCount"); \
+                                                             } \
+                            } while (0)
+#else /* RX_REFCOUNT_CHECK */
+#define CALL_HOLD(call, type)   call->refCount++
+#define CALL_RELE(call, type)   call->refCount--
+#endif /* RX_REFCOUNT_CHECK */
+
+#else /* RX_ENABLE_LOCKS */
+#define CALL_HOLD(call, type)
+#define CALL_RELE(call, type)
+#endif /* RX_ENABLE_LOCKS */
+
+#endif /* _CALL_REF_DEFINED_ */
+
+#endif
index 7f9c3c75c965e06f14e705a1191b1b740adf641c..15f1675ce5066c7abdd03e984b66e1da3dea8536 100644 (file)
@@ -55,6 +55,7 @@
 
 #include "rx.h"
 #include "rx_atomic.h"
+#include "rx_call.h"
 
 struct rxevent {
     struct opr_queue q;
index 4e51d9d3c53b62bcb8398d27ea35c142837426fc..cc33e84f0d4d0d55234dc14a20be1837305014c8 100644 (file)
@@ -67,6 +67,7 @@
 #include "rx_stats.h"
 
 #include "rx_conn.h"
+#include "rx_call.h"
 
 #ifdef RX_LOCKS_DB
 /* rxdb_fileID is used to identify the lock location, along with line#. */
index 367e2b3853fe52eba07d9ec7dd7e8a5ee83ba3fb..d470f74b0622d9fb2bc9a887c43cd1d25a6d796f 100644 (file)
@@ -61,6 +61,7 @@
 #include "rx_globals.h"
 
 #include "rx_conn.h"
+#include "rx_call.h"
 
 #ifdef RX_LOCKS_DB
 /* rxdb_fileID is used to identify the lock location, along with line#. */
index ff6139b6bf4e5f67c07718579fd9da1c381f06fe..dc1e10703a58833f556f0e3c6eb07221d8434a2a 100644 (file)
@@ -30,6 +30,7 @@ main(int argc, char **argv)
 #include "rx_trace.h"
 
 #include "rx_conn.h"
+#include "rx_call.h"
 
 #ifdef RXTRACEON
 char rxi_tracename[80] = "/tmp/rxcalltrace";
index 87c2ce22f7eabb2007e101df2c5ed0d31c7d2215..0ebaefa3f7237488211116856bd4b735ca8996f2 100644 (file)
@@ -1237,12 +1237,6 @@ cs_ProcMarshallInParams_setup(definition * defp, int split_flag)
     if (!(split_flag > 1) || (noofallparams != 0)) {
        f_print(fout, "\tXDR z_xdrs;\n");
     }
-    /*
-     * Print out client side stat gathering call
-     */
-    if (xflag && split_flag != 1) {
-       f_print(fout, "\tstruct clock __QUEUE, __EXEC;\n");
-    }
 
     if ((!split_flag) || (split_flag == 1)) {
        f_print(fout, "\txdrrx_create(&z_xdrs, z_call, XDR_ENCODE);\n");
@@ -1328,39 +1322,18 @@ cs_ProcTail_setup(definition * defp, int split_flag)
     }
     if (xflag && split_flag != 1) {
        f_print(fout, "\tif (rx_enable_stats) {\n");
-       f_print(fout, "\t    clock_GetTime(&__EXEC);\n");
-       f_print(fout, "\t    clock_Sub(&__EXEC, &z_call->startTime);\n");
-       f_print(fout, "\t    __QUEUE = z_call->startTime;\n");
-       f_print(fout, "\t    clock_Sub(&__QUEUE, &z_call->queueTime);\n");
        if (PackageStatIndex[PackageIndex]) {
-           if (!split_flag) {
-               f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_conn), %s,\n",
-                       PackageStatIndex[PackageIndex]);
-           } else {
-               f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn), %s,\n",
-                       PackageStatIndex[PackageIndex]);
-           }
+           f_print(fout,
+                   "\t    rx_RecordCallStatistics(z_call, %s,\n",
+                   PackageStatIndex[PackageIndex]);
        } else {
-           if (!split_flag) {
-               f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_conn),\n"
-                       "\t\t(((afs_uint32)(ntohs(z_conn->serviceId) << 16)) \n"
-                       "\t\t| ((afs_uint32)ntohs(z_conn->peer->port))),\n");
-           } else {
-               f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn),\n"
-                       "\t\t(((afs_uint32)(ntohs(z_call->conn->serviceId) << 16)) |\n"
-                       "\t\t((afs_uint32)ntohs(z_call->conn->peer->port))),\n");
-           }
-       }
-       if (xflag) {
-           f_print(fout, "\t\t%d, %sNO_OF_STAT_FUNCS, &__QUEUE, &__EXEC,\n",
-                   no_of_stat_funcs, PackagePrefix[PackageIndex]);
            f_print(fout,
-                   "\t\t&z_call->bytesSent, &z_call->bytesRcvd, 1);\n");
+                   "\t    rx_RecordCallStatistics(z_call, \n"
+                   "\t\t(((afs_uint32)(ntohs(z_call->conn->serviceId) << 16)) |\n"
+                   "\t\t((afs_uint32)ntohs(z_call->conn->peer->port))),\n");
        }
+       f_print(fout, "\t\t%d, %sNO_OF_STAT_FUNCS, 1);\n",
+               no_of_stat_funcs, PackagePrefix[PackageIndex]);
        f_print(fout, "\t}\n\n");
     }
     f_print(fout, "\treturn z_result;\n}\n\n");
@@ -1400,9 +1373,6 @@ ss_ProcName_setup(definition * defp)
                PackagePrefix[PackageIndex], defp->pc.proc_name);
        f_print(fout, "struct rx_call *z_call, XDR *z_xdrs)\n{\n");
        f_print(fout, "\t" "afs_int32 z_result;\n");
-       if (xflag) {
-           f_print(fout, "\tstruct clock __QUEUE, __EXEC;\n");
-       }
 
        for (plist = defp->pc.plists; plist; plist = plist->next)
            if (plist->component_kind == DEF_PARAM) {
@@ -1733,11 +1703,7 @@ ss_ProcTail_setup(definition * defp, int somefrees)
 
     if (xflag) {
        f_print(fout, "\tif (rx_enable_stats) {\n");
-       f_print(fout, "\t    clock_GetTime(&__EXEC);\n");
-       f_print(fout, "\t    clock_Sub(&__EXEC, &z_call->startTime);\n");
-       f_print(fout, "\t    __QUEUE = z_call->startTime;\n");
-       f_print(fout, "\t    clock_Sub(&__QUEUE, &z_call->queueTime);\n");
-       f_print(fout, "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn),");
+       f_print(fout, "\t    rx_RecordCallStatistics(z_call,");
        if (PackageStatIndex[PackageIndex]) {
            f_print(fout, " %s,\n", PackageStatIndex[PackageIndex]);
        } else {
@@ -1745,9 +1711,8 @@ ss_ProcTail_setup(definition * defp, int somefrees)
                    "\n\t\t(((afs_uint32)(ntohs(z_call->conn->serviceId) << 16)) |\n"
                    "\t\t((afs_uint32)ntohs(z_call->conn->service->servicePort))),\n");
        }
-       f_print(fout, "\t\t%d, %sNO_OF_STAT_FUNCS, &__QUEUE, &__EXEC,\n",
+       f_print(fout, "\t\t%d, %sNO_OF_STAT_FUNCS, 0);\n",
                no_of_stat_funcs, PackagePrefix[PackageIndex]);
-       f_print(fout, "\t\t&z_call->bytesSent, &z_call->bytesRcvd, 0);\n");
        f_print(fout, "\t}\n\n");
     }
 
@@ -1757,12 +1722,8 @@ ss_ProcTail_setup(definition * defp, int somefrees)
 
        if (xflag) {
            f_print(fout, "\tif (rx_enable_stats) {\n");
-           f_print(fout, "\t    clock_GetTime(&__EXEC);\n");
-           f_print(fout, "\t    clock_Sub(&__EXEC, &z_call->startTime);\n");
-           f_print(fout, "\t    __QUEUE = z_call->startTime;\n");
-           f_print(fout, "\t    clock_Sub(&__QUEUE, &z_call->queueTime);\n");
            f_print(fout,
-                   "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn),");
+                   "\t    rx_RecordCallStatistics(z_call,");
            if (PackageStatIndex[PackageIndex]) {
                f_print(fout, " %s,\n", PackageStatIndex[PackageIndex]);
            } else {
@@ -1770,10 +1731,8 @@ ss_ProcTail_setup(definition * defp, int somefrees)
                        "\n\t\t(((afs_uint32)(ntohs(z_call->conn->serviceId) << 16)) |\n"
                        "\t\t((afs_uint32)ntohs(z_call->conn->service->servicePort))),\n");
            }
-           f_print(fout, "\t\t%d, %sNO_OF_STAT_FUNCS, &__QUEUE, &__EXEC,\n",
+           f_print(fout, "\t\t%d, %sNO_OF_STAT_FUNCS, 0);\n",
                    no_of_stat_funcs, PackagePrefix[PackageIndex]);
-           f_print(fout,
-                   "\t\t&z_call->bytesSent, &z_call->bytesRcvd, 0);\n");
            f_print(fout, "\t}\n\n");
        }
 
index 40b13fb75a9f8513e5717051b339fbda89c14fba..8fdb756a06713cc01efa44023229798e15c97773 100644 (file)
@@ -78,7 +78,8 @@ RXOBJS =\
        rx_stats.o \
        rx_trace.o \
        rx_multi.o \
-       rx_conn.o
+       rx_conn.o \
+        rx_call.o
 
 RXSTATOBJS =\
        rxstat.o \
@@ -164,6 +165,9 @@ rx.o: ${RX}/rx.c
 rx_conncache.o: ${RX}/rx_conncache.c
        $(AFS_CCRULE) $(RX)/rx_conncache.c
 
+rx_call.o: ${RX}/rx_call.c
+       $(AFS_CCRULE) $(RX)/rx_call.c
+
 rx_conn.o : ${RX}/rx_conn.c
        $(AFS_CCRULE) $(RX)/rx_conn.c
 
index 4560672df31b356c06253d661b34f1c9492e1036..21680fe84fe52b6fc743c43019b48e2d015e2661 100755 (executable)
        rx_ServiceIdOf;
        rx_SecurityObjectOf;
        rx_ConnError;
+       rx_ConnectionOf;
+       rx_RecordCallStatistics;
     local:
        *;
 };
index ef63a1c6b32e1d0da0ffa353c54f2d484d93897a..ec135e23cf1ddc5ab12ecf613239ada43821b296 100644 (file)
@@ -87,7 +87,7 @@ SRMTSYS_SetPag(struct rx_call *call, clientcred *creds, afs_int32 *newpag,
     afs_int32 error;
 
     *errornumber = 0;
-    SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(call->conn)), creds->uid,
+    SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), creds->uid,
                     creds->group0, creds->group1, PSETPAG, NFS_EXPORTER);
     data.in = (caddr_t) blob;
     data.in_size = sizeof(blob);
@@ -117,7 +117,7 @@ SRMTSYS_Pioctl(struct rx_call *call, clientcred *creds, char *path,
     afs_uint32 blob[PIOCTL_HEADER];
 
     *errornumber = 0;
-    SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(call->conn)), creds->uid,
+    SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), creds->uid,
                     creds->group0, creds->group1, cmd, NFS_EXPORTER);
     data.in =
        (char *)malloc(InData->rmtbulk_len +
index bd0c7c13ebaef5737d4abe3c6b51f0f5dcd2daf7..e91a4706cd5a042dec09c07daeefb12cd75525ef 100644 (file)
@@ -129,7 +129,7 @@ AuthOkay(struct rx_call *call, char *name)
        return 0;
 
     if (rx_SecurityClassOf(rx_ConnectionOf(call)) == 2) {
-       code = rxkad_GetServerInfo(call->conn, &level, 0, 0, 0, 0, 0);
+       code = rxkad_GetServerInfo(rx_ConnectionOf(call), &level, 0, 0, 0, 0, 0);
        if (code)
            return 0;
     } else
index ce14408e2361532ae44815c6b077214170d4fcf6..05c7006fcdc14ff20c0223cd1e820da2a99a582a 100644 (file)
@@ -2831,10 +2831,12 @@ VolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
        pntr->callValid = 0;
        if (tt->rxCallPtr) {    /*record call related info */
            pntr->callValid = 1;
+#if 0
            pntr->readNext = tt->rxCallPtr->rnext;
            pntr->transmitNext = tt->rxCallPtr->tnext;
            pntr->lastSendTime = tt->rxCallPtr->lastSendTime;
            pntr->lastReceiveTime = tt->rxCallPtr->lastReceiveTime;
+#endif
        }
         VTRANS_OBJ_UNLOCK(tt);
        pntr++;