Lines Matching full:call

65 	int (*deliver)(struct rxperf_call *call);
74 static int rxperf_deliver_param_block(struct rxperf_call *call);
75 static int rxperf_deliver_request(struct rxperf_call *call);
76 static int rxperf_process_call(struct rxperf_call *call);
82 static inline void rxperf_set_call_state(struct rxperf_call *call, in rxperf_set_call_state() argument
85 call->state = to; in rxperf_set_call_state()
88 static inline void rxperf_set_call_complete(struct rxperf_call *call, in rxperf_set_call_complete() argument
91 if (call->state != RXPERF_CALL_COMPLETE) { in rxperf_set_call_complete()
92 call->abort_code = remote_abort; in rxperf_set_call_complete()
93 call->error = error; in rxperf_set_call_complete()
94 call->state = RXPERF_CALL_COMPLETE; in rxperf_set_call_complete()
110 static void rxperf_queue_call_work(struct rxperf_call *call) in rxperf_queue_call_work() argument
112 queue_work(rxperf_workqueue, &call->work); in rxperf_queue_call_work()
118 struct rxperf_call *call = (struct rxperf_call *)call_user_ID; in rxperf_notify_rx() local
120 if (call->state != RXPERF_CALL_COMPLETE) in rxperf_notify_rx()
121 rxperf_queue_call_work(call); in rxperf_notify_rx()
126 struct rxperf_call *call = (struct rxperf_call *)user_call_ID; in rxperf_rx_attach() local
128 call->rxcall = rxcall; in rxperf_rx_attach()
140 * Charge the incoming call preallocation.
144 struct rxperf_call *call; in rxperf_charge_preallocation() local
147 call = kzalloc(sizeof(*call), GFP_KERNEL); in rxperf_charge_preallocation()
148 if (!call) in rxperf_charge_preallocation()
151 call->type = "unset"; in rxperf_charge_preallocation()
152 call->debug_id = atomic_inc_return(&rxrpc_debug_id); in rxperf_charge_preallocation()
153 call->deliver = rxperf_deliver_param_block; in rxperf_charge_preallocation()
154 call->state = RXPERF_CALL_SV_AWAIT_PARAMS; in rxperf_charge_preallocation()
155 call->service_id = RX_PERF_SERVICE; in rxperf_charge_preallocation()
156 call->iov_len = sizeof(call->params); in rxperf_charge_preallocation()
157 call->kvec[0].iov_len = sizeof(call->params); in rxperf_charge_preallocation()
158 call->kvec[0].iov_base = &call->params; in rxperf_charge_preallocation()
159 iov_iter_kvec(&call->iter, READ, call->kvec, 1, call->iov_len); in rxperf_charge_preallocation()
160 INIT_WORK(&call->work, rxperf_deliver_to_call); in rxperf_charge_preallocation()
165 (unsigned long)call, in rxperf_charge_preallocation()
167 call->debug_id) < 0) in rxperf_charge_preallocation()
169 call = NULL; in rxperf_charge_preallocation()
172 kfree(call); in rxperf_charge_preallocation()
245 static void rxperf_log_error(struct rxperf_call *call, s32 remote_abort) in rxperf_log_error() argument
268 pr_info("Peer reported %s failure on %s\n", msg, call->type); in rxperf_log_error()
273 * deliver messages to a call
277 struct rxperf_call *call = container_of(work, struct rxperf_call, work); in rxperf_deliver_to_call() local
282 if (call->state == RXPERF_CALL_COMPLETE) in rxperf_deliver_to_call()
285 while (state = call->state, in rxperf_deliver_to_call()
291 if (!rxrpc_kernel_check_life(rxperf_socket, call->rxcall)) in rxperf_deliver_to_call()
296 ret = call->deliver(call); in rxperf_deliver_to_call()
298 ret = rxperf_process_call(call); in rxperf_deliver_to_call()
307 rxperf_log_error(call, call->abort_code); in rxperf_deliver_to_call()
311 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall, in rxperf_deliver_to_call()
317 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall, in rxperf_deliver_to_call()
322 pr_err("Call %u in bad state %u\n", in rxperf_deliver_to_call()
323 call->debug_id, call->state); in rxperf_deliver_to_call()
330 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall, in rxperf_deliver_to_call()
335 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall, in rxperf_deliver_to_call()
343 rxperf_set_call_complete(call, ret, remote_abort); in rxperf_deliver_to_call()
344 /* The call may have been requeued */ in rxperf_deliver_to_call()
345 rxrpc_kernel_shutdown_call(rxperf_socket, call->rxcall); in rxperf_deliver_to_call()
346 rxrpc_kernel_put_call(rxperf_socket, call->rxcall); in rxperf_deliver_to_call()
347 cancel_work(&call->work); in rxperf_deliver_to_call()
348 kfree(call); in rxperf_deliver_to_call()
354 static int rxperf_extract_data(struct rxperf_call *call, bool want_more) in rxperf_extract_data() argument
359 ret = rxrpc_kernel_recv_data(rxperf_socket, call->rxcall, &call->iter, in rxperf_extract_data()
360 &call->iov_len, want_more, &remote_abort, in rxperf_extract_data()
361 &call->service_id); in rxperf_extract_data()
363 iov_iter_count(&call->iter), call->iov_len, want_more, ret); in rxperf_extract_data()
368 switch (call->state) { in rxperf_extract_data()
370 rxperf_set_call_state(call, RXPERF_CALL_SV_REPLYING); in rxperf_extract_data()
373 pr_debug("premature completion %d", call->error); in rxperf_extract_data()
374 return call->error; in rxperf_extract_data()
381 rxperf_set_call_complete(call, ret, remote_abort); in rxperf_extract_data()
386 * Grab the operation ID from an incoming manager call.
388 static int rxperf_deliver_param_block(struct rxperf_call *call) in rxperf_deliver_param_block() argument
394 ret = rxperf_extract_data(call, true); in rxperf_deliver_param_block()
398 version = ntohl(call->params.version); in rxperf_deliver_param_block()
399 call->operation_id = ntohl(call->params.type); in rxperf_deliver_param_block()
400 call->deliver = rxperf_deliver_request; in rxperf_deliver_param_block()
407 switch (call->operation_id) { in rxperf_deliver_param_block()
409 call->type = "send"; in rxperf_deliver_param_block()
410 call->reply_len = 0; in rxperf_deliver_param_block()
411 call->iov_len = 4; /* Expect req size */ in rxperf_deliver_param_block()
414 call->type = "recv"; in rxperf_deliver_param_block()
415 call->req_len = 0; in rxperf_deliver_param_block()
416 call->iov_len = 4; /* Expect reply size */ in rxperf_deliver_param_block()
419 call->type = "rpc"; in rxperf_deliver_param_block()
420 call->iov_len = 8; /* Expect req size and reply size */ in rxperf_deliver_param_block()
423 call->type = "file"; in rxperf_deliver_param_block()
429 rxperf_set_call_state(call, RXPERF_CALL_SV_AWAIT_REQUEST); in rxperf_deliver_param_block()
430 return call->deliver(call); in rxperf_deliver_param_block()
436 static int rxperf_deliver_request(struct rxperf_call *call) in rxperf_deliver_request() argument
440 switch (call->unmarshal) { in rxperf_deliver_request()
442 call->kvec[0].iov_len = call->iov_len; in rxperf_deliver_request()
443 call->kvec[0].iov_base = call->tmp; in rxperf_deliver_request()
444 iov_iter_kvec(&call->iter, READ, call->kvec, 1, call->iov_len); in rxperf_deliver_request()
445 call->unmarshal++; in rxperf_deliver_request()
448 ret = rxperf_extract_data(call, true); in rxperf_deliver_request()
452 switch (call->operation_id) { in rxperf_deliver_request()
454 call->type = "send"; in rxperf_deliver_request()
455 call->req_len = ntohl(call->tmp[0]); in rxperf_deliver_request()
456 call->reply_len = 0; in rxperf_deliver_request()
459 call->type = "recv"; in rxperf_deliver_request()
460 call->req_len = 0; in rxperf_deliver_request()
461 call->reply_len = ntohl(call->tmp[0]); in rxperf_deliver_request()
464 call->type = "rpc"; in rxperf_deliver_request()
465 call->req_len = ntohl(call->tmp[0]); in rxperf_deliver_request()
466 call->reply_len = ntohl(call->tmp[1]); in rxperf_deliver_request()
473 pr_debug("CALL op=%s rq=%zx rp=%zx\n", in rxperf_deliver_request()
474 call->type, call->req_len, call->reply_len); in rxperf_deliver_request()
476 call->iov_len = call->req_len; in rxperf_deliver_request()
477 iov_iter_discard(&call->iter, READ, call->req_len); in rxperf_deliver_request()
478 call->unmarshal++; in rxperf_deliver_request()
481 ret = rxperf_extract_data(call, false); in rxperf_deliver_request()
484 call->unmarshal++; in rxperf_deliver_request()
492 * Process a call for which we've received the request.
494 static int rxperf_process_call(struct rxperf_call *call) in rxperf_process_call() argument
500 size_t reply_len = call->reply_len, len; in rxperf_process_call()
502 rxrpc_kernel_set_tx_length(rxperf_socket, call->rxcall, in rxperf_process_call()
510 n = rxrpc_kernel_send_data(rxperf_socket, call->rxcall, &msg, in rxperf_process_call()
524 n = rxrpc_kernel_send_data(rxperf_socket, call->rxcall, &msg, len, in rxperf_process_call()
530 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall, in rxperf_process_call()