disable Rx packet tracking
[openafs.git] / src / rx / rx_globals.h
index 40a477d..e5208d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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
@@ -107,7 +107,7 @@ void  rx_SetUdpBufSize(int x);
 /*
  * Variables to control RX overload management. When the number of calls
  * waiting for a thread exceed the threshold, new calls are aborted
- * with the busy error. 
+ * with the busy error.
  */
 EXT int rx_BusyThreshold GLOBALSINIT(-1);      /* default is disabled */
 EXT int rx_BusyError GLOBALSINIT(-1);
@@ -121,7 +121,7 @@ EXT int rx_BusyError GLOBALSINIT(-1);
 #define        RX_REAP_TIME    60      /* Check for tossable connections every 60 seconds */
 #endif
 
-#define RX_FAST_ACK_RATE 1     /* as of 3.4, ask for an ack every 
+#define RX_FAST_ACK_RATE 1     /* as of 3.4, ask for an ack every
                                 * other packet. */
 
 EXT int rx_minPeerTimeout GLOBALSINIT(350); /* in milliseconds */
@@ -174,7 +174,7 @@ typedef struct rx_ts_info_t {
         struct rx_queue queue;
         int len;                /* local queue length */
         int delta;              /* number of new packets alloc'd locally since last sync w/ global queue */
-        
+
         /* FPQ stats */
         int checkin_ops;
         int checkin_xfer;
@@ -207,6 +207,7 @@ EXT struct rx_ts_info_t * rx_ts_info_init(void);   /* init function for thread-s
  * in which the first tier is thread-specific, and the second tier is
  * a global free packet queue */
 EXT struct rx_queue rx_freePacketQueue;
+#ifdef RX_TRACK_PACKETS
 #define RX_FPQ_MARK_FREE(p) \
     do { \
         if ((p)->flags & RX_PKTFLAG_FREE) \
@@ -223,6 +224,18 @@ EXT struct rx_queue rx_freePacketQueue;
         (p)->flags = 0;                /* clear RX_PKTFLAG_FREE, initialize the rest */ \
         (p)->header.flags = 0; \
     } while(0)
+#else
+#define RX_FPQ_MARK_FREE(p) \
+    do { \
+        (p)->length = 0; \
+        (p)->niovecs = 0; \
+    } while(0)
+#define RX_FPQ_MARK_USED(p) \
+    do { \
+        (p)->flags = 0;                /* clear RX_PKTFLAG_FREE, initialize the rest */ \
+        (p)->header.flags = 0; \
+    } while(0)
+#endif
 #define RX_PACKET_IOV_INIT(p) \
     do { \
        (p)->wirevec[0].iov_base = (char *)((p)->wirehead); \
@@ -262,7 +275,7 @@ EXT void rxi_FlushLocalPacketsTSFPQ(void); /* flush all thread-local packets to
  * also set minimum values of 15 and 3.  Given the algorithms, the number of buffers allocated
  * by each call to AllocPacketBufs() will increase indefinitely without a cap on the transfer
  * glob size.  A cap of 64 is selected because that will produce an allocation of greater than
- * three times that amount which is greater than half of ncalls * maxReceiveWindow. 
+ * three times that amount which is greater than half of ncalls * maxReceiveWindow.
  * Must be called under rx_packets_mutex.
  */
 #define RX_TS_FPQ_COMPUTE_LIMITS \
@@ -275,14 +288,14 @@ EXT void rxi_FlushLocalPacketsTSFPQ(void); /* flush all thread-local packets to
         rx_TSFPQLocalMax = newmax; \
         rx_TSFPQGlobSize = newglob; \
     } while(0)
-/* record the number of packets allocated by this thread 
+/* record the number of packets allocated by this thread
  * and stored in the thread local queue */
 #define RX_TS_FPQ_LOCAL_ALLOC(rx_ts_info_p,num_alloc) \
     do { \
         (rx_ts_info_p)->_FPQ.lalloc_ops++; \
         (rx_ts_info_p)->_FPQ.lalloc_xfer += num_alloc; \
     } while (0)
-/* record the number of packets allocated by this thread 
+/* record the number of packets allocated by this thread
  * and stored in the global queue */
 #define RX_TS_FPQ_GLOBAL_ALLOC(rx_ts_info_p,num_alloc) \
     do { \
@@ -400,8 +413,8 @@ EXT void rxi_FlushLocalPacketsTSFPQ(void); /* flush all thread-local packets to
         (rx_ts_info_p)->_FPQ.checkin_xfer++; \
     } while(0)
 /* check multiple packets into the thread-specific free packet queue */
-/* num_transfer must equal length of (q); it is not a means of checking 
- * in part of (q).  passing num_transfer just saves us instructions 
+/* num_transfer must equal length of (q); it is not a means of checking
+ * in part of (q).  passing num_transfer just saves us instructions
  * since caller already knows length of (q) for other reasons */
 #define RX_TS_FPQ_QCHECKIN(rx_ts_info_p,num_transfer,q) \
     do { \
@@ -536,19 +549,11 @@ EXT afs_kmutex_t rx_connHashTable_lock;
 #define rxi_AllocSecurityObject() (struct rx_securityClass *) rxi_Alloc(sizeof(struct rx_securityClass))
 #define        rxi_FreeSecurityObject(obj) rxi_Free(obj, sizeof(struct rx_securityClass))
 #define        rxi_AllocService()      (struct rx_service *) rxi_Alloc(sizeof(struct rx_service))
-#ifdef AFS_PTHREAD_ENV
-#define        rxi_FreeService(obj) \
-do { \
-    assert(MUTEX_DESTROY(&(obj)->svc_data_lock)==0); \
-    rxi_Free((obj), sizeof(struct rx_service)); \
-} while (0)
-#else
 #define        rxi_FreeService(obj) \
 do { \
     MUTEX_DESTROY(&(obj)->svc_data_lock);  \
     rxi_Free((obj), sizeof(struct rx_service)); \
 } while (0)
-#endif
 #define        rxi_AllocPeer()         (struct rx_peer *) rxi_Alloc(sizeof(struct rx_peer))
 #define        rxi_FreePeer(peer)      rxi_Free(peer, sizeof(struct rx_peer))
 #define        rxi_AllocConnection()   (struct rx_connection *) rxi_Alloc(sizeof(struct rx_connection))
@@ -573,7 +578,7 @@ EXT int rxdebug_active;
 #define dpf(args) FSLog args
 #else
 #define dpf(args) do { if (rx_debugFile) rxi_DebugPrint args; } while (0)
-#endif 
+#endif
 #endif
 #define rx_Log_event rxevent_debugFile
 
@@ -614,7 +619,7 @@ EXT int rxi_callAbortDelay GLOBALSINIT(3000);
 #if defined(AFS_PTHREAD_ENV)
 EXT int rxi_fcfs_thread_num GLOBALSINIT(0);
 EXT pthread_key_t rx_thread_id_key;
-/* keep track of pthread numbers - protected by rx_stats_mutex, 
+/* keep track of pthread numbers - protected by rx_stats_mutex,
  * except in rx_Init() before mutex exists! */
 EXT int rxi_pthread_hinum GLOBALSINIT(0);
 #else