Lines Matching defs:iosvc

581 	PTHREAD_MUTEX_INITIALIZER,	/* protects the iosvc msg Q */
582 NULL, /* iosvc msg Q head */
583 NULL, /* iosvc msg Q tail */
1495 * etm_iosvc_msg_enq - add element to tail of ETM iosvc msg queue
1496 * etm_iosvc_msg_deq - del element from head of ETM iosvc msg queue
1501 etm_iosvc_msg_enq(fmd_hdl_t *hdl, etm_iosvc_t *iosvc, etm_iosvc_q_ele_t *msgp)
1505 if (iosvc->msg_q_cur_len >= iosvc->msg_q_max_len) {
1514 if (iosvc->msg_q_cur_len == 0) {
1515 iosvc->msg_q_head = newp;
1517 iosvc->msg_q_tail->msg_nextp = newp;
1520 iosvc->msg_q_tail = newp;
1521 iosvc->msg_q_cur_len++;
1523 iosvc->msg_q_cur_len);
1530 etm_iosvc_msg_deq(fmd_hdl_t *hdl, etm_iosvc_t *iosvc, etm_iosvc_q_ele_t *msgp)
1534 if (iosvc->msg_q_cur_len == 0) {
1539 (void) memcpy(msgp, iosvc->msg_q_head, sizeof (*msgp));
1542 oldp = iosvc->msg_q_head;
1543 iosvc->msg_q_head = iosvc->msg_q_head->msg_nextp;
1550 iosvc->msg_q_cur_len--;
1551 if (iosvc->msg_q_cur_len == 0) {
1552 iosvc->msg_q_tail = NULL;
1564 * need to grab mutex lock iosvc->msg_q_lock before calling this routine.
1567 etm_msg_enq_head(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
1571 etm_iosvc_q_ele_t *newp; /* iosvc msg ele ptr */
1573 if (iosvc->msg_q_cur_len >= iosvc->msg_q_max_len) {
1580 newp = iosvc->msg_q_head;
1581 while (newp->msg_nextp != iosvc->msg_q_tail) {
1586 * free the msg in iosvc->msg_q_tail->msg
1587 * free the mem pointed to by iosvc->msg_q_tail
1589 fmd_hdl_free(fmd_hdl, iosvc->msg_q_tail->msg,
1590 iosvc->msg_q_tail->msg_size);
1591 fmd_hdl_free(fmd_hdl, iosvc->msg_q_tail, sizeof (*newp));
1592 iosvc->msg_q_tail = newp;
1593 iosvc->msg_q_tail->msg_nextp = NULL;
1594 iosvc->msg_q_cur_len--;
1602 if (iosvc->msg_q_cur_len == 0) {
1604 iosvc->msg_q_tail = newp;
1606 newp->msg_nextp = iosvc->msg_q_head;
1608 iosvc->msg_q_head = newp;
1609 iosvc->msg_q_cur_len++;
1614 * Clean up an iosvc structure
1622 etm_iosvc_cleanup(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc, boolean_t clean_msg_q,
1628 iosvc->thr_is_dying = 1;
1630 iosvc->ds_hdl = DS_INVALID_HDL;
1631 if (iosvc->fmd_xprt != NULL) {
1632 fmd_xprt_close(fmd_hdl, iosvc->fmd_xprt);
1633 iosvc->fmd_xprt = NULL;
1636 if (iosvc->send_tid != NULL) {
1637 fmd_thr_signal(fmd_hdl, iosvc->send_tid);
1638 fmd_thr_destroy(fmd_hdl, iosvc->send_tid);
1639 iosvc->send_tid = NULL;
1642 if (iosvc->recv_tid != NULL) {
1643 fmd_thr_signal(fmd_hdl, iosvc->recv_tid);
1644 fmd_thr_destroy(fmd_hdl, iosvc->recv_tid);
1645 iosvc->recv_tid = NULL;
1650 iosvc->ldom_name[0] = '\0';
1652 (void) pthread_mutex_lock(&iosvc->msg_q_lock);
1653 while (iosvc->msg_q_cur_len > 0) {
1654 (void) etm_iosvc_msg_deq(fmd_hdl, iosvc, &msg_ele);
1661 (void) pthread_mutex_unlock(&iosvc->msg_q_lock);
1685 * find an iosvc with the matching ds_hdl.
1687 * create an iosvc for ds_unreg_cb
1692 "info: found an iosvc at slot %d w/ ds_hdl %d \n",
1698 "info: found an iosvc w/ ldom_name %s \n",
1707 * this is an non-empty iosvc structure slot
1711 * found an iosvc structure that matches the
1716 "iosvc at slot %d w/ ds_hdl %d \n",
1719 "iosvc w/ ldom_name %s \n",
1742 * this is the case we need to add an iosvc at first_empty_slot
1746 "info: create an iosvc with ldom name %s\n",
1751 fmd_hdl_debug(fmd_hdl, "info: iosvc #%d has ldom name %s\n",
1763 * remove the ckpt for the iosvc element
1799 etm_send_ds_msg(fmd_hdl_t *fmd_hdl, boolean_t ckpt_remove, etm_iosvc_t *iosvc,
1811 if ((rc = (*etm_ds_send_msg)(iosvc->ds_hdl, msg_ele->msg,
1821 (void *) pthread_mutex_lock(&iosvc->msg_ack_lock);
1828 iosvc->ldom_name);
1829 rc = pthread_cond_timedwait(&iosvc->msg_ack_cv, &iosvc->msg_ack_lock,
1831 (void *) pthread_mutex_unlock(&iosvc->msg_ack_lock);
1838 if (iosvc->ack_ok != 0) {
1850 iosvc->cur_send_xid++;
1858 } /* iosvc->ack_ok != 0 */
1873 etm_pack_ds_msg(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
1934 "for ldom %s\n", hdr_sz, evsz, iosvc->ldom_name);
1946 (msg_type != SP_MSG) && (iosvc->start_sending_Q == 1)) {
1950 (void) pthread_mutex_lock(&iosvc->msg_q_lock);
1951 rc = etm_iosvc_msg_enq(fmd_hdl, iosvc, &msg_ele);
1956 if (iosvc->msg_q_cur_len == 1)
1957 (void) pthread_cond_signal(&iosvc->msg_q_cv);
1958 (void) pthread_mutex_unlock(&iosvc->msg_q_lock);
1963 iosvc->ack_ok = 0;
1965 evhdrp->ev_pp.pp_xid = iosvc->cur_send_xid + 1;
1966 while (!iosvc->ack_ok && iosvc->ds_hdl != DS_INVALID_HDL &&
1968 if (etm_send_ds_msg(fmd_hdl, B_FALSE, iosvc, &msg_ele,
1974 iosvc->start_sending_Q = 1;
2245 etm_iosvc_t *iosvc; /* iosvc data structure */
2400 * iosvc data.
2401 * add an iosvc struct if can not find one
2404 iosvc = etm_iosvc_lookup(hdl, ldom_name,
2407 if (iosvc == NULL) {
2409 "error: can't find iosvc for ldom "
2413 (void) etm_pack_ds_msg(hdl, iosvc,
2850 * setting up the fields in iosvc at DS_REG_CB time
2853 etm_iosvc_setup(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
2856 iosvc->ds_hdl = async_e->ds_hdl;
2857 iosvc->cur_send_xid = 0;
2858 iosvc->xid_posted_ev = 0;
2859 iosvc->start_sending_Q = 0;
2868 if (iosvc->fmd_xprt == NULL) {
2869 iosvc->fmd_xprt = fmd_xprt_open(fmd_hdl, flags, NULL, iosvc);
2872 iosvc->thr_is_dying = 0;
2873 if (iosvc->recv_tid == NULL) {
2874 iosvc->recv_tid = fmd_thr_create(fmd_hdl,
2875 etm_recv_from_remote_root, iosvc);
2877 if (iosvc->send_tid == NULL) {
2878 iosvc->send_tid = fmd_thr_create(fmd_hdl,
2879 etm_send_to_remote_root, iosvc);
3013 etm_iosvc_t *iosvc; /* ptr 2 iosvc struct */
3042 * we have a valid iosvc strcut ptr.
3052 * do nothing if can't find an iosvc
3053 * no iosvc clean up to do
3057 iosvc = etm_iosvc_lookup(fmd_hdl,
3060 if (iosvc == NULL) {
3062 "error: can't find iosvc for ldom "
3073 etm_iosvc_cleanup(fmd_hdl, iosvc, B_TRUE,
3082 * create iosvc if it has not been
3089 iosvc = etm_iosvc_lookup(fmd_hdl,
3092 if (iosvc == NULL) {
3094 "error: can't create iosvc for "
3101 (void) strcpy(iosvc->ldom_name,
3103 iosvc->ds_hdl = async_e.ds_hdl;
3132 * lookup the iosvc struct
3134 * and init the iosvc struct
3138 iosvc = etm_iosvc_lookup(
3141 if (iosvc == NULL) {
3143 "error: can't create iosvc "
3151 etm_iosvc_setup(fmd_hdl, iosvc,
3156 iosvc = &io_svc;
3157 (void) strcpy(iosvc->ldom_name,
3160 etm_iosvc_setup(fmd_hdl, iosvc,
3167 * decide which iosvc struct to perform
3174 * lookup the iosvc struct w/
3177 iosvc = etm_iosvc_lookup(
3180 if (iosvc == NULL) {
3182 "error: can't find iosvc "
3199 if (iosvc->ldom_name != '\0')
3201 "info: iosvc w/ ldom_name "
3202 "%s \n", iosvc->ldom_name);
3208 etm_iosvc_cleanup(fmd_hdl, iosvc,
3213 iosvc = &io_svc;
3218 etm_iosvc_cleanup(fmd_hdl, iosvc,
3269 * deQ what's in iosvc msg Q
3277 etm_iosvc_t *iosvc = (etm_iosvc_t *)arg; /* iosvc ptr */
3278 etm_iosvc_q_ele_t msg_ele; /* iosvc msg ele */
3284 "info: send to remote iosvc starting w/ ldom_name %s\n",
3285 iosvc->ldom_name);
3290 while (!etm_is_dying && !iosvc->thr_is_dying) {
3291 if (iosvc->ds_hdl != DS_INVALID_HDL &&
3292 iosvc->start_sending_Q > 0) {
3293 (void) pthread_mutex_lock(&iosvc->msg_q_lock);
3294 while (iosvc->msg_q_cur_len > 0 &&
3295 iosvc->ds_hdl != DS_INVALID_HDL) {
3296 (void) etm_iosvc_msg_deq(fmd_hdl, iosvc,
3302 (void) pthread_mutex_unlock(&iosvc->msg_q_lock);
3304 iosvc->ack_ok = 0;
3307 ev_hdrp->ev_pp.pp_xid = iosvc->cur_send_xid + 1;
3308 while (!iosvc->ack_ok &&
3309 iosvc->ds_hdl != DS_INVALID_HDL &&
3320 iosvc, &msg_ele, ev_hdrp) < 0) {
3324 if (etm_is_dying || iosvc->thr_is_dying)
3334 if (!iosvc->ack_ok) {
3336 &iosvc->msg_q_lock);
3343 etm_msg_enq_head(fmd_hdl, iosvc,
3346 &iosvc->msg_q_lock);
3353 (void) pthread_mutex_lock(&iosvc->msg_q_lock);
3354 if (etm_is_dying || iosvc->thr_is_dying) {
3357 } /* while dequeing iosvc msgs to send */
3365 if (!etm_is_dying && !iosvc->thr_is_dying &&
3366 iosvc->msg_q_cur_len == 0) {
3369 (void) pthread_cond_wait(&iosvc->msg_q_cv,
3370 &iosvc->msg_q_lock);
3372 (void) pthread_mutex_unlock(&iosvc->msg_q_lock);
3373 if (etm_is_dying || iosvc->thr_is_dying) {
3392 etm_iosvc_t *iosvc = (etm_iosvc_t *)arg; /* iosvc ptr */
3414 "info: recv from remote iosvc starting with ldom name %s \n",
3415 iosvc->ldom_name);
3422 while (!etm_is_dying && !iosvc->thr_is_dying) {
3423 if (iosvc->ds_hdl == DS_INVALID_HDL) {
3436 rc = (*etm_ds_recv_msg)(iosvc->ds_hdl, msg, maxlen, &msg_size);
3489 iosvc->xid_posted_ev) {
3504 iosvc->fmd_xprt, evp)) >= 0) {
3509 iosvc->xid_posted_ev =
3529 if ((*etm_ds_send_msg)(iosvc->ds_hdl, msg,
3542 msg_size, iosvc->ldom_name);
3554 * is the pp.pp_xid == iosvc->cur_send_xid+1,
3557 if (pp->pp_xid != iosvc->cur_send_xid+1) {
3561 pp->pp_xid, iosvc->cur_send_xid+1);
3564 (void) pthread_mutex_lock(&iosvc->msg_ack_lock);
3565 iosvc->ack_ok = 1;
3566 (void) pthread_cond_signal(&iosvc->msg_ack_cv);
3568 &iosvc->msg_ack_lock);
4084 * etm_send - receive an FMA event from FMD and enQ it in the iosvc.Q.
4098 etm_iosvc_t *iosvc; /* ptr to cur iosvc struct */
4114 iosvc =
4146 iosvc = &io_svc;
4165 "%s xprt=%lld\n", iosvc->ldom_name, xp);
4172 (void) etm_pack_ds_msg(fmd_hdl, iosvc, NULL, 0, nvl, msg_type,
4190 etm_iosvc_t *iosvc; /* ptr to insvc struct */
4191 etm_iosvc_q_ele_t msg_ele; /* iosvc msg ele */
4244 * On control domain side, there may be multiple iosvc struct
4247 * Need to go thru every iosvc struct to clean up its resources.
4252 * found an iosvc struct for a root domain
4254 iosvc = &iosvc_list[i];
4256 etm_iosvc_cleanup(hdl, iosvc, B_TRUE, B_FALSE);
4261 * reach the end of existing iosvc structures
4273 * On root domain side, there is only one iosvc struct in use.
4275 iosvc = &io_svc;
4276 if (iosvc->send_tid != NULL) {
4277 fmd_thr_signal(hdl, iosvc->send_tid);
4278 fmd_thr_destroy(hdl, iosvc->send_tid);
4279 iosvc->send_tid = NULL;
4282 if (iosvc->recv_tid != NULL) {
4283 fmd_thr_signal(hdl, iosvc->recv_tid);
4284 fmd_thr_destroy(hdl, iosvc->recv_tid);
4285 iosvc->recv_tid = NULL;
4288 (void) pthread_mutex_lock(&iosvc->msg_q_lock);
4289 while (iosvc->msg_q_cur_len > 0) {
4290 (void) etm_iosvc_msg_deq(hdl, iosvc, &msg_ele);
4293 (void) pthread_mutex_unlock(&iosvc->msg_q_lock);
4295 if (iosvc->fmd_xprt != NULL)
4296 fmd_xprt_close(hdl, iosvc->fmd_xprt);