Lines Matching defs:tep

241  * tep structure, so it should be never freed.
1134 tl_refhold(tl_endpt_t *tep)
1136 atomic_add_32(&tep->te_refcnt, 1);
1140 tl_refrele(tl_endpt_t *tep)
1142 ASSERT(tep->te_refcnt != 0);
1144 if (atomic_add_32_nv(&tep->te_refcnt, -1) == 0)
1145 tl_free(tep);
1152 tl_endpt_t *tep = buf;
1154 bzero(tep, sizeof (tl_endpt_t));
1155 mutex_init(&tep->te_closelock, NULL, MUTEX_DEFAULT, NULL);
1156 cv_init(&tep->te_closecv, NULL, CV_DEFAULT, NULL);
1157 mutex_init(&tep->te_srv_lock, NULL, MUTEX_DEFAULT, NULL);
1158 cv_init(&tep->te_srv_cv, NULL, CV_DEFAULT, NULL);
1159 mutex_init(&tep->te_ser_lock, NULL, MUTEX_DEFAULT, NULL);
1168 tl_endpt_t *tep = buf;
1170 mutex_destroy(&tep->te_closelock);
1171 cv_destroy(&tep->te_closecv);
1172 mutex_destroy(&tep->te_srv_lock);
1173 cv_destroy(&tep->te_srv_cv);
1174 mutex_destroy(&tep->te_ser_lock);
1178 tl_free(tl_endpt_t *tep)
1180 ASSERT(tep->te_refcnt == 0);
1181 ASSERT(tep->te_transport != NULL);
1182 ASSERT(tep->te_rq == NULL);
1183 ASSERT(tep->te_wq == NULL);
1184 ASSERT(tep->te_ser != NULL);
1185 ASSERT(tep->te_ser_count == 0);
1186 ASSERT(! (tep->te_flag & TL_ADDRHASHED));
1188 if (IS_SOCKET(tep)) {
1189 ASSERT(tep->te_alen == TL_SOUX_ADDRLEN);
1190 ASSERT(tep->te_abuf == &tep->te_uxaddr);
1191 ASSERT(tep->te_vp == (void *)(uintptr_t)tep->te_minor);
1192 ASSERT(tep->te_magic == SOU_MAGIC_IMPLICIT);
1193 } else if (tep->te_abuf != NULL) {
1194 kmem_free(tep->te_abuf, tep->te_alen);
1195 tep->te_alen = -1; /* uninitialized */
1196 tep->te_abuf = NULL;
1198 ASSERT(tep->te_alen == -1);
1201 id_free(tl_minors, tep->te_minor);
1202 ASSERT(tep->te_credp == NULL);
1204 if (tep->te_hash_hndl != NULL)
1205 mod_hash_cancel(tep->te_addrhash, &tep->te_hash_hndl);
1207 if (IS_COTS(tep)) {
1208 TL_REMOVE_PEER(tep->te_conp);
1209 TL_REMOVE_PEER(tep->te_oconp);
1210 tl_serializer_refrele(tep->te_ser);
1211 tep->te_ser = NULL;
1212 ASSERT(tep->te_nicon == 0);
1213 ASSERT(list_head(&tep->te_iconp) == NULL);
1215 ASSERT(tep->te_lastep == NULL);
1216 ASSERT(list_head(&tep->te_flowlist) == NULL);
1217 ASSERT(tep->te_flowq == NULL);
1220 ASSERT(tep->te_bufcid == 0);
1221 ASSERT(tep->te_timoutid == 0);
1222 bzero(&tep->te_ap, sizeof (tep->te_ap));
1223 tep->te_acceptor_id = 0;
1225 ASSERT(tep->te_closewait == 0);
1226 ASSERT(!tep->te_rsrv_active);
1227 ASSERT(!tep->te_wsrv_active);
1228 tep->te_closing = 0;
1229 tep->te_nowsrv = B_FALSE;
1230 tep->te_flag = 0;
1232 kmem_cache_free(tl_cache, tep);
1279 tl_serializer_enter(tl_endpt_t *tep, tlproc_t tlproc, mblk_t *mp)
1281 if (IS_COTS(tep)) {
1282 mutex_enter(&tep->te_ser_lock);
1283 tep->te_ser_count++;
1284 mutex_exit(&tep->te_ser_lock);
1286 serializer_enter(tep->te_serializer, (srproc_t *)tlproc, mp, tep);
1294 tl_serializer_exit(tl_endpt_t *tep)
1296 if (IS_COTS(tep)) {
1297 mutex_enter(&tep->te_ser_lock);
1298 ASSERT(tep->te_ser_count != 0);
1299 tep->te_ser_count--;
1300 mutex_exit(&tep->te_ser_lock);
1381 tl_noclose(tl_endpt_t *tep)
1385 mutex_enter(&tep->te_closelock);
1386 if (! tep->te_closing) {
1387 ASSERT(tep->te_closewait == 0);
1388 tep->te_closewait++;
1391 mutex_exit(&tep->te_closelock);
1399 tl_closeok(tl_endpt_t *tep)
1401 ASSERT(tep->te_closewait > 0);
1402 mutex_enter(&tep->te_closelock);
1403 ASSERT(tep->te_closewait == 1);
1404 tep->te_closewait--;
1405 cv_signal(&tep->te_closecv);
1406 mutex_exit(&tep->te_closelock);
1416 tl_endpt_t *tep;
1437 tep = kmem_cache_alloc(tl_cache, KM_SLEEP);
1438 tep->te_refcnt = 1;
1439 tep->te_cpid = curproc->p_pid;
1440 rq->q_ptr = WR(rq)->q_ptr = tep;
1441 tep->te_state = TS_UNBND;
1442 tep->te_credp = credp;
1444 tep->te_zoneid = getzoneid();
1446 tep->te_flag = minor & TL_MINOR_MASK;
1447 tep->te_transport = &tl_transports[minor];
1450 tep->te_minor = (minor_t)id_alloc(tl_minors);
1453 (void) mod_hash_reserve(tep->te_addrhash, &tep->te_hash_hndl);
1456 if (IS_COTS(tep)) {
1458 tep->te_ser = tl_serializer_alloc(KM_SLEEP);
1461 list_create(&tep->te_iconp, sizeof (tl_icon_t),
1463 tep->te_qlen = 0;
1464 tep->te_nicon = 0;
1465 tep->te_oconp = NULL;
1466 tep->te_conp = NULL;
1469 tep->te_ser = tep->te_transport->tr_serializer;
1470 bzero(&tep->te_flows, sizeof (list_node_t));
1472 list_create(&tep->te_flowlist, sizeof (tl_endpt_t),
1474 tep->te_flowq = NULL;
1475 tep->te_lastep = NULL;
1480 if (IS_SOCKET(tep)) {
1482 tep->te_alen = TL_SOUX_ADDRLEN;
1483 tep->te_abuf = &tep->te_uxaddr;
1484 tep->te_vp = (void *)(uintptr_t)tep->te_minor;
1485 tep->te_magic = SOU_MAGIC_IMPLICIT;
1487 tep->te_alen = -1;
1488 tep->te_abuf = NULL;
1492 *devp = makedevice(getmajor(*devp), tep->te_minor);
1494 tep->te_rq = rq;
1495 tep->te_wq = WR(rq);
1498 if (IS_SOCKET(tep))
1499 tep->te_acceptor_id = tep->te_minor;
1501 tep->te_acceptor_id = (t_uscalar_t)rq;
1503 tep->te_acceptor_id = tep->te_minor;
1513 (void) mod_hash_insert(tep->te_transport->tr_ai_hash,
1514 (mod_hash_key_t)(uintptr_t)tep->te_acceptor_id,
1515 (mod_hash_val_t)tep);
1524 tl_endpt_t *tep = (tl_endpt_t *)rq->q_ptr;
1526 queue_t *wq = tep->te_wq;
1534 rc = mod_hash_remove(tep->te_transport->tr_ai_hash,
1535 (mod_hash_key_t)(uintptr_t)tep->te_acceptor_id,
1537 ASSERT(rc == 0 && tep == elp);
1538 if ((rc != 0) || (tep != elp)) {
1539 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1547 mutex_enter(&tep->te_closelock);
1548 while (tep->te_closewait)
1549 cv_wait(&tep->te_closecv, &tep->te_closelock);
1550 tep->te_closing = B_TRUE;
1555 tep->te_closewait = 1;
1556 tep->te_nowsrv = B_FALSE;
1557 mutex_exit(&tep->te_closelock);
1563 tl_serializer_enter(tep, tl_close_ser, &tep->te_closemp);
1568 mutex_enter(&tep->te_closelock);
1569 while (tep->te_closewait)
1570 cv_wait(&tep->te_closecv, &tep->te_closelock);
1571 mutex_exit(&tep->te_closelock);
1575 if (tep->te_bufcid) {
1576 qunbufcall(rq, tep->te_bufcid);
1577 tep->te_bufcid = 0;
1579 if (tep->te_timoutid) {
1580 (void) quntimeout(rq, tep->te_timoutid);
1581 tep->te_timoutid = 0;
1591 * Fot a COTS endpoint wait before destroying tep since the serializer
1592 * may go away together with tep and we need to destroy serializer
1595 ASSERT(tep->te_closewait == 0);
1596 if (IS_COTS(tep))
1597 tep->te_closewait = 1;
1599 tl_refhold(tep);
1601 tl_serializer_enter(tep, tl_close_finish_ser, &tep->te_closemp);
1607 if (IS_COTS(tep)) {
1608 mutex_enter(&tep->te_closelock);
1609 while (tep->te_closewait)
1610 cv_wait(&tep->te_closecv, &tep->te_closelock);
1611 mutex_exit(&tep->te_closelock);
1614 crfree(tep->te_credp);
1615 tep->te_credp = NULL;
1616 tep->te_wq = NULL;
1617 tl_refrele(tep);
1619 * tep is likely to be destroyed now, so can't reference it any more.
1634 tl_close_ser(mblk_t *mp, tl_endpt_t *tep)
1636 ASSERT(tep->te_closing);
1637 ASSERT(tep->te_closewait == 1);
1638 ASSERT(!(tep->te_flag & TL_CLOSE_SER));
1640 tep->te_flag |= TL_CLOSE_SER;
1646 if (tep->te_wq->q_first && (IS_CLTS(tep) || IS_COTSORD(tep))) {
1647 tl_wsrv_ser(NULL, tep);
1651 tl_addr_unbind(tep);
1657 if (IS_COTS(tep) && !IS_SOCKET(tep)) {
1658 tl_endpt_t *peer_tep = tep->te_conp;
1660 tep->te_wq->q_next = NULL;
1665 tep->te_rq = NULL;
1668 tl_closeok(tep);
1669 tl_serializer_exit(tep);
1680 tl_close_finish_ser(mblk_t *mp, tl_endpt_t *tep)
1682 ASSERT(tep->te_closing);
1683 IMPLY(IS_CLTS(tep), tep->te_closewait == 0);
1684 IMPLY(IS_COTS(tep), tep->te_closewait == 1);
1686 tep->te_state = -1; /* Uninitialized */
1687 if (IS_COTS(tep)) {
1688 tl_co_unconnect(tep);
1691 TL_REMOVE_PEER(tep->te_lastep);
1696 tl_cl_backenable(tep);
1697 if (tep->te_flowq != NULL) {
1698 list_remove(&(tep->te_flowq->te_flowlist), tep);
1699 tep->te_flowq = NULL;
1703 tl_serializer_exit(tep);
1704 if (IS_COTS(tep))
1705 tl_closeok(tep);
1707 tl_refrele(tep);
1719 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
1727 if (IS_CLTS(tep)) {
1728 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1772 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1799 if (IS_CLTS(tep)) {
1812 if (IS_COTS(tep) ||
1817 if ((tep->te_state == TS_IDLE) && !wq->q_first) {
1843 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1851 tl_capability_req(mp, tep);
1857 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1865 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
1875 tl_refhold(tep);
1876 tl_serializer_enter(tep, tl_proc, mp);
1883 tl_putq_ser(mblk_t *mp, tl_endpt_t *tep)
1885 if (tep->te_closing) {
1886 tl_wput_ser(mp, tep);
1888 TL_PUTQ(tep, mp);
1889 tl_serializer_exit(tep);
1890 tl_refrele(tep);
1896 tl_wput_common_ser(mblk_t *mp, tl_endpt_t *tep)
1902 tl_data(mp, tep);
1905 tl_do_proto(mp, tep);
1917 tl_wput_ser(mblk_t *mp, tl_endpt_t *tep)
1919 tl_wput_common_ser(mp, tep);
1920 tl_serializer_exit(tep);
1921 tl_refrele(tep);
1928 tl_wput_data_ser(mblk_t *mp, tl_endpt_t *tep)
1930 tl_endpt_t *peer_tep = tep->te_conp;
1934 ASSERT(IS_COTS(tep));
1936 IMPLY(peer_tep, tep->te_serializer == peer_tep->te_serializer);
1939 * fastpath for data. Ignore flow control if tep is closing.
1943 ((tep->te_state == TS_DATA_XFER) ||
1944 (tep->te_state == TS_WREQ_ORDREL)) &&
1945 (tep->te_wq != NULL) &&
1946 (tep->te_wq->q_first == NULL) &&
1950 (canputnext(peer_rq) || tep->te_closing)) {
1952 } else if (tep->te_closing) {
1954 * It is possible that by the time we got here tep started to
1959 if ((tep->te_wq != NULL) &&
1960 ((tep->te_state == TS_DATA_XFER) ||
1961 (tep->te_state == TS_WREQ_ORDREL))) {
1962 TL_PUTQ(tep, mp);
1967 TL_PUTQ(tep, mp);
1970 tl_serializer_exit(tep);
1971 tl_refrele(tep);
1985 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
1987 while ((wq->q_first != NULL) && !tep->te_nowsrv) {
1988 mutex_enter(&tep->te_srv_lock);
1989 ASSERT(tep->te_wsrv_active == B_FALSE);
1990 tep->te_wsrv_active = B_TRUE;
1991 mutex_exit(&tep->te_srv_lock);
1993 tl_serializer_enter(tep, tl_wsrv_ser, &tep->te_wsrvmp);
1998 mutex_enter(&tep->te_srv_lock);
1999 while (tep->te_wsrv_active) {
2000 cv_wait(&tep->te_srv_cv, &tep->te_srv_lock);
2002 cv_signal(&tep->te_srv_cv);
2003 mutex_exit(&tep->te_srv_lock);
2013 tl_wsrv_ser(mblk_t *ser_mp, tl_endpt_t *tep)
2016 queue_t *wq = tep->te_wq;
2019 while (!tep->te_nowsrv && (mp = getq(wq)) != NULL) {
2020 tl_wput_common_ser(mp, tep);
2036 mutex_enter(&tep->te_srv_lock);
2037 ASSERT(tep->te_wsrv_active);
2038 tep->te_wsrv_active = B_FALSE;
2039 cv_signal(&tep->te_srv_cv);
2040 mutex_exit(&tep->te_srv_lock);
2041 tl_serializer_exit(tep);
2047 * flow controlled by tep.
2056 tl_endpt_t *tep = (tl_endpt_t *)rq->q_ptr;
2059 ASSERT(tep->te_rsrv_active == 0);
2061 tep->te_rsrv_active = B_TRUE;
2062 tl_serializer_enter(tep, tl_rsrv_ser, &tep->te_rsrvmp);
2066 mutex_enter(&tep->te_srv_lock);
2067 while (tep->te_rsrv_active) {
2068 cv_wait(&tep->te_srv_cv, &tep->te_srv_lock);
2070 cv_signal(&tep->te_srv_cv);
2071 mutex_exit(&tep->te_srv_lock);
2076 tl_rsrv_ser(mblk_t *mp, tl_endpt_t *tep)
2080 if (IS_CLTS(tep) && tep->te_state == TS_IDLE) {
2081 tl_cl_backenable(tep);
2083 IS_COTS(tep) &&
2084 ((peer_tep = tep->te_conp) != NULL) &&
2086 ((tep->te_state == TS_DATA_XFER) ||
2087 (tep->te_state == TS_WIND_ORDREL)||
2088 (tep->te_state == TS_WREQ_ORDREL))) {
2095 mutex_enter(&tep->te_srv_lock);
2096 ASSERT(tep->te_rsrv_active);
2097 tep->te_rsrv_active = B_FALSE;
2098 cv_signal(&tep->te_srv_cv);
2099 mutex_exit(&tep->te_srv_lock);
2100 tl_serializer_exit(tep);
2107 tl_do_proto(mblk_t *mp, tl_endpt_t *tep)
2117 tl_unbind(mp, tep);
2121 tl_addr_req(mp, tep);
2126 if (IS_CLTS(tep)) {
2127 tl_merror(tep->te_wq, mp, EPROTO);
2130 tl_conn_res(mp, tep);
2134 if (IS_CLTS(tep)) {
2135 tl_merror(tep->te_wq, mp, EPROTO);
2138 tl_discon_req(mp, tep);
2142 if (IS_CLTS(tep)) {
2143 tl_merror(tep->te_wq, mp, EPROTO);
2146 tl_data(mp, tep);
2150 if (IS_CLTS(tep)) {
2151 tl_merror(tep->te_wq, mp, EPROTO);
2154 tl_data(mp, tep);
2158 if (IS_CLTS(tep)) {
2159 tl_merror(tep->te_wq, mp, EPROTO);
2162 tl_exdata(mp, tep);
2166 if (! IS_COTSORD(tep)) {
2167 tl_merror(tep->te_wq, mp, EPROTO);
2170 tl_ordrel(mp, tep);
2174 if (IS_COTS(tep)) {
2175 tl_merror(tep->te_wq, mp, EPROTO);
2178 tl_unitdata(mp, tep);
2182 tl_merror(tep->te_wq, mp, EPROTO);
2192 tl_do_ioctl_ser(mblk_t *mp, tl_endpt_t *tep)
2194 if (! tep->te_closing)
2195 tl_do_ioctl(mp, tep);
2199 tl_serializer_exit(tep);
2200 tl_refrele(tep);
2204 tl_do_ioctl(mblk_t *mp, tl_endpt_t *tep)
2208 queue_t *wq = tep->te_wq;
2229 if (IS_SOCKET(tep) || (tep->te_flag & otheropt)) {
2249 tep->te_flag |= thisopt;
2251 tep->te_flag &= ~thisopt;
2325 tl_bind_ser(mblk_t *mp, tl_endpt_t *tep)
2327 if (! tep->te_closing)
2328 tl_bind(mp, tep);
2332 tl_serializer_exit(tep);
2333 tl_refrele(tep);
2341 tl_bind(mblk_t *mp, tl_endpt_t *tep)
2343 queue_t *wq = tep->te_wq;
2355 t_scalar_t save_state = tep->te_state;
2357 if (tep->te_state != TS_UNBND) {
2358 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2361 tep->te_state));
2371 tep->te_state = NEXTSTATE(TE_BIND_REQ, tep->te_state);
2380 if (IS_COTS(tep)) {
2390 if ((tep->te_hash_hndl == NULL) &&
2391 ((tep->te_flag & TL_ADDRHASHED) == 0) &&
2392 mod_hash_reserve_nosleep(tep->te_addrhash,
2393 &tep->te_hash_hndl) != 0) {
2401 if (IS_SOCKET(tep)) {
2407 (void) (STRLOG(TL_ID, tep->te_minor,
2410 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2421 (void) (STRLOG(TL_ID, tep->te_minor,
2424 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2430 (void) (STRLOG(TL_ID, tep->te_minor,
2433 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2439 (void) (STRLOG(TL_ID, tep->te_minor,
2442 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2450 (void) (STRLOG(TL_ID, tep->te_minor,
2453 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2458 (void) (STRLOG(TL_ID, tep->te_minor,
2461 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2473 (void) (STRLOG(TL_ID, tep->te_minor,
2484 if (IS_SOCKET(tep)) {
2494 if (tep->te_flag & TL_ADDRHASHED) {
2495 ASSERT(IS_COTS(tep) && tep->te_qlen == 0);
2496 if (tep->te_vp == ux_addr.soua_vp)
2499 tl_addr_unbind(tep);
2506 rc = mod_hash_insert_reserve(tep->te_addrhash,
2508 (mod_hash_val_t)tep, tep->te_hash_hndl);
2517 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2524 tep->te_uxaddr = ux_addr;
2525 tep->te_flag |= TL_ADDRHASHED;
2526 tep->te_hash_hndl = NULL;
2532 if (! tl_get_any_addr(tep, NULL)) {
2533 (void) (STRLOG(TL_ID, tep->te_minor,
2543 addr_req.ta_zoneid = tep->te_zoneid;
2545 tep->te_abuf = kmem_zalloc((size_t)alen, KM_NOSLEEP);
2546 if (tep->te_abuf == NULL) {
2550 bcopy(addr_req.ta_abuf, tep->te_abuf, addr_req.ta_alen);
2551 tep->te_alen = alen;
2553 if (mod_hash_insert_reserve(tep->te_addrhash,
2554 (mod_hash_key_t)&tep->te_ap, (mod_hash_val_t)tep,
2555 tep->te_hash_hndl) != 0) {
2562 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2573 if (! tl_get_any_addr(tep, &addr_req)) {
2574 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2581 tep->te_flag |= TL_ADDRHASHED;
2582 tep->te_hash_hndl = NULL;
2586 ASSERT(tep->te_alen >= 0);
2592 basize = sizeof (struct T_bind_ack) + tep->te_alen;
2595 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2600 tl_addr_unbind(tep);
2601 tep->te_state = TS_UNBND;
2611 b_ack->ADDR_length = tep->te_alen;
2614 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
2616 if (IS_COTS(tep)) {
2617 tep->te_qlen = qlen;
2619 tep->te_flag |= TL_LISTENER;
2622 tep->te_state = NEXTSTATE(TE_BIND_ACK, tep->te_state);
2635 tep->te_state = save_state;
2639 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2648 tl_unbind(mblk_t *mp, tl_endpt_t *tep)
2653 if (tep->te_closing) {
2658 wq = tep->te_wq;
2677 if (tep->te_state != TS_IDLE) {
2678 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2681 tep->te_state));
2685 tep->te_state = NEXTSTATE(TE_UNBIND_REQ, tep->te_state);
2694 if (! IS_SOCKET(tep) || !IS_CLTS(tep) || tep->te_qlen != 0 ||
2695 tep->te_magic != SOU_MAGIC_EXPLICIT) {
2702 tl_addr_unbind(tep);
2705 tep->te_state = NEXTSTATE(TE_OK_ACK1, tep->te_state);
2727 tl_endpt_t *tep;
2732 tep = (tl_endpt_t *)wq->q_ptr;
2750 if (!IS_SOCKET(tep) && tep->te_state != TS_IDLE &&
2757 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2760 tep->te_state));
2796 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
2807 ASSERT(IS_COTS(tep));
2809 if (tep->te_closing) {
2830 if (tep->te_state != TS_IDLE) {
2831 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2834 tep->te_state));
2846 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2859 if (IS_SOCKET(tep)) {
2864 (void) (STRLOG(TL_ID, tep->te_minor,
2874 (void) (STRLOG(TL_ID, tep->te_minor,
2886 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2896 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2912 (void) (STRLOG(TL_ID, tep->te_minor, 3,
2922 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2933 * Prevent tep from closing on us.
2935 if (! tl_noclose(tep)) {
2936 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2943 tep->te_state = NEXTSTATE(TE_CONN_REQ, tep->te_state);
2951 dst.ta_zoneid = tep->te_zoneid;
2956 peer_tep = (IS_SOCKET(tep) ?
2957 tl_sock_find_peer(tep, &ux_addr) :
2958 tl_find_peer(tep, &dst));
2961 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2969 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE,
2981 tep->te_state = NEXTSTATE(TE_OK_ACK1, tep->te_state);
2982 tl_ok_ack(tep->te_wq, ackmp, T_CONN_REQ);
2983 tl_closeok(tep);
2994 tep->te_state = TS_IDLE;
2998 putnext(tep->te_rq, dimp);
3010 tl_serializer_refrele(tep->te_ser);
3011 tep->te_ser = peer_tep->te_ser;
3012 ASSERT(tep->te_oconp == NULL);
3013 tep->te_oconp = peer_tep;
3018 tl_closeok(tep);
3027 tl_refhold(tep);
3028 tl_serializer_enter(tep, tl_conn_req_ser, mp);
3035 tl_conn_req_ser(mblk_t *mp, tl_endpt_t *tep)
3038 tl_endpt_t *peer_tep = tep->te_oconp;
3053 if (tep->te_closing) {
3054 TL_UNCONNECT(tep->te_oconp);
3055 tl_serializer_exit(tep);
3056 tl_refrele(tep);
3061 wq = tep->te_wq;
3062 tep->te_flag |= TL_EAGER;
3076 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE | SL_ERROR,
3079 TL_UNCONNECT(tep->te_oconp);
3082 tl_serializer_exit(tep);
3083 tl_refrele(tep);
3108 ci_msz = sizeof (struct T_conn_ind) + tep->te_alen;
3121 tep->te_state = TS_IDLE;
3124 TL_UNCONNECT(tep->te_oconp);
3125 tl_serializer_exit(tep);
3126 tl_refrele(tep);
3133 if (IS_SOCKET(tep) && !tl_disable_early_connect) {
3145 tep->te_state = TS_IDLE;
3150 TL_UNCONNECT(tep->te_oconp);
3151 tl_serializer_exit(tep);
3152 tl_refrele(tep);
3164 tep->te_state = TS_IDLE;
3170 TL_UNCONNECT(tep->te_oconp);
3171 tl_serializer_exit(tep);
3172 tl_refrele(tep);
3181 tep->te_state = TS_IDLE;
3187 TL_UNCONNECT(tep->te_oconp);
3188 tl_serializer_exit(tep);
3189 tl_refrele(tep);
3202 tep->te_state = NEXTSTATE(TE_OK_ACK1, tep->te_state);
3220 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
3223 TL_UNCONNECT(tep->te_oconp);
3224 tl_serializer_exit(tep);
3225 tl_refrele(tep);
3238 ci->SRC_length = tep->te_alen;
3239 ci->SEQ_number = tep->te_seqno;
3242 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
3268 * increment references for both peer_tep and tep: peer_tep is placed on
3269 * te_oconp and tep is placed on listeners queue.
3271 tip->ti_tep = tep;
3272 tip->ti_seqno = tep->te_seqno;
3287 tep->te_state = NEXTSTATE(TE_CONN_CON, tep->te_state);
3289 putnext(tep->te_rq, confmp);
3292 * Now we need to increment tep reference because tep is referenced by
3297 ASSERT(tep->te_refcnt >= 2);
3299 tl_serializer_exit(tep);
3315 tl_conn_res(mblk_t *mp, tl_endpt_t *tep)
3333 ASSERT(IS_COTS(tep));
3335 if (tep->te_closing) {
3340 wq = tep->te_wq;
3364 if (tep->te_state != TS_WRES_CIND) {
3365 (void) (STRLOG(TL_ID, tep->te_minor, 1,
3368 tep->te_state));
3380 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3389 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3400 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3407 tep->te_state = NEXTSTATE(TE_CONN_RES, tep->te_state);
3408 ASSERT(tep->te_state == TS_WACK_CRES);
3412 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3414 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3423 if (mod_hash_find_cb(tep->te_transport->tr_ai_hash,
3426 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3428 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3438 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3440 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3454 if ((tep != acc_ep) && (acc_ep->te_state != TS_IDLE)) {
3455 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3458 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3471 if ((tep == acc_ep) && (tep->te_nicon > 1)) {
3472 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
3474 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3488 tip = tl_icon_find(tep, cres->SEQ_number);
3490 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3492 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3563 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE,
3593 tep->te_state = TS_WRES_CIND;
3608 if (tep->te_nicon == 1) {
3609 if (tep == acc_ep)
3610 tep->te_state = NEXTSTATE(TE_OK_ACK2, tep->te_state);
3612 tep->te_state = NEXTSTATE(TE_OK_ACK3, tep->te_state);
3614 tep->te_state = NEXTSTATE(TE_OK_ACK4, tep->te_state);
3628 (void) (STRLOG(TL_ID, tep->te_minor, 3,
3650 tep->te_state = TS_IDLE;
3665 if (tep != acc_ep)
3680 tl_freetip(tep, tip);
3708 (void) (STRLOG(TL_ID, tep->te_minor, 3,
3763 ASSERT(cl_ep->te_ser == tep->te_ser);
3798 tl_freetip(tep, tip);
3808 if (! IS_SOCKET(tep)) {
3847 tl_discon_req(mblk_t *mp, tl_endpt_t *tep)
3852 tl_endpt_t *peer_tep = tep->te_conp;
3853 tl_endpt_t *srv_tep = tep->te_oconp;
3860 if (tep->te_closing) {
3866 TL_UNCONNECT(tep->te_conp);
3870 TL_UNCONNECT(tep->te_oconp);
3874 wq = tep->te_wq;
3898 save_state = new_state = tep->te_state;
3901 (void) (STRLOG(TL_ID, tep->te_minor, 1,
3904 tep->te_state));
3913 new_state = NEXTSTATE(TE_DISCON_REQ, tep->te_state);
3917 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3919 tep->te_state = NEXTSTATE(TE_ERROR_ACK, new_state);
3929 if (tep->te_nicon > 0) { /* server */
3934 tip = tl_icon_find(tep, dr->SEQ_number);
3936 (void) (STRLOG(TL_ID, tep->te_minor, 2,
3939 tep->te_state = NEXTSTATE(TE_ERROR_ACK, new_state);
3968 if (tep->te_nicon == 0)
3971 if (tep->te_nicon == 1)
3979 if ((tep->te_nicon <= 1) &&
3991 if (tep->te_nicon > 0) { /* listener */
3994 * disconnect incoming connect request pending to tep
3997 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4000 tep->te_state = new_state;
4021 tl_freetip(tep, tip);
4022 } else if ((peer_tep = tep->te_oconp) != NULL) { /* client */
4024 * disconnect an outgoing request pending from tep
4028 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4031 tep->te_state = new_state;
4039 di->SEQ_number = tep->te_seqno;
4048 if (IS_SOCKET(tep) && !tl_disable_early_connect) {
4055 tl_icon_queuemsg(peer_tep, tep->te_seqno, dimp);
4060 * it as a hint not to free the tep.
4064 new_state = tep->te_state;
4067 tip = tl_icon_find(peer_tep, tep->te_seqno);
4069 ASSERT(tep == tip->ti_tep);
4081 ASSERT(tep->te_oconp != NULL);
4082 TL_UNCONNECT(tep->te_oconp);
4084 } else if ((peer_tep = tep->te_conp) != NULL) { /* connected! */
4086 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4089 tep->te_state = new_state;
4100 tep->te_state = new_state;
4106 tep->te_state = new_state;
4135 if (tep->te_conp) { /* disconnect pointers if connected */
4151 if (! IS_SOCKET(tep)) {
4155 tep->te_wq->q_next = NULL;
4158 TL_UNCONNECT(tep->te_conp);
4164 tl_addr_req(mblk_t *mp, tl_endpt_t *tep)
4171 if (tep->te_closing) {
4176 wq = tep->te_wq;
4183 if (IS_CLTS(tep) ||
4184 (tep->te_state > TS_WREQ_ORDREL) ||
4185 (tep->te_state < TS_DATA_XFER)) {
4191 if (tep->te_state >= TS_IDLE)
4193 ack_sz += tep->te_alen;
4196 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4211 if (tep->te_state >= TS_IDLE) {
4213 taa->LOCADDR_length = tep->te_alen;
4216 bcopy(tep->te_abuf, ackmp->b_wptr,
4217 tep->te_alen);
4218 ackmp->b_wptr += tep->te_alen;
4224 ASSERT(tep->te_state == TS_DATA_XFER ||
4225 tep->te_state == TS_WIND_ORDREL ||
4226 tep->te_state == TS_WREQ_ORDREL);
4228 tl_connected_cots_addr_req(mp, tep);
4234 tl_connected_cots_addr_req(mblk_t *mp, tl_endpt_t *tep)
4242 if (tep->te_closing) {
4247 ASSERT(tep->te_state >= TS_IDLE);
4250 ack_sz += T_ALIGN(tep->te_alen);
4251 peer_tep = tep->te_conp;
4256 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4258 tl_memrecover(tep->te_wq, mp, ack_sz);
4265 taa->LOCADDR_length = tep->te_alen;
4270 bcopy(tep->te_abuf, addr_startp,
4271 tep->te_alen);
4283 putnext(tep->te_rq, ackmp);
4287 tl_copy_info(struct T_info_ack *ia, tl_endpt_t *tep)
4289 if (IS_CLTS(tep)) {
4294 if (IS_COTSORD(tep))
4298 ia->CURRENT_state = tep->te_state;
4306 tl_capability_req(mblk_t *mp, tl_endpt_t *tep)
4312 if (tep->te_closing) {
4322 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4324 tl_memrecover(tep->te_wq, mp,
4333 tl_copy_info(&tcap->INFO_ack, tep);
4338 tcap->ACCEPTOR_id = tep->te_acceptor_id;
4342 putnext(tep->te_rq, ackmp);
4346 tl_info_req_ser(mblk_t *mp, tl_endpt_t *tep)
4348 if (! tep->te_closing)
4349 tl_info_req(mp, tep);
4353 tl_serializer_exit(tep);
4354 tl_refrele(tep);
4358 tl_info_req(mblk_t *mp, tl_endpt_t *tep)
4365 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4367 tl_memrecover(tep->te_wq, mp, sizeof (struct T_info_ack));
4374 tl_copy_info((struct T_info_ack *)ackmp->b_rptr, tep);
4379 putnext(tep->te_rq, ackmp);
4387 tl_data(mblk_t *mp, tl_endpt_t *tep)
4389 queue_t *wq = tep->te_wq;
4394 boolean_t closing = tep->te_closing;
4396 if (IS_CLTS(tep)) {
4397 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4414 (tep->te_state != TS_DATA_XFER) &&
4415 (tep->te_state != TS_WREQ_ORDREL)) {
4423 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4433 (msz < sizeof (struct T_optdata_req) || !IS_SOCKET(tep))) {
4434 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4449 switch (tep->te_state) {
4455 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
4461 if (tep->te_conp != NULL)
4464 if (tep->te_oconp == NULL) {
4482 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4485 TL_PUTBQ(tep, mp);
4499 tl_icon_queuemsg(tep->te_oconp, tep->te_seqno, mp);
4503 if (tep->te_conp == NULL) {
4510 (void) (STRLOG(TL_ID, tep->te_minor, 3,
4513 tl_discon_ind(tep, 0);
4520 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4526 * tep->te_state = NEXTSTATE(TE_DATA_REQ, tep->te_state);
4533 if (((peer_tep = tep->te_conp) == NULL) || peer_tep->te_closing) {
4536 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4541 ASSERT(tep->te_serializer == peer_tep->te_serializer);
4550 TL_PUTBQ(tep, mp);
4563 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4588 tl_exdata(mblk_t *mp, tl_endpt_t *tep)
4590 queue_t *wq = tep->te_wq;
4595 boolean_t closing = tep->te_closing;
4598 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4614 (tep->te_state != TS_DATA_XFER) &&
4615 (tep->te_state != TS_WREQ_ORDREL)) {
4623 switch (tep->te_state) {
4629 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
4635 if (tep->te_conp != NULL)
4638 if (tep->te_oconp == NULL) {
4656 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4659 TL_PUTBQ(tep, mp);
4662 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4665 tl_icon_queuemsg(tep->te_oconp, tep->te_seqno, mp);
4669 if (tep->te_conp == NULL) {
4676 (void) (STRLOG(TL_ID, tep->te_minor, 3,
4679 tl_discon_ind(tep, 0);
4685 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4688 tep->te_state));
4693 * tep->te_state = NEXTSTATE(TE_EXDATA_REQ, tep->te_state);
4700 if (((peer_tep = tep->te_conp) == NULL) || peer_tep->te_closing) {
4703 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4716 TL_PUTBQ(tep, mp);
4729 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4752 tl_ordrel(mblk_t *mp, tl_endpt_t *tep)
4754 queue_t *wq = tep->te_wq;
4759 boolean_t closing = tep->te_closing;
4762 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4775 switch (tep->te_state) {
4779 if (tep->te_conp != NULL)
4782 if (tep->te_oconp == NULL)
4795 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4798 TL_PUTBQ(tep, mp);
4801 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4804 (void) tl_icon_queuemsg(tep->te_oconp, tep->te_seqno, mp);
4808 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4811 tep->te_state));
4819 tep->te_state = NEXTSTATE(TE_ORDREL_REQ, tep->te_state);
4824 if (((peer_tep = tep->te_conp) == NULL) || peer_tep->te_closing) {
4826 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4840 TL_PUTBQ(tep, mp);
4853 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4864 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4881 tl_endpt_t *tep;
4890 tep = (tl_endpt_t *)wq->q_ptr;
4902 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
4943 tep->te_state = NEXTSTATE(TE_UDERROR_IND, tep->te_state);
4949 tl_unitdata_ser(mblk_t *mp, tl_endpt_t *tep)
4951 queue_t *wq = tep->te_wq;
4953 if (!tep->te_closing && (wq->q_first != NULL)) {
4954 TL_PUTQ(tep, mp);
4955 } else if (tep->te_rq != NULL)
4956 tl_unitdata(mp, tep);
4960 tl_serializer_exit(tep);
4961 tl_refrele(tep);
4970 tl_unitdata(mblk_t *mp, tl_endpt_t *tep)
4972 queue_t *wq = tep->te_wq;
4991 if (tep->te_state != TS_IDLE) {
4992 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4999 * tep->te_state = NEXTSTATE(TE_UNITDATA_REQ, tep->te_state);
5009 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
5021 if (IS_SOCKET(tep)) {
5027 (void) (STRLOG(TL_ID, tep->te_minor,
5039 (void) (STRLOG(TL_ID, tep->te_minor,
5055 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5064 if (alen == 0 || (olen != 0 && !IS_SOCKET(tep))) {
5065 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
5077 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
5086 destaddr.ta_zoneid = tep->te_zoneid;
5093 peer_tep = tep->te_lastep;
5102 peer_tep = (IS_SOCKET(tep) ?
5103 tl_sock_find_peer(tep, &ux_addr) :
5104 tl_find_peer(tep, &destaddr));
5107 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5117 if (tep->te_lastep != NULL)
5118 tl_refrele(tep->te_lastep);
5120 tep->te_lastep = peer_tep;
5124 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
5137 if (!canputnext(peer_tep->te_rq) && !(tep->te_closing)) {
5139 if (tep->te_flowq != NULL) {
5140 list_remove(&tep->te_flowq->te_flowlist, tep);
5142 list_insert_head(&peer_tep->te_flowlist, tep);
5143 tep->te_flowq = peer_tep;
5144 TL_PUTBQ(tep, mp);
5175 ui_sz = T_ALIGN(sizeof (struct T_unitdata_ind) + tep->te_alen) +
5181 if (msz >= ui_sz && alen >= tep->te_alen &&
5188 udind->SRC_length = tep->te_alen;
5190 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
5197 (void) (STRLOG(TL_ID, tep->te_minor, 4, SL_TRACE,
5211 udind->SRC_length = tep->te_alen;
5213 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
5259 tl_find_peer(tl_endpt_t *tep, tl_addr_t *ap)
5262 int rc = mod_hash_find_cb(tep->te_addrhash, (mod_hash_key_t)ap,
5265 ASSERT(! IS_SOCKET(tep));
5268 ASSERT(ap->ta_zoneid == tep->te_zoneid);
5272 (tep->te_zoneid == peer_tep->te_zoneid) &&
5273 (tep->te_transport == peer_tep->te_transport));
5289 tl_sock_find_peer(tl_endpt_t *tep, soux_addr_t *ux_addr)
5293 tep->te_aihash : tep->te_addrhash;
5297 ASSERT(IS_SOCKET(tep));
5299 IMPLY(rc == 0, (tep->te_transport == peer_tep->te_transport));
5311 if ((peer_tep->te_zoneid != tep->te_zoneid) &&
5339 tl_get_any_addr(tl_endpt_t *tep, tl_addr_t *req)
5344 ASSERT(tep->te_hash_hndl != NULL);
5345 ASSERT(! IS_SOCKET(tep));
5347 if (tep->te_hash_hndl == NULL)
5358 ASSERT(tep->te_zoneid == req->ta_zoneid);
5361 if (tep->te_alen < alen) {
5365 * Not enough space in tep->ta_ap to hold the address,
5371 if (tep->te_alen > 0)
5372 kmem_free(tep->te_abuf, tep->te_alen);
5374 tep->te_alen = alen;
5375 tep->te_abuf = abuf;
5381 bcopy(req->ta_abuf, tep->te_abuf, (size_t)req->ta_alen);
5387 bcopy(&tep->te_minor, tep->te_abuf, sizeof (uint32_t));
5390 if (mod_hash_insert_reserve(tep->te_addrhash,
5391 (mod_hash_key_t)&tep->te_ap, (mod_hash_val_t)tep,
5392 tep->te_hash_hndl) == 0) {
5396 tep->te_flag |= TL_ADDRHASHED;
5397 tep->te_hash_hndl = NULL;
5404 bcopy(&tep->te_defaddr, tep->te_abuf, sizeof (uint32_t));
5405 atomic_add_32(&tep->te_defaddr, 1);
5431 tl_cl_backenable(tl_endpt_t *tep)
5433 list_t *l = &tep->te_flowlist;
5436 ASSERT(IS_CLTS(tep));
5439 ASSERT(tep->te_ser == elp->te_ser);
5440 ASSERT(elp->te_flowq == tep);
5452 tl_co_unconnect(tl_endpt_t *tep)
5454 tl_endpt_t *peer_tep = tep->te_conp;
5455 tl_endpt_t *srv_tep = tep->te_oconp;
5461 ASSERT(IS_COTS(tep));
5466 TL_UNCONNECT(tep->te_conp);
5470 TL_UNCONNECT(tep->te_oconp);
5474 if (tep->te_nicon > 0) {
5475 l = &tep->te_iconp;
5483 while (tep->te_nicon > 0) {
5488 tl_freetip(tep, tip);
5498 tl_freetip(tep, tip);
5509 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5514 tl_freetip(tep, tip);
5522 if (IS_SOCKET(tep) && !tl_disable_early_connect &&
5524 !tl_icon_hasprim(srv_tep, tep->te_seqno, T_ORDREL_IND)) {
5534 d_mp = tl_discon_ind_alloc(ECONNRESET, tep->te_seqno);
5537 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5540 TL_UNCONNECT(tep->te_oconp);
5551 if (IS_SOCKET(tep) && !tl_disable_early_connect) {
5555 tl_icon_queuemsg(srv_tep, tep->te_seqno, d_mp);
5557 tip = tl_icon_find(srv_tep, tep->te_seqno);
5561 ASSERT(tep == tip->ti_tep);
5562 ASSERT(tep->te_ser == srv_tep->te_ser);
5580 TL_UNCONNECT(tep->te_oconp);
5591 ASSERT(tep->te_ser == peer_tep->te_ser);
5598 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
5604 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5631 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5634 tep->te_state));
5637 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5639 "tl_co_unconnect: state %d", tep->te_state));
5647 if (tep->te_closing) {
5648 peer_tep = tep->te_conp;
5650 TL_REMOVE_PEER(tep->te_conp);
5661 tl_discon_ind(tl_endpt_t *tep, uint32_t reason)
5665 if (tep->te_closing)
5671 flushq(tep->te_rq, FLUSHDATA);
5672 (void) putnextctl1(tep->te_rq, M_FLUSH, FLUSHRW);
5677 d_mp = tl_discon_ind_alloc(reason, tep->te_seqno);
5679 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
5683 tep->te_state = TS_IDLE;
5684 putnext(tep->te_rq, d_mp);
5734 tl_icon_find(tl_endpt_t *tep, t_scalar_t seqno)
5736 list_t *l = &tep->te_iconp;
5753 tl_icon_queuemsg(tl_endpt_t *tep, t_scalar_t seqno, mblk_t *nmp)
5764 tip = tl_icon_find(tep, seqno);
5805 tl_icon_hasprim(tl_endpt_t *tep, t_scalar_t seqno, t_scalar_t prim)
5807 tl_icon_t *tip = tl_icon_find(tep, seqno);
5825 tl_icon_sendmsgs(tl_endpt_t *tep, mblk_t **mpp)
5830 if (tep->te_closing) {
5835 ASSERT(tep->te_state == TS_DATA_XFER);
5836 ASSERT(tep->te_rq->q_first == NULL);
5848 putnext(tep->te_rq, mp);
5857 putnext(tep->te_rq, mp);
5860 tep->te_state = NEXTSTATE(TE_ORDREL_IND,
5861 tep->te_state);
5862 putnext(tep->te_rq, mp);
5865 tep->te_state = TS_IDLE;
5866 putnext(tep->te_rq, mp);
5907 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
5909 if (tep->te_closing) {
5914 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5916 "tl_merror: tep=%p, err=%d", (void *)tep, error));
5923 if (IS_COTS(tep)) {
5925 tl_co_unconnect(tep);
5936 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5949 (void) putnextctl1(tep->te_rq, M_ERROR, error);
6007 tl_endpt_t *tep;
6010 tep = (tl_endpt_t *)wq->q_ptr;
6020 if (! IS_SOCKET(tep))
6026 *valp = (tep->te_flag & TL_SOCKUCRED) != 0;
6064 tl_endpt_t *tep;
6066 tep = (tl_endpt_t *)wq->q_ptr;
6076 if (! IS_SOCKET(tep)) {
6091 if (! IS_CLTS(tep)) {
6096 tep->te_flag &= ~TL_SOCKUCRED;
6098 tep->te_flag |= TL_SOCKUCRED;
6116 (void) (STRLOG(TL_ID, tep->te_minor, 1,
6131 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
6133 ASSERT(tep);
6135 tep->te_timoutid = 0;
6149 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
6151 ASSERT(tep);
6153 tep->te_bufcid = 0;
6154 tep->te_nowsrv = B_FALSE;
6167 tl_endpt_t *tep;
6169 tep = (tl_endpt_t *)wq->q_ptr;
6171 if (tep->te_closing) {
6179 if (tep->te_bufcid || tep->te_timoutid) {
6180 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
6185 if (!(tep->te_bufcid = qbufcall(wq, size, BPRI_MED, tl_buffer, wq))) {
6186 tep->te_timoutid = qtimeout(wq, tl_timer, wq,
6192 tl_freetip(tl_endpt_t *tep, tl_icon_t *tip)
6204 list_remove(&tep->te_iconp, tip);
6206 tep->te_nicon--;
6213 tl_addr_unbind(tl_endpt_t *tep)
6217 if (tep->te_flag & TL_ADDRHASHED) {
6218 if (IS_SOCKET(tep)) {
6219 (void) mod_hash_remove(tep->te_addrhash,
6220 (mod_hash_key_t)tep->te_vp,
6222 tep->te_vp = (void *)(uintptr_t)tep->te_minor;
6223 tep->te_magic = SOU_MAGIC_IMPLICIT;
6225 (void) mod_hash_remove(tep->te_addrhash,
6226 (mod_hash_key_t)&tep->te_ap,
6228 (void) kmem_free(tep->te_abuf, tep->te_alen);
6229 tep->te_alen = -1;
6230 tep->te_abuf = NULL;
6232 tep->te_flag &= ~TL_ADDRHASHED;