Lines Matching refs:xprt
65 * but it involves locking (master's xprt->xp_thread_lock).
81 * an `xprt-ready' queue and a creator thread (see below). Threads in
120 * If there is none we take a hint from the pool's `xprt-ready' queue.
135 * The `xprt-ready' queue.
138 * this search more efficient each pool has an `xprt-ready' queue.
140 * inserts a pointer to the transport into the `xprt-ready' queue. A
144 * case we try the next hint. The `xprt-ready' queue has fixed size (by
149 * Both the svc_poll() loop and the `xprt-ready' queue are optimized
235 * Size of the `xprt-ready' queue.
266 * A node for the `xprt-ready' queue.
317 #define RELE_PROC(xprt) \
318 ((xprt)->xp_type == T_RDMA ? rdma_rele : \
319 (((xprt)->xp_type == T_CLTS) ? rpc_rele : mir_rele))
327 #define version_keepquiet(xprt) (FALSE)
413 /* Destroy `xprt-ready' queue */
622 /* Allocate and initialize the `xprt-ready' queue */
625 /* Initialize doubly-linked xprt list */
786 svc_xprt_register(SVCMASTERXPRT *xprt, int id)
818 xprt->xp_pool = pool;
825 pool->p_lhead = xprt->xp_prev = xprt->xp_next = xprt;
830 xprt->xp_next = next;
831 xprt->xp_prev = prev;
833 pool->p_lhead = prev->xp_next = next->xp_prev = xprt;
849 svc_xprt_unregister(SVCMASTERXPRT *xprt)
851 SVCPOOL *pool = xprt->xp_pool;
854 * Unlink xprt from the list.
855 * If the list head points to this xprt then move it
856 * to the next xprt or reset to NULL if this is the last
857 * xprt in the list.
861 if (xprt == xprt->xp_next)
864 SVCMASTERXPRT *next = xprt->xp_next;
865 SVCMASTERXPRT *prev = xprt->xp_prev;
870 if (pool->p_lhead == xprt)
874 xprt->xp_next = xprt->xp_prev = NULL;
890 * Initialize an `xprt-ready' queue for a given pool.
914 * - insert a pointer to xprt into the xprt-ready queue (FIFO)
915 * - if the xprt-ready queue is full turn the overflow flag on.
921 svc_xprt_qput(SVCPOOL *pool, SVCMASTERXPRT *xprt)
941 pool->p_qtop->q_xprt = xprt;
948 * `xprt-ready' queue is empty.
958 SVCMASTERXPRT *xprt;
975 xprt = pool->p_qend->q_xprt;
979 } while (xprt == NULL);
982 return (xprt);
987 * is being destroyed from the xprt-ready queue.
991 svc_xprt_qdelete(SVCPOOL *pool, SVCMASTERXPRT *xprt)
997 if (q->q_xprt == xprt)
1010 * a) remove references to this transport from the xprt-ready queue
1018 svc_xprt_cleanup(SVCMASTERXPRT *xprt, bool_t detached)
1020 ASSERT(MUTEX_HELD(&xprt->xp_thread_lock));
1021 ASSERT(xprt->xp_wq == NULL);
1027 if (!detached && xprt->xp_threads == 0 && xprt->xp_closeproc) {
1028 (*(xprt->xp_closeproc)) (xprt);
1031 if (xprt->xp_threads + xprt->xp_detached_threads > 0)
1032 mutex_exit(&xprt->xp_thread_lock);
1034 /* Remove references to xprt from the `xprt-ready' queue */
1035 svc_xprt_qdelete(xprt->xp_pool, xprt);
1037 /* Unregister xprt from the pool's transport list */
1038 svc_xprt_unregister(xprt);
1039 svc_callout_free(xprt);
1040 SVC_DESTROY(xprt);
1055 svc_callout_find(SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
1058 SVC_CALLOUT_TABLE *sct = xprt->xp_sct;
1086 svc_callout_free(SVCMASTERXPRT *xprt)
1088 SVC_CALLOUT_TABLE *sct = xprt->xp_sct;
1279 * Note: the xprt's xp_svc_lock is not held while the service's dispatch
1469 svc_clone_link(SVCMASTERXPRT *xprt, SVCXPRT *clone_xprt, SVCXPRT *clone_xprt2)
1480 mutex_enter(&xprt->xp_thread_lock);
1481 xprt->xp_threads++;
1482 mutex_exit(&xprt->xp_thread_lock);
1488 clone_xprt->xp_master = xprt;
1491 clone_xprt->xp_xpc = xprt->xp_xpc;
1512 SVCMASTERXPRT *xprt = clone_xprt->xp_master;
1516 ASSERT(xprt->xp_threads > 0);
1519 mutex_enter(&xprt->xp_thread_lock);
1520 xprt->xp_threads--;
1522 /* svc_xprt_cleanup() unlocks xp_thread_lock or destroys xprt */
1523 if (xprt->xp_wq)
1524 mutex_exit(&xprt->xp_thread_lock);
1526 svc_xprt_cleanup(xprt, FALSE);
1547 SVCMASTERXPRT *xprt = clone_xprt->xp_master;
1551 ASSERT(xprt->xp_detached_threads > 0);
1552 ASSERT(xprt->xp_threads + xprt->xp_detached_threads > 0);
1554 /* Grab xprt->xp_thread_lock and decrement link counts */
1555 mutex_enter(&xprt->xp_thread_lock);
1556 xprt->xp_detached_threads--;
1558 /* svc_xprt_cleanup() unlocks xp_thread_lock or destroys xprt */
1559 if (xprt->xp_wq)
1560 mutex_exit(&xprt->xp_thread_lock);
1562 svc_xprt_cleanup(xprt, TRUE);
1842 svc_poll(SVCPOOL *pool, SVCMASTERXPRT *xprt, SVCXPRT *clone_xprt)
1868 * and then take a hint from the xprt-ready queue or walk
1871 if (xprt && xprt->xp_req_head && (!pool->p_qoverflow ||
1873 mutex_enter(&xprt->xp_req_lock);
1874 if (xprt->xp_req_head)
1875 return (xprt);
1876 mutex_exit(&xprt->xp_req_lock);
1899 * Get the next transport from the xprt-ready queue.
1926 * If there was no hint in the xprt-ready queue then
1930 * xprt-ready queue; if so, then we need to break
1947 * If there was an overflow in the xprt-ready queue then we
1952 * switch svc_poll() back to taking hints from the xprt-ready
1957 if (xprt == NULL && pool->p_lhead == NULL) {
1967 next = xprt ? xprt->xp_next : pool->p_lhead;
2063 if (xprt && xprt->xp_wq == NULL)
2093 * On input the xprt->xp_full determines whether the flow control is currently
2158 svc_flowcontrol(SVCMASTERXPRT *xprt)
2160 SVCPOOL *pool = xprt->xp_pool;
2164 ASSERT(MUTEX_HELD(&xprt->xp_req_lock));
2167 if (xprt->xp_full == FALSE) {
2173 if (xprt->xp_reqs >= enough_reqs * 2) {
2174 xprt->xp_full = TRUE;
2183 xprt->xp_size >= totalmem / 5 / pool->p_lcount)
2184 xprt->xp_full = TRUE;
2192 if (xprt->xp_reqs > enough_reqs)
2200 xprt->xp_size >= totalmem / 5 / pool->p_lcount / 2)
2204 xprt->xp_full = FALSE;
2205 xprt->xp_enable = TRUE;
2220 SVCMASTERXPRT *xprt = NULL; /* master transport handle */
2250 next = svc_poll(pool, xprt, clone_xprt);
2267 xprt = NULL;
2319 if (next != xprt) {
2320 if (xprt)
2323 xprt = next;
2387 mutex_enter(&xprt->xp_req_lock);
2388 enable = xprt->xp_enable;
2390 xprt->xp_enable = FALSE;
2391 mutex_exit(&xprt->xp_req_lock);
2392 (*RELE_PROC(xprt)) (clone_xprt->xp_wq, NULL, enable);
2404 SVCMASTERXPRT *xprt = ((void **) q->q_ptr)[0];
2411 mutex_enter(&xprt->xp_req_lock);
2412 pool = xprt->xp_pool;
2413 while ((mp = xprt->xp_req_head) != NULL) {
2415 xprt->xp_req_head = mp->b_next;
2417 (*RELE_PROC(xprt)) (xprt->xp_wq, mp, FALSE);
2421 pool->p_reqs -= xprt->xp_reqs;
2422 pool->p_size -= xprt->xp_size;
2425 xprt->xp_reqs = 0;
2426 xprt->xp_size = 0;
2427 xprt->xp_full = FALSE;
2428 xprt->xp_enable = FALSE;
2429 mutex_exit(&xprt->xp_req_lock);
2447 SVCMASTERXPRT *xprt = ((void **) q->q_ptr)[0];
2449 if (xprt == NULL) {
2451 * If there is no master xprt associated with this stream,
2459 mutex_enter(&xprt->xp_thread_lock);
2461 ASSERT(xprt->xp_req_head == NULL);
2462 ASSERT(xprt->xp_wq != NULL);
2464 xprt->xp_wq = NULL;
2466 if (xprt->xp_threads == 0) {
2467 SVCPOOL *pool = xprt->xp_pool;
2473 svc_xprt_cleanup(xprt, FALSE);
2504 mutex_exit(&xprt->xp_thread_lock);
2511 * - insert a hint for svc_poll() into the xprt-ready queue
2520 SVCMASTERXPRT *xprt = ((void **) q->q_ptr)[0];
2521 SVCPOOL *pool = xprt->xp_pool;
2535 * the xprt ready queue and increment the
2538 mutex_enter(&xprt->xp_req_lock);
2539 if (flowcontrol && xprt->xp_full) {
2540 mutex_exit(&xprt->xp_req_lock);
2544 ASSERT(xprt->xp_full == FALSE);
2546 if (xprt->xp_req_head == NULL)
2547 xprt->xp_req_head = mp;
2549 xprt->xp_req_tail->b_next = mp;
2550 xprt->xp_req_tail = mp;
2554 * Insert a hint into the xprt-ready queue, increment
2559 /* Insert pointer to this transport into the xprt-ready queue */
2560 svc_xprt_qput(pool, xprt);
2564 xprt->xp_reqs++;
2567 xprt->xp_size += size;
2572 svc_flowcontrol(xprt);
2598 mutex_exit(&xprt->xp_req_lock);
2707 SVCMASTERXPRT *xprt = clone_xprt->xp_master;
2708 SVCPOOL *pool = xprt->xp_pool;
2716 mutex_enter(&xprt->xp_thread_lock);
2717 xprt->xp_threads--;
2718 xprt->xp_detached_threads++;
2719 mutex_exit(&xprt->xp_thread_lock);
2729 mutex_enter(&xprt->xp_req_lock);
2730 enable = xprt->xp_enable;
2732 xprt->xp_enable = FALSE;
2733 mutex_exit(&xprt->xp_req_lock);
2734 (*RELE_PROC(xprt)) (clone_xprt->xp_wq, NULL, enable);
2750 * to cleanup the pool and destroy the xprt in svc_queueclose()
2755 SVCMASTERXPRT *xprt;
2772 xprt = curr_rec->rtr_xprt_ptr;
2773 q = xprt->xp_wq;
2774 svc_rdma_kstop(xprt);
2776 mutex_enter(&xprt->xp_req_lock);
2777 pool = xprt->xp_pool;
2778 while ((mp = xprt->xp_req_head) != NULL) {
2782 xprt->xp_req_head = mp->b_next;
2790 pool->p_reqs -= xprt->xp_reqs;
2791 pool->p_size -= xprt->xp_size;
2793 xprt->xp_reqs = 0;
2794 xprt->xp_size = 0;
2795 xprt->xp_full = FALSE;
2796 xprt->xp_enable = FALSE;
2797 mutex_exit(&xprt->xp_req_lock);