Lines Matching refs:buf
628 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_sendctxs_destroy() local
631 if (!buf->rb_sc_ctxs) in rpcrdma_sendctxs_destroy()
633 for (i = 0; i <= buf->rb_sc_last; i++) in rpcrdma_sendctxs_destroy()
634 kfree(buf->rb_sc_ctxs[i]); in rpcrdma_sendctxs_destroy()
635 kfree(buf->rb_sc_ctxs); in rpcrdma_sendctxs_destroy()
636 buf->rb_sc_ctxs = NULL; in rpcrdma_sendctxs_destroy()
654 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_sendctxs_create() local
664 buf->rb_sc_ctxs = kcalloc(i, sizeof(sc), GFP_KERNEL); in rpcrdma_sendctxs_create()
665 if (!buf->rb_sc_ctxs) in rpcrdma_sendctxs_create()
668 buf->rb_sc_last = i - 1; in rpcrdma_sendctxs_create()
669 for (i = 0; i <= buf->rb_sc_last; i++) { in rpcrdma_sendctxs_create()
674 buf->rb_sc_ctxs[i] = sc; in rpcrdma_sendctxs_create()
677 buf->rb_sc_head = 0; in rpcrdma_sendctxs_create()
678 buf->rb_sc_tail = 0; in rpcrdma_sendctxs_create()
686 static unsigned long rpcrdma_sendctx_next(struct rpcrdma_buffer *buf, in rpcrdma_sendctx_next() argument
689 return likely(item < buf->rb_sc_last) ? item + 1 : 0; in rpcrdma_sendctx_next()
707 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_sendctx_get_locked() local
711 next_head = rpcrdma_sendctx_next(buf, buf->rb_sc_head); in rpcrdma_sendctx_get_locked()
713 if (next_head == READ_ONCE(buf->rb_sc_tail)) in rpcrdma_sendctx_get_locked()
717 sc = buf->rb_sc_ctxs[next_head]; in rpcrdma_sendctx_get_locked()
722 buf->rb_sc_head = next_head; in rpcrdma_sendctx_get_locked()
749 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_sendctx_put_locked() local
755 next_tail = buf->rb_sc_tail; in rpcrdma_sendctx_put_locked()
757 next_tail = rpcrdma_sendctx_next(buf, next_tail); in rpcrdma_sendctx_put_locked()
760 rpcrdma_sendctx_unmap(buf->rb_sc_ctxs[next_tail]); in rpcrdma_sendctx_put_locked()
762 } while (buf->rb_sc_ctxs[next_tail] != sc); in rpcrdma_sendctx_put_locked()
765 smp_store_release(&buf->rb_sc_tail, next_tail); in rpcrdma_sendctx_put_locked()
773 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_mrs_create() local
791 spin_lock(&buf->rb_lock); in rpcrdma_mrs_create()
792 rpcrdma_mr_push(mr, &buf->rb_mrs); in rpcrdma_mrs_create()
793 list_add(&mr->mr_all, &buf->rb_all_mrs); in rpcrdma_mrs_create()
794 spin_unlock(&buf->rb_lock); in rpcrdma_mrs_create()
804 struct rpcrdma_buffer *buf = container_of(work, struct rpcrdma_buffer, in rpcrdma_mr_refresh_worker() local
806 struct rpcrdma_xprt *r_xprt = container_of(buf, struct rpcrdma_xprt, in rpcrdma_mr_refresh_worker()
820 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_mrs_refresh() local
831 queue_work(xprtiod_workqueue, &buf->rb_refresh_worker); in rpcrdma_mrs_refresh()
917 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_reqs_setup() local
921 list_for_each_entry(req, &buf->rb_allreqs, rl_all) { in rpcrdma_reqs_setup()
950 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_reqs_reset() local
953 list_for_each_entry(req, &buf->rb_allreqs, rl_all) in rpcrdma_reqs_reset()
1003 static struct rpcrdma_rep *rpcrdma_rep_get_locked(struct rpcrdma_buffer *buf) in rpcrdma_rep_get_locked() argument
1008 node = llist_del_first(&buf->rb_free_reps); in rpcrdma_rep_get_locked()
1014 static void rpcrdma_rep_put(struct rpcrdma_buffer *buf, in rpcrdma_rep_put() argument
1017 llist_add(&rep->rr_node, &buf->rb_free_reps); in rpcrdma_rep_put()
1022 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_reps_unmap() local
1025 list_for_each_entry(rep, &buf->rb_all_reps, rr_all) { in rpcrdma_reps_unmap()
1031 static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf) in rpcrdma_reps_destroy() argument
1035 while ((rep = rpcrdma_rep_get_locked(buf)) != NULL) in rpcrdma_reps_destroy()
1047 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_buffer_create() local
1050 buf->rb_bc_srv_max_requests = 0; in rpcrdma_buffer_create()
1051 spin_lock_init(&buf->rb_lock); in rpcrdma_buffer_create()
1052 INIT_LIST_HEAD(&buf->rb_mrs); in rpcrdma_buffer_create()
1053 INIT_LIST_HEAD(&buf->rb_all_mrs); in rpcrdma_buffer_create()
1054 INIT_WORK(&buf->rb_refresh_worker, rpcrdma_mr_refresh_worker); in rpcrdma_buffer_create()
1056 INIT_LIST_HEAD(&buf->rb_send_bufs); in rpcrdma_buffer_create()
1057 INIT_LIST_HEAD(&buf->rb_allreqs); in rpcrdma_buffer_create()
1058 INIT_LIST_HEAD(&buf->rb_all_reps); in rpcrdma_buffer_create()
1068 list_add(&req->rl_list, &buf->rb_send_bufs); in rpcrdma_buffer_create()
1071 init_llist_head(&buf->rb_free_reps); in rpcrdma_buffer_create()
1075 rpcrdma_buffer_destroy(buf); in rpcrdma_buffer_create()
1093 struct rpcrdma_buffer *buf = &mr->mr_xprt->rx_buf; in rpcrdma_req_destroy() local
1095 spin_lock(&buf->rb_lock); in rpcrdma_req_destroy()
1097 spin_unlock(&buf->rb_lock); in rpcrdma_req_destroy()
1117 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_mrs_destroy() local
1120 cancel_work_sync(&buf->rb_refresh_worker); in rpcrdma_mrs_destroy()
1122 spin_lock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1123 while ((mr = list_first_entry_or_null(&buf->rb_all_mrs, in rpcrdma_mrs_destroy()
1128 spin_unlock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1132 spin_lock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1134 spin_unlock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1146 rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) in rpcrdma_buffer_destroy() argument
1148 rpcrdma_reps_destroy(buf); in rpcrdma_buffer_destroy()
1150 while (!list_empty(&buf->rb_send_bufs)) { in rpcrdma_buffer_destroy()
1153 req = list_first_entry(&buf->rb_send_bufs, in rpcrdma_buffer_destroy()
1170 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_mr_get() local
1173 spin_lock(&buf->rb_lock); in rpcrdma_mr_get()
1174 mr = rpcrdma_mr_pop(&buf->rb_mrs); in rpcrdma_mr_get()
1175 spin_unlock(&buf->rb_lock); in rpcrdma_mr_get()
1296 void *buf; in rpcrdma_regbuf_realloc() local
1298 buf = kmalloc(size, flags); in rpcrdma_regbuf_realloc()
1299 if (!buf) in rpcrdma_regbuf_realloc()
1305 rb->rg_data = buf; in rpcrdma_regbuf_realloc()
1396 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_post_recvs() local
1414 rep = rpcrdma_rep_get_locked(buf); in rpcrdma_post_recvs()
1424 rpcrdma_rep_put(buf, rep); in rpcrdma_post_recvs()