summaryrefslogtreecommitdiff
path: root/usr.sbin/afs
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2003-08-05 09:11:13 +0000
committerHans Insulander <hin@cvs.openbsd.org>2003-08-05 09:11:13 +0000
commit5257d723bfe2effb2d10613847e00ff9f325cd8c (patch)
treed7651baf75ed93056f7774bffc0ebdd90986e409 /usr.sbin/afs
parent6eab1886b7bf5c162ad17ee95d12d9e9458bf9c0 (diff)
Merge
Diffstat (limited to 'usr.sbin/afs')
-rw-r--r--usr.sbin/afs/src/rx/rx.c591
-rw-r--r--usr.sbin/afs/src/rx/rx.h285
-rw-r--r--usr.sbin/afs/src/rx/rx_clock.c2
-rw-r--r--usr.sbin/afs/src/rx/rx_clock.h15
-rw-r--r--usr.sbin/afs/src/rx/rx_event.c10
-rw-r--r--usr.sbin/afs/src/rx/rx_event.h2
-rw-r--r--usr.sbin/afs/src/rx/rx_globs.c2
-rw-r--r--usr.sbin/afs/src/rx/rx_globs.h105
-rw-r--r--usr.sbin/afs/src/rx/rx_kern.h4
-rw-r--r--usr.sbin/afs/src/rx/rx_locl.h6
-rw-r--r--usr.sbin/afs/src/rx/rx_mach.h18
-rw-r--r--usr.sbin/afs/src/rx/rx_misc.c48
-rw-r--r--usr.sbin/afs/src/rx/rx_misc.h6
-rw-r--r--usr.sbin/afs/src/rx/rx_multi.c2
-rw-r--r--usr.sbin/afs/src/rx/rx_multi.h10
-rw-r--r--usr.sbin/afs/src/rx/rx_null.c2
-rw-r--r--usr.sbin/afs/src/rx/rx_null.h4
-rw-r--r--usr.sbin/afs/src/rx/rx_pkt.c56
-rw-r--r--usr.sbin/afs/src/rx/rx_pkt.h44
-rw-r--r--usr.sbin/afs/src/rx/rx_queue.h4
-rw-r--r--usr.sbin/afs/src/rx/rx_rdwr.c101
-rw-r--r--usr.sbin/afs/src/rx/rx_strm.h4
-rw-r--r--usr.sbin/afs/src/rx/rx_trace.c89
-rw-r--r--usr.sbin/afs/src/rx/rx_trace.h35
-rw-r--r--usr.sbin/afs/src/rx/rx_user.c153
-rw-r--r--usr.sbin/afs/src/rx/rx_user.h43
-rw-r--r--usr.sbin/afs/src/rx/rxdebug.148
-rw-r--r--usr.sbin/afs/src/rx/rxdebug.c128
-rw-r--r--usr.sbin/afs/src/rx/rxgencon.h2
-rw-r--r--usr.sbin/afs/src/rx/rxperf.c762
-rw-r--r--usr.sbin/afs/src/rx/test_rx_clock.c2
31 files changed, 1646 insertions, 937 deletions
diff --git a/usr.sbin/afs/src/rx/rx.c b/usr.sbin/afs/src/rx/rx.c
index 654120ee9a4..01ce8fd0df9 100644
--- a/usr.sbin/afs/src/rx/rx.c
+++ b/usr.sbin/afs/src/rx/rx.c
@@ -24,7 +24,7 @@
#include <assert.h>
#include "rx_locl.h"
-RCSID("$KTH: rx.c,v 1.20 2001/01/07 16:42:43 lha Exp $");
+RCSID("$arla: rx.c,v 1.34 2003/04/08 22:14:29 lha Exp $");
/*
* quota system: each attached server process must be able to make
@@ -78,7 +78,7 @@ struct rx_packet *rx_allocedP = 0;
*/
void
-rx_SetEpoch(u_long epoch)
+rx_SetEpoch(uint32_t epoch)
{
rx_epoch = epoch;
}
@@ -94,10 +94,11 @@ rx_SetEpoch(u_long epoch)
static int rxinit_status = 1;
int
-rx_Init(u_short port)
+rx_Init(uint16_t port)
{
struct timeval tv;
char *htable, *ptable;
+ uint16_t rport;
SPLVAR;
@@ -109,7 +110,7 @@ rx_Init(u_short port)
* Allocate and initialize a socket for client and perhaps server
* connections
*/
- rx_socket = rxi_GetUDPSocket(port);
+ rx_socket = rxi_GetUDPSocket(port, &rport);
if (rx_socket == OSI_NULLSOCKET) {
return RX_ADDRINUSE;
@@ -144,7 +145,7 @@ rx_Init(u_short port)
* *Slightly* random start time for the cid. This is just to help
* out with the hashing function at the peer
*/
- rx_port = port;
+ rx_port = rport;
rx_stats.minRtt.sec = 9999999;
rx_SetEpoch(tv.tv_sec); /*
* Start time of this package, rxkad
@@ -159,9 +160,6 @@ rx_Init(u_short port)
rx_connHashTable = (struct rx_connection **) htable;
rx_peerHashTable = (struct rx_peer **) ptable;
- rx_lastAckDelay.sec = 0;
- rx_lastAckDelay.usec = 500000;
-
clock_Init();
rxevent_Init(20, rxi_ReScheduleEvents);
@@ -169,13 +167,22 @@ rx_Init(u_short port)
rx_nFreePackets = 0;
queue_Init(&rx_freePacketQueue);
rx_nFreeCbufs = 0;
- rxi_NeedMoreCbufs = FALSE;
queue_Init(&rx_freeCbufQueue);
USERPRI;
rxi_MorePackets(rx_nPackets);
+ rxi_MoreCbufs(rx_nPackets);
rx_CheckCbufs(0);
NETPRI;
+ rx_lastAckDelay.sec = 0;
+ rx_lastAckDelay.usec = 400000; /* 400 ms */
+#ifdef SOFT_ACK
+ rx_hardAckDelay.sec = 0;
+ rx_hardAckDelay.usec = 100000; /* 100 ms */
+ rx_softAckDelay.sec = 0;
+ rx_softAckDelay.usec = 100000; /* 100 ms */
+#endif /* SOFT_ACK */
+
/* Initialize various global queues */
queue_Init(&rx_idleServerQueue);
queue_Init(&rx_incomingCallQueue);
@@ -273,11 +280,11 @@ rx_StartServer(int donateMe)
* connection.
*/
struct rx_connection *
-rx_NewConnection(u_long shost, u_short sport, u_short sservice,
+rx_NewConnection(uint32_t shost, uint16_t sport, uint16_t sservice,
struct rx_securityClass * securityObject,
int serviceSecurityIndex)
{
- int hashindex;
+ int hashindex, error;
long cid;
struct rx_connection *conn;
@@ -314,7 +321,9 @@ rx_NewConnection(u_long shost, u_short sport, u_short sservice,
conn->maxPacketSize = MIN(conn->peer->packetSize, OLD_MAX_PACKET_SIZE);
rx_SetConnDeadTime(conn, rx_connDeadTime);
- RXS_NewConnection(securityObject, conn);
+ error = RXS_NewConnection(securityObject, conn);
+ if (error)
+ conn->error = error;
hashindex = CONN_HASH(shost, sport, conn->cid, conn->epoch,
RX_CLIENT_CONNECTION);
conn->next = rx_connHashTable[hashindex];
@@ -434,7 +443,7 @@ rx_DestroyConnection(struct rx_connection * conn)
rx_stats.nClientConns--;
- MUTEX_DESTROY(&conn->lock);
+ RX_MUTEX_DESTROY(&conn->lock);
rxi_FreeConnection(conn);
USERPRI;
}
@@ -458,7 +467,7 @@ rx_NewCall(struct rx_connection * conn)
#endif
clock_NewTime();
- dpf(("rx_MakeCall(conn %x)\n", conn));
+ dpf(("rx_NewCall(conn %x)\n", conn));
GLOBAL_LOCK();
#if defined(AFS_SGIMP_ENV)
@@ -470,14 +479,14 @@ rx_NewCall(struct rx_connection * conn)
call = conn->call[i];
if (call) {
if (call->state == RX_STATE_DALLY) {
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
rxi_ResetCall(call);
(*call->callNumber)++;
break;
}
} else {
call = rxi_NewCall(conn, i);
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
break;
}
}
@@ -502,7 +511,7 @@ rx_NewCall(struct rx_connection * conn)
/* Turn on busy protocol. */
rxi_KeepAliveOn(call);
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
USERPRI;
#if defined(AFS_SGIMP_ENV)
AFS_GACQUIRE(&ms);
@@ -579,13 +588,15 @@ rxi_SetCallNumberVector(struct rx_connection * aconn,
* on a failure.
*/
struct rx_service *
-rx_NewService(u_short port, u_short serviceId, char *serviceName,
+rx_NewService(uint16_t port, uint16_t serviceId, char *serviceName,
struct rx_securityClass ** securityObjects,
int nSecurityObjects,
int32_t (*serviceProc) (struct rx_call *))
{
osi_socket socket = OSI_NULLSOCKET;
+ struct rx_securityClass **sersec;
struct rx_service *tservice;
+ int reuse = 0;
int i;
SPLVAR;
@@ -593,21 +604,23 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
clock_NewTime();
if (serviceId == 0) {
- (osi_Msg "rx_NewService: service id for service %s is not"
- " non-zero.\n",
- serviceName);
+ osi_Msg(("rx_NewService: service id for service %s is not"
+ " non-zero.\n", serviceName));
return 0;
}
if (port == 0) {
if (rx_port == 0) {
- (osi_Msg "rx_NewService: A non-zero port must be specified on "
- "this call if a non-zero port was not provided at Rx "
- "initialization (service %s).\n", serviceName);
+ osi_Msg(("rx_NewService: A non-zero port must be specified on "
+ "this call if a non-zero port was not provided at Rx "
+ "initialization (service %s).\n", serviceName));
return 0;
}
port = rx_port;
socket = rx_socket;
}
+ sersec = (void *)rxi_Alloc(sizeof(*sersec) * nSecurityObjects);
+ for (i = 0; i < nSecurityObjects; i++)
+ sersec[i] = securityObjects[i];
tservice = rxi_AllocService();
NETPRI;
for (i = 0; i < RX_MAX_SERVICES; i++) {
@@ -622,20 +635,20 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
* change the security classes used by this
* service, he/she loses.
*/
- (osi_Msg "rx_NewService: tried to install service %s "
- "with service id %d, which is already in use "
- "for service %s\n", serviceName, serviceId,
- service->serviceName);
+ osi_Msg(("rx_NewService: tried to install service %s "
+ "with service id %d, which is already in use "
+ "for service %s\n", serviceName, serviceId,
+ service->serviceName));
USERPRI;
rxi_FreeService(tservice);
return service;
}
-
/*
* Different service, same port: re-use the socket which is
* bound to the same port
*/
socket = service->socket;
+ reuse = 1;
}
} else {
if (socket == OSI_NULLSOCKET) {
@@ -644,7 +657,7 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
* If we don't already have a socket (from another service on
* same port) get a new one
*/
- socket = rxi_GetUDPSocket(port);
+ socket = rxi_GetUDPSocket(port, NULL);
if (socket == OSI_NULLSOCKET) {
USERPRI;
rxi_FreeService(tservice);
@@ -657,20 +670,25 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
service->serviceId = serviceId;
service->serviceName = serviceName;
service->nSecurityObjects = nSecurityObjects;
- service->securityObjects = securityObjects;
+ service->securityObjects = sersec;
service->minProcs = 0;
service->maxProcs = 1;
service->idleDeadTime = 60;
service->connDeadTime = rx_connDeadTime;
service->executeRequestProc = serviceProc;
rx_services[i] = service; /* not visible until now */
+ for (i = 0; i < nSecurityObjects; i++) {
+ if (securityObjects[i])
+ RXS_NewService(securityObjects[i], service, reuse);
+ }
USERPRI;
return service;
}
}
USERPRI;
rxi_FreeService(tservice);
- (osi_Msg "rx_NewService: cannot support > %d services\n", RX_MAX_SERVICES);
+ osi_Msg(("rx_NewService: cannot support > %d services\n",
+ RX_MAX_SERVICES));
return 0;
}
@@ -712,14 +730,14 @@ rx_ServerProc(void)
call = rx_GetCall();
#ifdef KERNEL
if (afs_termState == AFSOP_STOP_RXCALLBACK) {
- MUTEX_ENTER(&afs_termStateLock);
+ RX_MUTEX_ENTER(&afs_termStateLock);
afs_termState = AFSOP_STOP_AFS;
#ifdef RX_ENABLE_LOCKS
cv_signal(&afs_termStateCv);
#else
osi_rxWakeup(&afs_termState);
#endif
- MUTEX_EXIT(&afs_termStateLock);
+ RX_MUTEX_EXIT(&afs_termStateLock);
return;
}
#endif
@@ -758,20 +776,20 @@ rx_GetCall(void)
SPLVAR;
GLOBAL_LOCK();
- MUTEX_ENTER(&freeSQEList_lock);
+ RX_MUTEX_ENTER(&freeSQEList_lock);
if ((sq = rx_FreeSQEList) != NULL) {
rx_FreeSQEList = *(struct rx_serverQueueEntry **) sq;
- MUTEX_EXIT(&freeSQEList_lock);
+ RX_MUTEX_EXIT(&freeSQEList_lock);
} else { /* otherwise allocate a new one and
* return that */
- MUTEX_EXIT(&freeSQEList_lock);
+ RX_MUTEX_EXIT(&freeSQEList_lock);
sq = (struct rx_serverQueueEntry *) rxi_Alloc(sizeof(struct rx_serverQueueEntry));
#ifdef RX_ENABLE_LOCKS
LOCK_INIT(&sq->lock, "server Queue lock");
#endif
}
- MUTEX_ENTER(&sq->lock);
+ RX_MUTEX_ENTER(&sq->lock);
#if defined(AFS_SGIMP_ENV)
ASSERT(!isafs_glock());
#endif
@@ -828,12 +846,12 @@ rx_GetCall(void)
#endif
} while (!(call = sq->newcall));
}
- MUTEX_EXIT(&sq->lock);
+ RX_MUTEX_EXIT(&sq->lock);
- MUTEX_ENTER(&freeSQEList_lock);
+ RX_MUTEX_ENTER(&freeSQEList_lock);
*(struct rx_serverQueueEntry **) sq = rx_FreeSQEList;
rx_FreeSQEList = sq;
- MUTEX_EXIT(&freeSQEList_lock);
+ RX_MUTEX_EXIT(&freeSQEList_lock);
call->state = RX_STATE_ACTIVE;
call->mode = RX_MODE_RECEIVING;
@@ -879,12 +897,12 @@ rx_SetArrivalProc(struct rx_call * call, void (*proc) (),
* appropriate, and return the final error code from the conversation
* to the caller
*/
-long
+int32_t
rx_EndCall(struct rx_call * call, int32_t rc)
{
struct rx_connection *conn = call->conn;
struct rx_service *service;
- long error;
+ int32_t error;
SPLVAR;
#if defined(AFS_SGIMP_ENV)
@@ -899,7 +917,7 @@ rx_EndCall(struct rx_call * call, int32_t rc)
#endif
NETPRI;
GLOBAL_LOCK();
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
call->arrivalProc = (void (*) ()) 0;
if (rc && call->error == 0) {
@@ -914,13 +932,13 @@ rx_EndCall(struct rx_call * call, int32_t rc)
if (conn->type == RX_SERVER_CONNECTION) {
/* Make sure reply or at least dummy reply is sent */
if (call->mode == RX_MODE_RECEIVING) {
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
- rx_WriteProc(call, 0, 0);
+ rx_Write(call, 0, 0);
GLOBAL_LOCK();
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
}
if (call->mode == RX_MODE_SENDING) {
rx_FlushWrite(call);
@@ -939,13 +957,13 @@ rx_EndCall(struct rx_call * call, int32_t rc)
* no reply arguments are expected
*/
if (call->mode == RX_MODE_SENDING) {
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
- (void) rx_ReadProc(call, &dummy, 1);
+ (void) rx_Read(call, &dummy, 1);
GLOBAL_LOCK();
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
}
if (conn->flags & RX_CONN_MAKECALL_WAITING) {
conn->flags &= (~RX_CONN_MAKECALL_WAITING);
@@ -973,7 +991,7 @@ rx_EndCall(struct rx_call * call, int32_t rc)
call->nLeft = call->nFree = 0;
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
#if defined(AFS_SGIMP_ENV)
@@ -1012,6 +1030,12 @@ rx_Finalize(void)
}
}
+#ifdef RXDEBUG
+ if (rx_debugFile) {
+ fclose(rx_debugFile);
+ rx_debugFile = NULL;
+ }
+#endif
rxi_flushtrace();
USERPRI;
}
@@ -1024,13 +1048,13 @@ void
rxi_PacketsUnWait(void)
{
- MUTEX_ENTER(&rx_waitingForPackets_lock);
+ RX_MUTEX_ENTER(&rx_waitingForPackets_lock);
if (!rx_waitingForPackets) {
- MUTEX_EXIT(&rx_waitingForPackets_lock);
+ RX_MUTEX_EXIT(&rx_waitingForPackets_lock);
return;
}
if (rxi_OverQuota(RX_PACKET_CLASS_SEND)) {
- MUTEX_EXIT(&rx_waitingForPackets_lock);
+ RX_MUTEX_EXIT(&rx_waitingForPackets_lock);
return; /* still over quota */
}
rx_waitingForPackets = 0;
@@ -1039,7 +1063,7 @@ rxi_PacketsUnWait(void)
#else
osi_rxWakeup(&rx_waitingForPackets);
#endif
- MUTEX_EXIT(&rx_waitingForPackets_lock);
+ RX_MUTEX_EXIT(&rx_waitingForPackets_lock);
return;
}
@@ -1051,7 +1075,7 @@ rxi_PacketsUnWait(void)
* specified socket and service
*/
static struct rx_service *
-rxi_FindService(osi_socket socket, u_short serviceId)
+rxi_FindService(osi_socket socket, uint16_t serviceId)
{
struct rx_service **sp;
@@ -1077,14 +1101,14 @@ rxi_NewCall(struct rx_connection * conn, int channel)
* Existing call structures are assumed to have been left reset by
* rxi_FreeCall
*/
- MUTEX_ENTER(&rx_freeCallQueue_lock);
+ RX_MUTEX_ENTER(&rx_freeCallQueue_lock);
if (queue_IsNotEmpty(&rx_freeCallQueue)) {
call = queue_First(&rx_freeCallQueue, rx_call);
queue_Remove(call);
rx_stats.nFreeCallStructs--;
- MUTEX_EXIT(&rx_freeCallQueue_lock);
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_EXIT(&rx_freeCallQueue_lock);
+ RX_MUTEX_ENTER(&call->lock);
#ifdef ADAPT_PERF
/* Bind the call to its connection structure */
@@ -1093,10 +1117,10 @@ rxi_NewCall(struct rx_connection * conn, int channel)
} else {
call = (struct rx_call *) rxi_Alloc(sizeof(struct rx_call));
- MUTEX_EXIT(&rx_freeCallQueue_lock);
- MUTEX_INIT(&call->lock, "call lock", MUTEX_DEFAULT, NULL);
- MUTEX_INIT(&call->lockw, "call wlock", MUTEX_DEFAULT, NULL);
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_EXIT(&rx_freeCallQueue_lock);
+ RX_MUTEX_INIT(&call->lock, "call lock", RX_MUTEX_DEFAULT, NULL);
+ RX_MUTEX_INIT(&call->lockw, "call wlock", RX_MUTEX_DEFAULT, NULL);
+ RX_MUTEX_ENTER(&call->lock);
rx_stats.nCallStructs++;
/* Initialize once-only items */
@@ -1126,7 +1150,7 @@ rxi_NewCall(struct rx_connection * conn, int channel)
if (*call->callNumber == 0)
*call->callNumber = 1;
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
return call;
}
@@ -1142,20 +1166,20 @@ rxi_FreeCall(struct rx_call * call)
struct rx_connection *conn = call->conn;
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
if (call->state == RX_STATE_DALLY)
(*call->callNumber)++;
rxi_ResetCall(call);
call->conn->call[channel] = (struct rx_call *) 0;
- MUTEX_ENTER(&rx_freeCallQueue_lock);
+ RX_MUTEX_ENTER(&rx_freeCallQueue_lock);
queue_Append(&rx_freeCallQueue, call);
rx_stats.nFreeCallStructs++;
- MUTEX_EXIT(&rx_freeCallQueue_lock);
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&rx_freeCallQueue_lock);
+ RX_MUTEX_EXIT(&call->lock);
/*
* Destroy the connection if it was previously slated for
@@ -1175,18 +1199,15 @@ rxi_FreeCall(struct rx_call * call)
long rxi_Alloccnt = 0, rxi_Allocsize = 0;
-char *
+
+void *
rxi_Alloc(int size)
{
- char *p;
+ void *p;
rxi_Alloccnt++;
rxi_Allocsize += size;
-#if (defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)) && defined(KERNEL)
- p = (char *) osi_AllocSmall(size, 1);
-#else
- p = (char *) osi_Alloc(size);
-#endif
+ p = osi_Alloc(size);
if (!p)
osi_Panic("rxi_Alloc error");
memset(p, 0, size);
@@ -1211,7 +1232,7 @@ rxi_Free(void *addr, int size)
* new one will be allocated and initialized
*/
struct rx_peer *
-rxi_FindPeer(u_long host, u_short port)
+rxi_FindPeer(uint32_t host, uint16_t port)
{
struct rx_peer *pp;
int hashIndex;
@@ -1318,7 +1339,7 @@ rxi_InsertPeer(struct rx_peer *peer)
*/
static struct rx_peer *
-rxi_ChangePeer(struct rx_peer *peer, u_long host, u_short port)
+rxi_ChangePeer(struct rx_peer *peer, uint32_t host, uint16_t port)
{
rxi_RemovePeer(peer);
peer->host = host;
@@ -1341,9 +1362,9 @@ rxi_ChangePeer(struct rx_peer *peer, u_long host, u_short port)
* index, if the index is valid for this service
*/
static struct rx_connection *
-rxi_FindConnection(osi_socket socket, long host,
- u_short port, u_short serviceId, u_long cid,
- u_long epoch, int type, u_int securityIndex)
+rxi_FindConnection(osi_socket socket, uint32_t host,
+ uint16_t port, uint16_t serviceId, uint32_t cid,
+ uint32_t epoch, int type, u_int securityIndex)
{
int hashindex;
struct rx_connection *conn;
@@ -1427,7 +1448,7 @@ int (*rx_almostSent)() = NULL;
struct rx_packet *
rxi_ReceivePacket(struct rx_packet * np, osi_socket socket,
- u_long host, u_short port)
+ uint32_t host, uint16_t port)
{
struct rx_call *call;
struct rx_connection *conn;
@@ -1453,7 +1474,7 @@ rxi_ReceivePacket(struct rx_packet * np, osi_socket socket,
? rx_packetTypes[np->header.type - 1] : "*UNKNOWN*";
dpf(("R %d %s: %x.%d.%d.%d.%d.%d.%d flags %d, packet %x",
np->header.serial, packetType, host, port, np->header.serviceId,
- np->header.epoch, np->header.cid, np->header.callNumber,
+ (int)np->header.epoch, np->header.cid, np->header.callNumber,
np->header.seq, np->header.flags, np));
#endif
@@ -1526,7 +1547,7 @@ rxi_ReceivePacket(struct rx_packet * np, osi_socket socket,
switch (np->header.type) {
case RX_PACKET_TYPE_ABORT:
/* What if the supplied error is zero? */
- rxi_ConnectionError(conn, ntohl(rx_GetLong(np, 0)));
+ rxi_ConnectionError(conn, ntohl(rx_SlowGetLong(np, 0)));
conn->refCount--;
return np;
case RX_PACKET_TYPE_CHALLENGE:
@@ -1676,7 +1697,7 @@ rxi_ReceivePacket(struct rx_packet * np, osi_socket socket,
* LWSXXX since it will interact badly with the
* LWSXXX server-restart detection code in receiveackpacket.
*/
- if (ntohl(rx_GetLong(np, FIRSTACKOFFSET)) < call->tfirst) {
+ if (ntohl(rx_SlowGetLong(np, FIRSTACKOFFSET)) < call->tfirst) {
rx_stats.spuriousPacketsRead++;
#ifdef RX_ENABLE_LOCKSX
mutex_exit(&call->lock);
@@ -1739,7 +1760,7 @@ rxi_ReceivePacket(struct rx_packet * np, osi_socket socket,
* the user
*/
/* XXX What if error is zero? and length of packet is 0 */
- rxi_CallError(call, ntohl(*(u_int32_t *) rx_DataOf(np)));
+ rxi_CallError(call, ntohl(*(uint32_t *) rx_DataOf(np)));
break;
case RX_PACKET_TYPE_BUSY:
/* XXXX */
@@ -1864,8 +1885,14 @@ rxi_ReceiveDataPacket(struct rx_call * call,
struct rx_packet * np)
{
u_long seq, serial, flags;
+ int ack_done;
+
+ ack_done = 0;
seq = np->header.seq;
+ serial = np->header.serial;
+ flags = np->header.flags;
+
rx_stats.dataPacketsRead++;
/* If the call is in an error state, send an abort message */
@@ -1888,14 +1915,13 @@ rxi_ReceiveDataPacket(struct rx_call * call,
return np;
}
/* The usual case is that this is the expected next packet */
- if (np->header.seq == call->rnext) {
+ if (seq == call->rnext) {
/* Check to make sure it is not a duplicate of one already queued */
if (queue_IsNotEmpty(&call->rq)
&& queue_First(&call->rq, rx_packet)->header.seq == seq) {
rx_stats.dupPacketsRead++;
- np = rxi_SendAck(call, np, seq, np->header.serial,
- np->header.flags, RX_ACK_DUPLICATE);
+ np = rxi_SendAck(call, np, seq, serial, flags, RX_ACK_DUPLICATE);
call->rprev = seq;
return np;
}
@@ -1903,10 +1929,10 @@ rxi_ReceiveDataPacket(struct rx_call * call,
* It's the next packet. Stick it on the receive queue for this call
*/
queue_Prepend(&call->rq, np);
+#ifdef SOFT_ACK
+ call->nSoftAcks++;
+#endif /* SOFT_ACK */
- /* I don't think these two variables are needed (lws) */
- serial = np->header.serial;
- flags = np->header.flags;
#ifndef ADAPT_PERF
np = 0; /* We can't use this any more */
@@ -1922,14 +1948,14 @@ rxi_ReceiveDataPacket(struct rx_call * call,
/* Wakeup the reader, if any */
if (call->flags & RX_CALL_READER_WAIT) {
call->flags &= ~RX_CALL_READER_WAIT;
- MUTEX_ENTER(&call->lockq);
+ RX_MUTEX_ENTER(&call->lockq);
#ifdef RX_ENABLE_LOCKS
cv_broadcast(&call->cv_rq);
#else
osi_rxWakeup(&call->rq);
#endif
- MUTEX_EXIT(&call->lockq);
+ RX_MUTEX_EXIT(&call->lockq);
}
#endif
@@ -1954,8 +1980,7 @@ rxi_ReceiveDataPacket(struct rx_call * call,
* Perhaps it would be better done in
* ComputeRate if I decide it's ever worth doing. (lws)
*/
- if (!(np->header.flags & RX_LAST_PACKET) &&
- call->conn && call->conn->peer) {
+ if (!(flags & RX_LAST_PACKET) && call->conn && call->conn->peer) {
u_long length;
struct rx_peer *peer = call->conn->peer;
@@ -1963,12 +1988,11 @@ rxi_ReceiveDataPacket(struct rx_call * call,
if (length < peer->packetSize) {
dpf(("CONG peer %lx/%u: packetsize %lu=>%lu (rtt %u)",
ntohl(peer->host), ntohs(peer->port), peer->packetSize,
- length, peer->rtt));
+ length, peer->srtt));
peer->packetSize = length;
}
}
#endif /* MISCMTU */
- np = rxi_SendAck(call, 0, seq, serial, flags, RX_ACK_REQUESTED);
} else if (flags & RX_LAST_PACKET) {
struct clock when;
@@ -1976,8 +2000,11 @@ rxi_ReceiveDataPacket(struct rx_call * call,
rxevent_Cancel(call->delayedAckEvent);
clock_GetTime(&when);
clock_Add(&when, &rx_lastAckDelay);
+
call->delayedAckEvent = rxevent_Post(&when, rxi_SendDelayedAck,
- call, 0);
+ call, NULL);
+
+ ack_done = 1;
}
#ifdef ADAPT_PERF
/*
@@ -1990,7 +2017,7 @@ rxi_ReceiveDataPacket(struct rx_call * call,
call->arrivalProc = (void (*) ()) 0;
}
/* Wakeup the reader, if any */
- MUTEX_ENTER(&call->lockq);
+ RX_MUTEX_ENTER(&call->lockq);
if (call->flags & RX_CALL_READER_WAIT) {
call->flags &= ~RX_CALL_READER_WAIT;
#ifdef RX_ENABLE_LOCKS
@@ -2000,7 +2027,7 @@ rxi_ReceiveDataPacket(struct rx_call * call,
osi_rxWakeup(&call->rq);
#endif
}
- MUTEX_EXIT(&call->lockq);
+ RX_MUTEX_EXIT(&call->lockq);
np = 0; /* We can't use this any more */
#endif /* ADAPT_PERF */
@@ -2054,10 +2081,9 @@ rxi_ReceiveDataPacket(struct rx_call * call,
* If the new packet's sequence number has been sent to the
* application already, then this is a duplicate
*/
- if (np->header.seq < call->rnext) {
+ if (seq < call->rnext) {
rx_stats.dupPacketsRead++;
- np = rxi_SendAck(call, np, seq, np->header.serial,
- np->header.flags, RX_ACK_DUPLICATE);
+ np = rxi_SendAck(call, np, seq, serial, flags, RX_ACK_DUPLICATE);
call->rprev = seq;
return np;
}
@@ -2066,22 +2092,22 @@ rxi_ReceiveDataPacket(struct rx_call * call,
* accommodated by the current window, then send a negative
* acknowledge and drop the packet
*/
- if ((call->rnext + call->rwind) <= np->header.seq) {
- np = rxi_SendAck(call, np, seq, np->header.serial,
- np->header.flags, RX_ACK_EXCEEDS_WINDOW);
+ if ((call->rnext + call->rwind) <= seq) {
+ np = rxi_SendAck(call, np, seq, serial, flags,
+ RX_ACK_EXCEEDS_WINDOW);
call->rprev = seq;
return np;
}
/* Look for the packet in the queue of old received packets */
prev = call->rprev;
- if (prev > np->header.seq)
+ if (prev > seq)
prev = 0;
for (nTwixt = 0, queue_Scan(&call->rq, tp, nxp, rx_packet)) {
/* Check for duplicate packet */
- if (np->header.seq == tp->header.seq) {
+ if (seq == tp->header.seq) {
rx_stats.dupPacketsRead++;
- np = rxi_SendAck(call, np, np->header.seq, np->header.serial,
- np->header.flags, RX_ACK_DUPLICATE);
+ np = rxi_SendAck(call, np, seq, serial, flags,
+ RX_ACK_DUPLICATE);
call->rprev = seq;
return np;
}
@@ -2090,14 +2116,14 @@ rxi_ReceiveDataPacket(struct rx_call * call,
* Count the number of packets received 'twixt the previous
* packet and the new packet
*/
- if (tp->header.seq > prev && tp->header.seq < np->header.seq)
+ if (tp->header.seq > prev && tp->header.seq < seq)
nTwixt++;
/*
* If we find a higher sequence packet, break out and insert the
* new packet here.
*/
- if (np->header.seq < tp->header.seq)
+ if (seq < tp->header.seq)
break;
}
@@ -2109,20 +2135,41 @@ rxi_ReceiveDataPacket(struct rx_call * call,
* appended.
*/
queue_InsertBefore(tp, np);
+#ifdef SOFT_ACK
+ call->nSoftAcks++;
+#endif /* SOFT_ACK */
- /*
- * Acknowledge the packet if it's out of sequence or if
- * requested by peer
- */
- if (np->header.flags & RX_REQUEST_ACK) {
- np = rxi_SendAck(call, 0, np->header.seq, np->header.serial,
- np->header.flags, RX_ACK_REQUESTED);
- call->rprev = seq;
- return np;
- }
call->rprev = seq;
np = 0;
}
+
+ /*
+ * Acknowledge the packet if requested by peer, or we are doing
+ * softack.
+ *
+ * Add a timed ack to make sure we send out a ack to before we get
+ * a request from the client that they send a REQUEST-ACK packet.
+ */
+ if (ack_done) {
+ /* ack is already taken care of */
+ } else if (flags & RX_REQUEST_ACK) {
+ rxi_SendAck(call, 0, seq, serial, flags, RX_ACK_REQUESTED);
+ call->rprev = seq;
+#ifdef SOFT_ACK
+ } else if (call->nSoftAcks > rxi_SoftAckRate) {
+ rxevent_Cancel(call->delayedAckEvent);
+ rxi_SendAck(call, 0, seq, serial, flags, RX_ACK_IDLE);
+ } else if (call->nSoftAcks) {
+ struct clock when;
+
+ rxevent_Cancel(call->delayedAckEvent);
+ clock_GetTime(&when);
+ clock_Add(&when, &rx_softAckDelay);
+ call->delayedAckEvent = rxevent_Post(&when, rxi_SendDelayedAck,
+ call, NULL);
+#endif /* SOFT_ACK */
+ }
+
return np;
}
@@ -2131,6 +2178,42 @@ static void rxi_ComputeRate();
#endif
+/* Timeout is set to RTT + 4*MDEV. */
+static
+void
+update_timeout(struct rx_peer *peer)
+{
+ u_long rtt_timeout;
+ rtt_timeout = peer->srtt + 4*peer->mdev;
+ /*
+ * Add 100ms to hide the effects of unpredictable
+ * scheduling. 100ms is *very* conservative and should probably be
+ * much smaller. We don't want to generate any redundant
+ * retransmits so for now, let's use 100ms.
+ */
+ rtt_timeout += 100*1000;
+ if (rtt_timeout < 1000) /* 1000 = 1ms */
+ rtt_timeout = 1000; /* Minimum timeout */
+ peer->timeout.usec = rtt_timeout % 1000000;
+ peer->timeout.sec = rtt_timeout / 1000000;;
+}
+
+/* On a dubious timeout double MDEV but within reason.
+ * Timeout is limited by 5*RTT.
+ */
+static
+void
+dubious_timeout(struct rx_peer *peer)
+{
+ if (peer->mdev >= peer->srtt)
+ return;
+
+ peer->mdev *= 2;
+ if (peer->mdev > peer->srtt)
+ peer->mdev = peer->srtt;
+ update_timeout(peer);
+}
+
/* The real smarts of the whole thing. Right now somewhat short-changed. */
struct rx_packet *
rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
@@ -2185,6 +2268,12 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
}
#endif
+#if 0 /* need congestion avoidance stuff first */
+ if (np->header.flags & RX_SLOW_START_OK)
+ call->flags |= RX_CALL_SLOW_START_OK;
+#endif
+
+
/*
* if a server connection has been re-created, it doesn't remember what
* serial # it was up to. An ack will tell us, since the serial field
@@ -2227,18 +2316,21 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
break;
call->tfirst = tp->header.seq + 1;
if (tp->header.serial == serial) {
+ if (ap->reason != RX_ACK_DELAY) {
#ifdef ADAPT_PERF
- rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
+ rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
#else
- rxi_ComputeRoundTripTime(tp, 0, 0);
+ rxi_ComputeRoundTripTime(tp, 0, 0);
#endif
+ }
#ifdef ADAPT_WINDOW
rxi_ComputeRate(peer, call, tp, np, ap->reason);
#endif
}
#ifdef ADAPT_PERF
else if ((tp->firstSerial == serial)) {
- rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
+ if (ap->reason != RX_ACK_DELAY)
+ rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
#ifdef ADAPT_WINDOW
rxi_ComputeRate(peer, call, tp, np, ap->reason);
#endif
@@ -2257,6 +2349,8 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
rxi_ComputeRate(peer, call, 0, np, ap->reason);
}
#endif
+ /* "Slow start" every call. */
+ if (call->twind < rx_Window) call->twind += 1;
/*
* N.B. we don't turn off any timers here. They'll go away by themselves,
@@ -2281,18 +2375,21 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
* this packet
*/
if (tp->header.serial == serial) {
+ if (ap->reason != RX_ACK_DELAY) {
#ifdef ADAPT_PERF
- rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
+ rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
#else
- rxi_ComputeRoundTripTime(tp, 0, 0);
+ rxi_ComputeRoundTripTime(tp, 0, 0);
#endif
+ }
#ifdef ADAPT_WINDOW
rxi_ComputeRate(peer, call, tp, np, ap->reason);
#endif
}
#ifdef ADAPT_PERF
else if ((tp->firstSerial == serial)) {
- rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
+ if (ap->reason != RX_ACK_DELAY)
+ rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
#ifdef ADAPT_WINDOW
rxi_ComputeRate(peer, call, tp, np, ap->reason);
#endif
@@ -2368,6 +2465,20 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
}
}
+ if (ap->reason == RX_ACK_DUPLICATE) {
+ /*
+ * Other end receives duplicates because either:
+ * A. acks where lost
+ * B. receiver gets scheduled in an unpredictable way
+ * C. we have a busted timer
+ *
+ * To fix B & C wait for new acks to update srtt and mdev. In
+ * the meantime, increase mdev to increase the retransmission
+ * timeout.
+ */
+ dubious_timeout(peer);
+ }
+
/*
* If the window has been extended by this acknowledge packet,
* then wakeup a sender waiting in alloc for window space, or try
@@ -2376,9 +2487,9 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
*/
if (call->tnext < (call->tfirst + call->twind)) {
#ifdef RX_ENABLE_LOCKS
- MUTEX_ENTER(&call->lockw);
+ RX_MUTEX_ENTER(&call->lockw);
cv_signal(&call->cv_twind);
- MUTEX_EXIT(&call->lockw);
+ RX_MUTEX_EXIT(&call->lockw);
#else
if (call->flags & RX_CALL_WAIT_WINDOW_ALLOC) {
call->flags &= ~RX_CALL_WAIT_WINDOW_ALLOC;
@@ -2416,6 +2527,21 @@ rxi_ReceiveAckPacket(struct rx_call * call, struct rx_packet * np)
return np;
}
+/* Post a new challenge-event, this is to resend lost packets. */
+static void
+rxi_resend_ChallengeEvent(struct rx_connection *conn)
+{
+ struct clock when;
+
+ if (conn->challengeEvent)
+ rxevent_Cancel(conn->challengeEvent);
+
+ clock_GetTime(&when);
+ when.sec += RX_CHALLENGE_TIMEOUT;
+ conn->challengeEvent = rxevent_Post(&when, rxi_ChallengeEvent,
+ conn, NULL);
+}
+
/* Received a response to a challenge packet */
struct rx_packet *
rxi_ReceiveResponsePacket(struct rx_connection * conn,
@@ -2433,8 +2559,11 @@ rxi_ReceiveResponsePacket(struct rx_connection * conn,
/* Otherwise, have the security object evaluate the response packet */
error = RXS_CheckResponse(conn->securityObject, conn, np);
- if (error) {
-
+ if (error == RX_AUTH_REPLY) {
+ rxi_SendSpecial(NULL, conn, np, RX_PACKET_TYPE_CHALLENGE,
+ NULL, -1);
+ rxi_resend_ChallengeEvent(conn);
+ } else if (error) {
/*
* If the response is invalid, reset the connection, sending an abort
* to the peer
@@ -2445,7 +2574,6 @@ rxi_ReceiveResponsePacket(struct rx_connection * conn,
rxi_ConnectionError(conn, error);
return rxi_SendConnectionAbort(conn, np);
} else {
-
/*
* If the response is valid, any calls waiting to attach servers can
* now do so
@@ -2538,7 +2666,7 @@ rxi_AttachServerProc(struct rx_call * call)
} else {
sq = queue_First(&rx_idleServerQueue, rx_serverQueueEntry);
- MUTEX_ENTER(&sq->lock);
+ RX_MUTEX_ENTER(&sq->lock);
queue_Remove(sq);
sq->newcall = call;
@@ -2564,7 +2692,7 @@ rxi_AttachServerProc(struct rx_call * call)
#else
osi_rxWakeup(sq);
#endif
- MUTEX_EXIT(&sq->lock);
+ RX_MUTEX_EXIT(&sq->lock);
}
}
@@ -2610,13 +2738,13 @@ rxi_ClearTransmitQueue(struct rx_call * call)
call->tfirst = call->tnext; /*
* implicitly acknowledge all data already sent
*/
- MUTEX_ENTER(&call->lockw);
+ RX_MUTEX_ENTER(&call->lockw);
#ifdef RX_ENABLE_LOCKS
cv_signal(&call->cv_twind);
#else
osi_rxWakeup(&call->twind);
#endif
- MUTEX_EXIT(&call->lockw);
+ RX_MUTEX_EXIT(&call->lockw);
}
void
@@ -2749,14 +2877,16 @@ rxi_ResetCall(struct rx_call * call)
#ifdef ADAPT_WINDOW
call->twind = call->conn->peer->maxWindow; /* XXXX */
#else
- call->twind = rx_Window; /* XXXX */
+ /* "Slow start" every call. */
+ call->twind = rx_initialWindow;
#endif
+
call->tfirst = call->rnext = call->tnext = 1;
call->rprev = 0;
call->lastAcked = 0;
call->localStatus = call->remoteStatus = 0;
- MUTEX_ENTER(&call->lockq);
+ RX_MUTEX_ENTER(&call->lockq);
if (flags & RX_CALL_READER_WAIT) {
#ifdef RX_ENABLE_LOCKS
/* cv_signal(&call->cv_rq);*/
@@ -2765,10 +2895,10 @@ rxi_ResetCall(struct rx_call * call)
osi_rxWakeup(&call->rq);
#endif
}
- MUTEX_EXIT(&call->lockq);
+ RX_MUTEX_EXIT(&call->lockq);
if (flags & RX_CALL_WAIT_PACKETS)
rxi_PacketsUnWait(); /* XXX */
- MUTEX_ENTER(&call->lockw);
+ RX_MUTEX_ENTER(&call->lockw);
#ifdef RX_ENABLE_LOCKS
cv_signal(&call->cv_twind);
@@ -2776,7 +2906,7 @@ rxi_ResetCall(struct rx_call * call)
if (flags & RX_CALL_WAIT_WINDOW_ALLOC)
osi_rxWakeup(&call->twind);
#endif
- MUTEX_EXIT(&call->lockw);
+ RX_MUTEX_EXIT(&call->lockw);
if (queue_IsOnQueue(call)) {
queue_Remove(call);
@@ -2829,6 +2959,7 @@ rxi_SendAck(struct rx_call * call,
if (call->rnext > call->lastAcked)
call->lastAcked = call->rnext;
+
p = optionalPacket;
if (p) {
@@ -2838,6 +2969,11 @@ rxi_SendAck(struct rx_call * call,
else if (!(p = rxi_AllocPacket(RX_PACKET_CLASS_SPECIAL)))
osi_Panic("rxi_SendAck");
+#ifdef SOFT_ACK
+ call->nSoftAcks = 0;
+ call->nHardAcks = 0;
+#endif /* SOFT_ACK */
+
templ = rx_AckDataSize(call->rwind) + 4 - rx_GetDataSize(p);
if (templ > 0) {
if (rxi_AllocDataBuf(p, templ))
@@ -3022,20 +3158,22 @@ rxi_Start(struct rxevent * event, struct rx_call * call)
* an event to "give back" the packets we've used, when the
* burst time has elapsed (if we used any packets at all).
*/
+ /* XXX this need to go away and replaced with congestion
+ * avoidance */
if (peer->burstSize && !peer->burst) {
if (nSent) {
- int foo; /* XXX - ugly */
/* Send off the prior packet */
/*
* Don't request an ack if it's a short packet, because the
* peer will cut down its MTU as a result.
*/
- if (((lastPacket->header.flags & RX_LAST_PACKET) == 0)) {
- if ((lastPacket->length + RX_HEADER_SIZE +
- call->conn->securityMaxTrailerSize) >= call->conn->maxPacketSize)
- foo = ACKHACK(lastPacket);
- else
- Rx0++;
+ if ((lastPacket->header.flags & RX_LAST_PACKET) == 0) {
+ if (/* call->cwind <= (u_short)call->ackRate || */
+ (!(call->flags & RX_CALL_SLOW_START_OK)
+ && (lastPacket->header.seq & 1))) {
+
+ lastPacket->header.flags |= RX_REQUEST_ACK;
+ }
}
rxi_Send(call, lastPacket);
rxi_ScheduleDecongestionEvent(call, nSent);
@@ -3055,10 +3193,31 @@ rxi_Start(struct rxevent * event, struct rx_call * call)
* this packet has elapsed
*/
if (!clock_IsZero(&p->retryTime)) {
+ struct clock updatedRetryTime;
+
if (clock_Lt(&now, &p->retryTime))
continue;
/*
+ * If the RTT has gone up since the packet
+ * was sent, don't retransmit just yet!
+ */
+ updatedRetryTime = p->timeSent;
+ clock_Add(&updatedRetryTime, &peer->timeout);
+ if (clock_Lt(&now, &updatedRetryTime)) {
+ p->retryTime = updatedRetryTime;
+ continue;
+ }
+
+ /*
+ * If we have to retransmit chances are that we have a
+ * busted timer. Increase MDEV to reflect this
+ * fact. If we are wrong, MDEV will come down quickly
+ * as new acks arrive.
+ */
+ dubious_timeout(peer);
+
+ /*
* Always request an ack on a retransmitted packet; this
* will help to get the data moving again, especially if
* the packet is near the beginning of the window.
@@ -3147,14 +3306,19 @@ rxi_Start(struct rxevent * event, struct rx_call * call)
* response from the peer implicitly acks it, but we do wait a
* little longer for the ack on the last packet on server conns.
*/
- if (((lastPacket->header.flags & RX_LAST_PACKET) == 0)) {
- int foo; /* XXX - ugly */
- if ((lastPacket->length + RX_HEADER_SIZE +
- call->conn->securityMaxTrailerSize) >=
- call->conn->maxPacketSize)
- foo = ACKHACK(lastPacket);
- else
- Rx1++;
+ if ((lastPacket->header.flags & RX_LAST_PACKET) == 0) {
+
+ /*
+ * to get the window up faster we ack every packet as
+ * long as we are below the fast ack window, or if the
+ * client doesn't support slow start, every second packet
+ */
+ if (/* call->cwind <= (u_short)call->ackRate || */
+ (!(call->flags & RX_CALL_SLOW_START_OK)
+ && (lastPacket->header.seq & 1))) {
+
+ lastPacket->header.flags |= RX_REQUEST_ACK;
+ }
} else if (!(lastPacket->header.flags & RX_CLIENT_INITIATED))
clock_Addmsec(&(lastPacket->retryTime), 400);
@@ -3198,7 +3362,7 @@ rxi_Start(struct rxevent * event, struct rx_call * call)
/* Post a new event to re-run rxi_Start when retries may be needed */
if (haveEvent) {
- call->resendEvent = rxevent_Post(&retryTime, rxi_Start, (char *) call, 0);
+ call->resendEvent = rxevent_Post(&retryTime, rxi_Start, (void *) call, NULL);
}
}
}
@@ -3341,7 +3505,7 @@ rxi_ScheduleKeepAliveEvent(struct rx_call *call)
clock_GetTime(&when);
when.sec += call->conn->secondsUntilPing;
- call->keepAliveEvent = rxevent_Post(&when, rxi_KeepAliveEvent, call, 0);
+ call->keepAliveEvent = rxevent_Post(&when, rxi_KeepAliveEvent, call, NULL);
}
}
@@ -3374,7 +3538,6 @@ rxi_ChallengeEvent(struct rxevent *event, struct rx_connection *conn,
conn->challengeEvent = (struct rxevent *) 0;
if (RXS_CheckAuthentication(conn->securityObject, conn) != 0) {
struct rx_packet *packet;
- struct clock when;
packet = rxi_AllocPacket(RX_PACKET_CLASS_SPECIAL);
if (!packet)
@@ -3383,10 +3546,7 @@ rxi_ChallengeEvent(struct rxevent *event, struct rx_connection *conn,
rxi_SendSpecial((struct rx_call *) 0, conn, packet,
RX_PACKET_TYPE_CHALLENGE, (char *) 0, -1);
rxi_FreePacket(packet);
- clock_GetTime(&when);
- when.sec += RX_CHALLENGE_TIMEOUT;
- conn->challengeEvent = rxevent_Post(&when, rxi_ChallengeEvent,
- conn, 0);
+ rxi_resend_ChallengeEvent(conn);
}
}
@@ -3497,7 +3657,6 @@ rxi_ComputeRoundTripTime(struct rx_packet *p,
struct clock thisRtt, *rttp = &thisRtt;
#ifdef ADAPT_RTO
- int rtt_timeout;
static char id[] = "@(#)adaptive RTO";
*id = *id; /* so it won't complain about unsed variables */
@@ -3526,59 +3685,51 @@ rxi_ComputeRoundTripTime(struct rx_packet *p,
/* better rtt calculation courtesy of UMich crew (dave,larry,peter,???) */
/* Apply VanJacobson round-trip estimations */
- if (peer->rtt) {
- int delta;
+ if (peer->srtt) {
+ u_long rtt;
+ u_long err;
+
+ rtt = rttp->usec + rttp->sec*1000000;
+ if (rtt >= peer->srtt)
+ err = rtt - peer->srtt;
+ else
+ err = peer->srtt - rtt;
/*
- * srtt (peer->rtt) is in units of one-eighth-milliseconds.
- * srtt is stored as fixed point with 3 bits after the binary
- * point (i.e., scaled by 8). The following magic is
- * equivalent to the smoothing algorithm in rfc793 with an
- * alpha of .875 (srtt = rtt/8 + srtt*7/8 in fixed point).
- * srtt*8 = srtt*8 + rtt - srtt
- * srtt = srtt + rtt/8 - srtt/8
+ * The following magic is equivalent to the smoothing
+ * algorithm in rfc793 with an alpha of .875
+ * (srtt = rtt/8 + srtt*7/8 in fixed point).
*/
- delta = MSEC(rttp) - (peer->rtt >> 3);
- peer->rtt += delta;
+ peer->srtt = (peer->srtt*7 + rtt)/8;
/*
* We accumulate a smoothed rtt variance (actually, a smoothed
* mean difference), then set the retransmit timer to smoothed
- * rtt + 4 times the smoothed variance (was 2x in van's original
- * paper, but 4x works better for me, and apparently for him as
- * well).
- * rttvar is stored as
- * fixed point with 2 bits after the binary point (scaled by
- * 4). The following is equivalent to rfc793 smoothing with
- * an alpha of .75 (rttvar = rttvar*3/4 + |delta| / 4). This
+ * rtt + 4 times the smoothed variance (was 2x in van's
+ * original paper, but 4x works better for me, and apparently
+ * for him as well).
+ *
+ * The following is equivalent to rfc793 smoothing with an
+ * alpha of .75 (rttvar = rttvar*3/4 + |err| / 4). This
* replaces rfc793's wired-in beta.
- * dev*4 = dev*4 + (|actual - expected| - dev)
*/
- if (delta < 0)
- delta = -delta;
-
- delta -= (peer->rtt_dev >> 2);
- peer->rtt_dev += delta;
+ peer->mdev = (peer->mdev*3 + err)/4;
} else {
- peer->rtt = MSEC(rttp) << 3;
- peer->rtt_dev = peer->rtt >> 2;/* rtt/2 */
+ peer->srtt = rttp->usec + rttp->sec*1000000;
+ peer->mdev = peer->srtt/2;
+ /* One single measurement is a real poor estimate of RTT&MDEV */
+ if (peer->mdev < 1000)
+ peer->mdev = 1000; /* 1ms */
}
- /*
- * the timeout is RTT + 4*MDEV + 0.4 sec This is because one end or the
- * other of these connections is usually in a user process, and can be
- * switched and/or swapped out. So on fast, reliable networks, the
- * timeout would otherwise be too short.
- */
- rtt_timeout = (peer->rtt >> 3) + peer->rtt_dev + 400;
- clock_Zero(&(peer->timeout));
- clock_Addmsec(&(peer->timeout), rtt_timeout);
+ update_timeout(peer);
- dpf(("rxi_ComputeRoundTripTime(rtt=%d ms, srtt=%d ms, rtt_dev=%d ms, timeout=%d.%0.3d sec)\n",
- MSEC(rttp), peer->rtt >> 3, peer->rtt_dev >> 2,
- (peer->timeout.sec), (peer->timeout.usec)));
+ dpf(("rtt=%.2f ms, srtt=%.2f ms, mdev=%.2f ms, timeout=%.2f ms\n",
+ rttp->usec/1000.0 + rttp->sec*1000.0,
+ peer->srtt/1000.0, peer->mdev/1000.0,
+ peer->timeout.sec*1000.0 + peer->timeout.usec/1000.0));
#endif /* ADAPT_RTO */
}
@@ -3672,7 +3823,7 @@ rxi_ReapConnections(void)
* place to another, but instead ought to always know if we can afford to
* hold onto a packet in its particular use.
*/
- MUTEX_ENTER(&rx_waitingForPackets_lock);
+ RX_MUTEX_ENTER(&rx_waitingForPackets_lock);
if (rx_waitingForPackets) {
rx_waitingForPackets = 0;
#ifdef RX_ENABLE_LOCKS
@@ -3681,10 +3832,10 @@ rxi_ReapConnections(void)
osi_rxWakeup(&rx_waitingForPackets);
#endif
}
- MUTEX_EXIT(&rx_waitingForPackets_lock);
+ RX_MUTEX_EXIT(&rx_waitingForPackets_lock);
now.sec += RX_REAP_TIME; /* Check every RX_REAP_TIME seconds */
- rxevent_Post(&now, rxi_ReapConnections, 0, 0);
+ rxevent_Post(&now, rxi_ReapConnections, NULL, NULL);
}
@@ -4074,8 +4225,8 @@ rx_PrintPeerStats(FILE *file, struct rx_peer *peer)
peer->burstSize,
(unsigned long)peer->burstWait.sec,
(unsigned long)peer->burstWait.usec);
- fprintf(file, " Rtt %d, retry time %lu.%06ld, total sent %d, resent %d\n",
- peer->rtt,
+ fprintf(file, " Rtt %lu us, retry time %lu.%06ld, total sent %d, resent %d\n",
+ peer->srtt,
(unsigned long)peer->timeout.sec,
(long)peer->timeout.usec,
peer->nSent,
@@ -4127,18 +4278,18 @@ shutdown_rx(void)
}
}
- MUTEX_ENTER(&freeSQEList_lock);
+ RX_MUTEX_ENTER(&freeSQEList_lock);
while ((np = rx_FreeSQEList) != NULL) {
rx_FreeSQEList = *(struct rx_serverQueueEntry **) np;
- MUTEX_DESTROY(&np->lock);
+ RX_MUTEX_DESTROY(&np->lock);
rxi_Free(np, sizeof(np));
}
- MUTEX_EXIT(&freeSQEList_lock);
- MUTEX_DESTROY(&freeSQEList_lock);
- MUTEX_DESTROY(&rx_waitingForPackets_lock);
- MUTEX_DESTROY(&rx_freeCallQueue_lock);
+ RX_MUTEX_EXIT(&freeSQEList_lock);
+ RX_MUTEX_DESTROY(&freeSQEList_lock);
+ RX_MUTEX_DESTROY(&rx_waitingForPackets_lock);
+ RX_MUTEX_DESTROY(&rx_freeCallQueue_lock);
osi_Free(rx_connHashTable,
rx_hashTableSize * sizeof(struct rx_connection *));
@@ -4154,3 +4305,15 @@ shutdown_rx(void)
rxi_dataQuota = RX_MAX_QUOTA;
rxi_availProcs = rxi_totalMin = rxi_minDeficit = 0;
}
+
+void *
+rx_getServiceRock(struct rx_service *service)
+{
+ return service->serviceRock;
+}
+
+void
+rx_setServiceRock(struct rx_service *service, void *rock)
+{
+ service->serviceRock = rock;
+}
diff --git a/usr.sbin/afs/src/rx/rx.h b/usr.sbin/afs/src/rx/rx.h
index f92e0c0778f..f0641fbb4b2 100644
--- a/usr.sbin/afs/src/rx/rx.h
+++ b/usr.sbin/afs/src/rx/rx.h
@@ -1,4 +1,4 @@
-/* $KTH: rx.h,v 1.19 2001/01/06 21:54:20 lha Exp $ */
+/* $arla: rx.h,v 1.28 2003/01/19 08:49:53 lha Exp $ */
/*
****************************************************************************
@@ -68,17 +68,19 @@ struct rx_peer;
int rx_Init(u_short);
struct rx_service *rx_NewService(u_short, u_short, char *,
struct rx_securityClass **, int, int32_t (*)());
-struct rx_connection *rx_NewConnection(register u_long, u_short, u_short,
- register struct rx_securityClass *,
- int);
-struct rx_call *rx_NewCall(struct rx_connection *);
-struct rx_call *rx_GetCall(void); /* Not normally used, but not obsolete */
-long rx_EndCall(struct rx_call * call, int32_t rc);
-int rx_AllocPackets();
-void rx_FreePackets();
-int rx_WriteProc(struct rx_call *call, const void *buf, int nbytes);
-int rx_ReadProc(struct rx_call *call, void *buf, int nbytes);
-void rx_FlushWrite(struct rx_call *call);
+struct rx_connection *rx_NewConnection(uint32_t, u_short, u_short,
+ struct rx_securityClass *, int);
+struct rx_call *
+ rx_NewCall(struct rx_connection *);
+struct rx_call *
+ rx_GetCall(void); /* Not normally used, but not obsolete */
+int32_t rx_EndCall(struct rx_call *, int32_t);
+int rx_AllocPackets(void);
+void rx_FreePackets(void);
+int rx_Write(struct rx_call *, const void *, int);
+int rx_Read(struct rx_call *, void *, int);
+void rx_FlushWrite(struct rx_call *);
+
#ifdef RXDEBUG
void rx_PrintStats(FILE *);
#else
@@ -90,10 +92,10 @@ void rx_SetArrivalProc(struct rx_call * call, void (*proc) (),
void rx_Finalize(void);
void rx_StartServer(int);
void rx_DestroyConnection(struct rx_connection *);
-void rxi_Free(void *, register int);
+void rxi_Free(void *, int);
int rxi_GetCallNumberVector(const struct rx_connection *, int32_t *);
int rxi_SetCallNumberVector(struct rx_connection *, int32_t *);
-void rx_SetEpoch(u_long);
+void rx_SetEpoch(uint32_t);
void shutdown_rx(void);
@@ -109,6 +111,8 @@ void shutdown_rx(void);
#define rx_SetLocalStatus(call, status) ((call)->localStatus = (status))
#define rx_GetLocalStatus(call, status) ((call)->localStatus)
#define rx_GetRemoteStatus(call) ((call)->remoteStatus)
+#define rx_SetCallError(call,status) ((call)->error = (status))
+#define rx_GetCallError(call) ((call)->error)
#define rx_Error(call) ((call)->error)
#define rx_ConnError(conn) ((conn)->error)
#define rx_IsServerConn(conn) ((conn)->type == RX_SERVER_CONNECTION)
@@ -208,39 +212,6 @@ extern int rx_nPackets;
#define cppos(call) \
((call)->currentPacket->wirevec[(call)->curvec].iov_base + (call)->curpos)
-#ifndef AFS_SGIMP_ENV
-/* Write nbytes of data to the call. Returns the number of bytes written */
-/* If it returns 0, the call status should be checked with rx_Error. */
-#define rx_Write(call, buf, nbytes) rx_WriteProc((call), (buf), (nbytes))
-/* this shortcut is a good idea, but I don't trust it right now MTUXXX
- (((call)->nFree > (nbytes)) && (cpspace(call) > (nbytes)) ? \
- memcpy(cppos(call), (buf), (nbytes)), \
- (call)->nFree -= (nbytes), \
- (call)->currentPacket->wirevec[(call)->curvec].iov_base += (nbytes), \
- (call)->curpos += (nbytes), \
- (nbytes) \
- : rx_WriteProc((call), (buf), (nbytes)))
-*/
-
-/*
- * Read nbytes of data from the call. Returns the number of bytes read
- */
-/*
- * If it returns less than requested, the call status should be checked
- * with rx_Error
- */
-#define rx_Read(call, buf, nbytes) rx_ReadProc((call), (buf), (nbytes))
-/* this shortcut is a good idea, but I don't trust it right now MTUXXX
- (((call)->nLeft > (nbytes)) && (cpspace(call) > (nbytes)) ? \
- memcpy((buf), cppos(call), (nbytes)), \
- (call)->nLeft -= (nbytes), \
- (call)->currentPacket->wirevec[(call)->curvec].iov_base += (nbytes), \
- (call)->curpos += (nbytes), \
- (nbytes) \
- : rx_ReadProc((call), (buf), (nbytes)))
-*/
-#endif /* AFS_SGIMP_ENV */
-
/*
* This is the maximum size data packet that can be sent on this connection,
* accounting for security module-specific overheads.
@@ -254,14 +225,14 @@ struct rx_securityObjectStats {
char type; /* 0:unk 1:null,2:vab 3:kad */
char level;
char sparec[10]; /* force correct alignment */
- long flags; /* 1=>unalloc, 2=>auth, 4=>expired */
- u_long expires;
- u_long packetsReceived;
- u_long packetsSent;
- u_long bytesReceived;
- u_long bytesSent;
- short spares[4];
- long sparel[8];
+ uint32_t flags; /* 1=>unalloc, 2=>auth, 4=>expired */
+ uint32_t expires;
+ uint32_t packetsReceived;
+ uint32_t packetsSent;
+ uint32_t bytesReceived;
+ uint32_t bytesSent;
+ uint16_t spares[4];
+ uint32_t sparel[8];
};
/*
@@ -288,7 +259,7 @@ struct rx_securityClass {
int (*op_CheckPacket) ( /* obj,call,packet */ );
int (*op_DestroyConnection) ( /* obj, conn */ );
int (*op_GetStats) ( /* obj, conn, stats */ );
- int (*op_Spare1) ();
+ int (*op_NewService) ( /* obj, service */ );
int (*op_Spare2) ();
int (*op_Spare3) ();
} *ops;
@@ -326,6 +297,8 @@ struct rx_securityClass {
(obj,conn))
#define RXS_GetStats(obj,conn,stats) RXS_OP(obj,GetStats,\
(obj,conn,stats))
+#define RXS_NewService(obj,service,reuse) RXS_OP(obj,NewService,\
+ (obj,service,reuse))
int
rxs_Release(struct rx_securityClass *aobj);
@@ -350,8 +323,8 @@ rxs_Release(struct rx_securityClass *aobj);
*/
struct rx_service {
- u_short serviceId; /* Service number */
- u_short servicePort; /* UDP port for this service */
+ uint16_t serviceId; /* Service number */
+ uint16_t servicePort; /* UDP port for this service */
char *serviceName; /* Name of the service */
osi_socket socket; /* socket struct or file descriptor */
u_short nRequestsRunning; /*
@@ -390,8 +363,12 @@ struct rx_service {
* Time a server will wait for I/O to
* start up again
*/
+ void *serviceRock; /* Rock for service */
};
+void * rx_getServiceRock(struct rx_service *);
+void rx_setServiceRock(struct rx_service *, void *);
+
/*
* A server puts itself on an idle queue for a service using an
* instance of the following structure. When a call arrives, the call
@@ -423,9 +400,9 @@ struct rx_serverQueueEntry {
struct rx_peer {
struct rx_peer *next; /* Next in hash conflict or free list */
struct rx_queue connQueue; /* a list of all conn use this peer */
- u_long host; /* Remote IP address, in net byte
+ uint32_t host; /* Remote IP address, in net byte
* order */
- u_short port; /* Remote UDP port, in net byte order */
+ uint16_t port; /* Remote UDP port, in net byte order */
u_short packetSize; /*
* Max packet size, if known, for this
* host
@@ -448,12 +425,9 @@ struct rx_peer {
* Calls that are waiting for non-zero
* burst value
*/
- int rtt; /*
- * Round trip time, measured in
- * milliseconds/8
- */
- int rtt_dev; /* rtt smoothed error, in
- * milliseconds/4 */
+ u_long srtt; /* Smoothed RTT in us. */
+ u_long mdev; /* Smoothed mean deviation of RTT (us)*/
+
struct clock timeout; /* Current retransmission delay */
int nSent; /*
* Total number of distinct data packets
@@ -497,21 +471,21 @@ struct rx_connection {
kmutex_t lock;
kcondvar_t cv;
#endif
- u_int32_t epoch; /* Process start time of client side
+ uint32_t epoch; /* Process start time of client side
* of connection */
- u_int32_t cid; /* Connection id (call channel is
+ uint32_t cid; /* Connection id (call channel is
* bottom bits) */
- long error; /* If this connection is in error,
+ uint32_t error; /* If this connection is in error,
* this is it */
void *rock; /* User definable */
struct rx_call *call[RX_MAXCALLS];
- u_int32_t callNumber[RX_MAXCALLS]; /* Current call numbers */
- u_int32_t serial; /* Next outgoing packet serial number */
- u_int32_t lastSerial; /* # of last packet received, for
+ uint32_t callNumber[RX_MAXCALLS]; /* Current call numbers */
+ uint32_t serial; /* Next outgoing packet serial number */
+ uint32_t lastSerial; /* # of last packet received, for
* computing skew */
- long maxSerial; /* largest serial number seen on
+ uint32_t maxSerial; /* largest serial number seen on
* incoming packets */
- long maxPacketSize; /*
+ uint32_t maxPacketSize; /*
* max packet size should be
* per-connection since peer process
* could be restarted on us.
@@ -556,7 +530,7 @@ struct rx_connection {
};
/* Flag bits for connection structure */
-#define RX_CONN_MAKECALL_WAITING 1 /* rx_MakeCall is waiting for a
+#define RX_CONN_MAKECALL_WAITING 1 /* rx_NewCall is waiting for a
* channel */
#define RX_CONN_DESTROY_ME 2 /*
* Destroy *client* connection after
@@ -594,7 +568,7 @@ struct rx_call {
kcondvar_t cv_rq;
#endif
struct rx_connection *conn; /* Parent connection for this call */
- u_int32_t *callNumber; /*
+ uint32_t *callNumber; /*
* Pointer to call number field
* within connection
*/
@@ -626,11 +600,11 @@ struct rx_call {
* band */
int32_t error; /* Error condition for this call */
u_long timeout; /* High level timeout for this call */
- u_long rnext; /*
+ uint32_t rnext; /*
* Next sequence number expected to be
* read by rx_ReadData
*/
- u_long rprev; /*
+ uint32_t rprev; /*
* Previous packet received; used for
* deciding what the next packet to be
* received should be in order to decide
@@ -642,17 +616,31 @@ struct rx_call {
* not send packets with sequence
* numbers >= rnext+rwind
*/
- u_long tfirst; /*
+ uint32_t tfirst; /*
* First unacknowledged transmit packet
* number
*/
- u_long tnext; /* Next transmit sequence number to
+ uint32_t tnext; /* Next transmit sequence number to
* use */
u_long twind; /*
* The transmit window: we cannot
* assign a sequence number to a
* packet >= tfirst + twind
*/
+#if SOFT_ACK
+ u_short nSoftAcks; /* The number of delayed soft acks */
+ u_short nHardAcks; /* The number of delayed hard acks */
+#endif
+#if 0
+ u_short cwind; /* The congestion window */
+ 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 nAcks; /* The number of consecttive acks */
+ u_short nNacks; /* Number packets acked that follow the
+ * first negatively acked packet */
+ u_short congestSeq; /* Peer's congestion sequence counter */
+#endif
struct rxevent *resendEvent; /*
* If this is non-Null, there is a
* retransmission event pending
@@ -745,6 +733,8 @@ struct rx_call {
* don't modify
*/
+#define RX_CALL_SLOW_START_OK 0x2000 /* receiver support slow start */
+
/* Maximum number of acknowledgements in an acknowledge packet */
#define RX_MAXACKS 255
@@ -782,7 +772,7 @@ struct rx_call {
*/
struct rx_ackPacket {
- u_int16_t bufferSpace; /*
+ uint16_t bufferSpace; /*
* Number of packet buffers available.
* That is: the number of buffers that
* the sender of the ack packet is
@@ -790,20 +780,20 @@ struct rx_ackPacket {
* on this or subsequent calls. Lying is
* permissable.
*/
- u_int16_t maxSkew; /*
+ uint16_t maxSkew; /*
* Maximum difference between serial# of
* packet acknowledged and highest
* packet yet received
*/
- u_int32_t firstPacket; /*
+ uint32_t firstPacket; /*
* The first packet in the list of
* acknowledged packets
*/
- u_int32_t previousPacket; /*
+ uint32_t previousPacket; /*
* The previous packet number received
* (obsolete?)
*/
- u_int32_t serial; /*
+ uint32_t serial; /*
* Serial number of the packet which
* prompted the acknowledge
*/
@@ -843,6 +833,7 @@ struct rx_ackPacket {
* Ack generated since nothing has
* happened since receiving packet
*/
+#define RX_ACK_IDLE 9 /* */
/* Packet acknowledgement type */
#define RX_ACK_TYPE_NACK 0 /* I Don't have this packet */
@@ -903,6 +894,12 @@ struct rx_ackPacket {
/* EMSGSIZE returned from network. Packet too big, must fragment */
#define RX_MSGSIZE (-8)
+/*
+ *Not on wire, when CheckResponse/GetResponse return this,
+ * packet should be sent.
+ */
+#define RX_AUTH_REPLY (-63)
+
/* Max rx error */
#define RX_MAX_ERROR (-64)
@@ -917,64 +914,64 @@ struct rx_ackPacket {
*/
struct rx_stats { /* General rx statistics */
- u_int32_t packetRequests; /* Number of packet allocation
+ uint32_t packetRequests; /* Number of packet allocation
* requests */
- u_int32_t noPackets[RX_N_PACKET_CLASSES];/*
+ uint32_t noPackets[RX_N_PACKET_CLASSES];/*
* Number of failed packet requests,
* per allocation class
*/
- u_int32_t socketGreedy; /* Whether SO_GREEDY succeeded */
- u_int32_t bogusPacketOnRead; /*
+ uint32_t socketGreedy; /* Whether SO_GREEDY succeeded */
+ uint32_t bogusPacketOnRead; /*
* Number of inappropriately short
* packets received
*/
- u_int32_t bogusHost; /* Host address from bogus packets */
- u_int32_t noPacketOnRead; /*
+ uint32_t bogusHost; /* Host address from bogus packets */
+ uint32_t noPacketOnRead; /*
* Number of read packets attempted
* when there was actually no packet
* to read off the wire
*/
- u_int32_t noPacketBuffersOnRead; /*
+ uint32_t noPacketBuffersOnRead; /*
* Number of dropped data packets due
* to lack of packet buffers
*/
- u_int32_t selects; /*
+ uint32_t selects; /*
* Number of selects waiting for packet
* or timeout
*/
- u_int32_t sendSelects; /*
+ uint32_t sendSelects; /*
* Number of selects forced when
* sending packet
*/
- u_int32_t packetsRead[RX_N_PACKET_TYPES];/*
+ uint32_t packetsRead[RX_N_PACKET_TYPES];/*
* Total number of packets read, per
* type
*/
- u_int32_t dataPacketsRead; /*
+ uint32_t dataPacketsRead; /*
* Number of unique data packets read
* off the wire
*/
- u_int32_t ackPacketsRead; /* Number of ack packets read */
- u_int32_t dupPacketsRead; /* Number of duplicate data packets
+ uint32_t ackPacketsRead; /* Number of ack packets read */
+ uint32_t dupPacketsRead; /* Number of duplicate data packets
* read */
- u_int32_t spuriousPacketsRead; /* Number of inappropriate data
+ uint32_t spuriousPacketsRead; /* Number of inappropriate data
* packets */
- u_int32_t packetsSent[RX_N_PACKET_TYPES];/*
+ uint32_t packetsSent[RX_N_PACKET_TYPES];/*
* Number of rxi_Sends: packets sent
* over the wire, per type
*/
- u_int32_t ackPacketsSent; /* Number of acks sent */
- u_int32_t pingPacketsSent; /* Total number of ping packets sent */
- u_int32_t abortPacketsSent; /* Total number of aborts */
- u_int32_t busyPacketsSent; /* Total number of busies sent
+ uint32_t ackPacketsSent; /* Number of acks sent */
+ uint32_t pingPacketsSent; /* Total number of ping packets sent */
+ uint32_t abortPacketsSent; /* Total number of aborts */
+ uint32_t busyPacketsSent; /* Total number of busies sent
* received */
- u_int32_t dataPacketsSent; /* Number of unique data packets sent */
- u_int32_t dataPacketsReSent; /* Number of retransmissions */
- u_int32_t dataPacketsPushed; /*
+ uint32_t dataPacketsSent; /* Number of unique data packets sent */
+ uint32_t dataPacketsReSent; /* Number of retransmissions */
+ uint32_t dataPacketsPushed; /*
* Number of retransmissions pushed early by
* a NACK
*/
- u_int32_t ignoreAckedPacket; /*
+ uint32_t ignoreAckedPacket; /*
* Number of packets with acked flag,
* on rxi_Start
*/
@@ -984,19 +981,19 @@ struct rx_stats { /* General rx statistics */
*/
struct clock minRtt; /* Minimum round trip time measured */
struct clock maxRtt; /* Maximum round trip time measured */
- u_int32_t nRttSamples; /* Total number of round trip samples */
- u_int32_t nServerConns; /* Total number of server connections */
- u_int32_t nClientConns; /* Total number of client connections */
- u_int32_t nPeerStructs; /* Total number of peer structures */
- u_int32_t nCallStructs; /* Total number of call structures
+ uint32_t nRttSamples; /* Total number of round trip samples */
+ uint32_t nServerConns; /* Total number of server connections */
+ uint32_t nClientConns; /* Total number of client connections */
+ uint32_t nPeerStructs; /* Total number of peer structures */
+ uint32_t nCallStructs; /* Total number of call structures
* allocated */
- u_int32_t nFreeCallStructs; /*
+ uint32_t nFreeCallStructs; /*
* Total number of previously allocated
* free call structures
*/
- u_int32_t netSendFailures;
- u_int32_t fatalErrors;
- u_int32_t spares[8];
+ uint32_t netSendFailures;
+ uint32_t fatalErrors;
+ uint32_t spares[8];
};
void rx_PrintTheseStats(FILE *file, struct rx_stats *s, int size);
@@ -1005,8 +1002,8 @@ void rx_PrintTheseStats(FILE *file, struct rx_stats *s, int size);
/* debug input types */
struct rx_debugIn {
- u_int32_t type;
- u_int32_t index;
+ uint32_t type;
+ uint32_t index;
};
/* Invalid rx debug package type */
@@ -1029,24 +1026,24 @@ struct rx_debugIn {
#define RX_DEBUGI_RXSTATS 4 /* get all rx stats */
struct rx_debugStats {
- u_int32_t nFreePackets;
- u_int32_t packetReclaims;
- u_int32_t callsExecuted;
- u_int8_t waitingForPackets;
- u_int8_t usedFDs;
- u_int8_t version;
- u_int8_t spare1;
- u_int32_t nWaiting;
- u_int32_t spare2[9];
+ uint32_t nFreePackets;
+ uint32_t packetReclaims;
+ uint32_t callsExecuted;
+ uint8_t waitingForPackets;
+ uint8_t usedFDs;
+ uint8_t version;
+ uint8_t spare1;
+ uint32_t nWaiting;
+ uint32_t spare2[9];
};
struct rx_debugConn_vL {
- u_int32_t host;
- u_int32_t cid;
- u_int32_t serial;
- u_int32_t callNumber[RX_MAXCALLS];
- u_int32_t error;
- u_int16_t port;
+ uint32_t host;
+ uint32_t cid;
+ uint32_t serial;
+ uint32_t callNumber[RX_MAXCALLS];
+ uint32_t error;
+ uint16_t port;
char flags;
char type;
char securityIndex;
@@ -1056,16 +1053,16 @@ struct rx_debugConn_vL {
char callOther[RX_MAXCALLS];
/* old style getconn stops here */
struct rx_securityObjectStats secStats;
- u_int32_t sparel[10];
+ uint32_t sparel[10];
};
struct rx_debugConn {
- u_int32_t host;
- u_int32_t cid;
- u_int32_t serial;
- u_int32_t callNumber[RX_MAXCALLS];
- u_int32_t error;
- u_int16_t port;
+ uint32_t host;
+ uint32_t cid;
+ uint32_t serial;
+ uint32_t callNumber[RX_MAXCALLS];
+ uint32_t error;
+ uint16_t port;
char flags;
char type;
char securityIndex;
@@ -1076,9 +1073,9 @@ struct rx_debugConn {
char callOther[RX_MAXCALLS];
/* old style getconn stops here */
struct rx_securityObjectStats secStats;
- u_int32_t epoch;
- u_int32_t maxPacketSize;
- u_int32_t sparel[9];
+ uint32_t epoch;
+ uint32_t maxPacketSize;
+ uint32_t sparel[9];
};
#define RX_OTHER_IN 1 /* packets avail in in queue */
diff --git a/usr.sbin/afs/src/rx/rx_clock.c b/usr.sbin/afs/src/rx/rx_clock.c
index da9bb5f3b26..d27ec59538f 100644
--- a/usr.sbin/afs/src/rx/rx_clock.c
+++ b/usr.sbin/afs/src/rx/rx_clock.c
@@ -23,7 +23,7 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_clock.c,v 1.15 2000/11/26 22:29:28 lha Exp $");
+RCSID("$arla: rx_clock.c,v 1.15 2000/11/26 22:29:28 lha Exp $");
#ifndef KERNEL
diff --git a/usr.sbin/afs/src/rx/rx_clock.h b/usr.sbin/afs/src/rx/rx_clock.h
index 3adbeb85141..1184205d4a6 100644
--- a/usr.sbin/afs/src/rx/rx_clock.h
+++ b/usr.sbin/afs/src/rx/rx_clock.h
@@ -1,4 +1,4 @@
-/* $KTH: rx_clock.h,v 1.4 1999/05/04 09:13:44 assar Exp $ */
+/* $arla: rx_clock.h,v 1.5 2002/01/22 05:53:29 lha Exp $ */
/*
****************************************************************************
@@ -21,8 +21,10 @@
****************************************************************************
*/
-/* Elapsed time package */
-/* This package maintains a clock which is independent of the time of day. It uses the 4.3BSD interval timer (getitimer/setitimer) in TIMER_REAL mode. Any other use of the timer voids this package's warranty. */
+/* Elapsed time package
+ *
+ * A time package that make sure time never goes backwards
+ */
#ifndef _CLOCK_
#define _CLOCK_
@@ -38,7 +40,12 @@
#endif /* ITIMER_REAL */
#endif /* KERNEL */
-/* Some macros to make macros more reasonable (this allows a block to be used within a macro which does not cause if statements to screw up). That is, you can use "if (...) macro_name(); else ...;" without having things blow up on the semi-colon. */
+/*
+ * Some macros to make macros more reasonable (this allows a block to
+ * be used within a macro which does not cause if statements to screw
+ * up). That is, you can use "if (...) macro_name(); else ...;"
+ * without having things blow up on the semi-colon.
+ */
#ifndef BEGIN
#define BEGIN do {
diff --git a/usr.sbin/afs/src/rx/rx_event.c b/usr.sbin/afs/src/rx/rx_event.c
index a1a07e04cb8..91d26da463e 100644
--- a/usr.sbin/afs/src/rx/rx_event.c
+++ b/usr.sbin/afs/src/rx/rx_event.c
@@ -21,7 +21,7 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_event.c,v 1.5 2000/09/04 03:59:54 lha Exp $");
+RCSID("$arla: rx_event.c,v 1.6 2003/01/19 08:46:29 lha Exp $");
/*
* All event processing is relative to the apparent current time
@@ -73,7 +73,7 @@ struct rxevent *
rxevent_Post(struct clock * when, void (*func)(), void *arg, void *arg1)
/* when - When event should happen, in clock (clock.h) units */
{
- register struct rxevent *ev, *qe, *qpr;
+ struct rxevent *ev, *qe, *qpr;
#ifdef RXDEBUG
if (Log) {
@@ -93,7 +93,7 @@ rxevent_Post(struct clock * when, void (*func)(), void *arg, void *arg1)
* add them to the free queue
*/
if (queue_IsEmpty(&rxevent_free)) {
- register int i;
+ int i;
#if defined(AFS_AIX32_ENV) && defined(KERNEL)
ev = (struct rxevent *) rxi_Alloc(sizeof(struct rxevent));
@@ -149,7 +149,7 @@ rxevent_Post(struct clock * when, void (*func)(), void *arg, void *arg1)
* event pointer after cancelling the event.
*/
void
-rxevent_Cancel_1(register struct rxevent * ev)
+rxevent_Cancel_1(struct rxevent * ev)
{
#ifdef RXDEBUG
if (Log) {
@@ -183,7 +183,7 @@ rxevent_Cancel_1(register struct rxevent * ev)
int
rxevent_RaiseEvents(struct clock * next)
{
- register struct rxevent *qe;
+ struct rxevent *qe;
struct clock now;
#ifdef RXDEBUG
diff --git a/usr.sbin/afs/src/rx/rx_event.h b/usr.sbin/afs/src/rx/rx_event.h
index ce8d8e9cd47..562b1cd2ac9 100644
--- a/usr.sbin/afs/src/rx/rx_event.h
+++ b/usr.sbin/afs/src/rx/rx_event.h
@@ -81,7 +81,7 @@ struct rxevent *rxevent_Post(struct clock*, void (*)(), void*, void*);
* pending. Also see the warning, above. The event pointer supplied is
* zeroed.
*/
-void rxevent_Cancel_1(register struct rxevent *);
+void rxevent_Cancel_1(struct rxevent *);
#define rxevent_Cancel(event_ptr) \
BEGIN \
diff --git a/usr.sbin/afs/src/rx/rx_globs.c b/usr.sbin/afs/src/rx/rx_globs.c
index d393656d742..7a82d14e901 100644
--- a/usr.sbin/afs/src/rx/rx_globs.c
+++ b/usr.sbin/afs/src/rx/rx_globs.c
@@ -27,4 +27,4 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_globs.c,v 1.5 1998/02/26 14:38:27 art Exp $");
+RCSID("$arla: rx_globs.c,v 1.5 1998/02/26 14:38:27 art Exp $");
diff --git a/usr.sbin/afs/src/rx/rx_globs.h b/usr.sbin/afs/src/rx/rx_globs.h
index 7462e125100..87aa1adea7c 100644
--- a/usr.sbin/afs/src/rx/rx_globs.h
+++ b/usr.sbin/afs/src/rx/rx_globs.h
@@ -1,4 +1,4 @@
-/* $KTH: rx_globs.h,v 1.6 2000/10/08 17:48:15 assar Exp $ */
+/* $arla: rx_globs.h,v 1.10 2003/01/19 08:49:58 lha Exp $ */
/*
****************************************************************************
@@ -43,9 +43,34 @@ EXT struct rx_queue rx_incomingCallQueue;
/* Server processes wait on this queue when there are no appropriate calls to process */
EXT struct rx_queue rx_idleServerQueue;
-/* Constant delay time before sending an acknowledge of the last packet received. This is to avoid sending an extra acknowledge when the client is about to make another call, anyway, or the server is about to respond. */
+/*
+ * Constant delay time before sending an acknowledge of the last
+ * packet received. This is to avoid sending an extra acknowledge
+ * when the client is about to make another call, anyway, or the
+ * server is about to respond.
+ */
EXT struct clock rx_lastAckDelay;
+#ifdef SOFT_ACK
+/*
+ * Constant delay time before sending a hard ack if the receiver
+ * consumes a packet while no delayed ack event is scheduled. Ensures
+ * that the sender is able to advance its window when the receiver
+ * consumes a packet after the sender has exhausted its transmit
+ * window.
+ */
+EXT struct clock rx_hardAckDelay;
+
+/*
+ * Constant delay time before sending a soft ack when none was
+ * requested. This is to make sure we send soft acks before the
+ * sender times out, Normally we wait and send a hard ack when the
+ * receiver consumes the packet
+ */
+EXT struct clock rx_softAckDelay;
+
+#endif /* SOFT_ACK */
+
/* Variable to allow introduction of network unreliability */
#ifdef RXDEBUG
EXT int rx_intentionallyDroppedPacketsPer100 INIT(0); /* Dropped on Send */
@@ -77,12 +102,17 @@ EXT int rx_idlePeerTime INIT(60); /* Time until we toss a peer
* every 60 seconds */
#endif
+#ifdef SOFT_ACK
+#define RX_FAST_ACK_RATE 1
+
+EXT int rxi_SoftAckRate INIT(RX_FAST_ACK_RATE);
+EXT int rxi_HardAckRate INIT(RX_FAST_ACK_RATE + 1);
+
+#endif /* SOFT_ACK */
+
EXT int rx_Window INIT(15); /* Temporary HACK: transmit/receive
* window */
-EXT int rx_ACKHACK INIT(4); /* Temporary HACK: how often to send
- * request for acknowledge */
-
-#define ACKHACK(p) ((((p)->header.seq & 3)==0) && ((p)->header.flags |= RX_REQUEST_ACK))
+EXT int rx_initialWindow INIT(2); /* "Slow start" with 2 packets */
EXT int rx_nPackets INIT(100); /* obsolete; use rx_extraPackets now */
@@ -108,14 +138,8 @@ EXT int rx_nWaiting INIT(0);
* IS RUNNING! */
EXT u_long rx_maxReceiveSize INIT(OLD_MAX_PACKET_SIZE);
-#if (defined(AFS_SUN5_ENV) || defined(AFS_AOS_ENV)) && defined(KERNEL)
EXT u_long rx_MyMaxSendSize INIT(OLD_MAX_PACKET_SIZE - RX_HEADER_SIZE);
-#else
-EXT u_long rx_MyMaxSendSize INIT(RX_MAX_PACKET_DATA_SIZE);
-
-#endif
-
/* List of free queue entries */
EXT struct rx_serverQueueEntry *rx_FreeSQEList INIT(0);
@@ -138,7 +162,7 @@ EXT long rxi_nCalls INIT(0);
EXT osi_socket rx_socket;
/* Port requested at rx_Init. If this is zero, the actual port used will be different--but it will only be used for client operations. If non-zero, server provided services may use the same port. */
-EXT u_short rx_port;
+EXT uint16_t rx_port;
/* This is actually the minimum number of packets that must remain free,
overall, immediately after a packet of the requested class has been
@@ -151,7 +175,7 @@ EXT u_short rx_port;
EXT int rx_packetQuota[RX_N_PACKET_CLASSES] INIT(RX_PACKET_QUOTAS);
EXT int rx_nextCid; /* Next connection call id */
-EXT int rx_epoch; /* Initialization time of rx */
+EXT uint32_t rx_epoch; /* Initialization time of rx */
#ifdef RX_ENABLE_LOCKS
EXT kmutex_t rx_waitingForPackets_lock;
@@ -188,28 +212,29 @@ EXT u_long rx_hashTableMask INIT(255); /* One less than rx_hashTableSize */
#define rxi_FreeConnection(conn) (rxi_Free(conn, sizeof(struct rx_connection)))
/* Forward definitions of internal procedures */
-struct rx_packet *rxi_AllocPacket(int);
-struct rx_packet *rxi_AllocSendPacket(struct rx_call *, int);
-char *rxi_Alloc(int);
-struct rx_peer *rxi_FindPeer(u_long, u_short);
-struct rx_call *rxi_NewCall(struct rx_connection *, int);
-void rxi_FreeCall(struct rx_call *);
-void rxi_Listener(void);
-int rxi_ReadPacket(int, struct rx_packet *, u_long *, u_short *);
-struct rx_packet *rxi_ReceivePacket(struct rx_packet *, osi_socket,
- u_long, u_short);
-struct rx_packet *rxi_ReceiveDataPacket(struct rx_call *,
- struct rx_packet *);
-struct rx_packet *rxi_ReceiveAckPacket(struct rx_call *,
- struct rx_packet *);
-struct rx_packet *rxi_ReceiveResponsePacket(struct rx_connection *,
- struct rx_packet *);
-struct rx_packet *rxi_ReceiveChallengePacket(struct rx_connection *,
+struct rx_packet * rxi_AllocPacket(int);
+struct rx_packet * rxi_AllocSendPacket(struct rx_call *, int);
+void * rxi_Alloc(int);
+struct rx_peer * rxi_FindPeer(uint32_t, uint16_t);
+struct rx_call * rxi_NewCall(struct rx_connection *, int);
+void rxi_FreeCall(struct rx_call *);
+void rxi_Listener(void);
+int rxi_ReadPacket(int, struct rx_packet *,
+ uint32_t *, uint16_t *);
+struct rx_packet * rxi_ReceivePacket(struct rx_packet *, osi_socket,
+ uint32_t, uint16_t);
+struct rx_packet * rxi_ReceiveDataPacket(struct rx_call *,
+ struct rx_packet *);
+struct rx_packet * rxi_ReceiveAckPacket(struct rx_call *,
struct rx_packet *);
-void rx_ServerProc(void);
-void rxi_AttachServerProc(struct rx_call *);
-void rxi_ChallengeOn(struct rx_connection *);
-void rxi_InitPeerParams(struct rx_peer *);
+struct rx_packet * rxi_ReceiveResponsePacket(struct rx_connection *,
+ struct rx_packet *);
+struct rx_packet * rxi_ReceiveChallengePacket(struct rx_connection *,
+ struct rx_packet *);
+void rx_ServerProc(void);
+void rxi_AttachServerProc(struct rx_call *);
+void rxi_ChallengeOn(struct rx_connection *);
+void rxi_InitPeerParams(struct rx_peer *);
#define rxi_ChallengeOff(conn) rxevent_Cancel((conn)->challengeEvent);
@@ -254,7 +279,7 @@ void rxi_DebugPrint(const char *, ...);
void rxi_PrepareSendPacket(struct rx_call *,
struct rx_packet *, int);
void rxi_MoreCbufs(int);
-long rx_SlowGetLong(struct rx_packet *, int);
+uint32_t rx_SlowGetLong(struct rx_packet *, int);
void rxi_Send(struct rx_call *, struct rx_packet *);
void rxi_FreeAllPackets(void);
@@ -262,10 +287,10 @@ void rxi_SendPacket(struct rx_connection *,
struct rx_packet *);
int rxi_IsConnInteresting(struct rx_connection *);
struct rx_packet *rxi_ReceiveDebugPacket(struct rx_packet *, osi_socket,
- long, short);
+ uint32_t, uint16_t);
struct rx_packet *rxi_ReceiveVersionPacket(struct rx_packet *, osi_socket,
- long, short);
-void rxi_SendDebugPacket(struct rx_packet *, osi_socket, long, short);
+ uint32_t, uint16_t);
+void rxi_SendDebugPacket(struct rx_packet *, osi_socket, uint32_t, uint16_t);
#ifdef RXDEBUG
@@ -274,7 +299,7 @@ EXT FILE *rx_debugFile; /* Set by the user to a stdio file for
* debugging output */
#define Log rx_debugFile
-#define dpf(args) if (rx_debugFile) rxi_DebugPrint args; else
+#define dpf(args) do { if (rx_debugFile) rxi_DebugPrint args; } while(0)
EXT char *rx_packetTypes[RX_N_PACKET_TYPES] INIT(RX_PACKET_TYPES); /* Strings defined in
* rx.h */
diff --git a/usr.sbin/afs/src/rx/rx_kern.h b/usr.sbin/afs/src/rx/rx_kern.h
index b6830817161..75d443074a1 100644
--- a/usr.sbin/afs/src/rx/rx_kern.h
+++ b/usr.sbin/afs/src/rx/rx_kern.h
@@ -1,4 +1,4 @@
-/* $KTH: rx_kern.h,v 1.3 1998/02/22 19:46:53 joda Exp $ */
+/* $arla: rx_kern.h,v 1.4 2003/01/19 08:47:23 lha Exp $ */
/*
****************************************************************************
@@ -42,7 +42,7 @@ extern int (*rxk_PacketArrivalProc) ();
#define NETPRI
#define USERPRI
#else
-#define SPLVAR register int splvar
+#define SPLVAR int splvar
#define NETPRI splvar=splnet()
#define USERPRI splx(splvar)
#endif
diff --git a/usr.sbin/afs/src/rx/rx_locl.h b/usr.sbin/afs/src/rx/rx_locl.h
index f75062fd2f9..a5de316b9b0 100644
--- a/usr.sbin/afs/src/rx/rx_locl.h
+++ b/usr.sbin/afs/src/rx/rx_locl.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: rx_locl.h,v 1.6 2000/10/03 00:41:28 lha Exp $ */
+/* $arla: rx_locl.h,v 1.7 2002/12/20 12:52:14 lha Exp $ */
#ifndef __RX_LOCL_H__
#define __RX_LOCL_H__
@@ -79,10 +79,6 @@ struct rtentry;
#include <sys/sysmacros.h> /* ??? */
#endif
-#ifdef USE_MMAPTIME
-#include <mmaptime.h>
-#endif
-
#include <roken.h>
#include "rx_mach.h"
diff --git a/usr.sbin/afs/src/rx/rx_mach.h b/usr.sbin/afs/src/rx/rx_mach.h
index eff36b7746e..7af2168a849 100644
--- a/usr.sbin/afs/src/rx/rx_mach.h
+++ b/usr.sbin/afs/src/rx/rx_mach.h
@@ -1,7 +1,7 @@
#ifndef _RX_MACHDEP_
#define _RX_MACHDEP_
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_mach.h,v 1.3 1998/03/29 01:25:32 assar Exp $ */
+/* $I$d$ */
/*
****************************************************************************
* Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
@@ -69,17 +69,17 @@ extern kmutex_t afs_rxglobal_lock;
extern kmutex_t afs_termStateLock;
extern kcondvar_t afs_termStateCv;
-#define MUTEX_DESTROY(a) mutex_destroy(a)
-#define MUTEX_ENTER(a) mutex_enter(a)
-#define MUTEX_EXIT(a) mutex_exit(a)
-#define MUTEX_INIT(a,b,c,d) mutex_init(a,b,c,d)
+#define RX_MUTEX_DESTROY(a) mutex_destroy(a)
+#define RX_MUTEX_ENTER(a) mutex_enter(a)
+#define RX_MUTEX_EXIT(a) mutex_exit(a)
+#define RX_MUTEX_INIT(a,b,c,d) mutex_init(a,b,c,d)
#else
#define MObtainWriteLock(a)
#define MReleaseWriteLock(a)
-#define MUTEX_DESTROY(a)
-#define MUTEX_ENTER(a)
-#define MUTEX_EXIT(a)
-#define MUTEX_INIT(a,b,c,d)
+#define RX_MUTEX_DESTROY(a)
+#define RX_MUTEX_ENTER(a)
+#define RX_MUTEX_EXIT(a)
+#define RX_MUTEX_INIT(a,b,c,d)
#endif
#ifndef AFS_AIX32_ENV
diff --git a/usr.sbin/afs/src/rx/rx_misc.c b/usr.sbin/afs/src/rx/rx_misc.c
index a36e253f1d3..03d35fffab4 100644
--- a/usr.sbin/afs/src/rx/rx_misc.c
+++ b/usr.sbin/afs/src/rx/rx_misc.c
@@ -1,6 +1,6 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_misc.c,v 1.4 1998/02/22 19:47:15 joda Exp $");
+RCSID("$arla: rx_misc.c,v 1.6 2003/06/10 16:55:01 lha Exp $");
/*
* We currently only include below the errors that
@@ -12,10 +12,10 @@ RCSID("$KTH: rx_misc.c,v 1.4 1998/02/22 19:47:15 joda Exp $");
* Convert from the local (host) to the standard
* (network) system error code.
*/
-int
-hton_syserr_conv(long code)
+uint32_t
+hton_syserr_conv(uint32_t code)
{
- register long err;
+ uint32_t err;
#if 0
if (code == ENOSPC)
@@ -36,10 +36,10 @@ hton_syserr_conv(long code)
* Convert from the standard (Network) format to the
* local (host) system error code.
*/
-int
-ntoh_syserr_conv(long code)
+uint32_t
+ntoh_syserr_conv(uint32_t code)
{
- register long err;
+ uint32_t err;
#if 0
if (code == VDISKFULL)
@@ -55,37 +55,3 @@ ntoh_syserr_conv(long code)
err = code;
return err;
}
-
-
-#ifndef KERNEL
-/*
- * We provide the following because some systems (like aix) would fail if we
- * pass 0 as length.
- */
-
-#ifndef osi_alloc
-static char memZero;
-
-char *
-osi_alloc(long x)
-{
-
- /*
- * 0-length allocs may return NULL ptr from osi_kalloc, so we
- * special-case things so that NULL returned iff an error occurred
- */
- if (x == 0)
- return &memZero;
- return (char *) malloc(x);
-}
-
-void
-osi_free(char *x, long size)
-{
- if (x == &memZero)
- return;
- free(x);
-}
-
-#endif
-#endif /* KERNEL */
diff --git a/usr.sbin/afs/src/rx/rx_misc.h b/usr.sbin/afs/src/rx/rx_misc.h
index a3312dff56f..c32f4f70357 100644
--- a/usr.sbin/afs/src/rx/rx_misc.h
+++ b/usr.sbin/afs/src/rx/rx_misc.h
@@ -31,12 +31,12 @@
* SUCH DAMAGE.
*/
-/* $KTH: rx_misc.h,v 1.2 2000/10/03 00:41:33 lha Exp $ */
+/* $arla: rx_misc.h,v 1.3 2003/01/19 08:50:01 lha Exp $ */
#ifndef __RX_MISC_H
#define __RX_MISC_H
-int ntoh_syserr_conv(register long code);
-int hton_syserr_conv(register long code);
+uint32_t ntoh_syserr_conv(uint32_t code);
+uint32_t hton_syserr_conv(uint32_t code);
char *osi_alloc(long);
void osi_free(char *, long);
diff --git a/usr.sbin/afs/src/rx/rx_multi.c b/usr.sbin/afs/src/rx/rx_multi.c
index 15596d45516..07fe1616606 100644
--- a/usr.sbin/afs/src/rx/rx_multi.c
+++ b/usr.sbin/afs/src/rx/rx_multi.c
@@ -21,7 +21,7 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_multi.c,v 1.6 2000/03/03 08:56:12 assar Exp $");
+RCSID("$arla: rx_multi.c,v 1.6 2000/03/03 08:56:12 assar Exp $");
/* multi.c and multi.h, together with some rxgen hooks, provide a way of making multiple, but similar, rx calls to multiple hosts simultaneously */
diff --git a/usr.sbin/afs/src/rx/rx_multi.h b/usr.sbin/afs/src/rx/rx_multi.h
index 77026994272..da3bf667abc 100644
--- a/usr.sbin/afs/src/rx/rx_multi.h
+++ b/usr.sbin/afs/src/rx/rx_multi.h
@@ -1,4 +1,4 @@
-/* $KTH: rx_multi.h,v 1.3 1998/02/22 19:48:23 joda Exp $ */
+/* $arla: rx_multi.h,v 1.4 2003/01/19 08:48:22 lha Exp $ */
/*
****************************************************************************
@@ -53,9 +53,9 @@ multi_Select (struct multi_handle *);
#define multi_Rx(conns, nConns) \
do {\
- register struct multi_handle *multi_h;\
- register int multi_i;\
- register struct rx_call *multi_call;\
+ struct multi_handle *multi_h;\
+ int multi_i;\
+ struct rx_call *multi_call;\
multi_h = multi_Init(conns, nConns);\
for (multi_i = 0; multi_i < nConns; multi_i++)
@@ -65,7 +65,7 @@ multi_Select (struct multi_handle *);
rx_FlushWrite(multi_call);\
}\
while ((multi_i = multi_Select(multi_h)) >= 0) {\
- register long multi_error;\
+ uint32_t multi_error;\
multi_call = multi_h->calls[multi_i];\
multi_error = rx_EndCall(multi_call, endProc);\
multi_h->calls[multi_i] = (struct rx_call *) 0
diff --git a/usr.sbin/afs/src/rx/rx_null.c b/usr.sbin/afs/src/rx/rx_null.c
index 4203ddddc85..044be70e3da 100644
--- a/usr.sbin/afs/src/rx/rx_null.c
+++ b/usr.sbin/afs/src/rx/rx_null.c
@@ -22,7 +22,7 @@
#include "rx_locl.h"
#include "rx_null.h"
-RCSID("$KTH: rx_null.c,v 1.4 1999/12/31 05:42:06 assar Exp $");
+RCSID("$arla: rx_null.c,v 1.4 1999/12/31 05:42:06 assar Exp $");
/* The null security object. No authentication, no nothing. */
diff --git a/usr.sbin/afs/src/rx/rx_null.h b/usr.sbin/afs/src/rx/rx_null.h
index 4b6bc9cbe76..23be406faab 100644
--- a/usr.sbin/afs/src/rx/rx_null.h
+++ b/usr.sbin/afs/src/rx/rx_null.h
@@ -1,5 +1,5 @@
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_null.h,v 1.3 1998/01/28 04:54:19 art Exp $ */
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_null.h,v $ */
+/* $arla: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_null.h,v 1.3 1998/01/28 04:54:19 art Exp $ */
+/* $arla: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_null.h,v $ */
/*
****************************************************************************
diff --git a/usr.sbin/afs/src/rx/rx_pkt.c b/usr.sbin/afs/src/rx/rx_pkt.c
index 1750e0d7c96..80beac988f3 100644
--- a/usr.sbin/afs/src/rx/rx_pkt.c
+++ b/usr.sbin/afs/src/rx/rx_pkt.c
@@ -1,6 +1,6 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_pkt.c,v 1.15.2.1 2001/07/05 23:16:53 lha Exp $");
+RCSID("$arla: rx_pkt.c,v 1.22 2003/04/08 22:15:08 lha Exp $");
struct rx_packet *rx_mallocedP = 0;
struct rx_cbuf *rx_mallocedC = 0;
@@ -27,14 +27,14 @@ extern int (*rx_almostSent) ();
* offset is an integral multiple of the word size.
*/
-long
+uint32_t
rx_SlowGetLong(struct rx_packet *packet, int offset)
{
int i, l;
for (l = 0, i = 1; i < packet->niovecs; i++) {
if (l + packet->wirevec[i].iov_len > offset) {
- return *((u_int32_t *)
+ return *((uint32_t *)
((char *)packet->wirevec[i].iov_base + (offset - l)));
}
l += packet->wirevec[i].iov_len;
@@ -48,20 +48,19 @@ rx_SlowGetLong(struct rx_packet *packet, int offset)
* size.
* offset is an integral multiple of the word size.
*/
-long
-rx_SlowPutLong(struct rx_packet *packet, int offset, long data)
+int
+rx_SlowPutLong(struct rx_packet *packet, int offset, uint32_t data)
{
int i, l;
for (l = 0, i = 1; i < packet->niovecs; i++) {
if (l + packet->wirevec[i].iov_len > offset) {
- *((u_int32_t *) ((char *)packet->wirevec[i].iov_base + (offset - l))) = data;
+ *((uint32_t *) ((char *)packet->wirevec[i].iov_base + (offset - l))) = data;
return 0;
}
l += packet->wirevec[i].iov_len;
}
-
- return 0;
+ return 1;
}
/*
@@ -164,9 +163,13 @@ allocCBuf(void)
MObtainWriteLock(&rx_freePktQ_lock);
if (queue_IsEmpty(&rx_freeCbufQueue)) {
+#ifdef KERNEL
c = NULL;
rxi_NeedMoreCbufs = TRUE;
goto done;
+#else /* KERNEL */
+ rxi_MoreCbufs(rx_Window);
+#endif /* KERNEL */
}
rx_nFreeCbufs--;
c = queue_First(&rx_freeCbufQueue, rx_cbuf);
@@ -175,7 +178,9 @@ allocCBuf(void)
queue_Remove(c);
+#ifdef KERNEL
done:
+#endif
MReleaseWriteLock(&rx_freePktQ_lock);
USERPRI;
@@ -525,7 +530,7 @@ rxi_AllocSendPacket(struct rx_call *call, int want)
* later, as packets are acknowledged, and so we just wait.
*/
NETPRI;
- MUTEX_ENTER(&rx_waitingForPackets_lock);
+ RX_MUTEX_ENTER(&rx_waitingForPackets_lock);
rx_waitingForPackets = 1;
call->flags |= RX_CALL_WAIT_PACKETS;
@@ -535,7 +540,7 @@ rxi_AllocSendPacket(struct rx_call *call, int want)
osi_rxSleep(&rx_waitingForPackets);
#endif
call->flags &= ~RX_CALL_WAIT_PACKETS;
- MUTEX_EXIT(&rx_waitingForPackets_lock);
+ RX_MUTEX_EXIT(&rx_waitingForPackets_lock);
USERPRI;
}
@@ -570,7 +575,7 @@ CountFDs(int amax)
*/
int
rxi_ReadPacket(int socket, struct rx_packet *p,
- u_long *host, u_short *port)
+ uint32_t *host, uint16_t *port)
{
struct sockaddr_in from;
int nbytes;
@@ -578,7 +583,7 @@ rxi_ReadPacket(int socket, struct rx_packet *p,
long tlen;
long _tlen;
struct msghdr msg;
- u_int32_t dummy; /* was using rlen but had aliasing
+ uint32_t dummy; /* was using rlen but had aliasing
* problems */
rx_computelen(p, tlen);
@@ -684,11 +689,12 @@ osi_NetSend(osi_socket socket, char *addr, struct iovec *dvec,
if (errno != EWOULDBLOCK
&& errno != ENOBUFS
&& errno != ECONNREFUSED) {
- (osi_Msg "rx failed to send packet: ");
- perror("rx_send"); /* translates the message to English */
+ osi_Msg(("rx failed to send packet: %s ", strerror(errno)));
return 3;
}
+ dpf(("rx_send failed with %d\n", errno));
+
FD_ZERO(&sfds);
if (socket >= FD_SETSIZE)
osi_Panic("osi_NetSend: fd too large");
@@ -849,7 +855,7 @@ rx_mb_to_packet(char *amb, void (*free)(), int hdr_len, int data_len,
struct rx_packet *
rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket,
- long ahost, short aport)
+ uint32_t ahost, uint16_t aport)
{
struct rx_debugIn tin;
long tl;
@@ -952,7 +958,7 @@ rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket,
DOHTONL(bytesReceived);
DOHTONL(bytesSent);
for (i = 0;
- i < sizeof(tconn.secStats.spares) / sizeof(short);
+ i < sizeof(tconn.secStats.spares) / sizeof(int16_t);
i++)
DOHTONS(spares[i]);
for (i = 0;
@@ -981,7 +987,7 @@ rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket,
case RX_DEBUGI_RXSTATS:{
int i;
- u_int32_t *s;
+ uint32_t *s;
tl = sizeof(rx_stats) - ap->length;
if (tl > 0)
@@ -990,9 +996,9 @@ rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket,
return ap;
/* Since its all longs convert to network order with a loop. */
- s = (u_int32_t *) &rx_stats;
+ s = (uint32_t *) &rx_stats;
for (i = 0; i < sizeof(rx_stats) / 4; i++, s++)
- rx_PutLong(ap, i * 4, htonl(*s));
+ rx_SlowPutLong(ap, i * 4, htonl(*s));
tl = ap->length;
ap->length = sizeof(rx_stats);
@@ -1017,7 +1023,7 @@ rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket,
struct rx_packet *
rxi_ReceiveVersionPacket(struct rx_packet *ap, osi_socket asocket,
- long ahost, short aport)
+ uint32_t ahost, uint16_t aport)
{
long tl;
@@ -1033,7 +1039,7 @@ rxi_ReceiveVersionPacket(struct rx_packet *ap, osi_socket asocket,
/* send a debug packet back to the sender */
void
rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket,
- long ahost, short aport)
+ uint32_t ahost, uint16_t aport)
{
struct sockaddr_in taddr;
int i = 0;
@@ -1271,7 +1277,7 @@ rxi_SendSpecial(struct rx_call *call,
static void
-put32 (unsigned char **p, u_int32_t u)
+put32 (unsigned char **p, uint32_t u)
{
(*p)[0] = (u >> 24) & 0xFF;
(*p)[1] = (u >> 16) & 0xFF;
@@ -1280,10 +1286,10 @@ put32 (unsigned char **p, u_int32_t u)
(*p) += 4;
}
-static u_int32_t
+static uint32_t
get32 (unsigned char **p)
{
- u_int32_t u;
+ uint32_t u;
u = ((*p)[0] << 24) | ((*p)[1] << 16) | ((*p)[2] << 8) | (*p)[3];
(*p) += 4;
@@ -1318,7 +1324,7 @@ void
rxi_DecodePacketHeader(struct rx_packet *p)
{
unsigned char *buf = (unsigned char *)p->wirevec[0].iov_base;
- u_int32_t temp;
+ uint32_t temp;
p->header.epoch = get32(&buf);
p->header.cid = get32(&buf);
diff --git a/usr.sbin/afs/src/rx/rx_pkt.h b/usr.sbin/afs/src/rx/rx_pkt.h
index 60d0768e0d5..ae14a866068 100644
--- a/usr.sbin/afs/src/rx/rx_pkt.h
+++ b/usr.sbin/afs/src/rx/rx_pkt.h
@@ -126,6 +126,10 @@
* greater than this one, rather than
* a resend of an earlier sequence
* number */
+#define RX_SLOW_START_OK 32 /* Set this flag in an ack
+ * packet to inform the sender
+ * that slow start is supported
+ * by the receiver. */
/* The following flags are preset per packet, i.e. they don't change
* on retransmission of the packet */
@@ -134,12 +138,12 @@
/* The rx part of the header of a packet, in host form */
struct rx_header {
- u_int32_t epoch; /* Start time of client process */
- u_int32_t cid; /* Connection id (defined by client) */
- u_int32_t callNumber; /* Current call number */
- u_int32_t seq; /* Sequence number of this packet,
+ uint32_t epoch; /* Start time of client process */
+ uint32_t cid; /* Connection id (defined by client) */
+ uint32_t callNumber; /* Current call number */
+ uint32_t seq; /* Sequence number of this packet,
* within this call */
- u_int32_t serial; /* Serial number of this packet: a new
+ uint32_t serial; /* Serial number of this packet: a new
* serial number is stamped on each
* packet sent out */
u_char type; /* RX packet type */
@@ -188,17 +192,16 @@ struct rx_packet {
* re-transmitted */
struct clock timeSent; /* When this packet was transmitted
* last */
- u_int32_t firstSerial; /* Original serial number of this
+ uint32_t firstSerial; /* Original serial number of this
* packet */
struct clock firstSent; /* When this packet was transmitted
* first */
struct rx_header header; /* The internal packet header */
int niovecs;
struct iovec wirevec[RX_MAXWVECS + 1]; /* the new form of the packet */
- /* should be `u_long' here /joda */
u_long wirehead[RX_HEADER_SIZE / sizeof(u_long)+1 ];
u_long localdata[RX_FIRSTBUFFERSIZE / sizeof(u_long)+1];
- u_int32_t dummy;
+ uint32_t dummy;
u_char acked; /* This packet has been *tentatively*
* acknowledged */
u_char backoff; /* for multiple re-sends */
@@ -207,7 +210,6 @@ struct rx_packet {
struct rx_cbuf {
struct rx_queue queueItemHeader;
- /* `u_long' is correct /joda */
u_long data[(RX_CBUFFERSIZE / sizeof(u_long)) + 1];
};
@@ -233,17 +235,9 @@ struct rx_cbuf {
#define rxi_OverQuota(packetclass) (rx_nFreePackets - 1 < rx_packetQuota[packetclass])
-/* this returns a long from byte offset o in packet p. offset must
- * always be aligned properly for a long, I'm leaving this up to the
- * caller. */
-#define rx_GetLong(p,off) (( (off) >= (p)->wirevec[1].iov_len) ? \
- rx_SlowGetLong((p), (off)) : \
- *((u_int32_t *)((char *)(p)->wirevec[1].iov_base + (off))))
-
-#define rx_PutLong(p,off,b) { \
- if ((off) >= (p)->wirevec[1].iov_len) \
- rx_SlowPutLong((p), (off), (b)); \
- else *((u_int32_t *)((char *)(p)->wirevec[1].iov_base + (off))) = b; }
+/* compat stuff */
+#define rx_GetLong(p,off) rx_SlowGetLong((p), (off))
+#define rx_PutLong(p,off,b) rx_SlowPutLong((p), (off), (b))
#define rx_data(p, o, l) ((l=((struct rx_packet*)(p))->wirevec[(o+1)].iov_len),\
(((struct rx_packet*)(p))->wirevec[(o+1)].iov_base))
@@ -252,14 +246,14 @@ struct rx_cbuf {
struct rx_packet *rx_AllocPacket(void);
void rxi_MorePackets(int);
void rx_CheckCbufs(unsigned long);
-void rxi_FreePacket(register struct rx_packet *);
+void rxi_FreePacket(struct rx_packet *);
int rxi_AllocDataBuf(struct rx_packet *, int);
size_t rx_SlowReadPacket(struct rx_packet*, int, int, void*);
size_t rx_SlowWritePacket(struct rx_packet*, int, int, void*);
int rxi_RoundUpPacket(struct rx_packet *, unsigned int);
-long rx_SlowGetLong(struct rx_packet *packet, int offset);
-long rx_SlowPutLong(struct rx_packet *packet, int offset, long data);
+uint32_t rx_SlowGetLong(struct rx_packet *packet, int offset);
+int rx_SlowPutLong(struct rx_packet *packet, int offset, uint32_t data);
int rxi_FreeDataBufs(struct rx_packet *p, int first);
int osi_NetSend(osi_socket socket, char *addr, struct iovec *dvec,
@@ -277,7 +271,7 @@ int osi_NetSend(osi_socket socket, char *addr, struct iovec *dvec,
rx_SlowReadPacket(p, off, len, out) : \
((memcpy((out), (char *)((p)->wirevec[1].iov_base)+(off), len)),0))
-#define rx_computelen(p,l) { register int i; \
+#define rx_computelen(p,l) { int i; \
for (l=0, i=1; i < p->niovecs; i++ ) l += p->wirevec[i].iov_len; }
/* return what the actual contiguous space is: should be min(length,size) */
@@ -293,7 +287,7 @@ int osi_NetSend(osi_socket socket, char *addr, struct iovec *dvec,
/* Unfortunately, they know that the cbuf stuff isn't there. */
/* try to ensure that rx_DataOf will return a contiguous space at
- * least size bytes long */
+ * least size bytes uint32_t */
/* return what the actual contiguous space is: should be min(length,size) */
#define rx_Pullup(p,size) /* this idea here is that this will
* make a guarantee */
diff --git a/usr.sbin/afs/src/rx/rx_queue.h b/usr.sbin/afs/src/rx/rx_queue.h
index db109e0c883..eadc1e1131e 100644
--- a/usr.sbin/afs/src/rx/rx_queue.h
+++ b/usr.sbin/afs/src/rx/rx_queue.h
@@ -1,5 +1,5 @@
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_queue.h,v 1.4 2000/10/02 21:08:29 haba Exp $ */
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_queue.h,v $ */
+/* $arla: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_queue.h,v 1.4 2000/10/02 21:08:29 haba Exp $ */
+/* $arla: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_queue.h,v $ */
/*
****************************************************************************
diff --git a/usr.sbin/afs/src/rx/rx_rdwr.c b/usr.sbin/afs/src/rx/rx_rdwr.c
index d570c74d432..fa9526efae3 100644
--- a/usr.sbin/afs/src/rx/rx_rdwr.c
+++ b/usr.sbin/afs/src/rx/rx_rdwr.c
@@ -1,44 +1,9 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_rdwr.c,v 1.5 1999/11/18 01:51:18 assar Exp $");
+RCSID("$arla: rx_rdwr.c,v 1.9 2002/12/15 11:45:19 lha Exp $");
-#ifdef AFS_SGIMP_ENV
int
-rx_Read(struct rx_call *call, char *buf, int nbytes)
-{
- int rv;
-
- SPLVAR;
- GLOCKSTATE ms;
-
- NETPRI;
- AFS_GRELEASE(&ms);
- rv = rx_ReadProc(call, buf, nbytes);
- AFS_GACQUIRE(&ms);
- USERPRI;
- return rv;
-}
-
-int
-rx_Write(struct rx_call *call, char *buf, int nbytes)
-{
- int rv;
-
- SPLVAR;
- GLOCKSTATE ms;
-
- NETPRI;
- AFS_GRELEASE(&ms);
- rv = rx_WriteProc(call, buf, nbytes);
- AFS_GACQUIRE(&ms);
- USERPRI;
- return rv;
-}
-
-#endif
-
-int
-rx_ReadProc(struct rx_call *call, void *vbuf, int nbytes)
+rx_Read(struct rx_call *call, void *vbuf, int nbytes)
{
struct rx_packet *rp;
int requestCount;
@@ -50,7 +15,7 @@ rx_ReadProc(struct rx_call *call, void *vbuf, int nbytes)
NETPRI;
GLOBAL_LOCK();
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
while (nbytes) {
if (call->nLeft == 0) {
@@ -58,7 +23,7 @@ rx_ReadProc(struct rx_call *call, void *vbuf, int nbytes)
for (;;) {
if (call->error || (call->mode != RX_MODE_RECEIVING)) {
if (call->error) {
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return 0;
@@ -95,7 +60,7 @@ rx_ReadProc(struct rx_call *call, void *vbuf, int nbytes)
rp = rxi_SendConnectionAbort(conn, rp);
rxi_FreePacket(rp);
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return 0;
@@ -135,14 +100,17 @@ rx_ReadProc(struct rx_call *call, void *vbuf, int nbytes)
* loser
*/
-#ifndef ADAPT_WINDOW
- if (call->rnext > (call->lastAcked + (rx_Window >> 1)))
-#else /* ADAPT_WINDOW */
- if (call->rnext > (call->lastAcked +
- (call->conn->peer->maxWindow >> 1)))
-#endif /* ADAPT_WINDOW */
{
- rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_DELAY);
+ int ack_window;
+
+#ifdef ADAPT_WINDOW
+ ack_window = call->conn->peer->maxWindow >> 1;
+#else /* !ADAPT_WINDOW */
+ ack_window = rx_Window >> 1;
+#endif/* ADAPT_WINDOW */
+
+ if (call->rnext > (call->lastAcked + ack_window))
+ rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_DELAY);
}
break;
}
@@ -152,7 +120,7 @@ MTUXXX doesn't there need to be an "else" here ???
*/
/* Are there ever going to be any more packets? */
if (call->flags & RX_CALL_RECEIVE_DONE) {
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return requestCount - nbytes;
@@ -162,16 +130,16 @@ MTUXXX doesn't there need to be an "else" here ???
clock_NewTime();
call->startWait = clock_Sec();
- MUTEX_EXIT(&call->lock);
- MUTEX_ENTER(&call->lockq);
+ RX_MUTEX_EXIT(&call->lock);
+ RX_MUTEX_ENTER(&call->lockq);
#ifdef RX_ENABLE_LOCKS
while (call->flags & RX_CALL_READER_WAIT)
cv_wait(&call->cv_rq, &call->lockq);
#else
osi_rxSleep(&call->rq);
#endif
- MUTEX_EXIT(&call->lockq);
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_EXIT(&call->lockq);
+ RX_MUTEX_ENTER(&call->lock);
call->startWait = 0;
}
@@ -233,7 +201,7 @@ MTUXXX doesn't there need to be an "else" here ???
}
if (nbytes == 0) {
/* user buffer is full, return */
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return requestCount;
@@ -242,14 +210,14 @@ MTUXXX doesn't there need to be an "else" here ???
} /* while (nbytes) ... */
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return requestCount;
}
int
-rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
+rx_Write(struct rx_call *call, const void *vbuf, int nbytes)
{
struct rx_connection *conn = call->conn;
int requestCount = nbytes;
@@ -258,7 +226,7 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
SPLVAR;
GLOBAL_LOCK();
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_ENTER(&call->lock);
NETPRI;
if (call->mode != RX_MODE_SENDING) {
if ((conn->type == RX_SERVER_CONNECTION)
@@ -271,7 +239,7 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
call->nFree = 0;
}
} else {
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return 0;
@@ -305,8 +273,8 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
clock_NewTime();
call->startWait = clock_Sec();
- MUTEX_EXIT(&call->lock);
- MUTEX_ENTER(&call->lockw);
+ RX_MUTEX_EXIT(&call->lock);
+ RX_MUTEX_ENTER(&call->lockw);
#ifdef RX_ENABLE_LOCKS
cv_wait(&call->cv_twind, &call->lockw);
@@ -314,8 +282,8 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
call->flags |= RX_CALL_WAIT_WINDOW_ALLOC;
osi_rxSleep(&call->twind);
#endif
- MUTEX_EXIT(&call->lockw);
- MUTEX_ENTER(&call->lock);
+ RX_MUTEX_EXIT(&call->lockw);
+ RX_MUTEX_ENTER(&call->lock);
call->startWait = 0;
}
@@ -335,7 +303,7 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
rxi_FreePacket(call->currentPacket);
call->currentPacket = NULL;
}
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return 0;
@@ -385,7 +353,10 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
if (mud > len) {
int want;
- want = MIN(nbytes, mud - len);
+ if (nbytes)
+ want = MIN(nbytes, mud - len);
+ else
+ want = mud - len;
rxi_AllocDataBuf(cp, want);
if (cp->length > mud)
cp->length = mud;
@@ -398,7 +369,7 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
*/
/* might be out of space now */
if (!nbytes) {
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return requestCount;
@@ -409,7 +380,7 @@ rx_WriteProc(struct rx_call *call, const void *vbuf, int nbytes)
}
} while (nbytes);
- MUTEX_EXIT(&call->lock);
+ RX_MUTEX_EXIT(&call->lock);
GLOBAL_UNLOCK();
USERPRI;
return requestCount - nbytes;
diff --git a/usr.sbin/afs/src/rx/rx_strm.h b/usr.sbin/afs/src/rx/rx_strm.h
index 849cfb16847..d44edc28123 100644
--- a/usr.sbin/afs/src/rx/rx_strm.h
+++ b/usr.sbin/afs/src/rx/rx_strm.h
@@ -1,5 +1,5 @@
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_strm.h,v 1.3 1998/02/22 19:54:23 joda Exp $ */
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_strm.h,v $ */
+/* $arla: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_strm.h,v 1.3 1998/02/22 19:54:23 joda Exp $ */
+/* $arla: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_strm.h,v $ */
/*
****************************************************************************
diff --git a/usr.sbin/afs/src/rx/rx_trace.c b/usr.sbin/afs/src/rx/rx_trace.c
index 64361004370..54e9b236746 100644
--- a/usr.sbin/afs/src/rx/rx_trace.c
+++ b/usr.sbin/afs/src/rx/rx_trace.c
@@ -1,6 +1,27 @@
+/*
+****************************************************************************
+* Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
+* *
+* Permission to use, copy, modify, and distribute this software and its *
+* documentation for any purpose and without fee is hereby granted, *
+* provided that the above copyright notice appear in all copies and *
+* that both that copyright notice and this permission notice appear in *
+* supporting documentation, and that the name of IBM not be used in *
+* advertising or publicity pertaining to distribution of the software *
+* without specific, written prior permission. *
+* *
+* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
+* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
+* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
+* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
+****************************************************************************
+*/
+
#include "rx_locl.h"
-RCSID("$KTH: rx_trace.c,v 1.5 1998/09/09 10:17:53 assar Exp $");
+RCSID("$arla: rx_trace.c,v 1.8 2002/04/28 22:19:18 lha Exp $");
#ifdef RXTRACEON
char rxi_tracename[80] = "/tmp/rxcalltrace";
@@ -16,16 +37,6 @@ int rxi_logfd = 0;
char rxi_tracebuf[4096];
unsigned long rxi_tracepos = 0;
-struct rx_trace {
- unsigned long cid;
- unsigned short call;
- unsigned short qlen;
- unsigned long now;
- unsigned long waittime;
- unsigned long servicetime;
- unsigned long event;
-};
-
struct rx_trace rxtinfo;
void
@@ -103,59 +114,3 @@ rxi_calltrace(unsigned int event, struct rx_call *call)
#endif /* RXDEBUG */
-#ifdef DUMPTRACE
-
-void
-main(int argc, char **argv)
-{
- struct rx_trace ip;
- int err = 0;
-
- setlinebuf(stdout);
- argv++;
- argc--;
- while (argc && **argv == '-') {
- if (strcmp(*argv, "-trace") == 0) {
- strlcpy(rxi_tracename, *(++argv), sizeof(rxi_tracename));
- argc--;
- } else {
- err++;
- break;
- }
- argv++, argc--;
- }
- if (err || argc != 0) {
- printf("usage: dumptrace [-trace pathname]");
- exit(1);
- }
- rxi_logfd = open(rxi_tracename, O_RDONLY);
- if (!rxi_logfd) {
- perror("");
- exit(errno);
- }
- while (read(rxi_logfd, &ip, sizeof(struct rx_trace))) {
- printf("%9u ", ip.now);
- switch (ip.event) {
- case RX_CALL_END:
- putchar('E');
- break;
- case RX_CALL_START:
- putchar('S');
- break;
- case RX_CALL_ARRIVAL:
- putchar('A');
- break;
- case RX_TRACE_DROP:
- putchar('D');
- break;
- default:
- putchar('U');
- break;
- }
- printf(" %3u %7u %7u %x.%x\n",
- ip.qlen, ip.servicetime, ip.waittime, ip.cid, ip.call);
- }
-}
-
-#endif /* DUMPTRACE */
-
diff --git a/usr.sbin/afs/src/rx/rx_trace.h b/usr.sbin/afs/src/rx/rx_trace.h
index 05b19dcd310..16bb82af598 100644
--- a/usr.sbin/afs/src/rx/rx_trace.h
+++ b/usr.sbin/afs/src/rx/rx_trace.h
@@ -1,4 +1,25 @@
-/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_trace.h,v 1.3 1998/02/22 19:55:28 joda Exp $ */
+/*
+****************************************************************************
+* Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
+* *
+* Permission to use, copy, modify, and distribute this software and its *
+* documentation for any purpose and without fee is hereby granted, *
+* provided that the above copyright notice appear in all copies and *
+* that both that copyright notice and this permission notice appear in *
+* supporting documentation, and that the name of IBM not be used in *
+* advertising or publicity pertaining to distribution of the software *
+* without specific, written prior permission. *
+* *
+* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
+* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
+* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
+* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
+****************************************************************************
+*/
+
+/* $arla: rx_trace.h,v 1.5 2002/04/28 22:19:39 lha Exp $ */
#ifndef _RX_TRACE
#define _RX_TRACE
@@ -15,6 +36,18 @@ void rxi_flushtrace(void);
#define RX_CALL_END 2
#define RX_TRACE_DROP 3
+struct rx_trace {
+ unsigned long cid;
+ unsigned short call;
+ unsigned short qlen;
+ unsigned long now;
+ unsigned long waittime;
+ unsigned long servicetime;
+ unsigned long event;
+};
+
+extern char rxi_tracename[80];
+
#endif /* RXDEBUG */
#endif /* _RX_TRACE */
diff --git a/usr.sbin/afs/src/rx/rx_user.c b/usr.sbin/afs/src/rx/rx_user.c
index c2a96285382..44588331a1c 100644
--- a/usr.sbin/afs/src/rx/rx_user.c
+++ b/usr.sbin/afs/src/rx/rx_user.c
@@ -26,7 +26,7 @@
#include "rx_locl.h"
-RCSID("$KTH: rx_user.c,v 1.16 2000/10/08 17:49:48 assar Exp $");
+RCSID("$arla: rx_user.c,v 1.21 2003/04/08 22:14:04 lha Exp $");
#ifndef IPPORT_USERRESERVED
/*
@@ -37,13 +37,8 @@ RCSID("$KTH: rx_user.c,v 1.16 2000/10/08 17:49:48 assar Exp $");
#define IPPORT_USERRESERVED 5000
#endif
-/* Don't set this to anything else right now; it is currently broken */
-static int (*rx_select) (int, fd_set *, fd_set *,
- fd_set *, struct timeval *) = IOMGR_Select;
- /*
- * Can be set to "select", in some
- * cases
- */
+static osi_socket *rx_sockets = NULL;
+static int num_rx_sockets = 0;
static fd_set rx_selectMask;
static int rx_maxSocketNumber = -1; /* Maximum socket number represented
@@ -89,8 +84,8 @@ rxi_StartListener(void)
void
rxi_StartServerProcs(int nExistingProcs)
{
- register struct rx_service *service;
- register int i;
+ struct rx_service *service;
+ int i;
int maxdiff = 0;
int nProcs = 0;
PROCESS scratchPid;
@@ -139,25 +134,39 @@ rxi_StartServerProcs(int nExistingProcs)
*/
osi_socket
-rxi_GetUDPSocket(u_short port)
+rxi_GetUDPSocket(uint16_t port, uint16_t *retport)
{
int code;
- int socketFd = OSI_NULLSOCKET;
+ osi_socket socketFd = OSI_NULLSOCKET;
+ osi_socket *sockets;
struct sockaddr_in taddr;
char *name = "rxi_GetUDPSocket: ";
+ int sa_size;
+
+ sockets = realloc(rx_sockets, (num_rx_sockets + 1) * sizeof(*rx_sockets));
+ if (sockets == NULL) {
+ perror("socket");
+ osi_Msg(("%sunable to allocated memory for UDP socket\n", name));
+ return OSI_NULLSOCKET;
+ }
+ rx_sockets = sockets;
socketFd = socket(AF_INET, SOCK_DGRAM, 0);
if (socketFd < 0) {
perror("socket");
- (osi_Msg "%sunable to create UDP socket\n", name);
+ osi_Msg(("%sunable to create UDP socket\n", name));
return OSI_NULLSOCKET;
}
if (socketFd >= FD_SETSIZE) {
- (osi_Msg "socket fd too large\n");
+ osi_Msg(("socket fd too large\n"));
+ close(socketFd);
return OSI_NULLSOCKET;
}
+ rx_sockets[num_rx_sockets] = socketFd;
+ num_rx_sockets++;
+
#ifdef SO_BSDCOMPAT
{
int one = 1;
@@ -165,9 +174,8 @@ rxi_GetUDPSocket(u_short port)
}
#endif
- if (rx_maxSocketNumber < 0) {
+ if (rx_maxSocketNumber < 0)
FD_ZERO(&rx_selectMask);
- }
FD_SET(socketFd, &rx_selectMask);
if (socketFd > rx_maxSocketNumber)
@@ -177,13 +185,23 @@ rxi_GetUDPSocket(u_short port)
taddr.sin_family = AF_INET;
taddr.sin_port = port;
- code = bind(socketFd, (const struct sockaddr *) &taddr, sizeof(taddr));
+ code = bind(socketFd, (struct sockaddr *) &taddr, sizeof(taddr));
if (code < 0) {
perror("bind");
- (osi_Msg "%sunable to bind UDP socket\n", name);
+ osi_Msg(("%sunable to bind UDP socket\n", name));
goto error;
}
+ sa_size = sizeof(taddr);
+ code = getsockname(socketFd, (struct sockaddr *) &taddr, &sa_size);
+ if (code < 0) {
+ perror("getsockname");
+ osi_Msg(("%sunable to bind UDP socket\n", name));
+ goto error;
+ }
+ if (retport)
+ *retport = taddr.sin_port;
+
/*
* Use one of three different ways of getting a socket buffer expanded to
* a reasonable size
@@ -200,10 +218,8 @@ rxi_GetUDPSocket(u_short port)
&len2, sizeof(len2)) >= 0);
}
-/*#ifdef notdef*/
if (!rx_stats.socketGreedy)
- (osi_Msg "%s*WARNING* Unable to increase buffering on socket\n", name);
-/*#endif*/
+ osi_Msg(("%s*WARNING* Unable to increase buffering on socket\n",name));
/*
* Put it into non-blocking mode so that rx_Listener can do a polling
@@ -211,14 +227,17 @@ rxi_GetUDPSocket(u_short port)
*/
if (fcntl(socketFd, F_SETFL, FNDELAY) == -1) {
perror("fcntl");
- (osi_Msg "%sunable to set non-blocking mode on socket\n", name);
+ osi_Msg(("%sunable to set non-blocking mode on socket\n", name));
goto error;
}
return socketFd;
error:
- if (socketFd >= 0)
- close(socketFd);
+ num_rx_sockets--;
+ rx_sockets[num_rx_sockets] = OSI_NULLSOCKET;
+
+ close(socketFd);
+
return OSI_NULLSOCKET;
}
@@ -227,17 +246,19 @@ error:
* and retransmissions, etc. It also is responsible for scheduling the
* execution of pending events (in conjunction with event.c).
*
- * Note interaction of nextPollTime and lastPollWorked. The idea is that
- * if rx is not keeping up with the incoming stream of packets (because
- * there are threads that are interfering with its running sufficiently
- * often), rx does a polling select before doing a real IOMGR_Select system
- * call. Doing a real select means that we don't have to let other processes
- * run before processing more packets.
+ * Note interaction of nextPollTime and lastPollWorked. The idea is
+ * that if rx is not keeping up with the incoming stream of packets
+ * (because there are threads that are interfering with its running
+ * sufficiently often), rx does a polling select using IOMGR_Select
+ * (setting tv_sec = tv_usec = 0). Old code is a system select, but
+ * this was bad since we didn't know what calling conversion the
+ * system select() was using (on win32 hosts it was PASCAL, and you
+ * lost your $sp)
*
* So, our algorithm is that if the last poll on the file descriptor found
* useful data, or we're at the time nextPollTime (which is advanced so that
* it occurs every 3 or 4 seconds),
- * then we try the polling select before the IOMGR_Select. If we eventually
+ * then we try the polling select. If we eventually
* catch up (which we can tell by the polling select returning no input
* packets ready), then we don't do a polling select again until several
* seconds later (via nextPollTime mechanism).
@@ -250,9 +271,9 @@ error:
void
rxi_Listener(void)
{
- u_long host;
- u_short port;
- register struct rx_packet *p = (struct rx_packet *) 0;
+ uint32_t host;
+ uint16_t port;
+ struct rx_packet *p = NULL;
fd_set rfds;
int socket;
int fds;
@@ -270,8 +291,8 @@ rxi_Listener(void)
/*
* Grab a new packet only if necessary (otherwise re-use the old one)
*/
- if (!p) {
- if (!(p = rxi_AllocPacket(RX_PACKET_CLASS_RECEIVE)))
+ if (p == NULL) {
+ if ((p = rxi_AllocPacket(RX_PACKET_CLASS_RECEIVE)) == NULL)
osi_Panic("rxi_Listener: no packets!"); /* Shouldn't happen */
}
/* Wait for the next event time or a packet to arrive. */
@@ -281,7 +302,7 @@ rxi_Listener(void)
* that this is positive. If there is no next event, it returns 0
*/
if (!rxevent_RaiseEvents(&cv))
- tvp = (struct timeval *) 0;
+ tvp = NULL;
else {
/*
@@ -299,30 +320,30 @@ rxi_Listener(void)
FD_COPY(&rx_selectMask, &rfds);
if (lastPollWorked || nextPollTime < clock_Sec()) {
/* we're catching up, or haven't tried to for a few seconds */
- rx_select = select;
doingPoll = 1;
nextPollTime = clock_Sec() + 4; /* try again in 4 seconds no
* matter what */
tv.tv_sec = tv.tv_usec = 0;/* make sure we poll */
tvp = &tv;
} else {
- rx_select = IOMGR_Select;
doingPoll = 0;
}
lastPollWorked = 0; /* default is that it didn't find
* anything */
- fds = (*rx_select) (rx_maxSocketNumber + 1, &rfds, 0, 0, tvp);
+ fds = IOMGR_Select (rx_maxSocketNumber + 1, &rfds, 0, 0, tvp);
clock_NewTime();
if (fds > 0) {
if (doingPoll)
lastPollWorked = 1;
- for(socket = 0; socket < rx_maxSocketNumber + 1; ++socket) {
- if(p == NULL)
+
+ for (socket = 0; socket < num_rx_sockets; socket++) {
+ if (p == NULL)
break;
- if(FD_ISSET(socket, &rfds) &&
- rxi_ReadPacket(socket, p, &host, &port)) {
- p = rxi_ReceivePacket(p, socket, host, port);
+ if (FD_ISSET(rx_sockets[socket], &rfds) &&
+ rxi_ReadPacket(rx_sockets[socket], p, &host, &port))
+ {
+ p = rxi_ReceivePacket(p, rx_sockets[socket], host, port);
}
}
}
@@ -344,32 +365,16 @@ osi_Panic(const char *fmt, ...)
abort();
}
-#ifdef AFS_AIX32_ENV
-#ifndef osi_Alloc
-static char memZero;
-char *
-osi_Alloc(long x)
-{
-
- /*
- * 0-length allocs may return NULL ptr from osi_kalloc, so we
- * special-case things so that NULL returned iff an error occurred
- */
- if (x == 0)
- return &memZero;
- return ((char *) malloc(x));
-}
-
void
-osi_Free(char *x, long size)
+osi_vMsg(const char *fmt, ...)
{
- if (x == &memZero)
- return;
- free((char *) x);
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fflush(stderr);
}
-#endif
-#endif /* AFS_AIX32_ENV */
#define ADDRSPERSITE 256
@@ -430,6 +435,8 @@ GetIFInfo(void)
continue;
if (!(ifr->ifr_flags & IFF_UP))
continue;
+ if (ifr->ifr_flags & IFF_LOOPBACK)
+ continue;
myNetFlags[numMyNetAddrs] = ifr->ifr_flags;
res = ioctl(s, SIOCGIFADDR, ifr);
@@ -455,6 +462,12 @@ GetIFInfo(void)
rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE,
(myNetMTUs[numMyNetAddrs]
- RX_IPUDP_SIZE));
+
+ if (rx_MyMaxSendSize < myNetMTUs[numMyNetAddrs]
+ - RX_IPUDP_SIZE)
+ rx_MyMaxSendSize = myNetMTUs[numMyNetAddrs]
+ - RX_IPUDP_SIZE;
+
} else {
myNetMTUs[numMyNetAddrs] = OLD_MAX_PACKET_SIZE;
res = 0;
@@ -506,10 +519,10 @@ GetIFInfo(void)
*/
void
-rxi_InitPeerParams(register struct rx_peer * pp)
+rxi_InitPeerParams(struct rx_peer * pp)
{
- register u_long ppaddr, msk, net;
- u_short rxmtu;
+ uint32_t ppaddr, msk, net;
+ int rxmtu;
int ix, nlix = 0, nlcount;
static int Inited = 0;
diff --git a/usr.sbin/afs/src/rx/rx_user.h b/usr.sbin/afs/src/rx/rx_user.h
index 8be13fe4733..40a3cd478c7 100644
--- a/usr.sbin/afs/src/rx/rx_user.h
+++ b/usr.sbin/afs/src/rx/rx_user.h
@@ -1,4 +1,4 @@
-/* $KTH: rx_user.h,v 1.5 1998/03/28 16:35:47 lha Exp $ */
+/* $arla: rx_user.h,v 1.9 2003/04/08 22:13:44 lha Exp $ */
/*
****************************************************************************
@@ -21,20 +21,19 @@
****************************************************************************
*/
-#ifdef VALIDATE
-error - foo error - foo error - foo
-#endif /* VALIDATE */
#ifndef RX_USER_INCLUDE
#define RX_USER_INCLUDE
-/* rx_user.h: definitions specific to the user-level implementation of Rx */
+/*
+ * rx_user.h:
+ * definitions specific to the user-level implementation of Rx
+ */
#include <stdio.h>
#include <lwp.h>
#ifdef RXDEBUG
extern FILE *rx_debugFile;
-
#endif
/* These routines are no-ops in the user level implementation */
@@ -60,7 +59,7 @@ void rxi_PacketsUnWait(void);
*/
typedef short osi_socket;
-osi_socket rxi_GetUDPSocket(u_short);
+osi_socket rxi_GetUDPSocket(uint16_t, uint16_t *);
#define OSI_NULLSOCKET ((osi_socket) -1)
@@ -70,36 +69,36 @@ osi_socket rxi_GetUDPSocket(u_short);
#define osi_rxWakeup(x) osi_Wakeup(x)
#define osi_Sleep(x) LWP_WaitProcess(x)
#define osi_Wakeup(x) LWP_NoYieldSignal(x)
-/* osi_WakeupAndYieldIfPossible doesn't actually have to yield, but its better if it does */
+/*
+ * osi_WakeupAndYieldIfPossible doesn't actually have to yield, but
+ * its better if it does
+ */
#define osi_WakeupAndYieldIfPossible(x) LWP_SignalProcess(x)
#define osi_YieldIfPossible() LWP_DispatchProcess();
-#ifndef AFS_AIX32_ENV
-
#ifndef osi_Alloc
-#define osi_Alloc(size) ((char *) malloc(size))
+#define osi_Alloc(size) (malloc(size))
#endif
#ifndef osi_Free
-#define osi_Free(ptr, size) free((char *)(ptr))
-#endif
-
+#define osi_Free(ptr, size) free(ptr)
#endif
-#ifdef USE_MMAPTIME
-#define osi_GetTime(timevalptr) mmaptime_gettimeofday(timevalptr, 0)
-#else
#define osi_GetTime(timevalptr) gettimeofday(timevalptr, 0)
-#endif
-/* Just in case it's possible to distinguish between relatively long-lived stuff and stuff which will be freed very soon, but which needs quick allocation (e.g. dynamically allocated xdr things) */
+/*
+ * Just in case it's possible to distinguish between relatively
+ * long-lived stuff and stuff which will be freed very soon, but which
+ * needs quick allocation (e.g. dynamically allocated xdr things)
+ */
+
#define osi_QuickFree(ptr, size) osi_Free(ptr, size)
#define osi_QuickAlloc(size) osi_Alloc(size)
-void osi_Panic(const char *fmt, ...);
-int fprintf(FILE *, const char *, ...);
+void osi_Panic(const char *fmt, ...);
+void osi_vMsg(const char *fmt, ...);
-#define osi_Msg fprintf)(stderr,
+#define osi_Msg(x) do { osi_vMsg x ; } while(0)
#endif /* RX_USER_INCLUDE */
diff --git a/usr.sbin/afs/src/rx/rxdebug.1 b/usr.sbin/afs/src/rx/rxdebug.1
index b75fb285eb5..c346836c61d 100644
--- a/usr.sbin/afs/src/rx/rxdebug.1
+++ b/usr.sbin/afs/src/rx/rxdebug.1
@@ -1,9 +1,41 @@
-.\" Copyright (c) 2000 Kungliga Tekniska Högskolan
-.\" $KTH: rxdebug.1,v 1.1 2000/08/25 15:04:44 lha Exp $
-.Dd Aug 24, 2000
+.\" Copyright (c) 2000 - 2003 Kungliga Tekniska Högskolan
+.\" (Royal Institute of Technology, Stockholm, Sweden).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Institute nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $arla: rxdebug.1,v 1.3 2003/04/01 14:08:19 lha Exp $
+.\"
+.\" $arla: rxdebug.1,v 1.3 2003/04/01 14:08:19 lha Exp $
+.Dd April 1, 2003
.Dt SECTION
.Nm rxdebug
-.Os Arla
+.Os "The Arla Project"
.Sh NAME
.Nm rxdebug
.Nd
@@ -56,8 +88,8 @@ list of the servers to talk to.
.El
.Sh DIAGNOSTICS
.Nm
-is used to diagnose a rx-implementation, what version the afs-client
-are running, why rx missbehavies, or if there are performance problems.
+is used to diagnose a rx-implementation, what version the AFS-client
+are running, why rx misbehaves, or if there are performance problems.
.Pp
.Sh EXAMPLES
.Bd -literal
@@ -71,5 +103,5 @@ data# rxdebug -servers localhost -port 4711 -version
Trying 127.0.0.1 (port 4711):
AFS version: arla-0.34.1
.Ed
-.\".Sh SEE ALSO
-.\"XXX
+.Sh SEE ALSO
+.Xr arlad 8
diff --git a/usr.sbin/afs/src/rx/rxdebug.c b/usr.sbin/afs/src/rx/rxdebug.c
index 20c88f07fde..220e0e71540 100644
--- a/usr.sbin/afs/src/rx/rxdebug.c
+++ b/usr.sbin/afs/src/rx/rxdebug.c
@@ -44,39 +44,40 @@
#include "config.h"
#include "roken.h"
-RCSID ("$KTH: rxdebug.c,v 1.7.2.5 2001/11/24 17:00:58 mattiasa Exp $");
+RCSID ("$arla: rxdebug.c,v 1.15 2003/01/19 08:50:12 lha Exp $");
#define TIMEOUT 20
-static short
+static uint16_t
PortNumber(char *aport)
{
- return htons(atoi (aport));
+ uint16_t port = atoi(aport);
+ return htons(port);
}
-static short
+static uint16_t
PortName(char *aname)
{
struct servent *ts = getservbyname(aname, NULL);
if (ts == NULL)
- return -1;
+ return 0;
return ts->s_port; /* returns it in network byte order */
}
static int
-MakeCall (int asocket, long ahost, short aport, char *adata,
+MakeCall (int asocket, uint32_t ahost, uint16_t aport, char *adata,
long alen, char *aresult, long aresultLen)
{
static long counter = 100;
long endTime;
struct rx_header theader;
char tbuffer[1500];
- register long code;
+ int code;
struct timeval tv;
struct sockaddr_in taddr, faddr;
int faddrLen;
fd_set imask;
- register char *tp;
+ char *tp;
endTime = time(0) + TIMEOUT; /* try for N seconds */
counter++;
@@ -85,7 +86,7 @@ MakeCall (int asocket, long ahost, short aport, char *adata,
taddr.sin_port = aport;
taddr.sin_addr.s_addr = ahost;
while(1) {
- bzero(&theader, sizeof(theader));
+ memset(&theader, 0, sizeof(theader));
theader.epoch = htonl(999);
theader.cid = 0;
theader.callNumber = htonl(counter);
@@ -95,8 +96,11 @@ MakeCall (int asocket, long ahost, short aport, char *adata,
theader.flags = RX_CLIENT_INITIATED | RX_LAST_PACKET;
theader.serviceId = 0;
- bcopy(&theader, tbuffer, sizeof(theader));
- bcopy(adata, tp, alen);
+ if (sizeof(theader) + alen > sizeof(tbuffer))
+ errx(1, "message to large");
+
+ memcpy(tbuffer, &theader, sizeof(theader));
+ memcpy(tp, adata, alen);
code = sendto(asocket, tbuffer, alen+sizeof(struct rx_header), 0,
(struct sockaddr *)&taddr, sizeof(struct sockaddr_in));
if (code == -1) {
@@ -113,7 +117,7 @@ MakeCall (int asocket, long ahost, short aport, char *adata,
FD_SET(asocket,&imask);
tv.tv_sec = 1;
tv.tv_usec = 0;
- code = select(asocket+1, &imask, NULL, NULL, &tv);
+ code = select(asocket + 1, &imask, NULL, NULL, &tv);
if (code == -1) {
err(1, "select");
}
@@ -125,8 +129,9 @@ MakeCall (int asocket, long ahost, short aport, char *adata,
if (code == -1) {
err(1, "recvfrom");
}
- bcopy(tbuffer, &theader, sizeof(struct rx_header));
- if (counter == ntohl(theader.callNumber)) break;
+ memcpy(&theader, tbuffer, sizeof(struct rx_header));
+ if (counter == ntohl(theader.callNumber))
+ break;
}
/* see if we've timed out */
@@ -134,24 +139,25 @@ MakeCall (int asocket, long ahost, short aport, char *adata,
}
code -= sizeof(struct rx_header);
if (code > aresultLen) code = aresultLen;
- bcopy(tp, aresult, code);
+ memcpy(aresult, tp, code);
return code;
}
static int
-GetVersion(int asocket, long ahost, short aport, void *adata, long alen,
+GetVersion(int asocket, uint32_t ahost, uint16_t aport,
+ void *adata, long alen,
char *aresult, long aresultLen)
{
static long counter = 100;
long endTime;
struct rx_header theader;
char tbuffer[1500];
- register long code;
+ int code;
struct timeval tv;
struct sockaddr_in taddr, faddr;
int faddrLen;
fd_set imask;
- register char *tp;
+ char *tp;
endTime = time(0) + TIMEOUT; /* try for N seconds */
counter++;
@@ -160,7 +166,7 @@ GetVersion(int asocket, long ahost, short aport, void *adata, long alen,
taddr.sin_port = aport;
taddr.sin_addr.s_addr = ahost;
while(1) {
- bzero(&theader, sizeof(theader));
+ memset(&theader, 0, sizeof(theader));
theader.epoch = htonl(999);
theader.cid = 0;
theader.callNumber = htonl(counter);
@@ -170,8 +176,11 @@ GetVersion(int asocket, long ahost, short aport, void *adata, long alen,
theader.flags = RX_CLIENT_INITIATED | RX_LAST_PACKET;
theader.serviceId = 0;
- bcopy(&theader, tbuffer, sizeof(theader));
- bcopy(adata, tp, alen);
+ if (sizeof(theader) + alen > sizeof(tbuffer))
+ errx(1, "message to large");
+
+ memcpy(tbuffer, &theader, sizeof(theader));
+ memcpy(tp, adata, alen);
code = sendto(asocket, tbuffer, alen+sizeof(struct rx_header), 0,
(struct sockaddr *)&taddr, sizeof(struct sockaddr_in));
@@ -193,7 +202,7 @@ GetVersion(int asocket, long ahost, short aport, void *adata, long alen,
tv.tv_sec = 10;
tv.tv_usec = 0;
- code = select(32, &imask, 0, 0, &tv);
+ code = select(asocket + 1, &imask, 0, 0, &tv);
if (code == -1) {
err(1, "select");
}
@@ -207,17 +216,19 @@ GetVersion(int asocket, long ahost, short aport, void *adata, long alen,
err(1, "recvfrom");
}
- bcopy(tbuffer, &theader, sizeof(struct rx_header));
+ memcpy(&theader, tbuffer, sizeof(struct rx_header));
- if (counter == ntohl(theader.callNumber)) break;
+ if (counter == ntohl(theader.callNumber))
+ break;
}
/* see if we've timed out */
if (endTime < time(0)) return -1;
}
code -= sizeof(struct rx_header);
- if (code > aresultLen) code = aresultLen;
- bcopy(tp, aresult, code);
+ if (code > aresultLen)
+ code = aresultLen;
+ memcpy(aresult, tp, code);
return code;
}
@@ -268,18 +279,18 @@ static int helpflag;
static int
MainCommand (void)
{
- register int i;
+ int i;
int s;
int j;
struct sockaddr_in taddr;
- long host;
+ uint32_t host;
struct in_addr hostAddr;
- short port;
+ uint16_t port;
struct hostent *th;
struct rx_debugIn tin;
int code;
- long onlyHost;
- short onlyPort;
+ uint32_t onlyHost;
+ uint16_t onlyPort;
int onlyAuth;
int flag;
int dallyCounter;
@@ -296,13 +307,14 @@ MainCommand (void)
if (onlyPortName) {
char *name = onlyPortName;
- if ((onlyPort = PortNumber(name)) == -1)
+ if ((onlyPort = PortNumber(name)) == 0)
onlyPort = PortName(name);
- if (onlyPort == -1) {
+ if (onlyPort == 0) {
printf("rxdebug: can't resolve port name %s\n", name);
exit(1);
}
- } else onlyPort = -1;
+ } else
+ onlyPort = 0xffff;
if (onlyHostName) {
char *name = onlyHostName;
@@ -312,8 +324,9 @@ MainCommand (void)
printf("rxdebug: host %s not found in host table\n", name);
exit(1);
}
- bcopy(th->h_addr, &onlyHost, sizeof(long));
- } else onlyHost = -1;
+ memcpy(&onlyHost, th->h_addr, sizeof(onlyHost));
+ } else
+ onlyHost = 0xffffffff;
if (onlyAuthName) {
char *name = onlyAuthName;
@@ -337,16 +350,16 @@ MainCommand (void)
printf("rxdebug: host %s not found in host table\n", hostName);
exit(1);
}
- bcopy(th->h_addr, &host, sizeof(long));
+ memcpy(&host, th->h_addr, sizeof(host));
}
else host = htonl(0x7f000001); /* IP localhost */
if (!portName)
port = htons(7000); /* default is fileserver */
else {
- if ((port = PortNumber(portName)) == -1)
+ if ((port = PortNumber(portName)) == 0)
port = PortName(portName);
- if (port == -1) {
+ if (port == 0) {
printf("rxdebug: can't resolve port name %s\n", portName);
exit(1);
}
@@ -357,9 +370,12 @@ MainCommand (void)
hostAddr.s_addr = host;
printf("Trying %s (port %d):\n", inet_ntoa(hostAddr), ntohs(port));
s = socket(AF_INET, SOCK_DGRAM, 0);
+
+ memset(&taddr, 0, sizeof(taddr));
taddr.sin_family = AF_INET;
taddr.sin_port = 0;
taddr.sin_addr.s_addr = 0;
+
code = bind(s, (struct sockaddr *)&taddr, sizeof(struct sockaddr_in));
if (code) {
perror("bind");
@@ -394,9 +410,6 @@ MainCommand (void)
exit(1);
}
- if ((tstats.version < RX_DEBUGI_VERSION_MINIMUM) ||
- (tstats.version > RX_DEBUGI_VERSION))
- tstats.version = RX_DEBUGI_VERSION_MINIMUM-1;
withSecStats = (tstats.version >= RX_DEBUGI_VERSION_W_SECSTATS);
withAllConn = (tstats.version >= RX_DEBUGI_VERSION_W_GETALLCONN);
withRxStats = (tstats.version >= RX_DEBUGI_VERSION_W_RXSTATS);
@@ -421,9 +434,9 @@ MainCommand (void)
} else {
struct rx_stats rxstats;
int i;
- long *lp;
+ uint32_t *lp;
- bzero (&rxstats, sizeof(rxstats));
+ memset (&rxstats, 0, sizeof(rxstats));
tin.type = htonl(RX_DEBUGI_RXSTATS);
tin.index = 0;
/* should gracefully handle the case where rx_stats grows */
@@ -446,10 +459,10 @@ MainCommand (void)
"unexpected size (got %d)\n",
code);
}
- /* Since its all longs convert to host order with a loop. */
- lp = (long *)&rxstats;
- for (i=0; i<sizeof(rxstats)/sizeof(int); i++,lp++)
- *lp = ntohl(*lp);
+ /* Since its all int32's, convert to host order with a loop. */
+ lp = (uint32_t*)&rxstats;
+ for (i=0; i< sizeof(rxstats)/sizeof(uint32_t); i++)
+ lp[i] = ntohl(lp[i]);
rx_PrintTheseStats (stdout, &rxstats, sizeof(rxstats));
}
@@ -460,9 +473,8 @@ MainCommand (void)
return 0;
tin.type = htonl(RX_DEBUGI_GETCONN);
- if (allconns) {
+ if (allconns)
tin.type = htonl(RX_DEBUGI_GETALLCONN);
- }
if (onlyServer) printf ("Showing only server connections\n");
if (onlyClient) printf ("Showing only client connections\n");
@@ -471,17 +483,17 @@ MainCommand (void)
{"unauthenticated", "rxkad_clear", "rxkad_auth", "rxkad_crypt"};
printf ("Showing only %s connections\n", name[onlyAuth+1]);
}
- if (onlyHost != -1) {
+ if (onlyHost != 0xffffffff) {
hostAddr.s_addr = onlyHost;
printf ("Showing only connections from host %s\n",
inet_ntoa(hostAddr));
}
- if (onlyPort != -1)
+ if (onlyPort != 0xffff)
printf ("Showing only connections on port %u\n", ntohs(onlyPort));
for(i=0;;i++) {
tin.index = htonl(i);
- bzero (&tconn, sizeof(tconn));
+ memset (&tconn, 0, sizeof(tconn));
code = MakeCall(s, host, port, (char *)&tin, sizeof(tin),
(char *) &tconn, sizeof(tconn));
if (code < 0) {
@@ -514,7 +526,7 @@ MainCommand (void)
}
}
if ((onlyHost != -1) && (onlyHost != tconn.host)) continue;
- if ((onlyPort != -1) && (onlyPort != tconn.port)) continue;
+ if ((onlyPort != 0) && (onlyPort != tconn.port)) continue;
if (onlyServer && (tconn.type != RX_SERVER_CONNECTION)) continue;
if (onlyClient && (tconn.type != RX_CLIENT_CONNECTION)) continue;
if (onlyAuth != 999) {
@@ -560,12 +572,12 @@ MainCommand (void)
printf (" no GetStats procedure for security object\n");
break;
case 1:
- printf (" rxnull level=%d, flags=%ld\n",
- tconn.secStats.level, tconn.secStats.flags);
+ printf (" rxnull level=%d, flags=%d\n",
+ tconn.secStats.level, (int)tconn.secStats.flags);
break;
case 2:
- printf (" rxvab level=%d, flags=%ld\n",
- tconn.secStats.level, tconn.secStats.flags);
+ printf (" rxvab level=%d, flags=%d\n",
+ tconn.secStats.level, (int)tconn.secStats.flags);
break;
case 3: {
char *level;
diff --git a/usr.sbin/afs/src/rx/rxgencon.h b/usr.sbin/afs/src/rx/rxgencon.h
index f3dd9c00dc6..435b8f28948 100644
--- a/usr.sbin/afs/src/rx/rxgencon.h
+++ b/usr.sbin/afs/src/rx/rxgencon.h
@@ -19,7 +19,7 @@
****************************************************************************
*/
-/* $KTH: rxgencon.h,v 1.1 1999/02/05 06:09:06 lha Exp $ */
+/* $arla: rxgencon.h,v 1.1 1999/02/05 06:09:06 lha Exp $ */
#ifndef _RXGEN_CONSTS_
#define _RXGEN_CONSTS_
diff --git a/usr.sbin/afs/src/rx/rxperf.c b/usr.sbin/afs/src/rx/rxperf.c
index ec10fc2ace1..7d1f44dc415 100644
--- a/usr.sbin/afs/src/rx/rxperf.c
+++ b/usr.sbin/afs/src/rx/rxperf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 2000 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -40,22 +40,28 @@
* transarc libs.
*/
+#define HAVE_GETRUSAGE 1
+
#ifdef RCSID
-RCSID("$KTH: rxperf.c,v 1.3 2000/10/03 00:41:39 lha Exp $");
+RCSID("$arla: rxperf.c,v 1.23 2003/04/08 00:19:47 lha Exp $");
#endif
+#include <stdarg.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
+#if HAVE_GETRUSAGE
+#include <sys/resource.h>
+#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <strings.h>
+#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <signal.h>
@@ -64,61 +70,120 @@ RCSID("$KTH: rxperf.c,v 1.3 2000/10/03 00:41:39 lha Exp $");
* is hopefully a err.h */
#endif
#include "rx.h"
+#include "rx_globs.h"
#include "rx_null.h"
#if defined(u_int32)
-#define u_int32_t u_int32
+#define uint32_t u_int32
#elif defined(hget32)
-#define u_int32_t afs_uint32
+#define uint32_t afs_uint32
#endif
static const char *__progname;
+#ifndef HAVE_WARNX
+static void
+warnx(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", __progname);
+ vfprintf (stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+}
+#endif /* !HAVE_WARNX */
+
#ifndef HAVE_ERRX
static void
-errx(int eval, const char *fmt)
+errx(int eval, const char *fmt, ...)
{
- fprintf(stderr, "%s: %s", __progname, fmt);
- exit(eval);
+ va_list args;
+
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", __progname);
+ vfprintf (stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+
+ exit(eval);
}
#endif /* !HAVE_ERRX */
-#ifndef HAVE_WARNX
+#ifndef HAVE_WARN
static void
-warnx(const char *fmt)
+warn(const char *fmt, ...)
{
- fprintf(stderr, "%s: %s", __progname, fmt);
+ va_list args;
+ char *errstr;
+
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", __progname);
+ vfprintf (stderr, fmt, args);
+
+ errstr = strerror(errno);
+
+ fprintf(stderr, ": %s\n", errstr ? errstr : "unknown error");
+ va_end(args);
}
-#endif /* !HAVE_WARNX */
+#endif /* !HAVE_WARN */
-#ifndef HAVE_WARN
+#ifndef HAVE_ERR
static void
-warn(const char *fmt)
+err(int eval, const char *fmt, ...)
{
- fprintf(stderr, "%s: %s", __progname, fmt);
+ va_list args;
+ char *errstr;
+
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", __progname);
+ vfprintf (stderr, fmt, args);
+
+ errstr = strerror(errno);
+
+ fprintf(stderr, ": %s\n", errstr ? errstr : "unknown error");
+ va_end(args);
+
+ exit(eval);
}
-#endif /* HAVE_WARN */
-
+#endif /* !HAVE_ERR */
+
#define DEFAULT_PORT 7009 /* To match tcpdump */
#define DEFAULT_HOST "127.0.0.1"
#define DEFAULT_BYTES 1000000
-#define RXPERF_BUFSIZE 1400
+#define RXPERF_BUFSIZE 10000
-enum { RX_PERF_VERSION = 0 };
+enum { RX_PERF_VERSION = 3 };
enum { RX_SERVER_ID = 147 };
-enum { RX_PERF_SEND = 0, RX_PERF_RECV = 1 };
+enum { RX_PERF_UNKNOWN = -1, RX_PERF_SEND = 0, RX_PERF_RECV = 1,
+ RX_PERF_RPC=3, RX_PERF_FILE=4 };
+enum { RXPERF_MAGIC_COOKIE = 0x4711 };
/*
*
*/
+#if DEBUG
+#define DBFPRINT(x) do { printf x ; } while(0)
+#else
+#define DBFPRINT(x)
+#endif
+
static void
sigusr1 (int foo)
{
exit (2); /* XXX profiler */
}
+static void
+sigint (int foo)
+{
+ rx_Finalize();
+ exit (2); /* XXX profiler */
+}
+
/*
*
*/
@@ -195,14 +260,59 @@ get_sec(int serverp, struct rx_securityClass** sec, int *secureindex)
* process the "RPC" and return the results
*/
+char somebuf[RXPERF_BUFSIZE];
+
+int32_t rxwrite_size = sizeof(somebuf);
+int32_t rxread_size = sizeof(somebuf);
+
+static int
+readbytes(struct rx_call *call, int32_t bytes)
+{
+ int32_t size;
+
+ while (bytes > 0) {
+ size = rxread_size;
+ if (size > bytes)
+ size = bytes;
+ if (rx_Read (call, somebuf, size) != size)
+ return 1;
+ bytes -= size;
+ }
+ return 0;
+}
+
+static int
+sendbytes(struct rx_call *call, int32_t bytes)
+{
+ int32_t size;
+
+ while (bytes > 0) {
+ size = rxwrite_size;
+ if (size > bytes)
+ size = bytes;
+ if (rx_Write (call, somebuf, size) != size)
+ return 1;
+ bytes -= size;
+ }
+ return 0;
+}
+
+
static int32_t
rxperf_ExecuteRequest(struct rx_call *call)
{
int32_t version;
int32_t command;
- u_int32_t bytes;
- char buf[RXPERF_BUFSIZE];
- int size;
+ uint32_t bytes;
+ uint32_t recvb;
+ uint32_t sendb;
+ uint32_t data;
+ uint32_t num;
+ uint32_t *readwrite;
+ int i;
+ int readp=TRUE;
+
+ DBFPRINT(("got a request\n"));
if (rx_Read (call, &version, 4) != 4) {
warn ("rx_Read failed to read version");
@@ -220,35 +330,138 @@ rxperf_ExecuteRequest(struct rx_call *call)
}
command = ntohl(command);
- if (rx_Read (call, &bytes, 4) != 4) {
- warnx ("rx_Read failed to read bytes");
+ if (rx_Read (call, &data, 4) != 4) {
+ warnx ("rx_Read failed to read size");
+ return -1;
+ }
+ rxread_size = ntohl(data);
+ if (rxread_size > sizeof(somebuf)) {
+ warnx("rxread_size too large %d", rxread_size);
return -1;
}
- bytes = ntohl(bytes);
- memset (buf, 0, sizeof(buf));
+ if (rx_Read (call, &data, 4) != 4) {
+ warnx ("rx_Read failed to write size");
+ return -1;
+ }
+ rxwrite_size = ntohl(data);
+ if (rxwrite_size > sizeof(somebuf)) {
+ warnx("rxwrite_size too large %d", rxwrite_size);
+ return -1;
+ }
switch (command) {
case RX_PERF_SEND:
- while (bytes > 0) {
- size = sizeof(buf);
- if (size > bytes)
- size = bytes;
- if (rx_Read (call, buf, size) != size)
- errx (1, "rx_Read failed to read data");
- bytes -= size;
+ DBFPRINT(("got a send request\n"));
+
+ if (rx_Read (call, &bytes, 4) != 4) {
+ warnx ("rx_Read failed to read bytes");
+ return -1;
}
- {
- int32_t data = htonl(4711); /* XXX */
- if (rx_Write (call, &data, 4) != 4)
- errx (1, "rx_Write failed when sending back result");
+ bytes = ntohl(bytes);
+
+ DBFPRINT(("reading(%d) ", bytes));
+ readbytes(call, bytes);
+
+ data = htonl(RXPERF_MAGIC_COOKIE);
+ if (rx_Write (call, &data, 4) != 4) {
+ warnx ("rx_Write failed when sending back result");
+ return -1;
}
+ DBFPRINT(("done\n"));
+
+ break;
+ case RX_PERF_RPC:
+ DBFPRINT(("got a rpc request, reading commands\n"));
+
+ if (rx_Read (call, &recvb, 4) != 4) {
+ warnx ("rx_Read failed to read recvbytes");
+ return -1;
+ }
+ recvb = ntohl(recvb);
+ if (rx_Read (call, &sendb, 4) != 4) {
+ warnx ("rx_Read failed to read recvbytes");
+ return -1;
+ }
+ sendb = ntohl(sendb);
+
+ DBFPRINT(("read(%d) ", recvb));
+ if (readbytes(call, recvb)) {
+ warnx("readbytes failed");
+ return -1;
+ }
+ DBFPRINT(("send(%d) ", sendb));
+ if (sendbytes(call, sendb)) {
+ warnx("sendbytes failed");
+ return -1;
+ }
+
+ DBFPRINT(("done\n"));
+
+ data = htonl(RXPERF_MAGIC_COOKIE);
+ if (rx_Write (call, &data, 4) != 4) {
+ warnx ( "rx_Write failed when sending back magic cookie");
+ return -1;
+ }
+
+ break;
+ case RX_PERF_FILE:
+ if (rx_Read (call, &data, 4) != 4)
+ errx (1, "failed to read num from client");
+ num = ntohl(data);
+
+ readwrite = malloc(num*sizeof(uint32_t));
+ if(readwrite == NULL)
+ err(1, "malloc");
+
+ if (rx_Read (call, readwrite, num*sizeof(uint32_t)) !=
+ num*sizeof(uint32_t))
+ errx (1, "failed to read recvlist from client");
+
+ for(i=0; i < num; i++) {
+ if(readwrite[i] == 0) {
+ DBFPRINT(("readp %d", readwrite[i] ));
+ readp = !readp;
+ }
+
+ bytes = ntohl(readwrite[i])*sizeof(uint32_t);
+
+ if(readp) {
+ DBFPRINT(("read\n"));
+ readbytes(call, bytes);
+ } else {
+ sendbytes(call, bytes);
+ DBFPRINT(("send\n"));
+ }
+ }
+
break;
case RX_PERF_RECV:
+ DBFPRINT(("got a recv request\n"));
+
+ if (rx_Read (call, &bytes, 4) != 4) {
+ warnx ("rx_Read failed to read bytes");
+ return -1;
+ }
+ bytes = ntohl(bytes);
+
+ DBFPRINT(("sending(%d) ", bytes));
+ sendbytes(call, bytes);
+
+ data = htonl(RXPERF_MAGIC_COOKIE);
+ if (rx_Write (call, &data, 4) != 4) {
+ warnx ("rx_Write failed when sending back result");
+ return -1;
+ }
+ DBFPRINT(("done\n"));
+
+ break;
default:
warnx ("client sent a unsupported command");
return -1;
}
+ DBFPRINT(("done with command\n"));
+
return 0;
}
@@ -288,21 +501,78 @@ do_server (int port)
*/
static void
-do_client (const char *server, int port, int32_t bytes)
+readfile(const char *filename, uint32_t **readwrite, uint32_t *size)
+{
+ FILE *f;
+ uint32_t len=16;
+ uint32_t num=0;
+ uint32_t data;
+ char *ptr;
+ char buf[RXPERF_BUFSIZE];
+
+ *readwrite = malloc(sizeof(uint32_t)*len);
+
+ if(*readwrite == NULL)
+ err(1, "malloc");
+
+ f=fopen(filename, "r");
+ if(f==NULL)
+ err(1, "fopen");
+
+ while(fgets(buf, sizeof(buf), f) != NULL) {
+
+ buf[strcspn(buf, "\n")] = '\0';
+
+ if(num >= len) {
+ len=len*2;
+ *readwrite = realloc(*readwrite, len*sizeof(uint32_t));
+ if(*readwrite == NULL)
+ err(1, "realloc");
+ }
+
+ if(*buf != '\0') {
+ data = htonl(strtol (buf, &ptr, 0));
+ if (ptr && ptr == buf)
+ errx (1, "can't resolve number of bytes to transfer");
+ } else {
+ data = 0;
+ }
+
+ (*readwrite)[num] =data;
+ num++;
+ }
+
+ *size = num;
+
+
+ if(fclose(f) == -1)
+ err(1, "fclose");
+}
+
+
+/*
+ *
+ */
+
+static void
+do_client (const char *server, int port, char *filename,
+ int32_t command, int32_t times,
+ int32_t bytes, int32_t rpc_sendbytes, int32_t rpc_recvbytes)
{
struct rx_connection *conn;
struct rx_call *call;
- u_int32_t addr = str2addr(server);
+ uint32_t addr = str2addr(server);
struct rx_securityClass *secureobj;
int secureindex;
- char buf[RXPERF_BUFSIZE];
int32_t data;
- int size;
+ int32_t num;
int ret;
+ int i;
+ int readp = FALSE;
char stamp[1024];
+ uint32_t size;
- for (size = 0; size < RXPERF_BUFSIZE; size++)
- buf[size] = rand() >> 3;
+ uint32_t *readwrite;
ret = rx_Init (0);
if (ret)
@@ -318,47 +588,165 @@ do_client (const char *server, int port, int32_t bytes)
if (conn == NULL)
errx (1, "failed to contact server");
- call = rx_NewCall (conn);
- if (call == NULL)
- errx (1, "rx_NewCall failed");
+ if (command == RX_PERF_RPC)
+ snprintf (stamp, sizeof(stamp),
+ "send\t%d times\t%d writes\t%d reads",
+ times, rpc_sendbytes, rpc_recvbytes);
+ else
+ snprintf (stamp, sizeof(stamp),
+ "send\t%d times", times);
- data = htonl(RX_PERF_VERSION);
- if (rx_Write (call, &data, 4) != 4)
- errx (1, "rx_Write failed to send version");
+ start_timer();
- data = htonl(RX_PERF_SEND);
- if (rx_Write (call, &data, 4) != 4)
- errx (1, "rx_Write failed to send command");
+ for(i=0; i < times ; i++) {
- snprintf (stamp, sizeof(stamp), "send %d bytes", bytes);
- start_timer();
-
- data = htonl (bytes);
- if (rx_Write (call, &data, 4) != 4)
- errx (1, "rx_Write failed to send size");
+ DBFPRINT(("starting command "));
- while (bytes > 0) {
- size = sizeof (buf);
- if (size > bytes)
- size = bytes;
- if (rx_Write (call, buf, size) != size)
- errx (1, "failed when bytes where still left to send");
- bytes -= size;
+ call = rx_NewCall (conn);
+ if (call == NULL)
+ errx (1, "rx_NewCall failed");
+
+ data = htonl(RX_PERF_VERSION);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send version");
+
+ data = htonl(command);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send command");
+
+ data = htonl(rxread_size);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send read size");
+ data = htonl(rxwrite_size);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send write read");
+
+
+ switch (command) {
+ case RX_PERF_RECV:
+ DBFPRINT(("command "));
+
+ data = htonl (bytes);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send size");
+
+ DBFPRINT(("sending(%d) ", bytes));
+ if (readbytes(call, bytes))
+ errx(1, "sendbytes");
+
+ if (rx_Read (call, &data, 4) != 4)
+ errx (1, "failed to read result from server");
+
+ if (data != htonl(RXPERF_MAGIC_COOKIE))
+ warn("server send wrong magic cookie in responce");
+
+ DBFPRINT(("done\n"));
+
+ break;
+ case RX_PERF_SEND:
+ DBFPRINT(("command "));
+
+ data = htonl (bytes);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send size");
+
+ DBFPRINT(("sending(%d) ", bytes));
+ if (sendbytes(call, bytes))
+ errx(1, "sendbytes");
+
+ if (rx_Read (call, &data, 4) != 4)
+ errx (1, "failed to read result from server");
+
+ if (data != htonl(RXPERF_MAGIC_COOKIE))
+ warn("server send wrong magic cookie in responce");
+
+ DBFPRINT(("done\n"));
+
+ break;
+ case RX_PERF_RPC:
+ DBFPRINT(("commands "));
+
+ data = htonl(rpc_sendbytes);
+ if (rx_Write(call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send command");
+
+ data = htonl(rpc_recvbytes);
+ if (rx_Write (call, &data, 4) != 4)
+ errx (1, "rx_Write failed to send command");
+
+ DBFPRINT(("send(%d) ", rpc_sendbytes));
+ sendbytes(call, rpc_sendbytes);
+
+ DBFPRINT(("recv(%d) ", rpc_recvbytes));
+ readbytes(call, rpc_recvbytes);
+
+ if (rx_Read (call, &bytes, 4) != 4)
+ errx (1, "failed to read result from server");
+
+ if (bytes != htonl(RXPERF_MAGIC_COOKIE))
+ warn("server send wrong magic cookie in responce");
+
+ DBFPRINT(("done\n"));
+
+ break;
+ case RX_PERF_FILE:
+ readfile(filename, &readwrite, &num);
+
+ data = htonl(num);
+ if (rx_Write(call, &data, sizeof(data)) != 4)
+ errx (1, "rx_Write failed to send size");
+
+ if (rx_Write(call, readwrite, num*sizeof(uint32_t))
+ != num*sizeof(uint32_t))
+ errx (1, "rx_Write failed to send list");
+
+ for(i=0; i < num; i++) {
+ if(readwrite[i] == 0)
+ readp = !readp;
+
+ size = ntohl(readwrite[i])*sizeof(uint32_t);
+
+ if(readp) {
+ readbytes(call, size);
+ DBFPRINT(("read\n"));
+ } else {
+ sendbytes(call, size);
+ DBFPRINT(("send\n"));
+ }
+ }
+ break;
+ default:
+ abort();
+ }
+
+ rx_EndCall (call, 0);
}
- if (rx_Read (call, &bytes, 4) != 4)
- errx (1, "failed to read result from server");
+
end_and_print_timer (stamp);
- rx_EndCall (call, 0);
+ DBFPRINT(("done for good\n"));
+
rx_Finalize();
}
static void
usage()
{
- fprintf(stderr, "usage: %s (client) -b bytes -p port -s server\n",
- __progname);
- fprintf(stderr, "usage: %s server -p port\n", __progname);
- exit(1);
+#define COMMON ""
+
+ fprintf(stderr, "usage: %s client -c send -b <bytes>\n",
+ __progname);
+ fprintf(stderr, "usage: %s client -c recv -b <bytes>\n",
+ __progname);
+ fprintf(stderr, "usage: %s client -c rpc -S <rpc_sendbytes> -R <rpc_recvbytes>\n",
+ __progname);
+ fprintf(stderr, "usage: %s client -c file -f filename\n",
+ __progname);
+ fprintf (stderr, "%s: usage: common option to the client "
+ "-w <rx_write size> -r <rx_read size> -T times -p port -s server\n",
+ __progname);
+ fprintf(stderr, "usage: %s server -p port\n", __progname);
+#undef COMMMON
+ exit(1);
}
/*
@@ -372,18 +760,45 @@ rxperf_server (int argc, char **argv)
char *ptr;
int ch;
- while ((ch = getopt(argc, argv, "p:")) != -1)
- switch (ch) {
- case 'p':
- port = strtol(optarg, &ptr, 0);
- if (ptr != 0 && ptr[0] != '\0')
- errx (1, "can't resolve portname");
- break;
- default:
- usage();
- }
+ while ((ch = getopt(argc, argv, "r:d:p:w:")) != -1) {
+ switch (ch) {
+ case 'd':
+#ifdef RXDEBUG
+ rx_debugFile = fopen(optarg, "w");
+ if (rx_debugFile == NULL)
+ err(1, "fopen %s", optarg);
+#else
+ errx(1, "compiled without RXDEBUG");
+#endif
+ break;
+ case 'r':
+ rxread_size = strtol(optarg, &ptr, 0);
+ if (ptr != 0 && ptr[0] != '\0')
+ errx (1, "can't resolve readsize");
+ if (rxread_size > sizeof(somebuf))
+ errx(1, "%d > sizeof(somebuf) (%d)",
+ rxread_size, sizeof(somebuf));
+ break;
+ case 'p':
+ port = strtol(optarg, &ptr, 0);
+ if (ptr != 0 && ptr[0] != '\0')
+ errx (1, "can't resolve portname");
+ break;
+ case 'w':
+ rxwrite_size = strtol(optarg, &ptr, 0);
+ if (ptr != 0 && ptr[0] != '\0')
+ errx (1, "can't resolve writesize");
+ if (rxwrite_size > sizeof(somebuf))
+ errx(1, "%d > sizeof(somebuf) (%d)",
+ rxwrite_size, sizeof(somebuf));
+ break;
+ default:
+ usage();
+ }
+ }
+
if (optind != argc)
- usage();
+ usage();
do_server (htons(port));
@@ -400,35 +815,155 @@ rxperf_client (int argc, char **argv)
char *host = DEFAULT_HOST;
int bytes = DEFAULT_BYTES;
int port = DEFAULT_PORT;
+ char *filename = NULL;
+ int32_t cmd;
+ int rpc_sendbytes = 3;
+ int rpc_recvbytes = 30;
+ int print_stats = 0;
+ int times = 100;
char *ptr;
int ch;
- while ((ch = getopt(argc, argv, "b:p:s:")) != -1)
- switch (ch) {
- case 'b':
- bytes = strtol (optarg, &ptr, 0);
- if (ptr && *ptr != '\0')
- errx (1, "can't resolve number of bytes to transfer");
- break;
- case 'p':
- port = strtol(optarg, &ptr, 0);
- if (ptr != 0 && ptr[0] != '\0')
- errx (1, "can't resolve portname");
- break;
- case 's':
- host = optarg;
- break;
- default:
- usage();
- }
- if (optind != argc)
- usage();
+ cmd = RX_PERF_UNKNOWN;
- do_client (host, htons(port), bytes);
+ while ((ch = getopt(argc, argv, "GT:S:R:b:c:d:p:r:s:w:f:")) != -1) {
+ switch (ch) {
+ case 'G':
+ print_stats = 1;
+#ifndef HAVE_GETRUSAGE
+ printf("could not find getrusage, can't print stats\n");
+#endif
+ break;
+ case 'b':
+ bytes = strtol (optarg, &ptr, 0);
+ if (ptr && *ptr != '\0')
+ errx (1, "can't resolve number of bytes to transfer");
+ break;
+ case 'c':
+ if (strcasecmp(optarg, "send") == 0)
+ cmd = RX_PERF_SEND;
+ else if (strcasecmp(optarg, "recv") == 0)
+ cmd = RX_PERF_RECV;
+ else if (strcasecmp(optarg, "rpc") == 0)
+ cmd = RX_PERF_RPC;
+ else if (strcasecmp(optarg, "file") == 0)
+ cmd = RX_PERF_FILE;
+ else
+ errx(1, "unknown command %s", optarg);
+ break;
+ case 'd':
+#ifdef RXDEBUG
+ rx_debugFile = fopen(optarg, "w");
+ if (rx_debugFile == NULL)
+ err(1, "fopen %s", optarg);
+#else
+ errx(1, "compiled without RXDEBUG");
+#endif
+ break;
+ case 'p':
+ port = strtol(optarg, &ptr, 0);
+ if (ptr != 0 && ptr[0] != '\0')
+ errx (1, "can't resolve portname");
+ break;
+ case 'r':
+ rxread_size = strtol(optarg, &ptr, 0);
+ if (ptr != 0 && ptr[0] != '\0')
+ errx (1, "can't resolve readsize");
+ if (rxread_size > sizeof(somebuf))
+ errx(1, "%d > sizeof(somebuf) (%d)",
+ rxread_size, sizeof(somebuf));
+ break;
+ case 's':
+ host = strdup(optarg);
+ if (host == NULL)
+ err(1, "strdup");
+ break;
+ case 'w':
+ rxwrite_size = strtol(optarg, &ptr, 0);
+ if (ptr != 0 && ptr[0] != '\0')
+ errx (1, "can't resolve writesize");
+ if (rxwrite_size > sizeof(somebuf))
+ errx(1, "%d > sizeof(somebuf) (%d)",
+ rxwrite_size, sizeof(somebuf));
+ break;
+ case 'T':
+ times = strtol (optarg, &ptr, 0);
+ if (ptr && *ptr != '\0')
+ errx (1, "can't resolve number times to run the test");
+ break;
+ case 'S':
+ rpc_sendbytes = strtol (optarg, &ptr, 0);
+ if (ptr && *ptr != '\0')
+ errx (1, "can't resolve number of bytes to transfer");
+ break;
+ case 'R':
+ rpc_recvbytes = strtol (optarg, &ptr, 0);
+ if (ptr && *ptr != '\0')
+ errx (1, "can't resolve number of bytes to transfer");
+ break;
+ case 'f':
+ filename = optarg;
+ break;
+ default:
+ usage();
+ }
+ }
+ if (optind != argc)
+ usage();
+
+ if (cmd == RX_PERF_UNKNOWN)
+ errx(1, "no command given to the client");
+
+ do_client(host, htons(port), filename, cmd, times, bytes,
+ rpc_sendbytes, rpc_recvbytes);
+
+#if HAVE_GETRUSAGE
+ if (print_stats) {
+ struct rusage rusage;
+ if(getrusage (RUSAGE_SELF, &rusage) < 0)
+ printf("no stats\n");
+ else
+ printf ("Status:\n"
+ "- utime = (%ld, %ld)\n"
+ "- stime = (%ld, %ld)\n"
+ "- maxrss = %ld\n"
+ "- ixrss = %ld\n"
+ "- idrss = %ld\n"
+ "- isrss = %ld\n"
+ "- minflt = %ld\n"
+ "- majflt = %ld\n"
+ "- nswap = %ld\n"
+ "- inblock = %ld\n"
+ "- oublock = %ld\n"
+ "- msgsnd = %ld\n"
+ "- msgrcv = %ld\n"
+ "- nsignals = %ld\n"
+ "- nvcsw = %ld\n"
+ "- nivcws = %ld\n",
+ rusage.ru_utime.tv_sec,
+ rusage.ru_utime.tv_usec,
+ rusage.ru_stime.tv_sec,
+ rusage.ru_stime.tv_usec,
+ rusage.ru_maxrss,
+ rusage.ru_ixrss,
+ rusage.ru_idrss,
+ rusage.ru_isrss,
+ rusage.ru_minflt,
+ rusage.ru_majflt,
+ rusage.ru_nswap,
+ rusage.ru_inblock,
+ rusage.ru_oublock,
+ rusage.ru_msgsnd,
+ rusage.ru_msgrcv,
+ rusage.ru_nsignals,
+ rusage.ru_nvcsw,
+ rusage.ru_nivcsw);
+ }
+#endif /* HAVE_GETRUSAGE */
return 0;
}
-
+
/*
* setup world and call cmd
*/
@@ -439,19 +974,24 @@ main(int argc, char **argv)
PROCESS pid;
__progname = strrchr(argv[0], '/');
- if (__progname == 0)
- __progname = argv[0];
+ if (__progname)
+ __progname++;
+ else
+ __progname = argv[0];
signal (SIGUSR1, sigusr1);
+ signal (SIGINT, sigint);
LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &pid);
+
+ memset (somebuf, 0, sizeof(somebuf));
if (argc >= 2 && strcmp(argv[1], "server") == 0)
- rxperf_server(argc - 1, argv + 1);
+ rxperf_server(argc - 1, argv + 1);
else if (argc >= 2 && strcmp(argv[1], "client") == 0)
- rxperf_client(argc - 1, argv + 1);
+ rxperf_client(argc - 1, argv + 1);
else
- rxperf_client(argc, argv);
+ usage();
return 0;
}
diff --git a/usr.sbin/afs/src/rx/test_rx_clock.c b/usr.sbin/afs/src/rx/test_rx_clock.c
index 25de7814f64..04e3acf01b4 100644
--- a/usr.sbin/afs/src/rx/test_rx_clock.c
+++ b/usr.sbin/afs/src/rx/test_rx_clock.c
@@ -37,7 +37,7 @@
#include "rx_clock.h"
-RCSID("$KTH: test_rx_clock.c,v 1.3 2000/10/03 00:41:44 lha Exp $");
+RCSID("$arla: test_rx_clock.c,v 1.3 2000/10/03 00:41:44 lha Exp $");
int
main(int argc, char **argv)