Lines Matching defs:vdcp

142 static void	vdc_switch_server(vdc_t *vdcp);
158 static int vdc_ver_negotiation(vdc_t *vdcp);
160 static int vdc_attr_negotiation(vdc_t *vdcp);
162 static int vdc_dring_negotiation(vdc_t *vdcp);
163 static int vdc_send_rdx(vdc_t *vdcp);
164 static int vdc_rdx_exchange(vdc_t *vdcp);
176 static int vdc_send_request(vdc_t *vdcp, int operation,
179 static int vdc_map_to_shared_dring(vdc_t *vdcp, int idx);
180 static int vdc_populate_descriptor(vdc_t *vdcp, int operation,
183 static int vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr,
190 static int vdc_wait_for_response(vdc_t *vdcp, vio_msg_t *msgp);
191 static int vdc_drain_response(vdc_t *vdcp, struct buf *buf);
193 static int vdc_populate_mem_hdl(vdc_t *vdcp, vdc_local_desc_t *ldep);
900 vdc_stop_ldc_connection(vdc_t *vdcp)
904 ASSERT(vdcp != NULL);
906 ASSERT(MUTEX_HELD(&vdcp->lock));
908 DMSG(vdcp, 0, ": Resetting connection to vDisk server : state %d\n",
909 vdcp->state);
911 status = ldc_down(vdcp->curr_server->ldc_handle);
912 DMSG(vdcp, 0, "ldc_down() = %d\n", status);
914 vdcp->initialized &= ~VDC_HANDSHAKE;
915 DMSG(vdcp, 0, "initialized=%x\n", vdcp->initialized);
1672 * vdcp - soft state pointer for this instance of the device driver.
1678 vdc_ver_negotiation(vdc_t *vdcp)
1683 if (status = vdc_init_ver_negotiation(vdcp, vdc_version[0]))
1687 mutex_exit(&vdcp->lock);
1688 status = vdc_wait_for_response(vdcp, &vio_msg);
1689 mutex_enter(&vdcp->lock);
1691 DMSG(vdcp, 0,
1693 vdcp->instance, status);
1700 DMSG(vdcp, 0, "[%d] Invalid ver negotiation response\n",
1701 vdcp->instance);
1705 return (vdc_handle_ver_msg(vdcp, (vio_ver_msg_t *)&vio_msg));
1773 vdc_attr_negotiation(vdc_t *vdcp)
1778 if (status = vdc_init_attr_negotiation(vdcp))
1782 mutex_exit(&vdcp->lock);
1783 status = vdc_wait_for_response(vdcp, &vio_msg);
1784 mutex_enter(&vdcp->lock);
1786 DMSG(vdcp, 0,
1788 vdcp->instance, status);
1795 DMSG(vdcp, 0, "[%d] Invalid attr negotiation response\n",
1796 vdcp->instance);
1800 return (vdc_handle_attr_msg(vdcp, (vd_attr_msg_t *)&vio_msg));
1880 vdc_dring_negotiation(vdc_t *vdcp)
1885 if (status = vdc_init_dring_negotiate(vdcp))
1889 mutex_exit(&vdcp->lock);
1890 status = vdc_wait_for_response(vdcp, &vio_msg);
1891 mutex_enter(&vdcp->lock);
1893 DMSG(vdcp, 0,
1895 " rv(%d)", vdcp->instance, status);
1902 DMSG(vdcp, 0, "[%d] Invalid Dring negotiation response\n",
1903 vdcp->instance);
1907 return (vdc_handle_dring_reg_msg(vdcp,
1925 vdc_send_rdx(vdc_t *vdcp)
1938 msg.tag.vio_sid = vdcp->session_id;
1939 status = vdc_send(vdcp, (caddr_t)&msg, &msglen);
1941 DMSG(vdcp, 0, "[%d] Failed to send RDX message (%d)",
1942 vdcp->instance, status);
1962 vdc_handle_rdx(vdc_t *vdcp, vio_rdx_msg_t *msgp)
1964 _NOTE(ARGUNUSED(vdcp))
1971 DMSG(vdcp, 1, "[%d] Got an RDX msg", vdcp->instance);
1989 vdc_rdx_exchange(vdc_t *vdcp)
1994 if (status = vdc_send_rdx(vdcp))
1998 mutex_exit(&vdcp->lock);
1999 status = vdc_wait_for_response(vdcp, &vio_msg);
2000 mutex_enter(&vdcp->lock);
2002 DMSG(vdcp, 0, "[%d] Failed waiting for RDX response, rv(%d)",
2003 vdcp->instance, status);
2010 DMSG(vdcp, 0, "[%d] Invalid RDX response\n", vdcp->instance);
2014 return (vdc_handle_rdx(vdcp, (vio_rdx_msg_t *)&vio_msg));
2100 vdc_decode_tag(vdc_t *vdcp, vio_msg_t *msg)
2135 DMSG(vdcp, 3, "(%x/%x/%x) message : (%s/%s/%s)\n",
2410 srvr->vdcp = vdc;
2863 * vdcp - soft state pointer for this instance of the device driver.
2870 vdc_map_to_shared_dring(vdc_t *vdcp, int idx)
2876 ldep = &(vdcp->local_dring[idx]);
2880 rv = vdc_populate_mem_hdl(vdcp, ldep);
2882 DMSG(vdcp, 0, "[%d] Cannot populate mem handle\n",
2883 vdcp->instance);
2894 dep->payload.req_id = VDC_GET_NEXT_REQ_ID(vdcp);
2916 * vdcp - the soft state pointer
2930 vdc_send_request(vdc_t *vdcp, int operation, caddr_t addr,
2936 ASSERT(vdcp != NULL);
2939 mutex_enter(&vdcp->lock);
2955 VD_KSTAT_WAITQ_ENTER(vdcp);
2963 rv = vdc_populate_descriptor(vdcp, operation, addr,
2969 while (vdcp->state != VDC_STATE_RUNNING) {
2972 if (vdcp->state == VDC_STATE_DETACH) {
2992 if (vdcp->state == VDC_STATE_FAILED) {
2993 vdcp->io_pending = B_TRUE;
2994 cv_signal(&vdcp->io_pending_cv);
2997 cv_wait(&vdcp->running_cv, &vdcp->lock);
3000 if (vdcp->state == VDC_STATE_FAILED) {
3006 } while (vdc_populate_descriptor(vdcp, operation, addr,
3021 VD_KSTAT_WAITQ_TO_RUNQ(vdcp);
3024 VD_UPDATE_ERR_STATS(vdcp, vd_transerrs);
3026 VD_KSTAT_WAITQ_EXIT(vdcp);
3032 mutex_exit(&vdcp->lock);
3048 * vdcp - the soft state pointer
3064 vdc_populate_descriptor(vdc_t *vdcp, int operation, caddr_t addr,
3075 ASSERT(MUTEX_HELD(&vdcp->lock));
3076 vdcp->threads_pending++;
3078 DMSG(vdcp, 2, ": dring_curr_idx = %d\n", vdcp->dring_curr_idx);
3083 local_dep = &(vdcp->local_dring[idx]);
3086 idx = vdcp->dring_curr_idx;
3087 local_dep = &(vdcp->local_dring[idx]);
3090 DMSG(vdcp, 2, "[%d]: dring full - waiting for space\n",
3091 vdcp->instance);
3092 cv_wait(&vdcp->dring_free_cv, &vdcp->lock);
3093 if (vdcp->state == VDC_STATE_RUNNING ||
3094 vdcp->state == VDC_STATE_HANDLE_PENDING) {
3097 vdcp->threads_pending--;
3102 if (next_idx >= vdcp->dring_len)
3104 vdcp->dring_curr_idx = next_idx;
3120 rv = vdc_map_to_shared_dring(vdcp, idx);
3123 DMSG(vdcp, 0, "[%d]: cannot bind memory - error\n",
3124 vdcp->instance);
3130 vdcp->threads_pending--;
3133 DMSG(vdcp, 0, "[%d]: cannot bind memory - waiting ..\n",
3134 vdcp->instance);
3137 vdcp->dring_curr_idx = idx;
3138 cv_wait(&vdcp->membind_cv, &vdcp->lock);
3139 if (vdcp->state == VDC_STATE_RUNNING ||
3140 vdcp->state == VDC_STATE_HANDLE_PENDING) {
3143 vdcp->threads_pending--;
3151 VDC_INIT_DRING_DATA_MSG_IDS(dmsg, vdcp);
3152 dmsg.dring_ident = vdcp->dring_ident;
3155 vdcp->seq_num++;
3157 DTRACE_PROBE2(populate, int, vdcp->instance,
3159 DMSG(vdcp, 2, "ident=0x%lx, st=%u, end=%u, seq=%ld\n",
3160 vdcp->dring_ident, dmsg.start_idx, dmsg.end_idx, dmsg.seq_num);
3167 rv = vdc_send(vdcp, (caddr_t)&dmsg, &msglen);
3182 DMSG(vdcp, 1, "sent via LDC: rv=%d\n", rv);
3186 DMSG(vdcp, 0, "unexpected error, rv=%d\n", rv);
3191 vdcp->threads_pending--;
3327 * vdcp - the soft state pointer
3348 vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes,
3358 mutex_enter(&vdcp->lock);
3359 vdcp->sync_op_cnt++;
3360 while (vdcp->sync_op_blocked && vdcp->state != VDC_STATE_DETACH) {
3363 vdcp->sync_op_cnt--;
3364 mutex_exit(&vdcp->lock);
3367 cv_wait(&vdcp->sync_blocked_cv, &vdcp->lock);
3371 if (vdcp->state == VDC_STATE_DETACH) {
3372 cv_broadcast(&vdcp->sync_blocked_cv);
3373 vdcp->sync_op_cnt--;
3374 mutex_exit(&vdcp->lock);
3379 vdcp->sync_op_blocked = B_TRUE;
3381 mutex_exit(&vdcp->lock);
3386 status = vdc_do_op(vdcp, operation, addr, nbytes, slice, offset,
3389 mutex_enter(&vdcp->lock);
3391 DMSG(vdcp, 2, ": operation returned %d\n", status);
3393 if (vdcp->state == VDC_STATE_DETACH) {
3397 vdcp->sync_op_blocked = B_FALSE;
3398 vdcp->sync_op_cnt--;
3401 cv_signal(&vdcp->sync_blocked_cv);
3403 mutex_exit(&vdcp->lock);
3643 vdc_populate_mem_hdl(vdc_t *vdcp, vdc_local_desc_t *ldep)
3654 ASSERT(vdcp != NULL);
3689 DMSG(vdcp, 0, "[%d] Misaligned address %p reallocating "
3691 vdcp->instance, (void *)vaddr, (void *)ldep->align_addr,
3701 DMSG(vdcp, 2, "[%d] bound mem handle; ncookies=%d\n",
3702 vdcp->instance, dep->payload.ncookies);
3704 DMSG(vdcp, 0, "[%d] Failed to bind LDC memory handle "
3706 vdcp->instance, (void *)mhdl, (void *)vaddr, rv);
3722 DMSG(vdcp, 0, "?[%d] Failed to get next cookie "
3724 vdcp->instance, mhdl, i, rv);
3760 vdc_t *vdc = srvr->vdcp;
3868 * vdcp - soft state pointer for this instance of the device driver.
3874 vdc_wait_for_response(vdc_t *vdcp, vio_msg_t *msgp)
3879 ASSERT(vdcp != NULL);
3881 DMSG(vdcp, 1, "[%d] Entered\n", vdcp->instance);
3883 status = vdc_recv(vdcp, msgp, &nbytes);
3884 DMSG(vdcp, 3, "vdc_read() done.. status=0x%x size=0x%x\n",
3887 DMSG(vdcp, 0, "?[%d] Error %d reading LDC msg\n",
3888 vdcp->instance, status);
3893 DMSG(vdcp, 0, "?[%d] Expect %lu bytes; recv'd %lu\n",
3894 vdcp->instance, sizeof (vio_msg_tag_t), nbytes);
3898 DMSG(vdcp, 2, "[%d] (%x/%x/%x)\n", vdcp->instance,
3909 if ((msgp->tag.vio_sid != vdcp->session_id) &&
3911 DMSG(vdcp, 0, "[%d] Invalid SID: received 0x%x, "
3913 vdcp->instance, msgp->tag.vio_sid,
3914 vdcp->session_id,
3933 * vdcp - soft state pointer for this instance of the device driver.
3939 vdc_resubmit_backup_dring(vdc_t *vdcp)
3948 ASSERT(MUTEX_NOT_HELD(&vdcp->lock));
3949 ASSERT(vdcp->state == VDC_STATE_HANDLE_PENDING);
3951 if (vdcp->local_dring_backup == NULL) {
3956 DMSG(vdcp, 1, "restoring pending dring entries (len=%d, tail=%d)\n",
3957 vdcp->local_dring_backup_len, vdcp->local_dring_backup_tail);
3963 b_idx = vdcp->local_dring_backup_tail;
3964 for (count = 0; count < vdcp->local_dring_backup_len; count++) {
3966 curr_ldep = &(vdcp->local_dring_backup[b_idx]);
3971 DMSG(vdcp, 1, "resubmitting entry idx=%x\n", b_idx);
3973 rv = vdc_do_op(vdcp, curr_ldep->operation,
3981 DMSG(vdcp, 1, "[%d] resubmit entry %d failed\n",
3982 vdcp->instance, b_idx);
3997 if (++b_idx >= vdcp->local_dring_backup_len)
4002 dring_size = vdcp->local_dring_backup_len *
4003 sizeof (vdcp->local_dring_backup[0]);
4005 (void) kmem_free(vdcp->local_dring_backup, dring_size);
4007 vdcp->local_dring_backup = NULL;
4010 DTRACE_PROBE2(processed, int, processed, vdc_t *, vdcp);
4024 * vdcp - soft state pointer for this instance of the device driver.
4030 vdc_cancel_backup_dring(vdc_t *vdcp)
4039 ASSERT(MUTEX_HELD(&vdcp->lock));
4040 ASSERT(vdcp->state == VDC_STATE_FAILED);
4042 if (vdcp->local_dring_backup == NULL) {
4047 DMSG(vdcp, 1, "cancelling pending dring entries (len=%d, tail=%d)\n",
4048 vdcp->local_dring_backup_len, vdcp->local_dring_backup_tail);
4054 b_idx = vdcp->local_dring_backup_tail;
4055 for (count = 0; count < vdcp->local_dring_backup_len; count++) {
4057 ldep = &(vdcp->local_dring_backup[b_idx]);
4062 DMSG(vdcp, 1, "cancelling entry idx=%x\n", b_idx);
4077 VD_UPDATE_ERR_STATS(vdcp, vd_softerrs);
4078 VD_KSTAT_WAITQ_EXIT(vdcp);
4086 if (++b_idx >= vdcp->local_dring_backup_len)
4091 dring_size = vdcp->local_dring_backup_len *
4092 sizeof (vdcp->local_dring_backup[0]);
4094 (void) kmem_free(vdcp->local_dring_backup, dring_size);
4096 vdcp->local_dring_backup = NULL;
4098 DTRACE_PROBE2(cancelled, int, cancelled, vdc_t *, vdcp);
4121 vdc_t *vdcp = (vdc_t *)arg;
4123 mutex_enter(&vdcp->lock);
4125 vdcp->ctimeout_reached = B_TRUE;
4127 mutex_exit(&vdcp->lock);
4140 * vdcp - soft state pointer for this instance of the device driver.
4146 vdc_backup_local_dring(vdc_t *vdcp)
4151 ASSERT(MUTEX_HELD(&vdcp->lock));
4152 ASSERT(vdcp->state == VDC_STATE_RESETTING);
4160 if (vdcp->local_dring_backup != NULL) {
4161 DMSG(vdcp, 1, "reusing local descriptor ring backup "
4162 "(len=%d, tail=%d)\n", vdcp->local_dring_backup_len,
4163 vdcp->local_dring_backup_tail);
4175 if (!(vdcp->initialized & VDC_DRING_LOCAL))
4178 DMSG(vdcp, 1, "backing up the local descriptor ring (len=%d, "
4179 "tail=%d)\n", vdcp->dring_len, vdcp->dring_curr_idx);
4181 dring_size = vdcp->dring_len * sizeof (vdcp->local_dring[0]);
4183 vdcp->local_dring_backup = kmem_alloc(dring_size, KM_SLEEP);
4184 bcopy(vdcp->local_dring, vdcp->local_dring_backup, dring_size);
4186 vdcp->local_dring_backup_tail = vdcp->dring_curr_idx;
4187 vdcp->local_dring_backup_len = vdcp->dring_len;
4194 b_idx = vdcp->local_dring_backup_tail;
4195 for (count = 0; count < vdcp->local_dring_backup_len; count++) {
4197 curr_ldep = &(vdcp->local_dring_backup[b_idx]);
4202 VD_KSTAT_RUNQ_BACK_TO_WAITQ(vdcp);
4206 if (++b_idx >= vdcp->local_dring_backup_len)
4213 vdc_switch_server(vdc_t *vdcp)
4218 ASSERT(MUTEX_HELD(&vdcp->lock));
4221 if (vdcp->num_servers == 1) {
4226 curr_server = vdcp->curr_server;
4228 (curr_server->next) ? curr_server->next : vdcp->server_list;
4234 DMSG(vdcp, 0, "[%d] Cannot bring channel down, port %ld\n",
4235 vdcp->instance, curr_server->id);
4240 vdcp->curr_server = new_server;
4242 DMSG(vdcp, 0, "[%d] Switched to next vdisk server, port@%ld, ldc@%ld\n",
4243 vdcp->instance, vdcp->curr_server->id, vdcp->curr_server->ldc_id);
4247 vdc_print_svc_status(vdc_t *vdcp)
4253 ASSERT(mutex_owned(&vdcp->lock));
4255 svc_state = vdcp->curr_server->svc_state;
4257 if (vdcp->curr_server->log_state == svc_state)
4260 instance = vdcp->instance;
4261 ldc_id = vdcp->curr_server->ldc_id;
4262 port_id = vdcp->curr_server->id;
4295 vdcp->curr_server->log_state = svc_state;
4332 vdc_handshake_retry(vdc_t *vdcp, int hshake_cnt, int hattr_cnt)
4337 ASSERT(vdcp->lifecycle != VDC_LC_DETACHING);
4340 vdcp->curr_server->hshake_cnt = hshake_cnt;
4341 vdcp->curr_server->hattr_cnt = hattr_cnt;
4348 vdcp->curr_server->hattr_total = 0;
4350 vdcp->curr_server->hattr_total += hattr_cnt;
4356 if (vdcp->lifecycle == VDC_LC_ONLINE)
4363 if (vdcp->lifecycle == VDC_LC_ATTACHING) {
4365 for (srvr = vdcp->server_list; srvr != NULL;
4379 ASSERT(vdcp->lifecycle == VDC_LC_ONLINE_PENDING);
4386 for (srvr = vdcp->server_list; srvr != NULL; srvr = srvr->next) {
4397 return (hattr_total < vdcp->hattr_min);
4424 vdc_process_msg_thread(vdc_t *vdcp)
4436 mutex_enter(&vdcp->lock);
4438 ASSERT(vdcp->lifecycle == VDC_LC_ATTACHING);
4442 #define Q(_s) (vdcp->state == _s) ? #_s :
4443 DMSG(vdcp, 3, "state = %d (%s)\n", vdcp->state,
4456 switch (vdcp->state) {
4478 vdc_timeout : vdcp->curr_server->ctimeout;
4481 tmid = timeout(vdc_connection_timeout, vdcp,
4486 if (vdcp->lifecycle == VDC_LC_DETACHING) {
4487 vdcp->state = VDC_STATE_DETACH;
4492 if (vdcp->ctimeout_reached) {
4495 vdcp->state = VDC_STATE_FAILED;
4506 if (!vdc_handshake_retry(vdcp, hshake_cnt,
4508 DMSG(vdcp, 0, "[%d] too many "
4509 "handshakes", vdcp->instance);
4510 vdcp->state = VDC_STATE_FAILED;
4514 vdc_switch_server(vdcp);
4523 status = vdc_start_ldc_connection(vdcp);
4525 vdcp->state = VDC_STATE_INIT_WAITING;
4527 vdcp->curr_server->svc_state =
4529 vdc_print_svc_status(vdcp);
4536 if (vdcp->curr_server->ldc_state == LDC_UP) {
4537 vdcp->state = VDC_STATE_NEGOTIATE;
4547 status = cv_timedwait(&vdcp->initwait_cv, &vdcp->lock,
4550 vdcp->state == VDC_STATE_INIT_WAITING &&
4551 vdcp->curr_server->ldc_state != LDC_UP) {
4553 vdcp->curr_server->svc_state =
4555 vdc_print_svc_status(vdcp);
4556 vdcp->state = VDC_STATE_INIT;
4560 if (vdcp->state != VDC_STATE_INIT_WAITING) {
4561 DMSG(vdcp, 0,
4563 vdcp->state);
4568 switch (status = vdc_ver_negotiation(vdcp)) {
4572 DMSG(vdcp, 0, "ver negotiate failed (%d)..\n",
4579 switch (status = vdc_attr_negotiation(vdcp)) {
4583 DMSG(vdcp, 0, "attr negotiate failed (%d)..\n",
4588 switch (status = vdc_dring_negotiation(vdcp)) {
4592 DMSG(vdcp, 0, "dring negotiate failed (%d)..\n",
4597 switch (status = vdc_rdx_exchange(vdcp)) {
4599 vdcp->state = VDC_STATE_HANDLE_PENDING;
4602 DMSG(vdcp, 0, "RDX xchg failed ..(%d)\n",
4607 DMSG(vdcp, 0, "negotiation failed: resetting (%d)\n",
4609 vdcp->state = VDC_STATE_RESETTING;
4610 vdcp->self_reset = B_TRUE;
4611 vdcp->curr_server->svc_state = VDC_SERVICE_FAILED;
4612 vdc_print_svc_status(vdcp);
4614 DMSG(vdcp, 0, "negotiation complete (state=0x%x)...\n",
4615 vdcp->state);
4620 DMSG(vdcp, 0, "[%d] connection to service domain is up",
4621 vdcp->instance);
4622 vdcp->curr_server->svc_state = VDC_SERVICE_CONNECTED;
4624 mutex_exit(&vdcp->lock);
4630 if (vdcp->num_servers > 1 &&
4631 vdc_eio_check(vdcp, 0) != 0) {
4632 mutex_enter(&vdcp->lock);
4633 vdcp->curr_server->svc_state =
4635 vdcp->state = VDC_STATE_FAULTED;
4642 vdcp->ctimeout_reached = B_FALSE;
4648 (void) vdc_setup_devid(vdcp);
4650 status = vdc_resubmit_backup_dring(vdcp);
4652 mutex_enter(&vdcp->lock);
4655 vdcp->state = VDC_STATE_RESETTING;
4656 vdcp->self_reset = B_TRUE;
4657 vdcp->curr_server->svc_state =
4659 vdc_print_svc_status(vdcp);
4661 vdcp->state = VDC_STATE_RUNNING;
4672 vdc_print_svc_status(vdcp);
4675 for (srvr = vdcp->server_list; srvr != NULL;
4683 vdcp->state = VDC_STATE_RESETTING;
4684 vdcp->self_reset = B_TRUE;
4686 vdcp->state = VDC_STATE_FAILED;
4703 vdcp->instance);
4706 if (vdcp->lifecycle == VDC_LC_ATTACHING) {
4707 vdcp->lifecycle = VDC_LC_ONLINE_PENDING;
4708 vdcp->hattr_min = vdc_hattr_min_initial;
4710 vdcp->hattr_min = vdc_hattr_min;
4720 cv_broadcast(&vdcp->running_cv);
4721 vdc_cancel_backup_dring(vdcp);
4724 while (!vdcp->io_pending)
4725 cv_wait(&vdcp->io_pending_cv, &vdcp->lock);
4733 for (srvr = vdcp->server_list; srvr != NULL;
4744 vdcp->ctimeout_reached = B_FALSE;
4746 vdcp->state = VDC_STATE_RESETTING;
4747 vdcp->self_reset = B_TRUE;
4753 if (vdcp->lifecycle == VDC_LC_DETACHING) {
4754 vdcp->state = VDC_STATE_DETACH;
4758 vdcp->lifecycle = VDC_LC_ONLINE;
4762 "recovered", vdcp->instance);
4770 cv_broadcast(&vdcp->running_cv);
4773 if (vdcp->failfast_interval != 0 ||
4774 vdcp->num_servers > 1)
4775 cv_signal(&vdcp->eio_cv);
4778 if (vdcp->ownership & VDC_OWNERSHIP_WANTED)
4779 vdcp->ownership |= VDC_OWNERSHIP_RESET;
4780 cv_signal(&vdcp->ownership_cv);
4782 vdcp->curr_server->svc_state = VDC_SERVICE_ONLINE;
4783 vdc_print_svc_status(vdcp);
4785 mutex_exit(&vdcp->lock);
4789 status = vdc_wait_for_response(vdcp, &msg);
4792 DMSG(vdcp, 1, "[%d] new pkt(s) available\n",
4793 vdcp->instance);
4794 status = vdc_process_data_msg(vdcp, &msg);
4796 DMSG(vdcp, 1, "[%d] process_data_msg "
4797 "returned err=%d\n", vdcp->instance,
4804 mutex_enter(&vdcp->lock);
4807 for (srvr = vdcp->server_list; srvr != NULL;
4819 vdc_print_svc_status(vdcp);
4821 vdcp->state = VDC_STATE_RESETTING;
4822 vdcp->self_reset = B_TRUE;
4837 DMSG(vdcp, 0, "Initiating channel reset "
4838 "(pending = %d)\n", (int)vdcp->threads_pending);
4840 if (vdcp->self_reset) {
4841 DMSG(vdcp, 0,
4843 vdcp->instance);
4844 status = vdc_stop_ldc_connection(vdcp);
4845 vdcp->self_reset = B_FALSE;
4852 while (vdcp->threads_pending) {
4853 cv_broadcast(&vdcp->membind_cv);
4854 cv_broadcast(&vdcp->dring_free_cv);
4855 mutex_exit(&vdcp->lock);
4858 mutex_enter(&vdcp->lock);
4861 ASSERT(vdcp->threads_pending == 0);
4864 ASSERT(vdcp->read_state != VDC_READ_WAITING);
4866 vdcp->read_state = VDC_READ_IDLE;
4867 vdcp->io_pending = B_FALSE;
4873 vdc_eio_unqueue(vdcp, 0, B_FALSE);
4875 vdc_backup_local_dring(vdcp);
4878 vdc_destroy_descriptor_ring(vdcp);
4881 vdcp->state = VDC_STATE_INIT;
4886 DMSG(vdcp, 0, "[%d] Reset thread exit cleanup ..\n",
4887 vdcp->instance);
4890 mutex_exit(&vdcp->lock);
4895 mutex_enter(&vdcp->lock);
4901 cv_broadcast(&vdcp->running_cv);
4903 while (vdcp->sync_op_cnt > 0) {
4904 cv_broadcast(&vdcp->sync_blocked_cv);
4905 mutex_exit(&vdcp->lock);
4908 mutex_enter(&vdcp->lock);
4911 mutex_exit(&vdcp->lock);
4913 DMSG(vdcp, 0, "[%d] Msg processing thread exiting ..\n",
4914 vdcp->instance);
4946 vdc_process_data_msg(vdc_t *vdcp, vio_msg_t *msg)
4958 ASSERT(vdcp != NULL);
4960 mutex_enter(&vdcp->lock);
4967 if ((start >= vdcp->dring_len) ||
4968 (end >= vdcp->dring_len) || (end < -1)) {
4974 VD_UPDATE_ERR_STATS(vdcp, vd_softerrs);
4975 DMSG(vdcp, 0, "[%d] Bogus ACK data : start %d, end %d\n",
4976 vdcp->instance, start, end);
4977 mutex_exit(&vdcp->lock);
4984 switch (vdc_verify_seq_num(vdcp, dring_msg)) {
4988 mutex_exit(&vdcp->lock);
4996 VD_UPDATE_ERR_STATS(vdcp, vd_softerrs);
4997 DMSG(vdcp, 0, "[%d] invalid seqno\n", vdcp->instance);
4998 mutex_exit(&vdcp->lock);
5008 VD_UPDATE_ERR_STATS(vdcp, vd_softerrs);
5010 DMSG(vdcp, 0, "[%d] DATA NACK\n", vdcp->instance);
5011 mutex_exit(&vdcp->lock);
5020 VD_UPDATE_ERR_STATS(vdcp, vd_protoerrs);
5021 mutex_exit(&vdcp->lock);
5025 DMSG(vdcp, 1, ": start %d end %d\n", start, end);
5028 ldep = &vdcp->local_dring[idx];
5030 DMSG(vdcp, 1, ": state 0x%x\n", ldep->dep->hdr.dstate);
5044 DMSG(vdcp, 1, "I/O status=%d\n", status);
5047 DMSG(vdcp, 1,
5059 ((vdcp->num_servers > 1 &&
5061 (vdcp->failfast_interval != 0 &&
5066 (void) vdc_eio_queue(vdcp, idx);
5071 VD_UPDATE_IO_STATS(vdcp, op,
5074 VD_UPDATE_ERR_STATS(vdcp, vd_softerrs);
5076 VD_KSTAT_RUNQ_EXIT(vdcp);
5079 (void) vdc_depopulate_descriptor(vdcp, idx);
5085 mutex_exit(&vdcp->lock);
5088 DTRACE_PROBE2(processed, int, 1, vdc_t *, vdcp);