Lines Matching refs:cu

188 	struct cu_data *cu = NULL;	/* private data */
227 cu = mem_alloc(sizeof (*cu));
228 cu->cu_threads = 0;
229 cu->cu_closing = FALSE;
230 cu->cu_closed = FALSE;
231 (void) memcpy(&cu->cu_raddr, svcaddr, (size_t)svcaddr->sa_len);
232 cu->cu_rlen = svcaddr->sa_len;
234 cu->cu_wait.tv_sec = 3; /* heuristically chosen */
235 cu->cu_wait.tv_usec = 0;
236 cu->cu_total.tv_sec = -1;
237 cu->cu_total.tv_usec = -1;
238 cu->cu_sendsz = sendsz;
239 cu->cu_recvsz = recvsz;
240 cu->cu_async = FALSE;
241 cu->cu_connect = FALSE;
242 cu->cu_connected = FALSE;
243 cu->cu_waitchan = "rpcrecv";
244 cu->cu_waitflag = 0;
245 cu->cu_cwnd = MAXCWND / 2;
246 cu->cu_sent = 0;
247 cu->cu_cwnd_wait = FALSE;
255 xdrmem_create(&xdrs, cu->cu_mcallc, MCALL_MSG_SIZE, XDR_ENCODE);
261 cu->cu_mcalllen = XDR_GETPOS(&xdrs);
268 cu->cu_closeit = FALSE;
269 cu->cu_socket = so;
315 cl->cl_private = (caddr_t)(void *)cu;
322 mem_free(cu, sizeof (*cu));
336 struct cu_data *cu = (struct cu_data *)cl->cl_private;
358 cs = cu->cu_socket->so_rcv.sb_upcallarg;
363 if (cu->cu_closing || cu->cu_closed) {
368 cu->cu_threads++;
375 errp = &cu->cu_error;
382 if (cu->cu_total.tv_usec == -1) {
385 tvp = &cu->cu_total; /* use default timeout */
392 if (cu->cu_connect && !cu->cu_connected) {
394 error = soconnect(cu->cu_socket,
395 (struct sockaddr *)&cu->cu_raddr, curthread);
402 cu->cu_connected = 1;
404 if (cu->cu_connected) {
408 sa = (struct sockaddr *)&cu->cu_raddr;
409 salen = cu->cu_rlen;
416 rt->rt_rtxcur = tvtohz(&cu->cu_wait);
420 retransmit_time = next_sendtime = tvtohz(&cu->cu_wait);
434 KASSERT(cu->cu_mcalllen <= MHLEN, ("RPC header too big"));
435 bcopy(cu->cu_mcallc, mreq->m_data, cu->cu_mcalllen);
436 mreq->m_len = cu->cu_mcalllen;
445 if (cu->cu_async == TRUE && args == NULL)
463 while (cu->cu_sent >= cu->cu_cwnd) {
464 cu->cu_cwnd_wait = TRUE;
465 error = msleep(&cu->cu_cwnd_wait, &cs->cs_lock,
466 cu->cu_waitflag, "rpccwnd", 0);
476 cu->cu_sent += CWNDSCALE;
484 error = sosend(cu->cu_socket, sa, NULL, mreq, NULL, 0, curthread);
503 cu->cu_sent -= CWNDSCALE;
504 if (cu->cu_cwnd_wait) {
505 cu->cu_cwnd_wait = FALSE;
506 wakeup(&cu->cu_cwnd_wait);
519 cu->cu_sent -= CWNDSCALE;
520 if (cu->cu_cwnd_wait) {
521 cu->cu_cwnd_wait = FALSE;
522 wakeup(&cu->cu_cwnd_wait);
528 cu->cu_sent -= CWNDSCALE;
529 if (cu->cu_cwnd_wait) {
530 cu->cu_cwnd_wait = FALSE;
531 wakeup(&cu->cu_cwnd_wait);
542 cu->cu_sent -= CWNDSCALE;
543 if (cu->cu_cwnd_wait) {
544 cu->cu_cwnd_wait = FALSE;
545 wakeup(&cu->cu_cwnd_wait);
560 if (cu->cu_closing || cu->cu_closed) {
565 cu->cu_waitflag, cu->cu_waitchan, tv);
572 cu->cu_sent -= CWNDSCALE;
573 if (cu->cu_cwnd_wait) {
574 cu->cu_cwnd_wait = FALSE;
575 wakeup(&cu->cu_cwnd_wait);
590 cu->cu_cwnd += (CWNDSCALE * CWNDSCALE
591 + cu->cu_cwnd / 2) / cu->cu_cwnd;
592 if (cu->cu_cwnd > MAXCWND)
593 cu->cu_cwnd = MAXCWND;
659 cu->cu_cwnd /= 2;
660 if (cu->cu_cwnd < CWNDSCALE)
661 cu->cu_cwnd = CWNDSCALE;
672 if (cu->cu_closing || cu->cu_closed) {
684 cu->cu_sent += CWNDSCALE;
707 stat = _seterr_reply(&reply_msg, &(cu->cu_error));
736 cu->cu_sent += CWNDSCALE;
775 cu->cu_threads--;
776 if (cu->cu_closing)
777 wakeup(cu);
792 struct cu_data *cu = (struct cu_data *)cl->cl_private;
794 *errp = cu->cu_error;
818 struct cu_data *cu = (struct cu_data *)cl->cl_private;
822 cs = cu->cu_socket->so_rcv.sb_upcallarg;
827 cu->cu_closeit = TRUE;
831 cu->cu_closeit = FALSE;
847 cu->cu_total = *(struct timeval *)info;
850 *(struct timeval *)info = cu->cu_total;
857 cu->cu_wait = *(struct timeval *)info;
860 *(struct timeval *)info = cu->cu_wait;
867 memcpy(info, &cu->cu_raddr, cu->cu_raddr.ss_len);
871 (void) memcpy(&cu->cu_raddr, addr, addr->sa_len);
891 ntohl(*(uint32_t *)(void *)(cu->cu_mcallc +
896 *(uint32_t *)(void *)(cu->cu_mcallc + 4 * BYTES_PER_XDR_UNIT)
908 ntohl(*(uint32_t *)(void *)(cu->cu_mcallc +
913 *(uint32_t *)(void *)(cu->cu_mcallc + 3 * BYTES_PER_XDR_UNIT)
917 cu->cu_async = *(int *)info;
920 cu->cu_connect = *(int *)info;
923 cu->cu_waitchan = (const char *)info;
926 *(const char **) info = cu->cu_waitchan;
930 cu->cu_waitflag = PCATCH;
932 cu->cu_waitflag = 0;
935 if (cu->cu_waitflag)
951 struct cu_data *cu = (struct cu_data *)cl->cl_private;
955 cs = cu->cu_socket->so_rcv.sb_upcallarg;
958 if (cu->cu_closed) {
963 if (cu->cu_closing) {
964 while (cu->cu_closing)
965 msleep(cu, &cs->cs_lock, 0, "rpcclose", 0);
966 KASSERT(cu->cu_closed, ("client should be closed"));
975 cu->cu_closing = TRUE;
984 while (cu->cu_threads)
985 msleep(cu, &cs->cs_lock, 0, "rpcclose", 0);
987 cu->cu_closing = FALSE;
988 cu->cu_closed = TRUE;
991 wakeup(cu);
997 struct cu_data *cu = (struct cu_data *)cl->cl_private;
1002 cs = cu->cu_socket->so_rcv.sb_upcallarg;
1005 SOCKBUF_LOCK(&cu->cu_socket->so_rcv);
1011 soupcall_clear(cu->cu_socket, SO_RCV);
1012 clnt_dg_upcallsdone(cu->cu_socket, cs);
1013 SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
1019 SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
1023 if (cu->cu_closeit && lastsocketref) {
1024 so = cu->cu_socket;
1025 cu->cu_socket = NULL;
1035 mem_free(cu, sizeof (*cu));