Lines Matching defs:tep

245  * tep structure, so it should be never freed.
1139 tl_refhold(tl_endpt_t *tep)
1141 atomic_inc_32(&tep->te_refcnt);
1145 tl_refrele(tl_endpt_t *tep)
1147 ASSERT(tep->te_refcnt != 0);
1149 if (atomic_dec_32_nv(&tep->te_refcnt) == 0)
1150 tl_free(tep);
1157 tl_endpt_t *tep = buf;
1159 bzero(tep, sizeof (tl_endpt_t));
1160 mutex_init(&tep->te_closelock, NULL, MUTEX_DEFAULT, NULL);
1161 cv_init(&tep->te_closecv, NULL, CV_DEFAULT, NULL);
1162 mutex_init(&tep->te_srv_lock, NULL, MUTEX_DEFAULT, NULL);
1163 cv_init(&tep->te_srv_cv, NULL, CV_DEFAULT, NULL);
1164 mutex_init(&tep->te_ser_lock, NULL, MUTEX_DEFAULT, NULL);
1173 tl_endpt_t *tep = buf;
1175 mutex_destroy(&tep->te_closelock);
1176 cv_destroy(&tep->te_closecv);
1177 mutex_destroy(&tep->te_srv_lock);
1178 cv_destroy(&tep->te_srv_cv);
1179 mutex_destroy(&tep->te_ser_lock);
1183 tl_free(tl_endpt_t *tep)
1185 ASSERT(tep->te_refcnt == 0);
1186 ASSERT(tep->te_transport != NULL);
1187 ASSERT(tep->te_rq == NULL);
1188 ASSERT(tep->te_wq == NULL);
1189 ASSERT(tep->te_ser != NULL);
1190 ASSERT(tep->te_ser_count == 0);
1191 ASSERT(! (tep->te_flag & TL_ADDRHASHED));
1193 if (IS_SOCKET(tep)) {
1194 ASSERT(tep->te_alen == TL_SOUX_ADDRLEN);
1195 ASSERT(tep->te_abuf == &tep->te_uxaddr);
1196 ASSERT(tep->te_vp == (void *)(uintptr_t)tep->te_minor);
1197 ASSERT(tep->te_magic == SOU_MAGIC_IMPLICIT);
1198 } else if (tep->te_abuf != NULL) {
1199 kmem_free(tep->te_abuf, tep->te_alen);
1200 tep->te_alen = -1; /* uninitialized */
1201 tep->te_abuf = NULL;
1203 ASSERT(tep->te_alen == -1);
1206 id_free(tl_minors, tep->te_minor);
1207 ASSERT(tep->te_credp == NULL);
1209 if (tep->te_hash_hndl != NULL)
1210 mod_hash_cancel(tep->te_addrhash, &tep->te_hash_hndl);
1212 if (IS_COTS(tep)) {
1213 TL_REMOVE_PEER(tep->te_conp);
1214 TL_REMOVE_PEER(tep->te_oconp);
1215 tl_serializer_refrele(tep->te_ser);
1216 tep->te_ser = NULL;
1217 ASSERT(tep->te_nicon == 0);
1218 ASSERT(list_head(&tep->te_iconp) == NULL);
1220 ASSERT(tep->te_lastep == NULL);
1221 ASSERT(list_head(&tep->te_flowlist) == NULL);
1222 ASSERT(tep->te_flowq == NULL);
1225 ASSERT(tep->te_bufcid == 0);
1226 ASSERT(tep->te_timoutid == 0);
1227 bzero(&tep->te_ap, sizeof (tep->te_ap));
1228 tep->te_acceptor_id = 0;
1230 ASSERT(tep->te_closewait == 0);
1231 ASSERT(!tep->te_rsrv_active);
1232 ASSERT(!tep->te_wsrv_active);
1233 tep->te_closing = 0;
1234 tep->te_nowsrv = B_FALSE;
1235 tep->te_flag = 0;
1237 kmem_cache_free(tl_cache, tep);
1284 tl_serializer_enter(tl_endpt_t *tep, tlproc_t tlproc, mblk_t *mp)
1286 if (IS_COTS(tep)) {
1287 mutex_enter(&tep->te_ser_lock);
1288 tep->te_ser_count++;
1289 mutex_exit(&tep->te_ser_lock);
1291 serializer_enter(tep->te_serializer, (srproc_t *)tlproc, mp, tep);
1299 tl_serializer_exit(tl_endpt_t *tep)
1301 if (IS_COTS(tep)) {
1302 mutex_enter(&tep->te_ser_lock);
1303 ASSERT(tep->te_ser_count != 0);
1304 tep->te_ser_count--;
1305 mutex_exit(&tep->te_ser_lock);
1386 tl_noclose(tl_endpt_t *tep)
1390 mutex_enter(&tep->te_closelock);
1391 if (! tep->te_closing) {
1392 ASSERT(tep->te_closewait == 0);
1393 tep->te_closewait++;
1396 mutex_exit(&tep->te_closelock);
1404 tl_closeok(tl_endpt_t *tep)
1406 ASSERT(tep->te_closewait > 0);
1407 mutex_enter(&tep->te_closelock);
1408 ASSERT(tep->te_closewait == 1);
1409 tep->te_closewait--;
1410 cv_signal(&tep->te_closecv);
1411 mutex_exit(&tep->te_closelock);
1421 tl_endpt_t *tep;
1442 tep = kmem_cache_alloc(tl_cache, KM_SLEEP);
1443 tep->te_refcnt = 1;
1444 tep->te_cpid = curproc->p_pid;
1445 rq->q_ptr = WR(rq)->q_ptr = tep;
1446 tep->te_state = TS_UNBND;
1447 tep->te_credp = credp;
1449 tep->te_zoneid = getzoneid();
1451 tep->te_flag = minor & TL_MINOR_MASK;
1452 tep->te_transport = &tl_transports[minor];
1455 tep->te_minor = (minor_t)id_alloc(tl_minors);
1458 (void) mod_hash_reserve(tep->te_addrhash, &tep->te_hash_hndl);
1461 if (IS_COTS(tep)) {
1463 tep->te_ser = tl_serializer_alloc(KM_SLEEP);
1466 list_create(&tep->te_iconp, sizeof (tl_icon_t),
1468 tep->te_qlen = 0;
1469 tep->te_nicon = 0;
1470 tep->te_oconp = NULL;
1471 tep->te_conp = NULL;
1474 tep->te_ser = tep->te_transport->tr_serializer;
1475 bzero(&tep->te_flows, sizeof (list_node_t));
1477 list_create(&tep->te_flowlist, sizeof (tl_endpt_t),
1479 tep->te_flowq = NULL;
1480 tep->te_lastep = NULL;
1485 if (IS_SOCKET(tep)) {
1487 tep->te_alen = TL_SOUX_ADDRLEN;
1488 tep->te_abuf = &tep->te_uxaddr;
1489 tep->te_vp = (void *)(uintptr_t)tep->te_minor;
1490 tep->te_magic = SOU_MAGIC_IMPLICIT;
1492 tep->te_alen = -1;
1493 tep->te_abuf = NULL;
1497 *devp = makedevice(getmajor(*devp), tep->te_minor);
1499 tep->te_rq = rq;
1500 tep->te_wq = WR(rq);
1503 if (IS_SOCKET(tep))
1504 tep->te_acceptor_id = tep->te_minor;
1506 tep->te_acceptor_id = (t_uscalar_t)rq;
1508 tep->te_acceptor_id = tep->te_minor;
1518 (void) mod_hash_insert(tep->te_transport->tr_ai_hash,
1519 (mod_hash_key_t)(uintptr_t)tep->te_acceptor_id,
1520 (mod_hash_val_t)tep);
1529 tl_endpt_t *tep = (tl_endpt_t *)rq->q_ptr;
1531 queue_t *wq = tep->te_wq;
1539 rc = mod_hash_remove(tep->te_transport->tr_ai_hash,
1540 (mod_hash_key_t)(uintptr_t)tep->te_acceptor_id,
1542 ASSERT(rc == 0 && tep == elp);
1543 if ((rc != 0) || (tep != elp)) {
1544 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1552 mutex_enter(&tep->te_closelock);
1553 while (tep->te_closewait)
1554 cv_wait(&tep->te_closecv, &tep->te_closelock);
1555 tep->te_closing = B_TRUE;
1560 tep->te_closewait = 1;
1561 tep->te_nowsrv = B_FALSE;
1562 mutex_exit(&tep->te_closelock);
1568 tl_serializer_enter(tep, tl_close_ser, &tep->te_closemp);
1573 mutex_enter(&tep->te_closelock);
1574 while (tep->te_closewait)
1575 cv_wait(&tep->te_closecv, &tep->te_closelock);
1576 mutex_exit(&tep->te_closelock);
1580 if (tep->te_bufcid) {
1581 qunbufcall(rq, tep->te_bufcid);
1582 tep->te_bufcid = 0;
1584 if (tep->te_timoutid) {
1585 (void) quntimeout(rq, tep->te_timoutid);
1586 tep->te_timoutid = 0;
1596 * Fot a COTS endpoint wait before destroying tep since the serializer
1597 * may go away together with tep and we need to destroy serializer
1600 ASSERT(tep->te_closewait == 0);
1601 if (IS_COTS(tep))
1602 tep->te_closewait = 1;
1604 tl_refhold(tep);
1606 tl_serializer_enter(tep, tl_close_finish_ser, &tep->te_closemp);
1612 if (IS_COTS(tep)) {
1613 mutex_enter(&tep->te_closelock);
1614 while (tep->te_closewait)
1615 cv_wait(&tep->te_closecv, &tep->te_closelock);
1616 mutex_exit(&tep->te_closelock);
1619 crfree(tep->te_credp);
1620 tep->te_credp = NULL;
1621 tep->te_wq = NULL;
1622 tl_refrele(tep);
1624 * tep is likely to be destroyed now, so can't reference it any more.
1639 tl_close_ser(mblk_t *mp, tl_endpt_t *tep)
1641 ASSERT(tep->te_closing);
1642 ASSERT(tep->te_closewait == 1);
1643 ASSERT(!(tep->te_flag & TL_CLOSE_SER));
1645 tep->te_flag |= TL_CLOSE_SER;
1651 if (tep->te_wq->q_first && (IS_CLTS(tep) || IS_COTSORD(tep))) {
1652 tl_wsrv_ser(NULL, tep);
1656 tl_addr_unbind(tep);
1662 if (IS_COTS(tep) && !IS_SOCKET(tep)) {
1663 tl_endpt_t *peer_tep = tep->te_conp;
1665 tep->te_wq->q_next = NULL;
1670 tep->te_rq = NULL;
1673 tl_closeok(tep);
1674 tl_serializer_exit(tep);
1685 tl_close_finish_ser(mblk_t *mp, tl_endpt_t *tep)
1687 ASSERT(tep->te_closing);
1688 IMPLY(IS_CLTS(tep), tep->te_closewait == 0);
1689 IMPLY(IS_COTS(tep), tep->te_closewait == 1);
1691 tep->te_state = -1; /* Uninitialized */
1692 if (IS_COTS(tep)) {
1693 tl_co_unconnect(tep);
1696 TL_REMOVE_PEER(tep->te_lastep);
1701 tl_cl_backenable(tep);
1702 if (tep->te_flowq != NULL) {
1703 list_remove(&(tep->te_flowq->te_flowlist), tep);
1704 tep->te_flowq = NULL;
1708 tl_serializer_exit(tep);
1709 if (IS_COTS(tep))
1710 tl_closeok(tep);
1712 tl_refrele(tep);
1724 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
1732 if (IS_CLTS(tep)) {
1733 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1777 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1804 if (IS_CLTS(tep)) {
1817 if (IS_COTS(tep) ||
1822 if ((tep->te_state == TS_IDLE) && !wq->q_first) {
1848 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1856 tl_capability_req(mp, tep);
1866 (void) (STRLOG(TL_ID, tep->te_minor, 1,
1874 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
1884 tl_refhold(tep);
1885 tl_serializer_enter(tep, tl_proc, mp);
1892 tl_putq_ser(mblk_t *mp, tl_endpt_t *tep)
1894 if (tep->te_closing) {
1895 tl_wput_ser(mp, tep);
1897 TL_PUTQ(tep, mp);
1898 tl_serializer_exit(tep);
1899 tl_refrele(tep);
1905 tl_wput_common_ser(mblk_t *mp, tl_endpt_t *tep)
1911 tl_data(mp, tep);
1914 tl_do_proto(mp, tep);
1926 tl_wput_ser(mblk_t *mp, tl_endpt_t *tep)
1928 tl_wput_common_ser(mp, tep);
1929 tl_serializer_exit(tep);
1930 tl_refrele(tep);
1937 tl_wput_data_ser(mblk_t *mp, tl_endpt_t *tep)
1939 tl_endpt_t *peer_tep = tep->te_conp;
1943 ASSERT(IS_COTS(tep));
1945 IMPLY(peer_tep, tep->te_serializer == peer_tep->te_serializer);
1948 * fastpath for data. Ignore flow control if tep is closing.
1952 ((tep->te_state == TS_DATA_XFER) ||
1953 (tep->te_state == TS_WREQ_ORDREL)) &&
1954 (tep->te_wq != NULL) &&
1955 (tep->te_wq->q_first == NULL) &&
1959 (canputnext(peer_rq) || tep->te_closing)) {
1961 } else if (tep->te_closing) {
1963 * It is possible that by the time we got here tep started to
1968 if ((tep->te_wq != NULL) &&
1969 ((tep->te_state == TS_DATA_XFER) ||
1970 (tep->te_state == TS_WREQ_ORDREL))) {
1971 TL_PUTQ(tep, mp);
1976 TL_PUTQ(tep, mp);
1979 tl_serializer_exit(tep);
1980 tl_refrele(tep);
1994 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
1996 while ((wq->q_first != NULL) && !tep->te_nowsrv) {
1997 mutex_enter(&tep->te_srv_lock);
1998 ASSERT(tep->te_wsrv_active == B_FALSE);
1999 tep->te_wsrv_active = B_TRUE;
2000 mutex_exit(&tep->te_srv_lock);
2002 tl_serializer_enter(tep, tl_wsrv_ser, &tep->te_wsrvmp);
2007 mutex_enter(&tep->te_srv_lock);
2008 while (tep->te_wsrv_active) {
2009 cv_wait(&tep->te_srv_cv, &tep->te_srv_lock);
2011 cv_signal(&tep->te_srv_cv);
2012 mutex_exit(&tep->te_srv_lock);
2022 tl_wsrv_ser(mblk_t *ser_mp, tl_endpt_t *tep)
2025 queue_t *wq = tep->te_wq;
2028 while (!tep->te_nowsrv && (mp = getq(wq)) != NULL) {
2029 tl_wput_common_ser(mp, tep);
2045 mutex_enter(&tep->te_srv_lock);
2046 ASSERT(tep->te_wsrv_active);
2047 tep->te_wsrv_active = B_FALSE;
2048 cv_signal(&tep->te_srv_cv);
2049 mutex_exit(&tep->te_srv_lock);
2050 tl_serializer_exit(tep);
2056 * flow controlled by tep.
2065 tl_endpt_t *tep = (tl_endpt_t *)rq->q_ptr;
2068 ASSERT(tep->te_rsrv_active == 0);
2070 tep->te_rsrv_active = B_TRUE;
2071 tl_serializer_enter(tep, tl_rsrv_ser, &tep->te_rsrvmp);
2075 mutex_enter(&tep->te_srv_lock);
2076 while (tep->te_rsrv_active) {
2077 cv_wait(&tep->te_srv_cv, &tep->te_srv_lock);
2079 cv_signal(&tep->te_srv_cv);
2080 mutex_exit(&tep->te_srv_lock);
2085 tl_rsrv_ser(mblk_t *mp, tl_endpt_t *tep)
2089 if (IS_CLTS(tep) && tep->te_state == TS_IDLE) {
2090 tl_cl_backenable(tep);
2092 IS_COTS(tep) &&
2093 ((peer_tep = tep->te_conp) != NULL) &&
2095 ((tep->te_state == TS_DATA_XFER) ||
2096 (tep->te_state == TS_WIND_ORDREL)||
2097 (tep->te_state == TS_WREQ_ORDREL))) {
2104 mutex_enter(&tep->te_srv_lock);
2105 ASSERT(tep->te_rsrv_active);
2106 tep->te_rsrv_active = B_FALSE;
2107 cv_signal(&tep->te_srv_cv);
2108 mutex_exit(&tep->te_srv_lock);
2109 tl_serializer_exit(tep);
2116 tl_do_proto(mblk_t *mp, tl_endpt_t *tep)
2126 tl_unbind(mp, tep);
2130 tl_addr_req(mp, tep);
2135 if (IS_CLTS(tep)) {
2136 tl_merror(tep->te_wq, mp, EPROTO);
2139 tl_conn_res(mp, tep);
2143 if (IS_CLTS(tep)) {
2144 tl_merror(tep->te_wq, mp, EPROTO);
2147 tl_discon_req(mp, tep);
2151 if (IS_CLTS(tep)) {
2152 tl_merror(tep->te_wq, mp, EPROTO);
2155 tl_data(mp, tep);
2159 if (IS_CLTS(tep)) {
2160 tl_merror(tep->te_wq, mp, EPROTO);
2163 tl_data(mp, tep);
2167 if (IS_CLTS(tep)) {
2168 tl_merror(tep->te_wq, mp, EPROTO);
2171 tl_exdata(mp, tep);
2175 if (! IS_COTSORD(tep)) {
2176 tl_merror(tep->te_wq, mp, EPROTO);
2179 tl_ordrel(mp, tep);
2183 if (IS_COTS(tep)) {
2184 tl_merror(tep->te_wq, mp, EPROTO);
2187 tl_unitdata(mp, tep);
2191 tl_merror(tep->te_wq, mp, EPROTO);
2201 tl_do_ioctl_ser(mblk_t *mp, tl_endpt_t *tep)
2203 if (! tep->te_closing)
2204 tl_do_ioctl(mp, tep);
2208 tl_serializer_exit(tep);
2209 tl_refrele(tep);
2213 tl_do_ioctl(mblk_t *mp, tl_endpt_t *tep)
2217 queue_t *wq = tep->te_wq;
2238 if (IS_SOCKET(tep) || (tep->te_flag & otheropt)) {
2258 tep->te_flag |= thisopt;
2260 tep->te_flag &= ~thisopt;
2334 tl_bind_ser(mblk_t *mp, tl_endpt_t *tep)
2336 if (! tep->te_closing)
2337 tl_bind(mp, tep);
2341 tl_serializer_exit(tep);
2342 tl_refrele(tep);
2350 tl_bind(mblk_t *mp, tl_endpt_t *tep)
2352 queue_t *wq = tep->te_wq;
2364 t_scalar_t save_state = tep->te_state;
2366 if (tep->te_state != TS_UNBND) {
2367 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2370 tep->te_state));
2380 tep->te_state = NEXTSTATE(TE_BIND_REQ, tep->te_state);
2389 if (IS_COTS(tep)) {
2399 if ((tep->te_hash_hndl == NULL) &&
2400 ((tep->te_flag & TL_ADDRHASHED) == 0) &&
2401 mod_hash_reserve_nosleep(tep->te_addrhash,
2402 &tep->te_hash_hndl) != 0) {
2410 if (IS_SOCKET(tep)) {
2416 (void) (STRLOG(TL_ID, tep->te_minor,
2419 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);
2448 (void) (STRLOG(TL_ID, tep->te_minor,
2451 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2459 (void) (STRLOG(TL_ID, tep->te_minor,
2462 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2467 (void) (STRLOG(TL_ID, tep->te_minor,
2470 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2482 (void) (STRLOG(TL_ID, tep->te_minor,
2493 if (IS_SOCKET(tep)) {
2503 if (tep->te_flag & TL_ADDRHASHED) {
2504 ASSERT(IS_COTS(tep) && tep->te_qlen == 0);
2505 if (tep->te_vp == ux_addr.soua_vp)
2508 tl_addr_unbind(tep);
2515 rc = mod_hash_insert_reserve(tep->te_addrhash,
2517 (mod_hash_val_t)tep, tep->te_hash_hndl);
2526 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2533 tep->te_uxaddr = ux_addr;
2534 tep->te_flag |= TL_ADDRHASHED;
2535 tep->te_hash_hndl = NULL;
2541 if (! tl_get_any_addr(tep, NULL)) {
2542 (void) (STRLOG(TL_ID, tep->te_minor,
2552 addr_req.ta_zoneid = tep->te_zoneid;
2554 tep->te_abuf = kmem_zalloc((size_t)alen, KM_NOSLEEP);
2555 if (tep->te_abuf == NULL) {
2559 bcopy(addr_req.ta_abuf, tep->te_abuf, addr_req.ta_alen);
2560 tep->te_alen = alen;
2562 if (mod_hash_insert_reserve(tep->te_addrhash,
2563 (mod_hash_key_t)&tep->te_ap, (mod_hash_val_t)tep,
2564 tep->te_hash_hndl) != 0) {
2571 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2582 if (! tl_get_any_addr(tep, &addr_req)) {
2583 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2590 tep->te_flag |= TL_ADDRHASHED;
2591 tep->te_hash_hndl = NULL;
2595 ASSERT(tep->te_alen >= 0);
2601 basize = sizeof (struct T_bind_ack) + tep->te_alen;
2604 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2609 tl_addr_unbind(tep);
2610 tep->te_state = TS_UNBND;
2620 b_ack->ADDR_length = tep->te_alen;
2623 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
2625 if (IS_COTS(tep)) {
2626 tep->te_qlen = qlen;
2628 tep->te_flag |= TL_LISTENER;
2631 tep->te_state = NEXTSTATE(TE_BIND_ACK, tep->te_state);
2644 tep->te_state = save_state;
2648 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
2657 tl_unbind(mblk_t *mp, tl_endpt_t *tep)
2662 if (tep->te_closing) {
2667 wq = tep->te_wq;
2686 if (tep->te_state != TS_IDLE) {
2687 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2690 tep->te_state));
2694 tep->te_state = NEXTSTATE(TE_UNBIND_REQ, tep->te_state);
2703 if (! IS_SOCKET(tep) || !IS_CLTS(tep) || tep->te_qlen != 0 ||
2704 tep->te_magic != SOU_MAGIC_EXPLICIT) {
2711 tl_addr_unbind(tep);
2714 tep->te_state = NEXTSTATE(TE_OK_ACK1, tep->te_state);
2736 tl_endpt_t *tep;
2741 tep = (tl_endpt_t *)wq->q_ptr;
2759 if (!IS_SOCKET(tep) && tep->te_state != TS_IDLE &&
2766 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2769 tep->te_state));
2805 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
2816 ASSERT(IS_COTS(tep));
2818 if (tep->te_closing) {
2839 if (tep->te_state != TS_IDLE) {
2840 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2843 tep->te_state));
2855 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2868 if (IS_SOCKET(tep)) {
2873 (void) (STRLOG(TL_ID, tep->te_minor,
2883 (void) (STRLOG(TL_ID, tep->te_minor,
2895 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2905 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2921 (void) (STRLOG(TL_ID, tep->te_minor, 3,
2931 (void) (STRLOG(TL_ID, tep->te_minor, 1,
2942 * Prevent tep from closing on us.
2944 if (! tl_noclose(tep)) {
2945 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2952 tep->te_state = NEXTSTATE(TE_CONN_REQ, tep->te_state);
2960 dst.ta_zoneid = tep->te_zoneid;
2965 peer_tep = (IS_SOCKET(tep) ?
2966 tl_sock_find_peer(tep, &ux_addr) :
2967 tl_find_peer(tep, &dst));
2970 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
2978 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE,
2990 tep->te_state = NEXTSTATE(TE_OK_ACK1, tep->te_state);
2991 tl_ok_ack(tep->te_wq, ackmp, T_CONN_REQ);
2992 tl_closeok(tep);
3003 tep->te_state = TS_IDLE;
3007 putnext(tep->te_rq, dimp);
3019 tl_serializer_refrele(tep->te_ser);
3020 tep->te_ser = peer_tep->te_ser;
3021 ASSERT(tep->te_oconp == NULL);
3022 tep->te_oconp = peer_tep;
3027 tl_closeok(tep);
3036 tl_refhold(tep);
3037 tl_serializer_enter(tep, tl_conn_req_ser, mp);
3044 tl_conn_req_ser(mblk_t *mp, tl_endpt_t *tep)
3047 tl_endpt_t *peer_tep = tep->te_oconp;
3062 if (tep->te_closing) {
3063 TL_UNCONNECT(tep->te_oconp);
3064 tl_serializer_exit(tep);
3065 tl_refrele(tep);
3070 wq = tep->te_wq;
3071 tep->te_flag |= TL_EAGER;
3085 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE | SL_ERROR,
3088 TL_UNCONNECT(tep->te_oconp);
3091 tl_serializer_exit(tep);
3092 tl_refrele(tep);
3117 ci_msz = sizeof (struct T_conn_ind) + tep->te_alen;
3130 tep->te_state = TS_IDLE;
3133 TL_UNCONNECT(tep->te_oconp);
3134 tl_serializer_exit(tep);
3135 tl_refrele(tep);
3142 if (IS_SOCKET(tep) && !tl_disable_early_connect) {
3154 tep->te_state = TS_IDLE;
3159 TL_UNCONNECT(tep->te_oconp);
3160 tl_serializer_exit(tep);
3161 tl_refrele(tep);
3173 tep->te_state = TS_IDLE;
3179 TL_UNCONNECT(tep->te_oconp);
3180 tl_serializer_exit(tep);
3181 tl_refrele(tep);
3190 tep->te_state = TS_IDLE;
3196 TL_UNCONNECT(tep->te_oconp);
3197 tl_serializer_exit(tep);
3198 tl_refrele(tep);
3211 tep->te_state = NEXTSTATE(TE_OK_ACK1, tep->te_state);
3229 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
3232 TL_UNCONNECT(tep->te_oconp);
3233 tl_serializer_exit(tep);
3234 tl_refrele(tep);
3247 ci->SRC_length = tep->te_alen;
3248 ci->SEQ_number = tep->te_seqno;
3251 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
3277 * increment references for both peer_tep and tep: peer_tep is placed on
3278 * te_oconp and tep is placed on listeners queue.
3280 tip->ti_tep = tep;
3281 tip->ti_seqno = tep->te_seqno;
3296 tep->te_state = NEXTSTATE(TE_CONN_CON, tep->te_state);
3298 putnext(tep->te_rq, confmp);
3301 * Now we need to increment tep reference because tep is referenced by
3306 ASSERT(tep->te_refcnt >= 2);
3308 tl_serializer_exit(tep);
3324 tl_conn_res(mblk_t *mp, tl_endpt_t *tep)
3342 ASSERT(IS_COTS(tep));
3344 if (tep->te_closing) {
3349 wq = tep->te_wq;
3373 if (tep->te_state != TS_WRES_CIND) {
3374 (void) (STRLOG(TL_ID, tep->te_minor, 1,
3377 tep->te_state));
3389 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3398 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3409 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3416 tep->te_state = NEXTSTATE(TE_CONN_RES, tep->te_state);
3417 ASSERT(tep->te_state == TS_WACK_CRES);
3421 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3423 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3432 if (mod_hash_find_cb(tep->te_transport->tr_ai_hash,
3435 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3437 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3447 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3449 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3463 if ((tep != acc_ep) && (acc_ep->te_state != TS_IDLE)) {
3464 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3467 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3480 if ((tep == acc_ep) && (tep->te_nicon > 1)) {
3481 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
3483 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3497 tip = tl_icon_find(tep, cres->SEQ_number);
3499 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE|SL_ERROR,
3501 tep->te_state = NEXTSTATE(TE_ERROR_ACK, tep->te_state);
3572 (void) (STRLOG(TL_ID, tep->te_minor, 2, SL_TRACE,
3602 tep->te_state = TS_WRES_CIND;
3617 if (tep->te_nicon == 1) {
3618 if (tep == acc_ep)
3619 tep->te_state = NEXTSTATE(TE_OK_ACK2, tep->te_state);
3621 tep->te_state = NEXTSTATE(TE_OK_ACK3, tep->te_state);
3623 tep->te_state = NEXTSTATE(TE_OK_ACK4, tep->te_state);
3637 (void) (STRLOG(TL_ID, tep->te_minor, 3,
3659 tep->te_state = TS_IDLE;
3674 if (tep != acc_ep)
3689 tl_freetip(tep, tip);
3717 (void) (STRLOG(TL_ID, tep->te_minor, 3,
3772 ASSERT(cl_ep->te_ser == tep->te_ser);
3807 tl_freetip(tep, tip);
3817 if (! IS_SOCKET(tep)) {
3856 tl_discon_req(mblk_t *mp, tl_endpt_t *tep)
3861 tl_endpt_t *peer_tep = tep->te_conp;
3862 tl_endpt_t *srv_tep = tep->te_oconp;
3869 if (tep->te_closing) {
3875 TL_UNCONNECT(tep->te_conp);
3879 TL_UNCONNECT(tep->te_oconp);
3883 wq = tep->te_wq;
3907 save_state = new_state = tep->te_state;
3910 (void) (STRLOG(TL_ID, tep->te_minor, 1,
3913 tep->te_state));
3922 new_state = NEXTSTATE(TE_DISCON_REQ, tep->te_state);
3926 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
3928 tep->te_state = NEXTSTATE(TE_ERROR_ACK, new_state);
3938 if (tep->te_nicon > 0) { /* server */
3943 tip = tl_icon_find(tep, dr->SEQ_number);
3945 (void) (STRLOG(TL_ID, tep->te_minor, 2,
3948 tep->te_state = NEXTSTATE(TE_ERROR_ACK, new_state);
3977 if (tep->te_nicon == 0)
3980 if (tep->te_nicon == 1)
3988 if ((tep->te_nicon <= 1) &&
4000 if (tep->te_nicon > 0) { /* listener */
4003 * disconnect incoming connect request pending to tep
4006 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4009 tep->te_state = new_state;
4030 tl_freetip(tep, tip);
4031 } else if ((peer_tep = tep->te_oconp) != NULL) { /* client */
4033 * disconnect an outgoing request pending from tep
4037 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4040 tep->te_state = new_state;
4048 di->SEQ_number = tep->te_seqno;
4057 if (IS_SOCKET(tep) && !tl_disable_early_connect) {
4064 tl_icon_queuemsg(peer_tep, tep->te_seqno, dimp);
4069 * it as a hint not to free the tep.
4073 new_state = tep->te_state;
4076 tip = tl_icon_find(peer_tep, tep->te_seqno);
4078 ASSERT(tep == tip->ti_tep);
4090 ASSERT(tep->te_oconp != NULL);
4091 TL_UNCONNECT(tep->te_oconp);
4093 } else if ((peer_tep = tep->te_conp) != NULL) { /* connected! */
4095 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4098 tep->te_state = new_state;
4109 tep->te_state = new_state;
4115 tep->te_state = new_state;
4144 if (tep->te_conp) { /* disconnect pointers if connected */
4160 if (! IS_SOCKET(tep)) {
4164 tep->te_wq->q_next = NULL;
4167 TL_UNCONNECT(tep->te_conp);
4172 tl_addr_req_ser(mblk_t *mp, tl_endpt_t *tep)
4174 if (!tep->te_closing)
4175 tl_addr_req(mp, tep);
4179 tl_serializer_exit(tep);
4180 tl_refrele(tep);
4184 tl_addr_req(mblk_t *mp, tl_endpt_t *tep)
4191 if (tep->te_closing) {
4196 wq = tep->te_wq;
4203 if (IS_CLTS(tep) ||
4204 (tep->te_state > TS_WREQ_ORDREL) ||
4205 (tep->te_state < TS_DATA_XFER)) {
4211 if (tep->te_state >= TS_IDLE)
4213 ack_sz += tep->te_alen;
4216 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4231 if (tep->te_state >= TS_IDLE) {
4233 taa->LOCADDR_length = tep->te_alen;
4236 bcopy(tep->te_abuf, ackmp->b_wptr,
4237 tep->te_alen);
4238 ackmp->b_wptr += tep->te_alen;
4244 ASSERT(tep->te_state == TS_DATA_XFER ||
4245 tep->te_state == TS_WIND_ORDREL ||
4246 tep->te_state == TS_WREQ_ORDREL);
4248 tl_connected_cots_addr_req(mp, tep);
4254 tl_connected_cots_addr_req(mblk_t *mp, tl_endpt_t *tep)
4256 tl_endpt_t *peer_tep = tep->te_conp;
4262 if (tep->te_closing) {
4268 tl_error_ack(tep->te_wq, mp, TSYSERR, ECONNRESET, T_ADDR_REQ);
4272 ASSERT(tep->te_state >= TS_IDLE);
4275 ack_sz += T_ALIGN(tep->te_alen);
4280 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4282 tl_memrecover(tep->te_wq, mp, ack_sz);
4289 taa->LOCADDR_length = tep->te_alen;
4294 bcopy(tep->te_abuf, addr_startp,
4295 tep->te_alen);
4307 putnext(tep->te_rq, ackmp);
4311 tl_copy_info(struct T_info_ack *ia, tl_endpt_t *tep)
4313 if (IS_CLTS(tep)) {
4318 if (IS_COTSORD(tep))
4322 ia->CURRENT_state = tep->te_state;
4330 tl_capability_req(mblk_t *mp, tl_endpt_t *tep)
4336 if (tep->te_closing) {
4346 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4348 tl_memrecover(tep->te_wq, mp,
4357 tl_copy_info(&tcap->INFO_ack, tep);
4362 tcap->ACCEPTOR_id = tep->te_acceptor_id;
4366 putnext(tep->te_rq, ackmp);
4370 tl_info_req_ser(mblk_t *mp, tl_endpt_t *tep)
4372 if (! tep->te_closing)
4373 tl_info_req(mp, tep);
4377 tl_serializer_exit(tep);
4378 tl_refrele(tep);
4382 tl_info_req(mblk_t *mp, tl_endpt_t *tep)
4389 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4391 tl_memrecover(tep->te_wq, mp, sizeof (struct T_info_ack));
4398 tl_copy_info((struct T_info_ack *)ackmp->b_rptr, tep);
4403 putnext(tep->te_rq, ackmp);
4411 tl_data(mblk_t *mp, tl_endpt_t *tep)
4413 queue_t *wq = tep->te_wq;
4418 boolean_t closing = tep->te_closing;
4420 if (IS_CLTS(tep)) {
4421 (void) (STRLOG(TL_ID, tep->te_minor, 2,
4438 (tep->te_state != TS_DATA_XFER) &&
4439 (tep->te_state != TS_WREQ_ORDREL)) {
4447 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4457 (msz < sizeof (struct T_optdata_req) || !IS_SOCKET(tep))) {
4458 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4473 switch (tep->te_state) {
4479 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
4485 if (tep->te_conp != NULL)
4488 if (tep->te_oconp == NULL) {
4506 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4509 TL_PUTBQ(tep, mp);
4523 tl_icon_queuemsg(tep->te_oconp, tep->te_seqno, mp);
4527 if (tep->te_conp == NULL) {
4534 (void) (STRLOG(TL_ID, tep->te_minor, 3,
4537 tl_discon_ind(tep, 0);
4544 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4550 * tep->te_state = NEXTSTATE(TE_DATA_REQ, tep->te_state);
4557 if (((peer_tep = tep->te_conp) == NULL) || peer_tep->te_closing) {
4560 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4565 ASSERT(tep->te_serializer == peer_tep->te_serializer);
4574 TL_PUTBQ(tep, mp);
4587 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4612 tl_exdata(mblk_t *mp, tl_endpt_t *tep)
4614 queue_t *wq = tep->te_wq;
4619 boolean_t closing = tep->te_closing;
4622 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4638 (tep->te_state != TS_DATA_XFER) &&
4639 (tep->te_state != TS_WREQ_ORDREL)) {
4647 switch (tep->te_state) {
4653 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
4659 if (tep->te_conp != NULL)
4662 if (tep->te_oconp == NULL) {
4680 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4683 TL_PUTBQ(tep, mp);
4686 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4689 tl_icon_queuemsg(tep->te_oconp, tep->te_seqno, mp);
4693 if (tep->te_conp == NULL) {
4700 (void) (STRLOG(TL_ID, tep->te_minor, 3,
4703 tl_discon_ind(tep, 0);
4709 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4712 tep->te_state));
4717 * tep->te_state = NEXTSTATE(TE_EXDATA_REQ, tep->te_state);
4724 if (((peer_tep = tep->te_conp) == NULL) || peer_tep->te_closing) {
4727 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4740 TL_PUTBQ(tep, mp);
4753 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4776 tl_ordrel(mblk_t *mp, tl_endpt_t *tep)
4778 queue_t *wq = tep->te_wq;
4783 boolean_t closing = tep->te_closing;
4786 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4799 switch (tep->te_state) {
4803 if (tep->te_conp != NULL)
4806 if (tep->te_oconp == NULL)
4819 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4822 TL_PUTBQ(tep, mp);
4825 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4828 (void) tl_icon_queuemsg(tep->te_oconp, tep->te_seqno, mp);
4832 (void) (STRLOG(TL_ID, tep->te_minor, 1,
4835 tep->te_state));
4843 tep->te_state = NEXTSTATE(TE_ORDREL_REQ, tep->te_state);
4848 if (((peer_tep = tep->te_conp) == NULL) || peer_tep->te_closing) {
4850 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4864 TL_PUTBQ(tep, mp);
4877 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
4888 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
4905 tl_endpt_t *tep;
4914 tep = (tl_endpt_t *)wq->q_ptr;
4926 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
4967 tep->te_state = NEXTSTATE(TE_UDERROR_IND, tep->te_state);
4973 tl_unitdata_ser(mblk_t *mp, tl_endpt_t *tep)
4975 queue_t *wq = tep->te_wq;
4977 if (!tep->te_closing && (wq->q_first != NULL)) {
4978 TL_PUTQ(tep, mp);
4979 } else if (tep->te_rq != NULL)
4980 tl_unitdata(mp, tep);
4984 tl_serializer_exit(tep);
4985 tl_refrele(tep);
4994 tl_unitdata(mblk_t *mp, tl_endpt_t *tep)
4996 queue_t *wq = tep->te_wq;
5015 if (tep->te_state != TS_IDLE) {
5016 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5023 * tep->te_state = NEXTSTATE(TE_UNITDATA_REQ, tep->te_state);
5033 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
5045 if (IS_SOCKET(tep)) {
5051 (void) (STRLOG(TL_ID, tep->te_minor,
5063 (void) (STRLOG(TL_ID, tep->te_minor,
5079 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5088 if (alen == 0 || (olen != 0 && !IS_SOCKET(tep))) {
5089 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
5101 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
5110 destaddr.ta_zoneid = tep->te_zoneid;
5117 peer_tep = tep->te_lastep;
5126 peer_tep = (IS_SOCKET(tep) ?
5127 tl_sock_find_peer(tep, &ux_addr) :
5128 tl_find_peer(tep, &destaddr));
5131 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5141 if (tep->te_lastep != NULL)
5142 tl_refrele(tep->te_lastep);
5144 tep->te_lastep = peer_tep;
5148 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
5161 if (!canputnext(peer_tep->te_rq) && !(tep->te_closing)) {
5163 if (tep->te_flowq != NULL) {
5164 list_remove(&tep->te_flowq->te_flowlist, tep);
5166 list_insert_head(&peer_tep->te_flowlist, tep);
5167 tep->te_flowq = peer_tep;
5168 TL_PUTBQ(tep, mp);
5199 ui_sz = T_ALIGN(sizeof (struct T_unitdata_ind) + tep->te_alen) +
5205 if (msz >= ui_sz && alen >= tep->te_alen &&
5212 udind->SRC_length = tep->te_alen;
5214 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
5221 (void) (STRLOG(TL_ID, tep->te_minor, 4, SL_TRACE,
5235 udind->SRC_length = tep->te_alen;
5237 bcopy(tep->te_abuf, addr_startp, tep->te_alen);
5283 tl_find_peer(tl_endpt_t *tep, tl_addr_t *ap)
5286 int rc = mod_hash_find_cb(tep->te_addrhash, (mod_hash_key_t)ap,
5289 ASSERT(! IS_SOCKET(tep));
5292 ASSERT(ap->ta_zoneid == tep->te_zoneid);
5296 (tep->te_zoneid == peer_tep->te_zoneid) &&
5297 (tep->te_transport == peer_tep->te_transport));
5313 tl_sock_find_peer(tl_endpt_t *tep, soux_addr_t *ux_addr)
5317 tep->te_aihash : tep->te_addrhash;
5321 ASSERT(IS_SOCKET(tep));
5323 IMPLY(rc == 0, (tep->te_transport == peer_tep->te_transport));
5335 if ((peer_tep->te_zoneid != tep->te_zoneid) &&
5363 tl_get_any_addr(tl_endpt_t *tep, tl_addr_t *req)
5368 ASSERT(tep->te_hash_hndl != NULL);
5369 ASSERT(! IS_SOCKET(tep));
5371 if (tep->te_hash_hndl == NULL)
5382 ASSERT(tep->te_zoneid == req->ta_zoneid);
5385 if (tep->te_alen < alen) {
5389 * Not enough space in tep->ta_ap to hold the address,
5395 if (tep->te_alen > 0)
5396 kmem_free(tep->te_abuf, tep->te_alen);
5398 tep->te_alen = alen;
5399 tep->te_abuf = abuf;
5405 bcopy(req->ta_abuf, tep->te_abuf, (size_t)req->ta_alen);
5411 bcopy(&tep->te_minor, tep->te_abuf, sizeof (uint32_t));
5414 if (mod_hash_insert_reserve(tep->te_addrhash,
5415 (mod_hash_key_t)&tep->te_ap, (mod_hash_val_t)tep,
5416 tep->te_hash_hndl) == 0) {
5420 tep->te_flag |= TL_ADDRHASHED;
5421 tep->te_hash_hndl = NULL;
5428 bcopy(&tep->te_defaddr, tep->te_abuf, sizeof (uint32_t));
5429 atomic_inc_32(&tep->te_defaddr);
5455 tl_cl_backenable(tl_endpt_t *tep)
5457 list_t *l = &tep->te_flowlist;
5460 ASSERT(IS_CLTS(tep));
5463 ASSERT(tep->te_ser == elp->te_ser);
5464 ASSERT(elp->te_flowq == tep);
5476 tl_co_unconnect(tl_endpt_t *tep)
5478 tl_endpt_t *peer_tep = tep->te_conp;
5479 tl_endpt_t *srv_tep = tep->te_oconp;
5485 ASSERT(IS_COTS(tep));
5490 TL_UNCONNECT(tep->te_conp);
5494 TL_UNCONNECT(tep->te_oconp);
5498 if (tep->te_nicon > 0) {
5499 l = &tep->te_iconp;
5507 while (tep->te_nicon > 0) {
5512 tl_freetip(tep, tip);
5522 tl_freetip(tep, tip);
5533 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5538 tl_freetip(tep, tip);
5546 if (IS_SOCKET(tep) && !tl_disable_early_connect &&
5548 !tl_icon_hasprim(srv_tep, tep->te_seqno, T_ORDREL_IND)) {
5558 d_mp = tl_discon_ind_alloc(ECONNRESET, tep->te_seqno);
5561 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5564 TL_UNCONNECT(tep->te_oconp);
5575 if (IS_SOCKET(tep) && !tl_disable_early_connect) {
5579 tl_icon_queuemsg(srv_tep, tep->te_seqno, d_mp);
5581 tip = tl_icon_find(srv_tep, tep->te_seqno);
5585 ASSERT(tep == tip->ti_tep);
5586 ASSERT(tep->te_ser == srv_tep->te_ser);
5604 TL_UNCONNECT(tep->te_oconp);
5615 ASSERT(tep->te_ser == peer_tep->te_ser);
5622 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE,
5628 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5655 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5658 tep->te_state));
5661 (void) (STRLOG(TL_ID, tep->te_minor, 3,
5663 "tl_co_unconnect: state %d", tep->te_state));
5671 if (tep->te_closing) {
5672 peer_tep = tep->te_conp;
5674 TL_REMOVE_PEER(tep->te_conp);
5685 tl_discon_ind(tl_endpt_t *tep, uint32_t reason)
5689 if (tep->te_closing)
5695 flushq(tep->te_rq, FLUSHDATA);
5696 (void) putnextctl1(tep->te_rq, M_FLUSH, FLUSHRW);
5701 d_mp = tl_discon_ind_alloc(reason, tep->te_seqno);
5703 (void) (STRLOG(TL_ID, tep->te_minor, 3, SL_TRACE|SL_ERROR,
5707 tep->te_state = TS_IDLE;
5708 putnext(tep->te_rq, d_mp);
5758 tl_icon_find(tl_endpt_t *tep, t_scalar_t seqno)
5760 list_t *l = &tep->te_iconp;
5777 tl_icon_queuemsg(tl_endpt_t *tep, t_scalar_t seqno, mblk_t *nmp)
5788 tip = tl_icon_find(tep, seqno);
5829 tl_icon_hasprim(tl_endpt_t *tep, t_scalar_t seqno, t_scalar_t prim)
5831 tl_icon_t *tip = tl_icon_find(tep, seqno);
5849 tl_icon_sendmsgs(tl_endpt_t *tep, mblk_t **mpp)
5854 if (tep->te_closing) {
5859 ASSERT(tep->te_state == TS_DATA_XFER);
5860 ASSERT(tep->te_rq->q_first == NULL);
5872 putnext(tep->te_rq, mp);
5881 putnext(tep->te_rq, mp);
5884 tep->te_state = NEXTSTATE(TE_ORDREL_IND,
5885 tep->te_state);
5886 putnext(tep->te_rq, mp);
5889 tep->te_state = TS_IDLE;
5890 putnext(tep->te_rq, mp);
5931 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
5933 if (tep->te_closing) {
5938 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5940 "tl_merror: tep=%p, err=%d", (void *)tep, error));
5947 if (IS_COTS(tep)) {
5949 tl_co_unconnect(tep);
5960 (void) (STRLOG(TL_ID, tep->te_minor, 1,
5973 (void) putnextctl1(tep->te_rq, M_ERROR, error);
6031 tl_endpt_t *tep;
6034 tep = (tl_endpt_t *)wq->q_ptr;
6044 if (! IS_SOCKET(tep))
6050 *valp = (tep->te_flag & TL_SOCKUCRED) != 0;
6088 tl_endpt_t *tep;
6090 tep = (tl_endpt_t *)wq->q_ptr;
6100 if (! IS_SOCKET(tep)) {
6115 if (! IS_CLTS(tep)) {
6120 tep->te_flag &= ~TL_SOCKUCRED;
6122 tep->te_flag |= TL_SOCKUCRED;
6140 (void) (STRLOG(TL_ID, tep->te_minor, 1,
6155 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
6157 ASSERT(tep);
6159 tep->te_timoutid = 0;
6173 tl_endpt_t *tep = (tl_endpt_t *)wq->q_ptr;
6175 ASSERT(tep);
6177 tep->te_bufcid = 0;
6178 tep->te_nowsrv = B_FALSE;
6191 tl_endpt_t *tep;
6193 tep = (tl_endpt_t *)wq->q_ptr;
6195 if (tep->te_closing) {
6203 if (tep->te_bufcid || tep->te_timoutid) {
6204 (void) (STRLOG(TL_ID, tep->te_minor, 1, SL_TRACE|SL_ERROR,
6209 if (!(tep->te_bufcid = qbufcall(wq, size, BPRI_MED, tl_buffer, wq))) {
6210 tep->te_timoutid = qtimeout(wq, tl_timer, wq,
6216 tl_freetip(tl_endpt_t *tep, tl_icon_t *tip)
6228 list_remove(&tep->te_iconp, tip);
6230 tep->te_nicon--;
6237 tl_addr_unbind(tl_endpt_t *tep)
6241 if (tep->te_flag & TL_ADDRHASHED) {
6242 if (IS_SOCKET(tep)) {
6243 (void) mod_hash_remove(tep->te_addrhash,
6244 (mod_hash_key_t)tep->te_vp,
6246 tep->te_vp = (void *)(uintptr_t)tep->te_minor;
6247 tep->te_magic = SOU_MAGIC_IMPLICIT;
6249 (void) mod_hash_remove(tep->te_addrhash,
6250 (mod_hash_key_t)&tep->te_ap,
6252 (void) kmem_free(tep->te_abuf, tep->te_alen);
6253 tep->te_alen = -1;
6254 tep->te_abuf = NULL;
6256 tep->te_flag &= ~TL_ADDRHASHED;