Lines Matching full:cu

183 	struct cu_data *cu = NULL;	/* private data */  in clnt_dg_create()  local
222 cu = mem_alloc(sizeof (*cu)); in clnt_dg_create()
223 cu->cu_threads = 0; in clnt_dg_create()
224 cu->cu_closing = FALSE; in clnt_dg_create()
225 cu->cu_closed = FALSE; in clnt_dg_create()
226 (void) memcpy(&cu->cu_raddr, svcaddr, (size_t)svcaddr->sa_len); in clnt_dg_create()
227 cu->cu_rlen = svcaddr->sa_len; in clnt_dg_create()
229 cu->cu_wait.tv_sec = 3; /* heuristically chosen */ in clnt_dg_create()
230 cu->cu_wait.tv_usec = 0; in clnt_dg_create()
231 cu->cu_total.tv_sec = -1; in clnt_dg_create()
232 cu->cu_total.tv_usec = -1; in clnt_dg_create()
233 cu->cu_sendsz = sendsz; in clnt_dg_create()
234 cu->cu_recvsz = recvsz; in clnt_dg_create()
235 cu->cu_async = FALSE; in clnt_dg_create()
236 cu->cu_connect = FALSE; in clnt_dg_create()
237 cu->cu_connected = FALSE; in clnt_dg_create()
238 cu->cu_waitchan = "rpcrecv"; in clnt_dg_create()
239 cu->cu_waitflag = 0; in clnt_dg_create()
240 cu->cu_cwnd = MAXCWND / 2; in clnt_dg_create()
241 cu->cu_sent = 0; in clnt_dg_create()
242 cu->cu_cwnd_wait = FALSE; in clnt_dg_create()
250 xdrmem_create(&xdrs, cu->cu_mcallc, MCALL_MSG_SIZE, XDR_ENCODE); in clnt_dg_create()
256 cu->cu_mcalllen = XDR_GETPOS(&xdrs); in clnt_dg_create()
263 cu->cu_closeit = FALSE; in clnt_dg_create()
264 cu->cu_socket = so; in clnt_dg_create()
310 cl->cl_private = (caddr_t)(void *)cu; in clnt_dg_create()
317 mem_free(cu, sizeof (*cu)); in clnt_dg_create()
331 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_call() local
352 cs = cu->cu_socket->so_rcv.sb_upcallarg; in clnt_dg_call()
357 if (cu->cu_closing || cu->cu_closed) { in clnt_dg_call()
362 cu->cu_threads++; in clnt_dg_call()
369 errp = &cu->cu_error; in clnt_dg_call()
376 if (cu->cu_total.tv_usec == -1) { in clnt_dg_call()
379 tvp = &cu->cu_total; /* use default timeout */ in clnt_dg_call()
386 if (cu->cu_connect && !cu->cu_connected) { in clnt_dg_call()
388 error = soconnect(cu->cu_socket, in clnt_dg_call()
389 (struct sockaddr *)&cu->cu_raddr, curthread); in clnt_dg_call()
396 cu->cu_connected = 1; in clnt_dg_call()
398 if (cu->cu_connected) in clnt_dg_call()
401 sa = (struct sockaddr *)&cu->cu_raddr; in clnt_dg_call()
407 rt->rt_rtxcur = tvtohz(&cu->cu_wait); in clnt_dg_call()
411 retransmit_time = next_sendtime = tvtohz(&cu->cu_wait); in clnt_dg_call()
425 KASSERT(cu->cu_mcalllen <= MHLEN, ("RPC header too big")); in clnt_dg_call()
426 bcopy(cu->cu_mcallc, mreq->m_data, cu->cu_mcalllen); in clnt_dg_call()
427 mreq->m_len = cu->cu_mcalllen; in clnt_dg_call()
436 if (cu->cu_async == TRUE && args == NULL) in clnt_dg_call()
454 while (cu->cu_sent >= cu->cu_cwnd) { in clnt_dg_call()
455 cu->cu_cwnd_wait = TRUE; in clnt_dg_call()
456 error = msleep(&cu->cu_cwnd_wait, &cs->cs_lock, in clnt_dg_call()
457 cu->cu_waitflag, "rpccwnd", 0); in clnt_dg_call()
467 cu->cu_sent += CWNDSCALE; in clnt_dg_call()
475 error = sosend(cu->cu_socket, sa, NULL, mreq, NULL, 0, curthread); in clnt_dg_call()
494 cu->cu_sent -= CWNDSCALE; in clnt_dg_call()
495 if (cu->cu_cwnd_wait) { in clnt_dg_call()
496 cu->cu_cwnd_wait = FALSE; in clnt_dg_call()
497 wakeup(&cu->cu_cwnd_wait); in clnt_dg_call()
510 cu->cu_sent -= CWNDSCALE; in clnt_dg_call()
511 if (cu->cu_cwnd_wait) { in clnt_dg_call()
512 cu->cu_cwnd_wait = FALSE; in clnt_dg_call()
513 wakeup(&cu->cu_cwnd_wait); in clnt_dg_call()
519 cu->cu_sent -= CWNDSCALE; in clnt_dg_call()
520 if (cu->cu_cwnd_wait) { in clnt_dg_call()
521 cu->cu_cwnd_wait = FALSE; in clnt_dg_call()
522 wakeup(&cu->cu_cwnd_wait); in clnt_dg_call()
533 cu->cu_sent -= CWNDSCALE; in clnt_dg_call()
534 if (cu->cu_cwnd_wait) { in clnt_dg_call()
535 cu->cu_cwnd_wait = FALSE; in clnt_dg_call()
536 wakeup(&cu->cu_cwnd_wait); in clnt_dg_call()
551 if (cu->cu_closing || cu->cu_closed) { in clnt_dg_call()
556 cu->cu_waitflag, cu->cu_waitchan, tv); in clnt_dg_call()
563 cu->cu_sent -= CWNDSCALE; in clnt_dg_call()
564 if (cu->cu_cwnd_wait) { in clnt_dg_call()
565 cu->cu_cwnd_wait = FALSE; in clnt_dg_call()
566 wakeup(&cu->cu_cwnd_wait); in clnt_dg_call()
581 cu->cu_cwnd += (CWNDSCALE * CWNDSCALE in clnt_dg_call()
582 + cu->cu_cwnd / 2) / cu->cu_cwnd; in clnt_dg_call()
583 if (cu->cu_cwnd > MAXCWND) in clnt_dg_call()
584 cu->cu_cwnd = MAXCWND; in clnt_dg_call()
650 cu->cu_cwnd /= 2; in clnt_dg_call()
651 if (cu->cu_cwnd < CWNDSCALE) in clnt_dg_call()
652 cu->cu_cwnd = CWNDSCALE; in clnt_dg_call()
663 if (cu->cu_closing || cu->cu_closed) { in clnt_dg_call()
675 cu->cu_sent += CWNDSCALE; in clnt_dg_call()
698 stat = _seterr_reply(&reply_msg, &(cu->cu_error)); in clnt_dg_call()
727 cu->cu_sent += CWNDSCALE; in clnt_dg_call()
766 cu->cu_threads--; in clnt_dg_call()
767 if (cu->cu_closing) in clnt_dg_call()
768 wakeup(cu); in clnt_dg_call()
783 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_geterr() local
785 *errp = cu->cu_error; in clnt_dg_geterr()
809 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_control() local
813 cs = cu->cu_socket->so_rcv.sb_upcallarg; in clnt_dg_control()
818 cu->cu_closeit = TRUE; in clnt_dg_control()
822 cu->cu_closeit = FALSE; in clnt_dg_control()
838 cu->cu_total = *(struct timeval *)info; in clnt_dg_control()
841 *(struct timeval *)info = cu->cu_total; in clnt_dg_control()
848 cu->cu_wait = *(struct timeval *)info; in clnt_dg_control()
851 *(struct timeval *)info = cu->cu_wait; in clnt_dg_control()
858 memcpy(info, &cu->cu_raddr, cu->cu_raddr.ss_len); in clnt_dg_control()
862 (void) memcpy(&cu->cu_raddr, addr, addr->sa_len); in clnt_dg_control()
882 ntohl(*(uint32_t *)(void *)(cu->cu_mcallc + in clnt_dg_control()
887 *(uint32_t *)(void *)(cu->cu_mcallc + 4 * BYTES_PER_XDR_UNIT) in clnt_dg_control()
899 ntohl(*(uint32_t *)(void *)(cu->cu_mcallc + in clnt_dg_control()
904 *(uint32_t *)(void *)(cu->cu_mcallc + 3 * BYTES_PER_XDR_UNIT) in clnt_dg_control()
908 cu->cu_async = *(int *)info; in clnt_dg_control()
911 cu->cu_connect = *(int *)info; in clnt_dg_control()
914 cu->cu_waitchan = (const char *)info; in clnt_dg_control()
917 *(const char **) info = cu->cu_waitchan; in clnt_dg_control()
921 cu->cu_waitflag = PCATCH; in clnt_dg_control()
923 cu->cu_waitflag = 0; in clnt_dg_control()
926 if (cu->cu_waitflag) in clnt_dg_control()
942 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_close() local
946 cs = cu->cu_socket->so_rcv.sb_upcallarg; in clnt_dg_close()
949 if (cu->cu_closed) { in clnt_dg_close()
954 if (cu->cu_closing) { in clnt_dg_close()
955 while (cu->cu_closing) in clnt_dg_close()
956 msleep(cu, &cs->cs_lock, 0, "rpcclose", 0); in clnt_dg_close()
957 KASSERT(cu->cu_closed, ("client should be closed")); in clnt_dg_close()
966 cu->cu_closing = TRUE; in clnt_dg_close()
975 while (cu->cu_threads) in clnt_dg_close()
976 msleep(cu, &cs->cs_lock, 0, "rpcclose", 0); in clnt_dg_close()
978 cu->cu_closing = FALSE; in clnt_dg_close()
979 cu->cu_closed = TRUE; in clnt_dg_close()
982 wakeup(cu); in clnt_dg_close()
988 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_destroy() local
993 cs = cu->cu_socket->so_rcv.sb_upcallarg; in clnt_dg_destroy()
996 SOCK_RECVBUF_LOCK(cu->cu_socket); in clnt_dg_destroy()
1002 soupcall_clear(cu->cu_socket, SO_RCV); in clnt_dg_destroy()
1003 clnt_dg_upcallsdone(cu->cu_socket, cs); in clnt_dg_destroy()
1004 SOCK_RECVBUF_UNLOCK(cu->cu_socket); in clnt_dg_destroy()
1010 SOCK_RECVBUF_UNLOCK(cu->cu_socket); in clnt_dg_destroy()
1014 if (cu->cu_closeit && lastsocketref) { in clnt_dg_destroy()
1015 so = cu->cu_socket; in clnt_dg_destroy()
1016 cu->cu_socket = NULL; in clnt_dg_destroy()
1026 mem_free(cu, sizeof (*cu)); in clnt_dg_destroy()