Lines Matching refs:newxprt
203 svc_rdma_parse_connect_private(struct svcxprt_rdma *newxprt, in svc_rdma_parse_connect_private() argument
211 newxprt->sc_snd_w_inv = pmsg->cp_flags & in svc_rdma_parse_connect_private()
218 newxprt->sc_snd_w_inv ? "" : "un"); in svc_rdma_parse_connect_private()
237 struct svcxprt_rdma *newxprt; in handle_connect_req() local
240 newxprt = svc_rdma_create_xprt(listen_xprt->sc_xprt.xpt_server, in handle_connect_req()
243 if (!newxprt) in handle_connect_req()
245 newxprt->sc_cm_id = new_cma_id; in handle_connect_req()
246 new_cma_id->context = newxprt; in handle_connect_req()
247 svc_rdma_parse_connect_private(newxprt, param); in handle_connect_req()
250 newxprt->sc_ord = param->initiator_depth; in handle_connect_req()
252 sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; in handle_connect_req()
253 newxprt->sc_xprt.xpt_remotelen = svc_addr_len(sa); in handle_connect_req()
254 memcpy(&newxprt->sc_xprt.xpt_remote, sa, in handle_connect_req()
255 newxprt->sc_xprt.xpt_remotelen); in handle_connect_req()
256 snprintf(newxprt->sc_xprt.xpt_remotebuf, in handle_connect_req()
257 sizeof(newxprt->sc_xprt.xpt_remotebuf) - 1, "%pISc", sa); in handle_connect_req()
263 rpc_set_port((struct sockaddr *)&newxprt->sc_xprt.xpt_remote, 0); in handle_connect_req()
265 sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr; in handle_connect_req()
266 svc_xprt_set_local(&newxprt->sc_xprt, sa, svc_addr_len(sa)); in handle_connect_req()
273 list_add_tail(&newxprt->sc_accept_q, &listen_xprt->sc_accept_q); in handle_connect_req()
410 struct svcxprt_rdma *newxprt = NULL; in svc_rdma_accept() local
424 newxprt = list_entry(listen_rdma->sc_accept_q.next, in svc_rdma_accept()
426 list_del_init(&newxprt->sc_accept_q); in svc_rdma_accept()
431 if (!newxprt) in svc_rdma_accept()
434 dev = newxprt->sc_cm_id->device; in svc_rdma_accept()
435 newxprt->sc_port_num = newxprt->sc_cm_id->port_num; in svc_rdma_accept()
437 if (rpcrdma_rn_register(dev, &newxprt->sc_rn, svc_rdma_xprt_done)) in svc_rdma_accept()
440 newxprt->sc_max_req_size = svcrdma_max_req_size; in svc_rdma_accept()
441 newxprt->sc_max_requests = svcrdma_max_requests; in svc_rdma_accept()
442 newxprt->sc_max_bc_requests = svcrdma_max_bc_requests; in svc_rdma_accept()
443 newxprt->sc_recv_batch = RPCRDMA_MAX_RECV_BATCH; in svc_rdma_accept()
444 newxprt->sc_fc_credits = cpu_to_be32(newxprt->sc_max_requests); in svc_rdma_accept()
451 newxprt->sc_max_send_sges = 3; in svc_rdma_accept()
453 newxprt->sc_max_send_sges += (svcrdma_max_req_size / PAGE_SIZE) + 1; in svc_rdma_accept()
454 if (newxprt->sc_max_send_sges > dev->attrs.max_send_sge) in svc_rdma_accept()
455 newxprt->sc_max_send_sges = dev->attrs.max_send_sge; in svc_rdma_accept()
456 rq_depth = newxprt->sc_max_requests + newxprt->sc_max_bc_requests + in svc_rdma_accept()
457 newxprt->sc_recv_batch + 1 /* drain */; in svc_rdma_accept()
460 newxprt->sc_recv_batch = 1; in svc_rdma_accept()
461 newxprt->sc_max_requests = rq_depth - 2; in svc_rdma_accept()
462 newxprt->sc_max_bc_requests = 2; in svc_rdma_accept()
471 newxprt->sc_sq_depth = rq_depth + ctxts; in svc_rdma_accept()
472 if (newxprt->sc_sq_depth > dev->attrs.max_qp_wr) in svc_rdma_accept()
473 newxprt->sc_sq_depth = dev->attrs.max_qp_wr; in svc_rdma_accept()
474 atomic_set(&newxprt->sc_sq_avail, newxprt->sc_sq_depth); in svc_rdma_accept()
476 newxprt->sc_pd = ib_alloc_pd(dev, 0); in svc_rdma_accept()
477 if (IS_ERR(newxprt->sc_pd)) { in svc_rdma_accept()
478 trace_svcrdma_pd_err(newxprt, PTR_ERR(newxprt->sc_pd)); in svc_rdma_accept()
481 newxprt->sc_sq_cq = ib_alloc_cq_any(dev, newxprt, newxprt->sc_sq_depth, in svc_rdma_accept()
483 if (IS_ERR(newxprt->sc_sq_cq)) in svc_rdma_accept()
485 newxprt->sc_rq_cq = in svc_rdma_accept()
486 ib_alloc_cq_any(dev, newxprt, rq_depth, IB_POLL_WORKQUEUE); in svc_rdma_accept()
487 if (IS_ERR(newxprt->sc_rq_cq)) in svc_rdma_accept()
492 qp_attr.qp_context = &newxprt->sc_xprt; in svc_rdma_accept()
493 qp_attr.port_num = newxprt->sc_port_num; in svc_rdma_accept()
495 qp_attr.cap.max_send_wr = newxprt->sc_sq_depth - ctxts; in svc_rdma_accept()
497 qp_attr.cap.max_send_sge = newxprt->sc_max_send_sges; in svc_rdma_accept()
501 qp_attr.send_cq = newxprt->sc_sq_cq; in svc_rdma_accept()
502 qp_attr.recv_cq = newxprt->sc_rq_cq; in svc_rdma_accept()
508 newxprt->sc_sq_depth, rq_depth); in svc_rdma_accept()
509 ret = rdma_create_qp(newxprt->sc_cm_id, newxprt->sc_pd, &qp_attr); in svc_rdma_accept()
511 trace_svcrdma_qp_err(newxprt, ret); in svc_rdma_accept()
514 newxprt->sc_max_send_sges = qp_attr.cap.max_send_sge; in svc_rdma_accept()
515 newxprt->sc_qp = newxprt->sc_cm_id->qp; in svc_rdma_accept()
518 newxprt->sc_snd_w_inv = false; in svc_rdma_accept()
519 if (!rdma_protocol_iwarp(dev, newxprt->sc_port_num) && in svc_rdma_accept()
520 !rdma_ib_or_roce(dev, newxprt->sc_port_num)) { in svc_rdma_accept()
521 trace_svcrdma_fabric_err(newxprt, -EINVAL); in svc_rdma_accept()
525 if (!svc_rdma_post_recvs(newxprt)) in svc_rdma_accept()
533 rpcrdma_encode_buffer_size(newxprt->sc_max_req_size); in svc_rdma_accept()
536 set_bit(RDMAXPRT_CONN_PENDING, &newxprt->sc_flags); in svc_rdma_accept()
539 conn_param.initiator_depth = min_t(int, newxprt->sc_ord, in svc_rdma_accept()
543 trace_svcrdma_initdepth_err(newxprt, ret); in svc_rdma_accept()
548 rdma_lock_handler(newxprt->sc_cm_id); in svc_rdma_accept()
549 newxprt->sc_cm_id->event_handler = svc_rdma_cma_handler; in svc_rdma_accept()
550 ret = rdma_accept(newxprt->sc_cm_id, &conn_param); in svc_rdma_accept()
551 rdma_unlock_handler(newxprt->sc_cm_id); in svc_rdma_accept()
553 trace_svcrdma_accept_err(newxprt, ret); in svc_rdma_accept()
559 sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr; in svc_rdma_accept()
561 sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; in svc_rdma_accept()
563 dprintk(" max_sge : %d\n", newxprt->sc_max_send_sges); in svc_rdma_accept()
564 dprintk(" sq_depth : %d\n", newxprt->sc_sq_depth); in svc_rdma_accept()
566 dprintk(" max_requests : %d\n", newxprt->sc_max_requests); in svc_rdma_accept()
570 return &newxprt->sc_xprt; in svc_rdma_accept()
574 svc_xprt_get(&newxprt->sc_xprt); in svc_rdma_accept()
575 if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp)) in svc_rdma_accept()
576 ib_destroy_qp(newxprt->sc_qp); in svc_rdma_accept()
577 rdma_destroy_id(newxprt->sc_cm_id); in svc_rdma_accept()
579 svc_xprt_put(&newxprt->sc_xprt); in svc_rdma_accept()