Lines Matching refs:buf
81 static void rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf);
407 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_ia_remove() local
410 cancel_work_sync(&buf->rb_refresh_worker); in rpcrdma_ia_remove()
433 list_for_each_entry(req, &buf->rb_allreqs, rl_all) { in rpcrdma_ia_remove()
438 rpcrdma_mrs_destroy(buf); in rpcrdma_ia_remove()
803 static void rpcrdma_sendctxs_destroy(struct rpcrdma_buffer *buf) in rpcrdma_sendctxs_destroy() argument
807 for (i = 0; i <= buf->rb_sc_last; i++) in rpcrdma_sendctxs_destroy()
808 kfree(buf->rb_sc_ctxs[i]); in rpcrdma_sendctxs_destroy()
809 kfree(buf->rb_sc_ctxs); in rpcrdma_sendctxs_destroy()
830 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_sendctxs_create() local
839 i = buf->rb_max_requests + RPCRDMA_MAX_BC_REQUESTS; in rpcrdma_sendctxs_create()
841 buf->rb_sc_ctxs = kcalloc(i, sizeof(sc), GFP_KERNEL); in rpcrdma_sendctxs_create()
842 if (!buf->rb_sc_ctxs) in rpcrdma_sendctxs_create()
845 buf->rb_sc_last = i - 1; in rpcrdma_sendctxs_create()
846 for (i = 0; i <= buf->rb_sc_last; i++) { in rpcrdma_sendctxs_create()
852 buf->rb_sc_ctxs[i] = sc; in rpcrdma_sendctxs_create()
862 static unsigned long rpcrdma_sendctx_next(struct rpcrdma_buffer *buf, in rpcrdma_sendctx_next() argument
865 return likely(item < buf->rb_sc_last) ? item + 1 : 0; in rpcrdma_sendctx_next()
883 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_sendctx_get_locked() local
887 next_head = rpcrdma_sendctx_next(buf, buf->rb_sc_head); in rpcrdma_sendctx_get_locked()
889 if (next_head == READ_ONCE(buf->rb_sc_tail)) in rpcrdma_sendctx_get_locked()
893 sc = buf->rb_sc_ctxs[next_head]; in rpcrdma_sendctx_get_locked()
898 buf->rb_sc_head = next_head; in rpcrdma_sendctx_get_locked()
924 struct rpcrdma_buffer *buf = &sc->sc_xprt->rx_buf; in rpcrdma_sendctx_put_locked() local
930 next_tail = buf->rb_sc_tail; in rpcrdma_sendctx_put_locked()
932 next_tail = rpcrdma_sendctx_next(buf, next_tail); in rpcrdma_sendctx_put_locked()
935 rpcrdma_sendctx_unmap(buf->rb_sc_ctxs[next_tail]); in rpcrdma_sendctx_put_locked()
937 } while (buf->rb_sc_ctxs[next_tail] != sc); in rpcrdma_sendctx_put_locked()
940 smp_store_release(&buf->rb_sc_tail, next_tail); in rpcrdma_sendctx_put_locked()
948 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_mrs_create() local
968 spin_lock(&buf->rb_lock); in rpcrdma_mrs_create()
969 rpcrdma_mr_push(mr, &buf->rb_mrs); in rpcrdma_mrs_create()
970 list_add(&mr->mr_all, &buf->rb_all_mrs); in rpcrdma_mrs_create()
971 spin_unlock(&buf->rb_lock); in rpcrdma_mrs_create()
981 struct rpcrdma_buffer *buf = container_of(work, struct rpcrdma_buffer, in rpcrdma_mr_refresh_worker() local
983 struct rpcrdma_xprt *r_xprt = container_of(buf, struct rpcrdma_xprt, in rpcrdma_mr_refresh_worker()
1057 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_reqs_reset() local
1060 list_for_each_entry(req, &buf->rb_allreqs, rl_all) { in rpcrdma_reqs_reset()
1105 static struct rpcrdma_rep *rpcrdma_rep_get_locked(struct rpcrdma_buffer *buf) in rpcrdma_rep_get_locked() argument
1110 node = llist_del_first(&buf->rb_free_reps); in rpcrdma_rep_get_locked()
1116 static void rpcrdma_rep_put(struct rpcrdma_buffer *buf, in rpcrdma_rep_put() argument
1119 llist_add(&rep->rr_node, &buf->rb_free_reps); in rpcrdma_rep_put()
1124 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_reps_unmap() local
1127 list_for_each_entry(rep, &buf->rb_all_reps, rr_all) in rpcrdma_reps_unmap()
1131 static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf) in rpcrdma_reps_destroy() argument
1135 while ((rep = rpcrdma_rep_get_locked(buf)) != NULL) in rpcrdma_reps_destroy()
1147 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_buffer_create() local
1150 buf->rb_max_requests = r_xprt->rx_ep.rep_max_requests; in rpcrdma_buffer_create()
1151 buf->rb_bc_srv_max_requests = 0; in rpcrdma_buffer_create()
1152 spin_lock_init(&buf->rb_lock); in rpcrdma_buffer_create()
1153 INIT_LIST_HEAD(&buf->rb_mrs); in rpcrdma_buffer_create()
1154 INIT_LIST_HEAD(&buf->rb_all_mrs); in rpcrdma_buffer_create()
1155 INIT_WORK(&buf->rb_refresh_worker, rpcrdma_mr_refresh_worker); in rpcrdma_buffer_create()
1159 INIT_LIST_HEAD(&buf->rb_send_bufs); in rpcrdma_buffer_create()
1160 INIT_LIST_HEAD(&buf->rb_allreqs); in rpcrdma_buffer_create()
1161 INIT_LIST_HEAD(&buf->rb_all_reps); in rpcrdma_buffer_create()
1164 for (i = 0; i < buf->rb_max_requests; i++) { in rpcrdma_buffer_create()
1171 list_add(&req->rl_list, &buf->rb_send_bufs); in rpcrdma_buffer_create()
1174 buf->rb_credits = 1; in rpcrdma_buffer_create()
1175 init_llist_head(&buf->rb_free_reps); in rpcrdma_buffer_create()
1183 rpcrdma_buffer_destroy(buf); in rpcrdma_buffer_create()
1201 struct rpcrdma_buffer *buf = &mr->mr_xprt->rx_buf; in rpcrdma_req_destroy() local
1203 spin_lock(&buf->rb_lock); in rpcrdma_req_destroy()
1205 spin_unlock(&buf->rb_lock); in rpcrdma_req_destroy()
1223 static void rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf) in rpcrdma_mrs_destroy() argument
1225 struct rpcrdma_xprt *r_xprt = container_of(buf, struct rpcrdma_xprt, in rpcrdma_mrs_destroy()
1229 spin_lock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1230 while ((mr = list_first_entry_or_null(&buf->rb_all_mrs, in rpcrdma_mrs_destroy()
1235 spin_unlock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1238 spin_lock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1240 spin_unlock(&buf->rb_lock); in rpcrdma_mrs_destroy()
1253 rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) in rpcrdma_buffer_destroy() argument
1255 cancel_work_sync(&buf->rb_refresh_worker); in rpcrdma_buffer_destroy()
1257 rpcrdma_sendctxs_destroy(buf); in rpcrdma_buffer_destroy()
1258 rpcrdma_reps_destroy(buf); in rpcrdma_buffer_destroy()
1260 while (!list_empty(&buf->rb_send_bufs)) { in rpcrdma_buffer_destroy()
1263 req = list_first_entry(&buf->rb_send_bufs, in rpcrdma_buffer_destroy()
1269 rpcrdma_mrs_destroy(buf); in rpcrdma_buffer_destroy()
1282 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_mr_get() local
1285 spin_lock(&buf->rb_lock); in rpcrdma_mr_get()
1286 mr = rpcrdma_mr_pop(&buf->rb_mrs); in rpcrdma_mr_get()
1287 spin_unlock(&buf->rb_lock); in rpcrdma_mr_get()
1396 void *buf; in rpcrdma_regbuf_realloc() local
1398 buf = kmalloc(size, flags); in rpcrdma_regbuf_realloc()
1399 if (!buf) in rpcrdma_regbuf_realloc()
1405 rb->rg_data = buf; in rpcrdma_regbuf_realloc()
1498 struct rpcrdma_buffer *buf = &r_xprt->rx_buf; in rpcrdma_post_recvs() local
1507 needed = buf->rb_credits + (buf->rb_bc_srv_max_requests << 1); in rpcrdma_post_recvs()
1517 rep = rpcrdma_rep_get_locked(buf); in rpcrdma_post_recvs()