Lines Matching refs:reqp
253 #define SEARCH_REMOVE_REQ_LOCKED(reqp, queue, link, tmp, id) \ argument
255 STAILQ_FOREACH_SAFE(reqp, queue, link, tmp) { \
256 if (reqp->vss_req.opt_msg.msgid == id) { \
258 reqp, hv_vss_req_internal, link); \
311 hv_vss_notify_host_result_locked(struct hv_vss_req_internal *reqp, uint32_t status) in hv_vss_notify_host_result_locked() argument
313 struct hv_vss_msg* msg = (struct hv_vss_msg *)reqp->rcv_buf; in hv_vss_notify_host_result_locked()
314 hv_vss_sc *sc = reqp->sc; in hv_vss_notify_host_result_locked()
315 if (reqp->vss_req.opt_msg.opt == HV_VSS_CHECK) { in hv_vss_notify_host_result_locked()
319 vss_opt_name[reqp->vss_req.opt_msg.opt], in hv_vss_notify_host_result_locked()
321 hv_vss_respond_host(reqp->rcv_buf, vmbus_get_channel(reqp->sc->dev), in hv_vss_notify_host_result_locked()
322 reqp->host_msg_len, reqp->host_msg_id, status); in hv_vss_notify_host_result_locked()
324 LIST_INSERT_HEAD(&sc->req_free_list, reqp, link); in hv_vss_notify_host_result_locked()
328 hv_vss_notify_host_result(struct hv_vss_req_internal *reqp, uint32_t status) in hv_vss_notify_host_result() argument
330 mtx_lock(&reqp->sc->pending_mutex); in hv_vss_notify_host_result()
331 hv_vss_notify_host_result_locked(reqp, status); in hv_vss_notify_host_result()
332 mtx_unlock(&reqp->sc->pending_mutex); in hv_vss_notify_host_result()
336 hv_vss_cp_vssreq_to_user(struct hv_vss_req_internal *reqp, in hv_vss_cp_vssreq_to_user() argument
340 hv_vss_dev_buf = &reqp->vss_req; in hv_vss_cp_vssreq_to_user()
342 switch (reqp->vss_req.msg.hdr.vss_hdr.operation) { in hv_vss_cp_vssreq_to_user()
369 struct hv_vss_req_internal *reqp, *tmp; in hv_vss_drain_req_queue_locked() local
370 SEARCH_REMOVE_REQ_LOCKED(reqp, &sc->daemon_sc.to_notify_queue, in hv_vss_drain_req_queue_locked()
372 if (reqp == NULL) in hv_vss_drain_req_queue_locked()
373 SEARCH_REMOVE_REQ_LOCKED(reqp, &sc->daemon_sc.to_ack_queue, in hv_vss_drain_req_queue_locked()
375 if (reqp == NULL) in hv_vss_drain_req_queue_locked()
376 SEARCH_REMOVE_REQ_LOCKED(reqp, &sc->app_sc.to_notify_queue, in hv_vss_drain_req_queue_locked()
378 if (reqp == NULL) in hv_vss_drain_req_queue_locked()
379 SEARCH_REMOVE_REQ_LOCKED(reqp, &sc->app_sc.to_ack_queue, slink, in hv_vss_drain_req_queue_locked()
381 return (reqp); in hv_vss_drain_req_queue_locked()
389 struct hv_vss_req_internal *reqp; in hv_vss_notified() local
392 reqp = STAILQ_FIRST(&dev_sc->to_notify_queue); in hv_vss_notified()
393 hv_vss_cp_vssreq_to_user(reqp, userdata); in hv_vss_notified()
396 STAILQ_INSERT_TAIL(&dev_sc->to_ack_queue, reqp, slink); in hv_vss_notified()
407 hv_vss_notify(struct hv_vss_dev_sc *dev_sc, struct hv_vss_req_internal *reqp) in hv_vss_notify() argument
409 uint32_t opt = reqp->vss_req.opt_msg.opt; in hv_vss_notify()
411 STAILQ_INSERT_TAIL(&dev_sc->to_notify_queue, reqp, slink); in hv_vss_notify()
413 vss_opt_name[opt], (uintmax_t)reqp->vss_req.opt_msg.msgid, in hv_vss_notify()
425 struct hv_vss_req_internal *reqp, *tmp; in hv_vss_daemon_acked() local
437 SEARCH_REMOVE_REQ_LOCKED(reqp, &dev_sc->to_ack_queue, slink, tmp, req_id); in hv_vss_daemon_acked()
439 if (reqp == NULL) { in hv_vss_daemon_acked()
445 KASSERT(opt == reqp->vss_req.opt_msg.opt, ("Mismatched VSS operation!")); in hv_vss_daemon_acked()
451 callout_drain(&reqp->callout); in hv_vss_daemon_acked()
452 hv_vss_notify_host_result(reqp, in hv_vss_daemon_acked()
458 hv_vss_notify(&dev_sc->sc->app_sc, reqp); in hv_vss_daemon_acked()
461 callout_drain(&reqp->callout); in hv_vss_daemon_acked()
462 hv_vss_notify_host_result(reqp, HV_E_FAIL); in hv_vss_daemon_acked()
465 callout_drain(&reqp->callout); in hv_vss_daemon_acked()
466 hv_vss_notify_host_result(reqp, in hv_vss_daemon_acked()
479 struct hv_vss_req_internal *reqp, *tmp; in hv_vss_app_acked() local
491 SEARCH_REMOVE_REQ_LOCKED(reqp, &dev_sc->to_ack_queue, slink, tmp, req_id); in hv_vss_app_acked()
493 if (reqp == NULL) { in hv_vss_app_acked()
499 KASSERT(opt == reqp->vss_req.opt_msg.opt, ("Mismatched VSS operation!")); in hv_vss_app_acked()
507 hv_vss_notify(&dev_sc->sc->daemon_sc, reqp); in hv_vss_app_acked()
510 callout_drain(&reqp->callout); in hv_vss_app_acked()
511 hv_vss_notify_host_result(reqp, HV_E_FAIL); in hv_vss_app_acked()
515 callout_drain(&reqp->callout); in hv_vss_app_acked()
516 hv_vss_notify_host_result(reqp, in hv_vss_app_acked()
690 hv_vss_req_internal *reqp = arg; in hv_vss_timeout() local
692 hv_vss_sc* sc = reqp->sc; in hv_vss_timeout()
693 uint64_t req_id = reqp->vss_req.opt_msg.msgid; in hv_vss_timeout()
698 hv_vss_notify_host_result_locked(reqp, HV_E_FAIL); in hv_vss_timeout()
705 hv_vss_init_req(hv_vss_req_internal *reqp, in hv_vss_init_req() argument
711 memset(reqp, 0, __offsetof(hv_vss_req_internal, callout)); in hv_vss_init_req()
712 reqp->host_msg_len = recvlen; in hv_vss_init_req()
713 reqp->host_msg_id = requestid; in hv_vss_init_req()
714 reqp->rcv_buf = vss_buf; in hv_vss_init_req()
715 reqp->sc = sc; in hv_vss_init_req()
716 memcpy(&reqp->vss_req.msg, in hv_vss_init_req()
721 reqp->vss_req.opt_msg.opt = HV_VSS_FREEZE; in hv_vss_init_req()
724 reqp->vss_req.opt_msg.opt = HV_VSS_THAW; in hv_vss_init_req()
727 reqp->vss_req.opt_msg.opt = HV_VSS_CHECK; in hv_vss_init_req()
732 reqp->vss_req.opt_msg.msgid = (vm_ts.tv_sec * NANOSEC) + vm_ts.tv_nsec; in hv_vss_init_req()
738 hv_vss_req_internal *reqp; in hv_vss_get_new_req_locked() local
756 reqp = LIST_FIRST(&sc->req_free_list); in hv_vss_get_new_req_locked()
757 LIST_REMOVE(reqp, link); in hv_vss_get_new_req_locked()
758 return (reqp); in hv_vss_get_new_req_locked()
762 hv_vss_start_notify(hv_vss_req_internal *reqp, uint32_t opt) in hv_vss_start_notify() argument
764 hv_vss_sc *sc = reqp->sc; in hv_vss_start_notify()
776 hv_vss_notify(&sc->app_sc, reqp); in hv_vss_start_notify()
778 hv_vss_notify(&sc->daemon_sc, reqp); in hv_vss_start_notify()
779 callout_reset(&reqp->callout, TIMEOUT_LIMIT * hz, in hv_vss_start_notify()
780 hv_vss_timeout, reqp); in hv_vss_start_notify()
783 hv_vss_notify(&sc->daemon_sc, reqp); in hv_vss_start_notify()
784 callout_reset(&reqp->callout, TIMEOUT_LIMIT * hz, in hv_vss_start_notify()
785 hv_vss_timeout, reqp); in hv_vss_start_notify()
804 hv_vss_req_internal *reqp; in hv_vss_process_request() local
833 reqp = hv_vss_get_new_req_locked(sc); in hv_vss_process_request()
835 if (reqp == NULL) { in hv_vss_process_request()
839 hv_vss_init_req(reqp, recvlen, requestid, vss_buf, sc); in hv_vss_process_request()
842 vss_opt_name[reqp->vss_req.opt_msg.opt], in hv_vss_process_request()
843 (uintmax_t)reqp->vss_req.opt_msg.msgid); in hv_vss_process_request()
844 hv_vss_start_notify(reqp, msg->hdr.vss_hdr.operation); in hv_vss_process_request()
913 struct hv_vss_req_internal* reqp; in hv_vss_init_send_receive_queue() local
922 reqp = malloc(sizeof(struct hv_vss_req_internal), in hv_vss_init_send_receive_queue()
924 LIST_INSERT_HEAD(&sc->req_free_list, reqp, link); in hv_vss_init_send_receive_queue()
925 callout_init_mtx(&reqp->callout, &sc->pending_mutex, 0); in hv_vss_init_send_receive_queue()
934 hv_vss_req_internal* reqp; in hv_vss_destroy_send_receive_queue() local
937 reqp = LIST_FIRST(&sc->req_free_list); in hv_vss_destroy_send_receive_queue()
938 LIST_REMOVE(reqp, link); in hv_vss_destroy_send_receive_queue()
939 free(reqp, M_DEVBUF); in hv_vss_destroy_send_receive_queue()
943 reqp = STAILQ_FIRST(&sc->daemon_sc.to_notify_queue); in hv_vss_destroy_send_receive_queue()
945 free(reqp, M_DEVBUF); in hv_vss_destroy_send_receive_queue()
949 reqp = STAILQ_FIRST(&sc->daemon_sc.to_ack_queue); in hv_vss_destroy_send_receive_queue()
951 free(reqp, M_DEVBUF); in hv_vss_destroy_send_receive_queue()
955 reqp = STAILQ_FIRST(&sc->app_sc.to_notify_queue); in hv_vss_destroy_send_receive_queue()
957 free(reqp, M_DEVBUF); in hv_vss_destroy_send_receive_queue()
961 reqp = STAILQ_FIRST(&sc->app_sc.to_ack_queue); in hv_vss_destroy_send_receive_queue()
963 free(reqp, M_DEVBUF); in hv_vss_destroy_send_receive_queue()