17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*448bf859SLida.Horn  * Common Development and Distribution License (the "License").
6*448bf859SLida.Horn  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*448bf859SLida.Horn 
227c478bd9Sstevel@tonic-gate /*
23*448bf859SLida.Horn  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * This file implements the timer setup and timeout handling functions.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <sys/ib/mgt/ibmf/ibmf_impl.h>
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate extern int ibmf_trace_level;
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * ibmf_i_set_timer():
367c478bd9Sstevel@tonic-gate  *	Set the timer to the response or transaction time interval
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate void
ibmf_i_set_timer(void (* func)(void *),ibmf_msg_impl_t * msgimplp,ibmf_timer_t type)397c478bd9Sstevel@tonic-gate ibmf_i_set_timer(void (*func)(void *), ibmf_msg_impl_t *msgimplp,
407c478bd9Sstevel@tonic-gate     ibmf_timer_t type)
417c478bd9Sstevel@tonic-gate {
427c478bd9Sstevel@tonic-gate 	clock_t		interval;
437c478bd9Sstevel@tonic-gate 	ibmf_rmpp_ctx_t	*rmpp_ctx;
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate 	ASSERT(MUTEX_HELD(&msgimplp->im_mutex));
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate 	IBMF_TRACE_3(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_i_set_timer_start,
487c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_set_timer: msgp = %p, "
497c478bd9Sstevel@tonic-gate 	    "timer_type = 0x%x, func_cb = 0x%p\n",
507c478bd9Sstevel@tonic-gate 	    tnf_opaque, msgimplp, msgimplp, tnf_opaque, timer_type, type,
517c478bd9Sstevel@tonic-gate 	    tnf_opaque, func_cb, func);
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate 	if (type == IBMF_RESP_TIMER) {
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate 		/*
567c478bd9Sstevel@tonic-gate 		 * The response timer interval is the sum of the IBA
577c478bd9Sstevel@tonic-gate 		 * defined RespTimeValue (Vol. 1, Section 13.4.6.2.2),
587c478bd9Sstevel@tonic-gate 		 * and the round trip time value. Both values are determined
597c478bd9Sstevel@tonic-gate 		 * by the IBMF client and passed in the retrans_rtv and
607c478bd9Sstevel@tonic-gate 		 * retrans_rttv fields respectively, when calling
617c478bd9Sstevel@tonic-gate 		 * ibmf_msg_transport()
627c478bd9Sstevel@tonic-gate 		 */
637c478bd9Sstevel@tonic-gate 		ASSERT(msgimplp->im_rp_timeout_id == 0);
647c478bd9Sstevel@tonic-gate 		interval = msgimplp->im_retrans.retrans_rtv +
657c478bd9Sstevel@tonic-gate 		    msgimplp->im_retrans.retrans_rttv;
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 		IBMF_TRACE_4(IBMF_TNF_DEBUG, DPRINT_L3, ibmf_i_set_timer,
687c478bd9Sstevel@tonic-gate 		    IBMF_TNF_TRACE, "", "ibmf_i_set_timer: %s, interval = %ld "
697c478bd9Sstevel@tonic-gate 		    "resp_time %x round trip time %x\n",
707c478bd9Sstevel@tonic-gate 		    tnf_string, msg, "setting response timer",
717c478bd9Sstevel@tonic-gate 		    tnf_long, interval, interval,
727c478bd9Sstevel@tonic-gate 		    tnf_uint, resp_time, msgimplp->im_retrans.retrans_rtv,
737c478bd9Sstevel@tonic-gate 		    tnf_uint, interval, msgimplp->im_retrans.retrans_rttv);
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate 		msgimplp->im_rp_timeout_id = timeout(func,
767c478bd9Sstevel@tonic-gate 		    (void *)msgimplp, drv_usectohz(interval));
777c478bd9Sstevel@tonic-gate 	} else if (type == IBMF_TRANS_TIMER) {
787c478bd9Sstevel@tonic-gate 		rmpp_ctx = &msgimplp->im_rmpp_ctx;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 		ASSERT(msgimplp->im_tr_timeout_id == 0);
817c478bd9Sstevel@tonic-gate 		if (rmpp_ctx->rmpp_flags & IBMF_CTX_RMPP_FLAGS_DYN_PYLD) {
827c478bd9Sstevel@tonic-gate 			/*
837c478bd9Sstevel@tonic-gate 			 * if payload was not specified use IB spec default
847c478bd9Sstevel@tonic-gate 			 * of 40 seconds
857c478bd9Sstevel@tonic-gate 			 */
867c478bd9Sstevel@tonic-gate 			interval = IBMF_RETRANS_DEF_TRANS_TO;
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate 			IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L2,
897c478bd9Sstevel@tonic-gate 			    ibmf_i_set_timer, IBMF_TNF_TRACE, "",
907c478bd9Sstevel@tonic-gate 			    "ibmf_i_set_timer: %s, interval = %ld\n",
917c478bd9Sstevel@tonic-gate 			    tnf_string, msg,
927c478bd9Sstevel@tonic-gate 			    "payload size unknown.  Using default trans_to",
937c478bd9Sstevel@tonic-gate 			    tnf_long, interval, interval);
947c478bd9Sstevel@tonic-gate 		} else {
957c478bd9Sstevel@tonic-gate 			/*
967c478bd9Sstevel@tonic-gate 			 * if payload was specified, use a variation of IB
977c478bd9Sstevel@tonic-gate 			 * spec equation (13.6.3.2) that accounts for average
987c478bd9Sstevel@tonic-gate 			 * window size
997c478bd9Sstevel@tonic-gate 			 */
1007c478bd9Sstevel@tonic-gate 			interval = (msgimplp->im_retrans.retrans_rtv +
1017c478bd9Sstevel@tonic-gate 			    msgimplp->im_retrans.retrans_rttv) /
1027c478bd9Sstevel@tonic-gate 			    IBMF_RMPP_DEFAULT_WIN_SZ * 4 *
1037c478bd9Sstevel@tonic-gate 			    msgimplp->im_rmpp_ctx.rmpp_num_pkts;
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate 			IBMF_TRACE_5(IBMF_TNF_DEBUG, DPRINT_L3,
1067c478bd9Sstevel@tonic-gate 			    ibmf_i_set_timer, IBMF_TNF_TRACE, "",
1077c478bd9Sstevel@tonic-gate 			    "ibmf_i_set_timer: %s, num_pkts = %d, rttv ="
1087c478bd9Sstevel@tonic-gate 			    " %x, window_size = %d, interval = %ld\n",
1097c478bd9Sstevel@tonic-gate 			    tnf_string, msg, "setting trans timer",
1107c478bd9Sstevel@tonic-gate 			    tnf_uint, num_pkts,
1117c478bd9Sstevel@tonic-gate 			    msgimplp->im_rmpp_ctx.rmpp_num_pkts, tnf_uint, rtv,
1127c478bd9Sstevel@tonic-gate 			    msgimplp->im_retrans.retrans_rttv,
1137c478bd9Sstevel@tonic-gate 			    tnf_uint, window_size, IBMF_RMPP_DEFAULT_WIN_SZ,
1147c478bd9Sstevel@tonic-gate 			    tnf_long, interval, interval);
1157c478bd9Sstevel@tonic-gate 		}
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate 		/*
1187c478bd9Sstevel@tonic-gate 		 * Use the client specified transaction timeout value if
1197c478bd9Sstevel@tonic-gate 		 * smaller than the calculated value
1207c478bd9Sstevel@tonic-gate 		 */
1217c478bd9Sstevel@tonic-gate 		if ((msgimplp->im_retrans.retrans_trans_to != 0) &&
1227c478bd9Sstevel@tonic-gate 		    (msgimplp->im_retrans.retrans_trans_to < interval)) {
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate 			interval = msgimplp->im_retrans.retrans_trans_to;
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 			IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L2,
1277c478bd9Sstevel@tonic-gate 			    ibmf_i_set_timer, IBMF_TNF_TRACE, "",
1287c478bd9Sstevel@tonic-gate 			    "ibmf_i_set_timer: %s, new_interval = %ld\n",
1297c478bd9Sstevel@tonic-gate 			    tnf_string, msg, "user trans_to is smaller",
1307c478bd9Sstevel@tonic-gate 			    tnf_long, new_interval, interval);
1317c478bd9Sstevel@tonic-gate 		}
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3, ibmf_i_set_timer,
1347c478bd9Sstevel@tonic-gate 		    IBMF_TNF_TRACE, "", "ibmf_i_set_timer: %s, interval = %ld"
1357c478bd9Sstevel@tonic-gate 		    "\n", tnf_string, msg, "setting transaction timer",
1367c478bd9Sstevel@tonic-gate 		    tnf_long, interval, interval);
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate 		msgimplp->im_tr_timeout_id = timeout(func,
1397c478bd9Sstevel@tonic-gate 		    (void *)msgimplp, drv_usectohz(interval));
1407c478bd9Sstevel@tonic-gate 	}
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate 	IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_i_set_timer_end,
1437c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_set_timer() exit\n");
1447c478bd9Sstevel@tonic-gate }
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * ibmf_i_unset_timer():
1487c478bd9Sstevel@tonic-gate  *	Unset the timer
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate void
ibmf_i_unset_timer(ibmf_msg_impl_t * msgimplp,ibmf_timer_t type)1517c478bd9Sstevel@tonic-gate ibmf_i_unset_timer(ibmf_msg_impl_t *msgimplp, ibmf_timer_t type)
1527c478bd9Sstevel@tonic-gate {
1537c478bd9Sstevel@tonic-gate 	IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_i_unset_timer_start,
1547c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_unset_timer(): msgp = %p, \n",
1557c478bd9Sstevel@tonic-gate 	    tnf_opaque, msgimplp, msgimplp);
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate 	ASSERT(MUTEX_HELD(&msgimplp->im_mutex));
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate 	if (type == IBMF_RESP_TIMER) {
1607c478bd9Sstevel@tonic-gate 		if (msgimplp->im_rp_timeout_id != 0) {
1617c478bd9Sstevel@tonic-gate 			msgimplp->im_rp_unset_timeout_id =
1627c478bd9Sstevel@tonic-gate 			    msgimplp->im_rp_timeout_id;
1637c478bd9Sstevel@tonic-gate 			msgimplp->im_rp_timeout_id = 0;
1647c478bd9Sstevel@tonic-gate 		}
1657c478bd9Sstevel@tonic-gate 	} else if (type == IBMF_TRANS_TIMER) {
1667c478bd9Sstevel@tonic-gate 		if (msgimplp->im_tr_timeout_id != 0) {
1677c478bd9Sstevel@tonic-gate 			msgimplp->im_tr_unset_timeout_id =
1687c478bd9Sstevel@tonic-gate 			    msgimplp->im_tr_timeout_id;
1697c478bd9Sstevel@tonic-gate 			msgimplp->im_tr_timeout_id = 0;
1707c478bd9Sstevel@tonic-gate 		}
1717c478bd9Sstevel@tonic-gate 	}
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate 	IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_i_unset_timer_end,
1747c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_unset_timer() exit\n");
1757c478bd9Sstevel@tonic-gate }
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * ibmf_i_recv_timeout:
1797c478bd9Sstevel@tonic-gate  *
1807c478bd9Sstevel@tonic-gate  *	Perform "receive" timeout processing for the message.
1817c478bd9Sstevel@tonic-gate  *	This timeout handler is only used in RMPP processing.
1827c478bd9Sstevel@tonic-gate  */
1837c478bd9Sstevel@tonic-gate void
ibmf_i_recv_timeout(void * argp)1847c478bd9Sstevel@tonic-gate ibmf_i_recv_timeout(void *argp)
1857c478bd9Sstevel@tonic-gate {
1867c478bd9Sstevel@tonic-gate 	ibmf_msg_impl_t *msgimplp = (ibmf_msg_impl_t *)argp;
1877c478bd9Sstevel@tonic-gate 	ibmf_client_t	*clientp = (ibmf_client_t *)msgimplp->im_client;
1887c478bd9Sstevel@tonic-gate 	ibmf_rmpp_ctx_t	*rmpp_ctx;
1897c478bd9Sstevel@tonic-gate 	int		msg_flags;
1907c478bd9Sstevel@tonic-gate 	uint_t		ref_cnt;
1917c478bd9Sstevel@tonic-gate 	int		status;
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate 	IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L4,
1947c478bd9Sstevel@tonic-gate 	    ibmf_i_recv_timeout_start, IBMF_TNF_TRACE, "",
1957c478bd9Sstevel@tonic-gate 	    "ibmf_i_recv_timeout(): msgp = 0x%p\n", tnf_opaque, msg, msgimplp);
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate 	mutex_enter(&msgimplp->im_mutex);
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate 	IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
2007c478bd9Sstevel@tonic-gate 	    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
2017c478bd9Sstevel@tonic-gate 	    "ibmf_i_recv_timeout(): resetting id time %llx\n",
2027c478bd9Sstevel@tonic-gate 	    tnf_opaque, time, gethrtime());
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate 	/*
2057c478bd9Sstevel@tonic-gate 	 * If the message has been marked unitialized or done
2067c478bd9Sstevel@tonic-gate 	 * release the message mutex and return
2077c478bd9Sstevel@tonic-gate 	 */
2087c478bd9Sstevel@tonic-gate 	if ((msgimplp->im_trans_state_flags & IBMF_TRANS_STATE_FLAG_UNINIT) ||
2097c478bd9Sstevel@tonic-gate 	    (msgimplp->im_trans_state_flags & IBMF_TRANS_STATE_FLAG_DONE)) {
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate 		mutex_exit(&msgimplp->im_mutex);
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
2147c478bd9Sstevel@tonic-gate 		    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
2157c478bd9Sstevel@tonic-gate 		    "ibmf_i_recv_timeout(): %s, msgp = 0x%p\n", tnf_string, msg,
2167c478bd9Sstevel@tonic-gate 		    "Message marked for removal, return without processing "
2177c478bd9Sstevel@tonic-gate 		    "recv timeout",
2187c478bd9Sstevel@tonic-gate 		    tnf_opaque, msgimplp, msgimplp);
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate 		return;
2217c478bd9Sstevel@tonic-gate 	}
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate 	/*
2247c478bd9Sstevel@tonic-gate 	 * Unset the response and trans timers if they haven't fired (unlikely)
2257c478bd9Sstevel@tonic-gate 	 */
2267c478bd9Sstevel@tonic-gate 	ibmf_i_unset_timer(msgimplp, IBMF_RESP_TIMER);
2277c478bd9Sstevel@tonic-gate 	ibmf_i_unset_timer(msgimplp, IBMF_TRANS_TIMER);
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate 	rmpp_ctx = &msgimplp->im_rmpp_ctx;
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate 	/* Perform timeout processing for the RMPP transaction */
2327c478bd9Sstevel@tonic-gate 	if (rmpp_ctx->rmpp_state == IBMF_RMPP_STATE_RECEVR_ACTIVE) {
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate 		IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
2357c478bd9Sstevel@tonic-gate 		    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
2367c478bd9Sstevel@tonic-gate 		    "ibmf_i_recv_timeout(): %s\n", tnf_string, msg,
2377c478bd9Sstevel@tonic-gate 		    "RMPP context is Receiver Active, sending ABORT T2L");
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate 		status = ibmf_i_send_rmpp(msgimplp, IBMF_RMPP_TYPE_ABORT,
2407c478bd9Sstevel@tonic-gate 		    IBMF_RMPP_STATUS_T2L, 0, 0, IBMF_NO_BLOCK);
2417c478bd9Sstevel@tonic-gate 		if (status != IBMF_SUCCESS) {
2427c478bd9Sstevel@tonic-gate 			IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1,
2437c478bd9Sstevel@tonic-gate 			    ibmf_i_recv_timeout_err, IBMF_TNF_ERROR, "",
2447c478bd9Sstevel@tonic-gate 			    "ibmf_i_recv_timeout(): %s\n", tnf_string, msg,
2457c478bd9Sstevel@tonic-gate 			    "RMPP ABORT send failed");
2467c478bd9Sstevel@tonic-gate 			msgimplp->im_trans_state_flags |=
2477c478bd9Sstevel@tonic-gate 			    IBMF_TRANS_STATE_FLAG_SEND_DONE;
2487c478bd9Sstevel@tonic-gate 		}
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate 		mutex_enter(&clientp->ic_kstat_mutex);
2517c478bd9Sstevel@tonic-gate 		IBMF_ADD32_KSTATS(clientp, rmpp_errors, 1);
2527c478bd9Sstevel@tonic-gate 		mutex_exit(&clientp->ic_kstat_mutex);
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate 		rmpp_ctx->rmpp_state = IBMF_RMPP_STATE_ABORT;
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate 		IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1,
2577c478bd9Sstevel@tonic-gate 		    ibmf_i_recv_timeout, IBMF_TNF_ERROR, "",
2587c478bd9Sstevel@tonic-gate 		    "ibmf_i_recv_timeout(): %s\n", tnf_string, msg,
2597c478bd9Sstevel@tonic-gate 		    "RMPP context is Receiver Active, terminating transaction");
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate 		ibmf_i_terminate_transaction(msgimplp->im_client,
2627c478bd9Sstevel@tonic-gate 		    msgimplp, IBMF_TRANS_TIMEOUT);
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate 	} else if (rmpp_ctx->rmpp_state == IBMF_RMPP_STATE_RECEVR_TERMINATE) {
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate 		IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
2677c478bd9Sstevel@tonic-gate 		    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
2687c478bd9Sstevel@tonic-gate 		    "ibmf_i_recv_timeout(): %s\n", tnf_string, msg,
2697c478bd9Sstevel@tonic-gate 		    "RMPP context is Receiver Terminate, "
2707c478bd9Sstevel@tonic-gate 		    "terminating transaction");
2717c478bd9Sstevel@tonic-gate 		rmpp_ctx->rmpp_state = IBMF_RMPP_STATE_DONE;
2727c478bd9Sstevel@tonic-gate 		ibmf_i_terminate_transaction(msgimplp->im_client, msgimplp,
2737c478bd9Sstevel@tonic-gate 		    IBMF_SUCCESS);
2747c478bd9Sstevel@tonic-gate 	}
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 	/*
2777c478bd9Sstevel@tonic-gate 	 * Save the transaction state flags and the timeout IDs
2787c478bd9Sstevel@tonic-gate 	 * before releasing the mutex as they may be changed after that.
2797c478bd9Sstevel@tonic-gate 	 */
2807c478bd9Sstevel@tonic-gate 	msg_flags = msgimplp->im_trans_state_flags;
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate 	mutex_exit(&msgimplp->im_mutex);
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate 	IBMF_TRACE_3(IBMF_TNF_DEBUG, DPRINT_L3,
2857c478bd9Sstevel@tonic-gate 	    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
2867c478bd9Sstevel@tonic-gate 	    "ibmf_i_recv_timeout(): %s, msgp = 0x%p, refcnt = %d\n", tnf_string,
2877c478bd9Sstevel@tonic-gate 	    msg, "recv timeout done.  Dec ref count", tnf_opaque, msgimplp,
2887c478bd9Sstevel@tonic-gate 	    msgimplp, tnf_uint, flags, msg_flags);
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate 	/*
2917c478bd9Sstevel@tonic-gate 	 * If the transaction flags indicate a completed transaction,
2927c478bd9Sstevel@tonic-gate 	 * notify the client
2937c478bd9Sstevel@tonic-gate 	 */
2947c478bd9Sstevel@tonic-gate 	if (msg_flags & IBMF_TRANS_STATE_FLAG_DONE) {
2957c478bd9Sstevel@tonic-gate 		/* Remove the message from the client's message list */
2967c478bd9Sstevel@tonic-gate 		ibmf_i_client_rem_msg(clientp, msgimplp, &ref_cnt);
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 		/*
2997c478bd9Sstevel@tonic-gate 		 * Notify the client if the message reference count is zero.
3007c478bd9Sstevel@tonic-gate 		 * At this point, we know that the transaction is done and
3017c478bd9Sstevel@tonic-gate 		 * the message has been removed from the client's message list.
3027c478bd9Sstevel@tonic-gate 		 * So, we only need to make sure the reference count is zero
3037c478bd9Sstevel@tonic-gate 		 * before notifying the client.
3047c478bd9Sstevel@tonic-gate 		 */
3057c478bd9Sstevel@tonic-gate 		if (ref_cnt == 0) {
3067c478bd9Sstevel@tonic-gate 			_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*msgimplp))
3077c478bd9Sstevel@tonic-gate 			if (msgimplp->im_flags & IBMF_MSG_FLAGS_TERMINATION) {
3087c478bd9Sstevel@tonic-gate 
3097c478bd9Sstevel@tonic-gate 				/*
3107c478bd9Sstevel@tonic-gate 				 * If the message is a termination message,
3117c478bd9Sstevel@tonic-gate 				 * free it at this time.
3127c478bd9Sstevel@tonic-gate 				 */
3137c478bd9Sstevel@tonic-gate 				IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
3147c478bd9Sstevel@tonic-gate 				    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
3157c478bd9Sstevel@tonic-gate 				    "ibmf_i_recv_timeout(): freeing terminate "
3167c478bd9Sstevel@tonic-gate 				    "message %p\n", tnf_opaque, msgp, msgimplp);
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 				/* free up the UD destination resource */
3197c478bd9Sstevel@tonic-gate 				if (msgimplp->im_ibmf_ud_dest != NULL) {
3207c478bd9Sstevel@tonic-gate 					ibmf_i_free_ud_dest(clientp, msgimplp);
3217c478bd9Sstevel@tonic-gate 					ibmf_i_clean_ud_dest_list(
3227c478bd9Sstevel@tonic-gate 					    clientp->ic_myci, B_FALSE);
3237c478bd9Sstevel@tonic-gate 				}
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate 				/* Free the receive buffer */
3267c478bd9Sstevel@tonic-gate 				kmem_free(
3277c478bd9Sstevel@tonic-gate 				    msgimplp->im_msgbufs_recv.im_bufs_mad_hdr,
3287c478bd9Sstevel@tonic-gate 				    IBMF_MAD_SIZE);
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate 				/* destroy the message mutex */
3317c478bd9Sstevel@tonic-gate 				mutex_destroy(&msgimplp->im_mutex);
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate 				/* Free the termination message context */
3347c478bd9Sstevel@tonic-gate 				kmem_free(msgimplp, sizeof (ibmf_msg_impl_t));
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 				/*
3377c478bd9Sstevel@tonic-gate 				 * Decrease the "messages allocated" count
3387c478bd9Sstevel@tonic-gate 				 * so that an ibmf_unregister() can succeed
3397c478bd9Sstevel@tonic-gate 				 * for this client.
3407c478bd9Sstevel@tonic-gate 				 */
3417c478bd9Sstevel@tonic-gate 				mutex_enter(&clientp->ic_mutex);
3427c478bd9Sstevel@tonic-gate 				clientp->ic_msgs_alloced--;
3437c478bd9Sstevel@tonic-gate 				mutex_exit(&clientp->ic_mutex);
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate 			} else {
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate 				IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
3487c478bd9Sstevel@tonic-gate 				    ibmf_i_recv_timeout, IBMF_TNF_TRACE, "",
3497c478bd9Sstevel@tonic-gate 				    "ibmf_i_recv_timeout(): calling "
3507c478bd9Sstevel@tonic-gate 				    "notify %p\n", tnf_opaque, msgp, msgimplp);
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate 				ibmf_i_notify_client(msgimplp);
3537c478bd9Sstevel@tonic-gate 			}
3547c478bd9Sstevel@tonic-gate 		}
3557c478bd9Sstevel@tonic-gate 	}
3567c478bd9Sstevel@tonic-gate 
3577c478bd9Sstevel@tonic-gate 	IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4,
3587c478bd9Sstevel@tonic-gate 	    ibmf_i_recv_timeout_end, IBMF_TNF_TRACE, "",
3597c478bd9Sstevel@tonic-gate 	    "ibmf_i_recv_timeout() exit\n");
3607c478bd9Sstevel@tonic-gate }
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate /*
3637c478bd9Sstevel@tonic-gate  * ibmf_i_send_timeout:
3647c478bd9Sstevel@tonic-gate  *
3657c478bd9Sstevel@tonic-gate  *	Perform "send" timeout processing for the message.
3667c478bd9Sstevel@tonic-gate  *	This timeout handler is used in non-RMPP and RMPP processing.
3677c478bd9Sstevel@tonic-gate  */
3687c478bd9Sstevel@tonic-gate void
ibmf_i_send_timeout(void * argp)3697c478bd9Sstevel@tonic-gate ibmf_i_send_timeout(void *argp)
3707c478bd9Sstevel@tonic-gate {
3717c478bd9Sstevel@tonic-gate 	ibmf_msg_impl_t *msgimplp = (ibmf_msg_impl_t *)argp;
3727c478bd9Sstevel@tonic-gate 	ibmf_client_t	*clientp = (ibmf_client_t *)msgimplp->im_client;
3737c478bd9Sstevel@tonic-gate 	ibmf_rmpp_ctx_t	*rmpp_ctx;
3747c478bd9Sstevel@tonic-gate 	int		msg_flags;
3757c478bd9Sstevel@tonic-gate 	uint_t		ref_cnt;
3767c478bd9Sstevel@tonic-gate 	int		status;
3777c478bd9Sstevel@tonic-gate 
378*448bf859SLida.Horn 	IBMF_TRACE_5(IBMF_TNF_DEBUG, DPRINT_L4,
3797c478bd9Sstevel@tonic-gate 	    ibmf_i_send_timeout_start, IBMF_TNF_TRACE, "",
380*448bf859SLida.Horn 	    "ibmf_i_send_timeout_client(): msgp = 0x%p mgt_class = 0x%x "
381*448bf859SLida.Horn 	    "local lid 0x%x remote lid 0x%x remote q# 0x%x\n",
382*448bf859SLida.Horn 	    tnf_opaque, msg, msgimplp,
383*448bf859SLida.Horn 	    tnf_uint, mgt_class, msgimplp->im_mgt_class,
384*448bf859SLida.Horn 	    tnf_uint, local_lid, msgimplp->im_local_addr.ia_local_lid,
385*448bf859SLida.Horn 	    tnf_uint, remote_lid, msgimplp->im_local_addr.ia_remote_lid,
386*448bf859SLida.Horn 	    tnf_uint, qno, msgimplp->im_local_addr.ia_remote_qno);
3877c478bd9Sstevel@tonic-gate 
3887c478bd9Sstevel@tonic-gate 	mutex_enter(&msgimplp->im_mutex);
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate 	/*
3917c478bd9Sstevel@tonic-gate 	 * If the message has been marked uninitialized or done, release the
3927c478bd9Sstevel@tonic-gate 	 * message mutex and return
3937c478bd9Sstevel@tonic-gate 	 */
3947c478bd9Sstevel@tonic-gate 	if ((msgimplp->im_trans_state_flags & IBMF_TRANS_STATE_FLAG_UNINIT) ||
3957c478bd9Sstevel@tonic-gate 	    (msgimplp->im_trans_state_flags & IBMF_TRANS_STATE_FLAG_DONE)) {
3967c478bd9Sstevel@tonic-gate 
3977c478bd9Sstevel@tonic-gate 		mutex_exit(&msgimplp->im_mutex);
3987c478bd9Sstevel@tonic-gate 
3997c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
4007c478bd9Sstevel@tonic-gate 		    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
4017c478bd9Sstevel@tonic-gate 		    "ibmf_i_send_timeout(): %s, msgp = 0x%p\n", tnf_string, msg,
4027c478bd9Sstevel@tonic-gate 		    "Message is done, return without processing send timeout",
4037c478bd9Sstevel@tonic-gate 		    tnf_opaque, msgimplp, msgimplp);
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate 		return;
4067c478bd9Sstevel@tonic-gate 	}
4077c478bd9Sstevel@tonic-gate 
4087c478bd9Sstevel@tonic-gate 	IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3, ibmf_i_send_timeout,
4097c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_send_timeout(): resetting id %d\n",
4107c478bd9Sstevel@tonic-gate 	    tnf_opaque, timeout_id, msgimplp->im_rp_timeout_id);
4117c478bd9Sstevel@tonic-gate 
4127c478bd9Sstevel@tonic-gate 	/*
4137c478bd9Sstevel@tonic-gate 	 * If the timer fired, but the corresponding MAD was received before
4147c478bd9Sstevel@tonic-gate 	 * we got to this point in the timeout code, then do nothing in the
4157c478bd9Sstevel@tonic-gate 	 * timeout handler and return
4167c478bd9Sstevel@tonic-gate 	 */
4177c478bd9Sstevel@tonic-gate 	if ((msgimplp->im_flags & IBMF_MSG_FLAGS_RECV_RMPP) &&
4187c478bd9Sstevel@tonic-gate 	    (msgimplp->im_rp_timeout_id == 0)) {
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate 		mutex_exit(&msgimplp->im_mutex);
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
4237c478bd9Sstevel@tonic-gate 		    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
4247c478bd9Sstevel@tonic-gate 		    "ibmf_i_send_timeout(): %s, msgp = 0x%p\n", tnf_string, msg,
4257c478bd9Sstevel@tonic-gate 		    "Message not in undefined state, return without processing "
4267c478bd9Sstevel@tonic-gate 		    "send timeout",
4277c478bd9Sstevel@tonic-gate 		    tnf_opaque, msgimplp, msgimplp);
4287c478bd9Sstevel@tonic-gate 
4297c478bd9Sstevel@tonic-gate 		return;
4307c478bd9Sstevel@tonic-gate 	}
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate 	/* Clear the response timer */
4337c478bd9Sstevel@tonic-gate 	if (msgimplp->im_rp_timeout_id != 0)
4347c478bd9Sstevel@tonic-gate 		ibmf_i_unset_timer(msgimplp, IBMF_RESP_TIMER);
4357c478bd9Sstevel@tonic-gate 
4367c478bd9Sstevel@tonic-gate 	rmpp_ctx = &msgimplp->im_rmpp_ctx;
4377c478bd9Sstevel@tonic-gate 
4387c478bd9Sstevel@tonic-gate 	/*
4397c478bd9Sstevel@tonic-gate 	 * Non-RMPP send transaction timeout processing
4407c478bd9Sstevel@tonic-gate 	 */
4417c478bd9Sstevel@tonic-gate 	if ((msgimplp->im_flags & IBMF_MSG_FLAGS_SEND_RMPP) == 0) {
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate 		/*
4447c478bd9Sstevel@tonic-gate 		 * We use the RMPP context to store the retry count even if
4457c478bd9Sstevel@tonic-gate 		 * the response does not use RMPP
4467c478bd9Sstevel@tonic-gate 		 */
4477c478bd9Sstevel@tonic-gate 		if (rmpp_ctx->rmpp_retry_cnt <
4487c478bd9Sstevel@tonic-gate 		    msgimplp->im_retrans.retrans_retries) {
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate 			IBMF_TRACE_4(IBMF_TNF_DEBUG, DPRINT_L3,
4517c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
4527c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s, msgp = 0x%p, "
4537c478bd9Sstevel@tonic-gate 			    "retry_cnt = %d, max_retries = %d\n",
4547c478bd9Sstevel@tonic-gate 			    tnf_string, msg, "Non-RMPP send timed out",
4557c478bd9Sstevel@tonic-gate 			    tnf_opaque, msgimplp, msgimplp,
4567c478bd9Sstevel@tonic-gate 			    tnf_uint, retry_cnt, rmpp_ctx->rmpp_retry_cnt,
4577c478bd9Sstevel@tonic-gate 			    tnf_uint, max_retries,
4587c478bd9Sstevel@tonic-gate 			    msgimplp->im_retrans.retrans_retries);
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate 			rmpp_ctx->rmpp_retry_cnt++;
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate 			status = ibmf_i_send_single_pkt(msgimplp->im_client,
4637c478bd9Sstevel@tonic-gate 			    msgimplp->im_qp_hdl, msgimplp, IBMF_NO_BLOCK);
4647c478bd9Sstevel@tonic-gate 			if (status == IBMF_SUCCESS) {
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate 				mutex_exit(&msgimplp->im_mutex);
4677c478bd9Sstevel@tonic-gate 
4687c478bd9Sstevel@tonic-gate 				IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
4697c478bd9Sstevel@tonic-gate 				    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
4707c478bd9Sstevel@tonic-gate 				    "ibmf_i_send_timeout(): %s, msgp = 0x%p\n",
4717c478bd9Sstevel@tonic-gate 				    tnf_string, msg, "Resent send",
4727c478bd9Sstevel@tonic-gate 				    tnf_opaque, msgimplp, msgimplp);
4737c478bd9Sstevel@tonic-gate 
4747c478bd9Sstevel@tonic-gate 				return;
4757c478bd9Sstevel@tonic-gate 			}
4767c478bd9Sstevel@tonic-gate 
4777c478bd9Sstevel@tonic-gate 			IBMF_TRACE_3(IBMF_TNF_NODEBUG, DPRINT_L1,
4787c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_ERROR, "",
4797c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s, msgp = 0x%p, "
4807c478bd9Sstevel@tonic-gate 			    "status = %d\n", tnf_string, msg,
4817c478bd9Sstevel@tonic-gate 			    "Retry send failed; terminating transaction",
4827c478bd9Sstevel@tonic-gate 			    tnf_opaque, msgimplp, msgimplp,
4837c478bd9Sstevel@tonic-gate 			    tnf_opaque, status, status);
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate 		} else {
4867c478bd9Sstevel@tonic-gate 
4877c478bd9Sstevel@tonic-gate 			IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1,
4887c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_ERROR, "",
4897c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s\n",  tnf_string, msg,
4907c478bd9Sstevel@tonic-gate 			    "Not RMPP SEND, terminate transaction with "
4917c478bd9Sstevel@tonic-gate 			    "IBMF_TRANS_TIMEOUT");
4927c478bd9Sstevel@tonic-gate 		}
4937c478bd9Sstevel@tonic-gate 
4947c478bd9Sstevel@tonic-gate 		/*
4957c478bd9Sstevel@tonic-gate 		 * If we are in receive RMPP mode, then an ABORT should
4967c478bd9Sstevel@tonic-gate 		 * be sent after the required number of retries.
4977c478bd9Sstevel@tonic-gate 		 */
4987c478bd9Sstevel@tonic-gate 		if (msgimplp->im_flags & IBMF_MSG_FLAGS_RECV_RMPP) {
4997c478bd9Sstevel@tonic-gate 			status = ibmf_i_send_rmpp(msgimplp,
5007c478bd9Sstevel@tonic-gate 			    IBMF_RMPP_TYPE_ABORT, IBMF_RMPP_STATUS_TMR, 0, 0,
5017c478bd9Sstevel@tonic-gate 			    IBMF_NO_BLOCK);
5027c478bd9Sstevel@tonic-gate 			if (status != IBMF_SUCCESS) {
5037c478bd9Sstevel@tonic-gate 				IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1,
5047c478bd9Sstevel@tonic-gate 				    ibmf_i_send_timeout_err, IBMF_TNF_ERROR, "",
5057c478bd9Sstevel@tonic-gate 				    "ibmf_i_send_timeout(): %s\n", tnf_string,
5067c478bd9Sstevel@tonic-gate 				    msg, "RMPP ABORT send failed");
5077c478bd9Sstevel@tonic-gate 				msgimplp->im_trans_state_flags |=
5087c478bd9Sstevel@tonic-gate 				    IBMF_TRANS_STATE_FLAG_SEND_DONE;
5097c478bd9Sstevel@tonic-gate 			}
5107c478bd9Sstevel@tonic-gate 			rmpp_ctx->rmpp_state = IBMF_RMPP_STATE_ABORT;
5117c478bd9Sstevel@tonic-gate 		}
5127c478bd9Sstevel@tonic-gate 
5137c478bd9Sstevel@tonic-gate 		ibmf_i_terminate_transaction(msgimplp->im_client,
5147c478bd9Sstevel@tonic-gate 		    msgimplp, IBMF_TRANS_TIMEOUT);
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate 		msg_flags = msgimplp->im_trans_state_flags;
5177c478bd9Sstevel@tonic-gate 
5187c478bd9Sstevel@tonic-gate 		mutex_exit(&msgimplp->im_mutex);
5197c478bd9Sstevel@tonic-gate 
5207c478bd9Sstevel@tonic-gate 		/* Notify the client if the transaction is done */
5217c478bd9Sstevel@tonic-gate 		if (msg_flags & IBMF_TRANS_STATE_FLAG_DONE) {
5227c478bd9Sstevel@tonic-gate 
5237c478bd9Sstevel@tonic-gate 			IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
5247c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
5257c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s, msgp = 0x%p\n",
5267c478bd9Sstevel@tonic-gate 			    tnf_string, msg, "calling notify",
5277c478bd9Sstevel@tonic-gate 			    tnf_opaque, msgimplp, msgimplp);
5287c478bd9Sstevel@tonic-gate 			/* Remove the message from the client's message list */
5297c478bd9Sstevel@tonic-gate 			ibmf_i_client_rem_msg(clientp, msgimplp, &ref_cnt);
5307c478bd9Sstevel@tonic-gate 			/*
5317c478bd9Sstevel@tonic-gate 			 * Notify the client if the message reference count is
5327c478bd9Sstevel@tonic-gate 			 * zero. At this point, we know that the transaction is
5337c478bd9Sstevel@tonic-gate 			 * done and the message has been removed from the
5347c478bd9Sstevel@tonic-gate 			 * client's message list. So, we need to be sure the
5357c478bd9Sstevel@tonic-gate 			 * reference count is zero before notifying the client.
5367c478bd9Sstevel@tonic-gate 			 */
5377c478bd9Sstevel@tonic-gate 			if (ref_cnt == 0) {
5387c478bd9Sstevel@tonic-gate 				ibmf_i_notify_client(msgimplp);
5397c478bd9Sstevel@tonic-gate 			}
5407c478bd9Sstevel@tonic-gate 		}
5417c478bd9Sstevel@tonic-gate 
5427c478bd9Sstevel@tonic-gate 		IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_i_send_timeout,
5437c478bd9Sstevel@tonic-gate 		    IBMF_TNF_TRACE, "", "ibmf_i_send_timeout() exit\n");
5447c478bd9Sstevel@tonic-gate 
5457c478bd9Sstevel@tonic-gate 		return;
5467c478bd9Sstevel@tonic-gate 	}
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate 	IBMF_TRACE_4(IBMF_TNF_DEBUG, DPRINT_L3,
5497c478bd9Sstevel@tonic-gate 	    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
5507c478bd9Sstevel@tonic-gate 	    "ibmf_i_send_timeout(): %s, msgp = 0x%p, retry_cnt = %d, "
5517c478bd9Sstevel@tonic-gate 	    "max_retries = %d\n", tnf_string, msg, "RMPP send timed out",
5527c478bd9Sstevel@tonic-gate 	    tnf_opaque, msgimplp, msgimplp,
5537c478bd9Sstevel@tonic-gate 	    tnf_uint, retry_cnt, rmpp_ctx->rmpp_retry_cnt,
5547c478bd9Sstevel@tonic-gate 	    tnf_uint, max_retries, msgimplp->im_retrans.retrans_retries);
5557c478bd9Sstevel@tonic-gate 
5567c478bd9Sstevel@tonic-gate 	/* RMPP send transaction timeout processing */
5577c478bd9Sstevel@tonic-gate 	if (rmpp_ctx->rmpp_retry_cnt == msgimplp->im_retrans.retrans_retries) {
5587c478bd9Sstevel@tonic-gate 
5597c478bd9Sstevel@tonic-gate 		IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
5607c478bd9Sstevel@tonic-gate 		    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
5617c478bd9Sstevel@tonic-gate 		    "ibmf_i_send_timeout(): %s\n", tnf_string, msg,
5627c478bd9Sstevel@tonic-gate 		    "Maximum retries done, sending ABORT TMR");
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate 		status = ibmf_i_send_rmpp(msgimplp, IBMF_RMPP_TYPE_ABORT,
5657c478bd9Sstevel@tonic-gate 		    IBMF_RMPP_STATUS_TMR, 0, 0, IBMF_NO_BLOCK);
5667c478bd9Sstevel@tonic-gate 		if (status != IBMF_SUCCESS) {
5677c478bd9Sstevel@tonic-gate 			IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1,
5687c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout_err, IBMF_TNF_ERROR, "",
5697c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s\n", tnf_string, msg,
5707c478bd9Sstevel@tonic-gate 			    "RMPP ABORT send failed");
5717c478bd9Sstevel@tonic-gate 			msgimplp->im_trans_state_flags |=
5727c478bd9Sstevel@tonic-gate 			    IBMF_TRANS_STATE_FLAG_SEND_DONE;
5737c478bd9Sstevel@tonic-gate 		}
5747c478bd9Sstevel@tonic-gate 
5757c478bd9Sstevel@tonic-gate 		rmpp_ctx->rmpp_state = IBMF_RMPP_STATE_ABORT;
5767c478bd9Sstevel@tonic-gate 
5777c478bd9Sstevel@tonic-gate 		mutex_enter(&clientp->ic_kstat_mutex);
5787c478bd9Sstevel@tonic-gate 		IBMF_ADD32_KSTATS(clientp, rmpp_errors, 1);
5797c478bd9Sstevel@tonic-gate 		mutex_exit(&clientp->ic_kstat_mutex);
5807c478bd9Sstevel@tonic-gate 
5817c478bd9Sstevel@tonic-gate 		IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1,
5827c478bd9Sstevel@tonic-gate 		    ibmf_i_send_timeout, IBMF_TNF_ERROR, "",
5837c478bd9Sstevel@tonic-gate 		    "ibmf_i_send_timeout(): %s\n", tnf_string, msg,
5847c478bd9Sstevel@tonic-gate 		    "Maximum retries done, terminate transaction with "
5857c478bd9Sstevel@tonic-gate 		    "IBMF_TRANS_TIMEOUT");
5867c478bd9Sstevel@tonic-gate 
5877c478bd9Sstevel@tonic-gate 		ibmf_i_terminate_transaction(msgimplp->im_client,
5887c478bd9Sstevel@tonic-gate 		    msgimplp, IBMF_TRANS_TIMEOUT);
5897c478bd9Sstevel@tonic-gate 
5907c478bd9Sstevel@tonic-gate 	} else {
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate 		if (rmpp_ctx->rmpp_state == IBMF_RMPP_STATE_SENDER_ACTIVE) {
5937c478bd9Sstevel@tonic-gate 
5947c478bd9Sstevel@tonic-gate 			IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
5957c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
5967c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s\n", tnf_string, msg,
5977c478bd9Sstevel@tonic-gate 			    "RMPP context is Sender Active, Resending window");
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate 			/*
6007c478bd9Sstevel@tonic-gate 			 * resend the window
6017c478bd9Sstevel@tonic-gate 			 */
6027c478bd9Sstevel@tonic-gate 			rmpp_ctx->rmpp_ns = rmpp_ctx->rmpp_wf;
6037c478bd9Sstevel@tonic-gate 
6047c478bd9Sstevel@tonic-gate 			ibmf_i_send_rmpp_window(msgimplp, IBMF_NO_BLOCK);
6057c478bd9Sstevel@tonic-gate 		} else if (rmpp_ctx->rmpp_state ==
6067c478bd9Sstevel@tonic-gate 		    IBMF_RMPP_STATE_SENDER_SWITCH) {
6077c478bd9Sstevel@tonic-gate 
6087c478bd9Sstevel@tonic-gate 			IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
6097c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
6107c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): %s\n", tnf_string, msg,
6117c478bd9Sstevel@tonic-gate 			    "RMPP context is Sender Terminate, sending ACK");
6127c478bd9Sstevel@tonic-gate 
6137c478bd9Sstevel@tonic-gate 			/* send ACK */
6147c478bd9Sstevel@tonic-gate 			(void) ibmf_i_send_rmpp(msgimplp, IBMF_RMPP_TYPE_ACK,
6157c478bd9Sstevel@tonic-gate 			    IBMF_RMPP_STATUS_NORMAL, 0, 1, IBMF_NO_BLOCK);
6167c478bd9Sstevel@tonic-gate 
6177c478bd9Sstevel@tonic-gate 			IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
6187c478bd9Sstevel@tonic-gate 			    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
6197c478bd9Sstevel@tonic-gate 			    "ibmf_i_send_timeout(): setting timer %d %p\n",
6207c478bd9Sstevel@tonic-gate 			    tnf_opaque, msgp, msgimplp, tnf_opaque,
6217c478bd9Sstevel@tonic-gate 			    timeout_id, msgimplp->im_rp_timeout_id);
6227c478bd9Sstevel@tonic-gate 
6237c478bd9Sstevel@tonic-gate 			/* set response timer */
6247c478bd9Sstevel@tonic-gate 			ibmf_i_set_timer(ibmf_i_send_timeout, msgimplp,
6257c478bd9Sstevel@tonic-gate 			    IBMF_RESP_TIMER);
6267c478bd9Sstevel@tonic-gate 		}
6277c478bd9Sstevel@tonic-gate 
6287c478bd9Sstevel@tonic-gate 		rmpp_ctx->rmpp_retry_cnt++;
6297c478bd9Sstevel@tonic-gate 
6307c478bd9Sstevel@tonic-gate 	}
6317c478bd9Sstevel@tonic-gate 
6327c478bd9Sstevel@tonic-gate 	msg_flags = msgimplp->im_trans_state_flags;
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate 	mutex_exit(&msgimplp->im_mutex);
6357c478bd9Sstevel@tonic-gate 
6367c478bd9Sstevel@tonic-gate 	clientp = (ibmf_client_t *)msgimplp->im_client;
6377c478bd9Sstevel@tonic-gate 
6387c478bd9Sstevel@tonic-gate 	IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
6397c478bd9Sstevel@tonic-gate 	    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
6407c478bd9Sstevel@tonic-gate 	    "ibmf_i_send_timeout(): %s, msgp = 0x%p\n", tnf_string, msg,
6417c478bd9Sstevel@tonic-gate 	    "Send timeout done", tnf_opaque, msgimplp, msgimplp);
6427c478bd9Sstevel@tonic-gate 
6437c478bd9Sstevel@tonic-gate 	if (msg_flags & IBMF_TRANS_STATE_FLAG_DONE) {
6447c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
6457c478bd9Sstevel@tonic-gate 		    ibmf_i_send_timeout, IBMF_TNF_TRACE, "",
6467c478bd9Sstevel@tonic-gate 		    "ibmf_i_send_timeout(): %s, msgp = 0x%p\n", tnf_string, msg,
6477c478bd9Sstevel@tonic-gate 		    "calling notify", tnf_opaque, msgimplp, msgimplp);
6487c478bd9Sstevel@tonic-gate 		/* Remove the message from the client's message list */
6497c478bd9Sstevel@tonic-gate 		ibmf_i_client_rem_msg(clientp, msgimplp, &ref_cnt);
6507c478bd9Sstevel@tonic-gate 		/*
6517c478bd9Sstevel@tonic-gate 		 * Notify the client if the message reference count is zero.
6527c478bd9Sstevel@tonic-gate 		 * At this point, we know that the transaction is done and
6537c478bd9Sstevel@tonic-gate 		 * the message has been removed from the client's message list.
6547c478bd9Sstevel@tonic-gate 		 * So, we only need to make sure the reference count is zero
6557c478bd9Sstevel@tonic-gate 		 * before notifying the client.
6567c478bd9Sstevel@tonic-gate 		 */
6577c478bd9Sstevel@tonic-gate 		if (ref_cnt == 0) {
6587c478bd9Sstevel@tonic-gate 			ibmf_i_notify_client(msgimplp);
6597c478bd9Sstevel@tonic-gate 		}
6607c478bd9Sstevel@tonic-gate 	}
6617c478bd9Sstevel@tonic-gate 
6627c478bd9Sstevel@tonic-gate 	IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_i_send_timeout_end,
6637c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_send_timeout() exit\n");
6647c478bd9Sstevel@tonic-gate }
6657c478bd9Sstevel@tonic-gate 
6667c478bd9Sstevel@tonic-gate void
ibmf_i_err_terminate_timeout(void * argp)6677c478bd9Sstevel@tonic-gate ibmf_i_err_terminate_timeout(void *argp)
6687c478bd9Sstevel@tonic-gate {
6697c478bd9Sstevel@tonic-gate 	ibmf_msg_impl_t *msgimplp = (ibmf_msg_impl_t *)argp;
6707c478bd9Sstevel@tonic-gate 	ibmf_client_t	*clientp = (ibmf_client_t *)msgimplp->im_client;
6717c478bd9Sstevel@tonic-gate 	int		msg_flags;
6727c478bd9Sstevel@tonic-gate 	uint_t		ref_cnt;
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate 	IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L4,
6757c478bd9Sstevel@tonic-gate 	    ibmf_i_err_terminate_timeout_start, IBMF_TNF_TRACE, "",
6767c478bd9Sstevel@tonic-gate 	    "ibmf_i_err_terminate_timeout_client(): msgp = 0x%p\n",
6777c478bd9Sstevel@tonic-gate 	    tnf_opaque, msg, msgimplp);
6787c478bd9Sstevel@tonic-gate 
6797c478bd9Sstevel@tonic-gate 	mutex_enter(&msgimplp->im_mutex);
6807c478bd9Sstevel@tonic-gate 
6817c478bd9Sstevel@tonic-gate 	/*
6827c478bd9Sstevel@tonic-gate 	 * If the message has been marked uninitialized or done, release the
6837c478bd9Sstevel@tonic-gate 	 * message mutex and return
6847c478bd9Sstevel@tonic-gate 	 */
6857c478bd9Sstevel@tonic-gate 	if ((msgimplp->im_trans_state_flags & IBMF_TRANS_STATE_FLAG_UNINIT) ||
6867c478bd9Sstevel@tonic-gate 	    (msgimplp->im_trans_state_flags & IBMF_TRANS_STATE_FLAG_DONE)) {
6877c478bd9Sstevel@tonic-gate 
6887c478bd9Sstevel@tonic-gate 		mutex_exit(&msgimplp->im_mutex);
6897c478bd9Sstevel@tonic-gate 
6907c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
6917c478bd9Sstevel@tonic-gate 		    ibmf_i_err_terminate_timeout, IBMF_TNF_TRACE, "",
6927c478bd9Sstevel@tonic-gate 		    "ibmf_i_err_terminate_timeout(): %s, msgp = 0x%p\n",
6937c478bd9Sstevel@tonic-gate 		    tnf_string, msg, "Message is done, return without "
6947c478bd9Sstevel@tonic-gate 		    "processing error terminate timeout",
6957c478bd9Sstevel@tonic-gate 		    tnf_opaque, msgimplp, msgimplp);
6967c478bd9Sstevel@tonic-gate 
6977c478bd9Sstevel@tonic-gate 		return;
6987c478bd9Sstevel@tonic-gate 	}
6997c478bd9Sstevel@tonic-gate 
7007c478bd9Sstevel@tonic-gate 	IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3, ibmf_i_err_terminate_timeout,
7017c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_err_terminate_timeout(): resetting "
7027c478bd9Sstevel@tonic-gate 	    "id %d\n", tnf_opaque, timeout_id, msgimplp->im_rp_timeout_id);
7037c478bd9Sstevel@tonic-gate 
7047c478bd9Sstevel@tonic-gate 	/* Clear the response timer */
7057c478bd9Sstevel@tonic-gate 	if (msgimplp->im_rp_timeout_id != 0)
7067c478bd9Sstevel@tonic-gate 		msgimplp->im_rp_timeout_id = 0;
7077c478bd9Sstevel@tonic-gate 
7087c478bd9Sstevel@tonic-gate 	/* Mark the transaction as terminated */
7097c478bd9Sstevel@tonic-gate 	ibmf_i_terminate_transaction(msgimplp->im_client, msgimplp,
7107c478bd9Sstevel@tonic-gate 	    IBMF_TRANS_FAILURE);
7117c478bd9Sstevel@tonic-gate 
7127c478bd9Sstevel@tonic-gate 	msg_flags = msgimplp->im_trans_state_flags;
7137c478bd9Sstevel@tonic-gate 
7147c478bd9Sstevel@tonic-gate 	mutex_exit(&msgimplp->im_mutex);
7157c478bd9Sstevel@tonic-gate 
7167c478bd9Sstevel@tonic-gate 	clientp = (ibmf_client_t *)msgimplp->im_client;
7177c478bd9Sstevel@tonic-gate 
7187c478bd9Sstevel@tonic-gate 	IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3, ibmf_i_err_terminate_timeout,
7197c478bd9Sstevel@tonic-gate 	    IBMF_TNF_TRACE, "", "ibmf_i_err_terminate_timeout(): %s, "
7207c478bd9Sstevel@tonic-gate 	    "msgp = 0x%p\n", tnf_string, msg,
7217c478bd9Sstevel@tonic-gate 	    "Error terminate timeout done", tnf_opaque, msgimplp, msgimplp);
7227c478bd9Sstevel@tonic-gate 
7237c478bd9Sstevel@tonic-gate 	if (msg_flags & IBMF_TRANS_STATE_FLAG_DONE) {
7247c478bd9Sstevel@tonic-gate 		IBMF_TRACE_2(IBMF_TNF_DEBUG, DPRINT_L3,
7257c478bd9Sstevel@tonic-gate 		    ibmf_i_err_terminate_timeout, IBMF_TNF_TRACE, "",
7267c478bd9Sstevel@tonic-gate 		    "ibmf_i_err_terminate_timeout(): %s, msgp = 0x%p\n",
7277c478bd9Sstevel@tonic-gate 		    tnf_string, msg,
7287c478bd9Sstevel@tonic-gate 		    "calling notify", tnf_opaque, msgimplp, msgimplp);
7297c478bd9Sstevel@tonic-gate 		/* Remove the message from the client's message list */
7307c478bd9Sstevel@tonic-gate 		ibmf_i_client_rem_msg(clientp, msgimplp, &ref_cnt);
7317c478bd9Sstevel@tonic-gate 		/*
7327c478bd9Sstevel@tonic-gate 		 * Notify the client if the message reference count is zero.
7337c478bd9Sstevel@tonic-gate 		 * At this point, we know that the transaction is done and
7347c478bd9Sstevel@tonic-gate 		 * the message has been removed from the client's message list.
7357c478bd9Sstevel@tonic-gate 		 * So, we only need to make sure the reference count is zero
7367c478bd9Sstevel@tonic-gate 		 * before notifying the client.
7377c478bd9Sstevel@tonic-gate 		 */
7387c478bd9Sstevel@tonic-gate 		if (ref_cnt == 0) {
7397c478bd9Sstevel@tonic-gate 			_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*msgimplp))
7407c478bd9Sstevel@tonic-gate 			if (msgimplp->im_flags & IBMF_MSG_FLAGS_TERMINATION) {
7417c478bd9Sstevel@tonic-gate 
7427c478bd9Sstevel@tonic-gate 				/*
7437c478bd9Sstevel@tonic-gate 				 * If the message is a termination message,
7447c478bd9Sstevel@tonic-gate 				 * free it at this time.
7457c478bd9Sstevel@tonic-gate 				 */
7467c478bd9Sstevel@tonic-gate 
7477c478bd9Sstevel@tonic-gate 				IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
7487c478bd9Sstevel@tonic-gate 				    ibmf_i_err_terminate_timeout,
7497c478bd9Sstevel@tonic-gate 				    IBMF_TNF_TRACE, "",
7507c478bd9Sstevel@tonic-gate 				    "ibmf_i_recv_timeout(): freeing terminate "
7517c478bd9Sstevel@tonic-gate 				    "message %p\n", tnf_opaque, msgp, msgimplp);
7527c478bd9Sstevel@tonic-gate 
7537c478bd9Sstevel@tonic-gate 				/* free up the UD destination resource */
7547c478bd9Sstevel@tonic-gate 				if (msgimplp->im_ibmf_ud_dest != NULL) {
7557c478bd9Sstevel@tonic-gate 					ibmf_i_free_ud_dest(clientp, msgimplp);
7567c478bd9Sstevel@tonic-gate 					ibmf_i_clean_ud_dest_list(
7577c478bd9Sstevel@tonic-gate 					    clientp->ic_myci, B_FALSE);
7587c478bd9Sstevel@tonic-gate 				}
7597c478bd9Sstevel@tonic-gate 
7607c478bd9Sstevel@tonic-gate 				/* Free the receive buffer */
7617c478bd9Sstevel@tonic-gate 				kmem_free(
7627c478bd9Sstevel@tonic-gate 				    msgimplp->im_msgbufs_recv.im_bufs_mad_hdr,
7637c478bd9Sstevel@tonic-gate 				    IBMF_MAD_SIZE);
7647c478bd9Sstevel@tonic-gate 
7657c478bd9Sstevel@tonic-gate 				/* destroy the message mutex */
7667c478bd9Sstevel@tonic-gate 				mutex_destroy(&msgimplp->im_mutex);
7677c478bd9Sstevel@tonic-gate 
7687c478bd9Sstevel@tonic-gate 				/* Free the termination message context */
7697c478bd9Sstevel@tonic-gate 				kmem_free(msgimplp, sizeof (ibmf_msg_impl_t));
7707c478bd9Sstevel@tonic-gate 
7717c478bd9Sstevel@tonic-gate 				/*
7727c478bd9Sstevel@tonic-gate 				 * Decrease the "messages allocated" count
7737c478bd9Sstevel@tonic-gate 				 * so that an ibmf_unregister() can succeed
7747c478bd9Sstevel@tonic-gate 				 * for this client.
7757c478bd9Sstevel@tonic-gate 				 */
7767c478bd9Sstevel@tonic-gate 				mutex_enter(&clientp->ic_mutex);
7777c478bd9Sstevel@tonic-gate 				clientp->ic_msgs_alloced--;
7787c478bd9Sstevel@tonic-gate 				mutex_exit(&clientp->ic_mutex);
7797c478bd9Sstevel@tonic-gate 
7807c478bd9Sstevel@tonic-gate 			} else {
7817c478bd9Sstevel@tonic-gate 
7827c478bd9Sstevel@tonic-gate 				IBMF_TRACE_1(IBMF_TNF_DEBUG, DPRINT_L3,
7837c478bd9Sstevel@tonic-gate 				    ibmf_i_err_terminate_timeout,
7847c478bd9Sstevel@tonic-gate 				    IBMF_TNF_TRACE, "",
7857c478bd9Sstevel@tonic-gate 				    "ibmf_i_recv_timeout(): calling "
7867c478bd9Sstevel@tonic-gate 				    "notify %p\n", tnf_opaque, msgp, msgimplp);
7877c478bd9Sstevel@tonic-gate 
7887c478bd9Sstevel@tonic-gate 				ibmf_i_notify_client(msgimplp);
7897c478bd9Sstevel@tonic-gate 			}
7907c478bd9Sstevel@tonic-gate 		}
7917c478bd9Sstevel@tonic-gate 	}
7927c478bd9Sstevel@tonic-gate 
7937c478bd9Sstevel@tonic-gate 	IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4,
7947c478bd9Sstevel@tonic-gate 	    ibmf_i_err_terminate_timeout_end, IBMF_TNF_TRACE, "",
7957c478bd9Sstevel@tonic-gate 	    "ibmf_i_err_terminate_timeout() exit\n");
7967c478bd9Sstevel@tonic-gate }
797