Lines Matching refs:fptr
140 static void fcip_setipq(struct fcip *fptr);
148 static int fcip_start(queue_t *wq, mblk_t *mp, struct fcip *fptr,
150 static void fcip_sendup(struct fcip *fptr, mblk_t *mp,
152 static struct fcipstr *fcip_accept(struct fcipstr *slp, struct fcip *fptr,
154 static mblk_t *fcip_addudind(struct fcip *fptr, mblk_t *mp,
156 static int fcip_setup_mac_addr(struct fcip *fptr);
157 static void fcip_kstat_init(struct fcip *fptr);
180 static int fcip_port_attach_handler(struct fcip *fptr);
203 static void fcip_handle_topology(struct fcip *fptr);
204 static int fcip_init_port(struct fcip *fptr);
205 struct fcip_routing_table *fcip_lookup_rtable(struct fcip *fptr,
207 static void fcip_rt_update(struct fcip *fptr, fc_portmap_t *devlist,
209 static void fcip_rt_flush(struct fcip *fptr);
211 static int fcip_do_plogi(struct fcip *fptr, struct fcip_routing_table *frp);
215 static struct fcip_dest *fcip_get_dest(struct fcip *fptr,
217 static struct fcip_dest *fcip_add_dest(struct fcip *fptr,
219 static int fcip_dest_add_broadcast_entry(struct fcip *fptr, int new_flag);
220 static uint32_t fcip_get_broadcast_did(struct fcip *fptr);
221 static void fcip_cleanup_dest(struct fcip *fptr);
228 static int fcip_port_get_num_pkts(struct fcip *fptr);
229 static int fcip_check_port_busy(struct fcip *fptr);
232 static int fcip_plogi_in_progress(struct fcip *fptr);
233 static int fcip_check_port_exists(struct fcip *fptr);
238 static fcip_pkt_t *fcip_pkt_alloc(struct fcip *fptr, mblk_t *bp,
241 static fcip_pkt_t *fcip_ipkt_alloc(struct fcip *fptr, int cmdlen,
274 static struct fcip_dest *fcip_do_farp(struct fcip *fptr, la_wwn_t *pwwn,
278 static int fcip_handle_farp_request(struct fcip *fptr, la_els_farp_t *fcmd);
279 static int fcip_handle_farp_response(struct fcip *fptr, la_els_farp_t *fcmd);
772 struct fcip *fptr;
897 fptr = ddi_get_soft_state(fcip_softp, instance);
899 if (fptr == NULL) {
909 mutex_init(&fptr->fcip_mutex, NULL, MUTEX_DRIVER, NULL);
910 mutex_init(&fptr->fcip_ub_mutex, NULL, MUTEX_DRIVER, NULL);
911 mutex_init(&fptr->fcip_rt_mutex, NULL, MUTEX_DRIVER, NULL);
912 mutex_init(&fptr->fcip_dest_mutex, NULL, MUTEX_DRIVER, NULL);
913 mutex_init(&fptr->fcip_sendup_mutex, NULL, MUTEX_DRIVER, NULL);
914 cv_init(&fptr->fcip_farp_cv, NULL, CV_DRIVER, NULL);
915 cv_init(&fptr->fcip_sendup_cv, NULL, CV_DRIVER, NULL);
916 cv_init(&fptr->fcip_ub_cv, NULL, CV_DRIVER, NULL);
918 mutex_enter(&fptr->fcip_mutex);
920 fptr->fcip_dip = fport->fcipp_dip; /* parent's dip */
921 fptr->fcip_instance = instance;
922 fptr->fcip_ub_upstream = 0;
926 fptr->fcip_port_state = FCIP_PORT_ONLINE;
927 if (fptr->fcip_flags & FCIP_LINK_DOWN) {
928 fptr->fcip_flags &= ~FCIP_LINK_DOWN;
931 fptr->fcip_port_state = FCIP_PORT_OFFLINE;
934 fptr->fcip_flags |= FCIP_ATTACHING;
935 fptr->fcip_port_info = fport;
941 wwn_to_ether(&fport->fcipp_nwwn, &fptr->fcip_macaddr);
943 fport->fcipp_fcip = fptr;
947 (long)(sizeof (fptr->fcip_dest)),
948 (long)(sizeof (fptr->fcip_rtable))));
950 bzero(fptr->fcip_dest, sizeof (fptr->fcip_dest));
951 bzero(fptr->fcip_rtable, sizeof (fptr->fcip_rtable));
957 fptr->fcip_tq = taskq_create("fcip_tasks",
961 mutex_exit(&fptr->fcip_mutex);
972 mutex_enter(&fptr->fcip_sendup_mutex);
974 (void (*)())fcip_sendup_thr, (caddr_t)fptr, 0, &p0,
976 mutex_exit(&fptr->fcip_sendup_mutex);
983 fptr->fcip_sendup_thr_initted = 1;
984 fptr->fcip_sendup_head = fptr->fcip_sendup_tail = NULL;
985 mutex_exit(&fptr->fcip_sendup_mutex);
989 if (fcip_port_attach_handler(fptr) != FC_SUCCESS) {
1063 fcip_port_attach_handler(struct fcip *fptr)
1065 fcip_port_info_t *fport = fptr->fcip_port_info;
1074 (void *)fcip_module_dip, ddi_get_instance(fptr->fcip_dip)));
1113 ddi_get_instance(fptr->fcip_dip), DDI_PSEUDO,
1118 ddi_get_instance(fptr->fcip_dip)));
1128 if (fcip_init_port(fptr) != FC_SUCCESS) {
1144 mutex_enter(&fptr->fcip_mutex);
1145 fptr->fcip_flags &= ~FCIP_ATTACHING;
1146 fptr->fcip_flags |= FCIP_INITED;
1147 fptr->fcip_timeout_ticks = 0;
1152 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
1155 mutex_exit(&fptr->fcip_mutex);
1183 struct fcip *fptr = fport->fcipp_fcip;
1188 ASSERT(fptr != NULL);
1190 mutex_enter(&fptr->fcip_mutex);
1193 fptr->fcip_flags &= ~(FCIP_POWER_DOWN);
1194 if (fptr->fcip_flags & FCIP_SUSPENDED) {
1195 mutex_exit(&fptr->fcip_mutex);
1199 fptr->fcip_flags &= ~(FCIP_SUSPENDED);
1201 mutex_exit(&fptr->fcip_mutex);
1213 if (tslp->sl_fcip == fptr) {
1227 mutex_enter(&fptr->fcip_rt_mutex);
1231 frp = fptr->fcip_rtable[index];
1238 did = fcip_get_broadcast_did(fptr);
1247 mutex_exit(&fptr->fcip_rt_mutex);
1256 fcip_handle_topology(fptr);
1262 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
1264 mutex_exit(&fptr->fcip_mutex);
1274 fcip_rt_update(struct fcip *fptr, fc_portmap_t *devlist, uint32_t listlen)
1277 fcip_port_info_t *fport = fptr->fcip_port_info;
1286 ASSERT(!mutex_owned(&fptr->fcip_mutex));
1287 mutex_enter(&fptr->fcip_rt_mutex);
1292 frp = fcip_lookup_rtable(fptr, &(pmap->map_pwwn),
1333 did = fptr->fcip_broadcast_did;
1338 fptr->fcip_timeout_ticks +
1363 frp->fcipr_next = fptr->fcip_rtable[hash_bucket];
1364 fptr->fcip_rtable[hash_bucket] = frp;
1385 (frp->fcipr_d_id.port_id != fptr->fcip_broadcast_did)) {
1387 frp->fcipr_invalid_timeout = fptr->fcip_timeout_ticks +
1398 (void) fcip_do_plogi(fptr, frp);
1404 (void) fcip_do_plogi(fptr, frp);
1411 mutex_exit(&fptr->fcip_rt_mutex);
1419 fcip_lookup_rtable(struct fcip *fptr, la_wwn_t *wwn, int matchflag)
1434 ASSERT(mutex_owned(&fptr->fcip_rt_mutex));
1437 frp = fptr->fcip_rtable[hash_bucket];
1511 struct fcip *fptr;
1535 fptr = fport->fcipp_fcip;
1536 if (fptr == NULL) {
1539 mutex_enter(&fptr->fcip_mutex);
1540 fptr->fcip_flags |= FCIP_DETACHING;
1541 if (fptr->fcip_ipq ||
1542 fptr->fcip_flags & (FCIP_IN_TIMEOUT |
1551 mutex_exit(&fptr->fcip_mutex);
1560 mutex_enter(&fptr->fcip_dest_mutex);
1561 if (fcip_port_get_num_pkts(fptr) > 0) {
1562 mutex_exit(&fptr->fcip_dest_mutex);
1563 mutex_exit(&fptr->fcip_mutex);
1569 mutex_exit(&fptr->fcip_dest_mutex);
1571 mutex_enter(&fptr->fcip_rt_mutex);
1572 if (fcip_plogi_in_progress(fptr)) {
1573 mutex_exit(&fptr->fcip_rt_mutex);
1574 mutex_exit(&fptr->fcip_mutex);
1580 mutex_exit(&fptr->fcip_rt_mutex);
1582 mutex_exit(&fptr->fcip_mutex);
1594 fptr = fport->fcipp_fcip;
1595 mutex_enter(&fptr->fcip_mutex);
1596 fptr->fcip_flags &= ~(FCIP_DETACHING);
1597 mutex_exit(&fptr->fcip_mutex);
1612 fptr = fport->fcipp_fcip;
1613 if (fptr) {
1614 mutex_enter(&fptr->fcip_mutex);
1619 detached = fptr->fcip_flags & FCIP_DETACHED;
1620 fptr->fcip_flags &= ~(FCIP_DETACHING);
1621 fptr->fcip_flags |= FCIP_DETACHED;
1622 mutex_exit(&fptr->fcip_mutex);
1683 struct fcip *fptr;
1709 fptr = fport->fcipp_fcip;
1721 if (strp->sl_fcip == fptr) {
1736 if (fptr != NULL) {
1737 mutex_enter(&fptr->fcip_mutex);
1739 (fptr) ||
1740 (fptr->fcip_flags &
1743 &fptr->fcip_mutex);
1749 fptr->fcip_flags |=
1751 mutex_exit(&fptr->fcip_mutex);
1797 fcip_check_port_busy(struct fcip *fptr)
1801 ASSERT(fptr != NULL);
1802 ASSERT(MUTEX_HELD(&fptr->fcip_mutex));
1804 mutex_enter(&fptr->fcip_dest_mutex);
1806 if (fptr->fcip_flags & FCIP_PORT_BUSY ||
1807 ((num_pkts = fcip_port_get_num_pkts(fptr)) > 0) ||
1808 fptr->fcip_num_ipkts_pending) {
1813 fptr->fcip_flags, num_pkts, fptr->fcip_num_ipkts_pending));
1816 mutex_exit(&fptr->fcip_dest_mutex);
1849 struct fcip *fptr = fport->fcipp_fcip;
1857 ASSERT(fptr != NULL);
1858 mutex_enter(&fptr->fcip_mutex);
1866 ((fptr->fcip_flags & FCIP_IN_CALLBACK) ||
1867 (fptr->fcip_flags & FCIP_IN_TIMEOUT))) {
1868 mutex_exit(&fptr->fcip_mutex);
1870 mutex_enter(&fptr->fcip_mutex);
1873 if (fptr->fcip_flags & FCIP_IN_CALLBACK ||
1874 fptr->fcip_flags & FCIP_IN_TIMEOUT) {
1875 mutex_exit(&fptr->fcip_mutex);
1880 if (fptr->fcip_flags & FCIP_SUSPENDED) {
1881 fptr->fcip_flags |= FCIP_POWER_DOWN;
1882 mutex_exit(&fptr->fcip_mutex);
1885 fptr->fcip_flags |= FCIP_POWER_DOWN;
1888 fptr->fcip_flags |= FCIP_SUSPENDED;
1890 mutex_exit(&fptr->fcip_mutex);
1894 mutex_exit(&fptr->fcip_mutex);
1902 if (tslp->sl_fcip == fptr) {
1922 mutex_enter(&fptr->fcip_rt_mutex);
1932 frp = fptr->fcip_rtable[index];
1947 mutex_enter(&fptr->fcip_dest_mutex);
1952 fdestp = fptr->fcip_dest[hash_bucket];
1968 mutex_exit(&fptr->fcip_dest_mutex);
1983 mutex_exit(&fptr->fcip_rt_mutex);
1985 mutex_enter(&fptr->fcip_rt_mutex);
2006 mutex_exit(&fptr->fcip_rt_mutex);
2009 mutex_enter(&fptr->fcip_mutex);
2010 fptr->fcip_flags &= ~(FCIP_SUSPENDED | FCIP_POWER_DOWN);
2011 mutex_exit(&fptr->fcip_mutex);
2016 mutex_enter(&fptr->fcip_mutex);
2017 tid = fptr->fcip_timeout_id;
2018 fptr->fcip_timeout_id = NULL;
2019 mutex_exit(&fptr->fcip_mutex);
2058 fcip_kstat_init(struct fcip *fptr)
2064 ASSERT(mutex_owned(&fptr->fcip_mutex));
2066 instance = ddi_get_instance(fptr->fcip_dip);
2070 fptr->fcip_kstatp = kstat_create("fcip", instance, buf, "net",
2075 fptr->fcip_kstatp = kstat_create("fcip", instance, buf, "net",
2079 if (fptr->fcip_kstatp == NULL) {
2084 fcipstatp = (struct fcipstat *)fptr->fcip_kstatp->ks_data;
2158 fptr->fcip_kstatp->ks_update = fcip_stat_update;
2159 fptr->fcip_kstatp->ks_private = (void *) fptr;
2160 kstat_install(fptr->fcip_kstatp);
2171 struct fcip *fptr;
2173 fptr = (struct fcip *)fcip_statp->ks_private;
2177 fptr->fcip_ipackets = fcipstatp->fcips_ipackets.value.ul;
2178 fptr->fcip_ierrors = fcipstatp->fcips_ierrors.value.ul;
2179 fptr->fcip_opackets = fcipstatp->fcips_opackets.value.ul;
2180 fptr->fcip_oerrors = fcipstatp->fcips_oerrors.value.ul;
2181 fptr->fcip_collisions = fcipstatp->fcips_collisions.value.ul;
2182 fptr->fcip_defer = fcipstatp->fcips_defer.value.ul;
2183 fptr->fcip_fram = fcipstatp->fcips_fram.value.ul;
2184 fptr->fcip_crc = fcipstatp->fcips_crc.value.ul;
2185 fptr->fcip_oflo = fcipstatp->fcips_oflo.value.ul;
2186 fptr->fcip_uflo = fcipstatp->fcips_uflo.value.ul;
2187 fptr->fcip_missed = fcipstatp->fcips_missed.value.ul;
2188 fptr->fcip_tlcol = fcipstatp->fcips_tlcol.value.ul;
2189 fptr->fcip_trtry = fcipstatp->fcips_trtry.value.ul;
2190 fptr->fcip_tnocar = fcipstatp->fcips_tnocar.value.ul;
2191 fptr->fcip_inits = fcipstatp->fcips_inits.value.ul;
2192 fptr->fcip_notbufs = fcipstatp->fcips_notbufs.value.ul;
2193 fptr->fcip_norbufs = fcipstatp->fcips_norbufs.value.ul;
2194 fptr->fcip_nocanput = fcipstatp->fcips_nocanput.value.ul;
2195 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2196 fptr->fcip_rcvbytes = fcipstatp->fcips_rcvbytes.value.ul;
2197 fptr->fcip_xmtbytes = fcipstatp->fcips_xmtbytes.value.ul;
2198 fptr->fcip_multircv = fcipstatp->fcips_multircv.value.ul;
2199 fptr->fcip_multixmt = fcipstatp->fcips_multixmt.value.ul;
2200 fptr->fcip_brdcstrcv = fcipstatp->fcips_brdcstrcv.value.ul;
2201 fptr->fcip_norcvbuf = fcipstatp->fcips_norcvbuf.value.ul;
2202 fptr->fcip_noxmtbuf = fcipstatp->fcips_noxmtbuf.value.ul;
2203 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2204 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2205 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2206 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2207 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2208 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2209 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2210 fptr->fcip_allocbfail = fcipstatp->fcips_allocbfail.value.ul;
2213 fcipstatp->fcips_ipackets.value.ul = fptr->fcip_ipackets;
2214 fcipstatp->fcips_ierrors.value.ul = fptr->fcip_ierrors;
2215 fcipstatp->fcips_opackets.value.ul = fptr->fcip_opackets;
2216 fcipstatp->fcips_oerrors.value.ul = fptr->fcip_oerrors;
2217 fcipstatp->fcips_collisions.value.ul = fptr->fcip_collisions;
2218 fcipstatp->fcips_nocanput.value.ul = fptr->fcip_nocanput;
2219 fcipstatp->fcips_allocbfail.value.ul = fptr->fcip_allocbfail;
2220 fcipstatp->fcips_defer.value.ul = fptr->fcip_defer;
2221 fcipstatp->fcips_fram.value.ul = fptr->fcip_fram;
2222 fcipstatp->fcips_crc.value.ul = fptr->fcip_crc;
2223 fcipstatp->fcips_oflo.value.ul = fptr->fcip_oflo;
2224 fcipstatp->fcips_uflo.value.ul = fptr->fcip_uflo;
2225 fcipstatp->fcips_missed.value.ul = fptr->fcip_missed;
2226 fcipstatp->fcips_tlcol.value.ul = fptr->fcip_tlcol;
2227 fcipstatp->fcips_trtry.value.ul = fptr->fcip_trtry;
2228 fcipstatp->fcips_tnocar.value.ul = fptr->fcip_tnocar;
2229 fcipstatp->fcips_inits.value.ul = fptr->fcip_inits;
2230 fcipstatp->fcips_norbufs.value.ul = fptr->fcip_norbufs;
2231 fcipstatp->fcips_notbufs.value.ul = fptr->fcip_notbufs;
2232 fcipstatp->fcips_rcvbytes.value.ul = fptr->fcip_rcvbytes;
2233 fcipstatp->fcips_xmtbytes.value.ul = fptr->fcip_xmtbytes;
2234 fcipstatp->fcips_multircv.value.ul = fptr->fcip_multircv;
2235 fcipstatp->fcips_multixmt.value.ul = fptr->fcip_multixmt;
2236 fcipstatp->fcips_brdcstrcv.value.ul = fptr->fcip_brdcstrcv;
2237 fcipstatp->fcips_brdcstxmt.value.ul = fptr->fcip_brdcstxmt;
2238 fcipstatp->fcips_norcvbuf.value.ul = fptr->fcip_norcvbuf;
2239 fcipstatp->fcips_noxmtbuf.value.ul = fptr->fcip_noxmtbuf;
2257 struct fcip *fptr;
2270 fptr = fport->fcipp_fcip;
2271 ASSERT(fptr != NULL);
2273 if (fptr == NULL) {
2288 mutex_enter(&fptr->fcip_mutex);
2290 if ((fptr->fcip_flags & (FCIP_DETACHING | FCIP_DETACHED)) ||
2291 (fptr->fcip_flags & (FCIP_SUSPENDED | FCIP_POWER_DOWN))) {
2292 mutex_exit(&fptr->fcip_mutex);
2301 fptr->fcip_flags |= FCIP_IN_SC_CB;
2321 fcip_handle_topology(fptr);
2324 mutex_exit(&fptr->fcip_mutex);
2351 fcip_rt_update(fptr, changelist, listlen);
2371 fcip_rt_update(fptr, changelist, listlen);
2384 mutex_enter(&fptr->fcip_mutex);
2385 fptr->fcip_port_state = FCIP_PORT_ONLINE;
2386 if (fptr->fcip_flags & FCIP_LINK_DOWN) {
2387 fptr->fcip_flags &= ~FCIP_LINK_DOWN;
2389 mutex_exit(&fptr->fcip_mutex);
2396 if (slp && slp->sl_fcip == fptr) {
2413 mutex_enter(&fptr->fcip_mutex);
2414 fptr->fcip_mark_offline = fptr->fcip_timeout_ticks +
2416 fptr->fcip_port_state = FCIP_PORT_OFFLINE;
2417 mutex_exit(&fptr->fcip_mutex);
2424 mutex_enter(&fptr->fcip_rt_mutex);
2426 frtp = fptr->fcip_rtable[index];
2432 mutex_exit(&fptr->fcip_rt_mutex);
2446 mutex_enter(&fptr->fcip_mutex);
2449 while (fptr->fcip_ub_upstream) {
2450 cv_wait(&fptr->fcip_ub_cv, &fptr->fcip_mutex);
2454 fptr->fcip_mark_offline = fptr->fcip_timeout_ticks +
2456 fptr->fcip_port_state = FCIP_PORT_OFFLINE;
2457 mutex_exit(&fptr->fcip_mutex);
2462 fcip_rt_update(fptr, changelist, listlen);
2475 mutex_enter(&fptr->fcip_mutex);
2476 fptr->fcip_flags &= ~(FCIP_IN_SC_CB);
2477 mutex_exit(&fptr->fcip_mutex);
2518 struct fcip *fptr;
2531 fptr = fport->fcipp_fcip;
2532 ASSERT(fptr != NULL);
2533 if (fptr == NULL) {
2539 mutex_enter(&fptr->fcip_mutex);
2540 if ((fptr->fcip_flags & (FCIP_DETACHING | FCIP_DETACHED)) ||
2541 (fptr->fcip_flags & (FCIP_SUSPENDED | FCIP_POWER_DOWN))) {
2542 mutex_exit(&fptr->fcip_mutex);
2551 fptr->fcip_flags |= FCIP_IN_ELS_CB;
2552 mutex_exit(&fptr->fcip_mutex);
2597 fcip_handle_farp_request(fptr, fcmd) ==
2631 fcip_handle_farp_response(fptr, fcmd) ==
2636 mutex_enter(&fptr->fcip_mutex);
2637 fptr->fcip_farp_rsp_flag = 1;
2638 cv_signal(&fptr->fcip_farp_cv);
2639 mutex_exit(&fptr->fcip_mutex);
2656 mutex_enter(&fptr->fcip_mutex);
2657 fptr->fcip_flags &= ~(FCIP_IN_ELS_CB);
2658 mutex_exit(&fptr->fcip_mutex);
2667 fcip_handle_farp_request(struct fcip *fptr, la_els_farp_t *fcmd)
2671 fcip_port_info_t *fport = fptr->fcip_port_info;
2692 fcip_rt_update(fptr, &map, 1);
2693 mutex_enter(&fptr->fcip_rt_mutex);
2694 frp = fcip_lookup_rtable(fptr, &fcmd->req_pwwn, FCIP_COMPARE_NWWN);
2695 mutex_exit(&fptr->fcip_rt_mutex);
2697 fdestp = fcip_add_dest(fptr, frp);
2699 fcip_pkt = fcip_ipkt_alloc(fptr, sizeof (la_els_farp_t),
2725 if (fcip_do_plogi(fptr, frp) != FC_SUCCESS) {
2763 fcip_handle_farp_response(struct fcip *fptr, la_els_farp_t *fcmd)
2784 fcip_rt_update(fptr, &map, 1);
2785 mutex_enter(&fptr->fcip_rt_mutex);
2786 frp = fcip_lookup_rtable(fptr, &fcmd->resp_pwwn, FCIP_COMPARE_NWWN);
2787 mutex_exit(&fptr->fcip_rt_mutex);
2789 fdestp = fcip_add_dest(fptr, frp);
2823 struct fcip *fptr;
2843 fptr = fport->fcipp_fcip;
2844 ASSERT(fptr != NULL);
2846 if (fptr == NULL) {
2850 mutex_enter(&fptr->fcip_mutex);
2851 if ((fptr->fcip_flags & (FCIP_DETACHING | FCIP_DETACHED)) ||
2852 (fptr->fcip_flags & (FCIP_SUSPENDED | FCIP_POWER_DOWN))) {
2853 mutex_exit(&fptr->fcip_mutex);
2863 fptr->fcip_flags |= FCIP_IN_DATA_CB;
2864 mutex_exit(&fptr->fcip_mutex);
2934 fcip_cache_arp_broadcast(fptr, buf);
3016 fptr->fcip_ipackets++;
3019 mutex_enter(&fptr->fcip_mutex);
3020 fptr->fcip_ub_upstream++;
3021 mutex_exit(&fptr->fcip_mutex);
3027 if (fcip_sendup_alloc_enque(fptr, bp, NULL) != FC_SUCCESS) {
3036 mutex_enter(&fptr->fcip_mutex);
3037 fptr->fcip_ub_upstream++;
3038 mutex_exit(&fptr->fcip_mutex);
3039 if (fcip_sendup_alloc_enque(fptr, bp,
3051 mutex_enter(&fptr->fcip_mutex);
3052 fptr->fcip_flags &= ~(FCIP_IN_DATA_CB);
3053 mutex_exit(&fptr->fcip_mutex);
3081 fcip_sendup_alloc_enque(struct fcip *fptr, mblk_t *mp, struct fcipstr *(*f)())
3088 msg_elem = kmem_cache_alloc(fptr->fcip_sendup_cache, KM_NOSLEEP);
3097 mutex_enter(&fptr->fcip_sendup_mutex);
3098 if (fptr->fcip_sendup_head == NULL) {
3099 fptr->fcip_sendup_head = fptr->fcip_sendup_tail = msg_elem;
3101 fptr->fcip_sendup_tail->fcipsu_next = msg_elem;
3102 fptr->fcip_sendup_tail = msg_elem;
3104 fptr->fcip_sendup_cnt++;
3105 cv_signal(&fptr->fcip_sendup_cv);
3106 mutex_exit(&fptr->fcip_sendup_mutex);
3123 fcip_cache_arp_broadcast(struct fcip *fptr, fc_unsol_buf_t *buf)
3130 fport = fptr->fcip_port_info;
3138 mutex_enter(&fptr->fcip_rt_mutex);
3139 frp = fcip_lookup_rtable(fptr, &nhdr->net_src_addr, FCIP_COMPARE_NWWN);
3140 mutex_exit(&fptr->fcip_rt_mutex);
3152 fcip_rt_update(fptr, &map, 1);
3153 mutex_enter(&fptr->fcip_rt_mutex);
3154 frp = fcip_lookup_rtable(fptr, &nhdr->net_src_addr,
3156 mutex_exit(&fptr->fcip_rt_mutex);
3158 (void) fcip_add_dest(fptr, frp);
3175 struct fcip *fptr = (struct fcip *)arg;
3179 CALLB_CPR_INIT(&fptr->fcip_cpr_info, &fptr->fcip_sendup_mutex,
3182 mutex_enter(&fptr->fcip_sendup_mutex);
3185 while (fptr->fcip_sendup_thr_initted &&
3186 fptr->fcip_sendup_head == NULL) {
3187 CALLB_CPR_SAFE_BEGIN(&fptr->fcip_cpr_info);
3188 cv_wait(&fptr->fcip_sendup_cv,
3189 &fptr->fcip_sendup_mutex);
3190 CALLB_CPR_SAFE_END(&fptr->fcip_cpr_info,
3191 &fptr->fcip_sendup_mutex);
3194 if (fptr->fcip_sendup_thr_initted == 0) {
3201 msg_elem = fptr->fcip_sendup_head;
3202 fptr->fcip_sendup_head = msg_elem->fcipsu_next;
3204 mutex_exit(&fptr->fcip_sendup_mutex);
3212 mutex_enter(&fptr->fcip_mutex);
3213 if (fptr->fcip_ipq && canputnext(fptr->fcip_ipq)) {
3214 ip4q = fptr->fcip_ipq;
3215 mutex_exit(&fptr->fcip_mutex);
3218 mutex_exit(&fptr->fcip_mutex);
3222 fcip_sendup(fptr, msg_elem->fcipsu_mp,
3230 mutex_enter(&fptr->fcip_mutex);
3231 ASSERT(fptr->fcip_ub_upstream > 0);
3232 fptr->fcip_ub_upstream--;
3233 mutex_exit(&fptr->fcip_mutex);
3236 kmem_cache_free(fptr->fcip_sendup_cache, (void *)msg_elem);
3237 mutex_enter(&fptr->fcip_sendup_mutex);
3238 fptr->fcip_sendup_cnt--;
3243 CALLB_CPR_EXIT(&fptr->fcip_cpr_info);
3245 mutex_exit(&fptr->fcip_sendup_mutex);
3249 cv_signal(&fptr->fcip_sendup_cv);
3267 struct fcip *fptr;
3271 fptr = fport->fcipp_fcip;
3282 mutex_enter(&fptr->fcip_mutex);
3283 ASSERT(fptr->fcip_ub_upstream > 0);
3284 fptr->fcip_ub_upstream--;
3285 cv_signal(&fptr->fcip_ub_cv);
3286 mutex_exit(&fptr->fcip_mutex);
3299 fcip_sendup(struct fcip *fptr, mblk_t *mp, struct fcipstr *(*acceptfunc)())
3330 if ((slp = (*acceptfunc)(fcipstrup, fptr, type, dhostp)) == NULL) {
3341 for (; nslp = (*acceptfunc)(slp->sl_nextp, fptr, type, dhostp);
3352 } else if ((nmp = fcip_addudind(fptr, nmp,
3369 } else if ((mp = fcip_addudind(fptr, mp, nhdr, type))) {
3390 fcip_accept(struct fcipstr *slp, struct fcip *fptr, int type, la_wwn_t *dhostp)
3403 if ((slp->sl_fcip == fptr) && (type == sap)) {
3414 fcip_addudind(struct fcip *fptr, mblk_t *mp, fcph_network_hdr_t *nhdr,
3437 fptr->fcip_allocbfail++;
3634 struct fcip *fptr;
3641 fptr = slp->sl_fcip;
3670 if (tslp->sl_fcip == fptr) {
3682 fcip_setipq(fptr);
3692 fcip_setipq(struct fcip *fptr)
3703 if (slp->sl_fcip == fptr) {
3719 if (fcip_check_port_exists(fptr)) {
3720 /* fptr passed to us is stale */
3724 mutex_enter(&fptr->fcip_mutex);
3726 fptr->fcip_ipq = ipq;
3728 fptr->fcip_ipq = NULL;
3730 mutex_exit(&fptr->fcip_mutex);
3770 struct fcip *fptr;
3780 fptr = slp->sl_fcip;
3784 (fptr == NULL)) {
3804 fptr->fcip_wantw = 1;
3806 } else if (fptr->fcip_flags & FCIP_PROMISC) {
3816 fdestp = fcip_get_dest(fptr, &headerp->net_dest_addr);
3825 (void) fcip_start(wq, mp, fptr, fdestp, KM_SLEEP);
4017 struct fcip *fptr;
4022 fptr = slp->sl_fcip;
4032 if (fptr && mp) {
4034 fdestp = fcip_get_dest(fptr,
4040 if (fcip_start(wq, mp, fptr, fdestp,
4072 fcip_start(queue_t *wq, mblk_t *mp, struct fcip *fptr,
4079 fcip_port_info_t *fport = fptr->fcip_port_info;
4094 if (fptr->fcip_flags & FCIP_LINK_DOWN) {
4139 fcip_pkt = fcip_pkt_alloc(fptr, mp, flags, datalen);
4187 fptr->fcip_opackets++;
4319 struct fcip *fptr;
4330 fptr = fcip_pkt->fcip_pkt_fptr;
4331 fport = fptr->fcip_port_info;
4336 did = fptr->fcip_broadcast_did;
4344 mutex_enter(&fptr->fcip_mutex);
4347 mutex_exit(&fptr->fcip_mutex);
4351 } else if (fptr->fcip_port_state == FCIP_PORT_OFFLINE) {
4352 mutex_exit(&fptr->fcip_mutex);
4357 mutex_exit(&fptr->fcip_mutex);
4363 mutex_enter(&fptr->fcip_rt_mutex);
4369 mutex_exit(&fptr->fcip_rt_mutex);
4387 mutex_exit(&fptr->fcip_rt_mutex);
4402 (void) fcip_do_plogi(fptr, frp);
4412 mutex_enter(&fptr->fcip_rt_mutex);
4415 mutex_exit(&fptr->fcip_rt_mutex);
4498 fcip_handle_topology(struct fcip *fptr)
4501 fcip_port_info_t *fport = fptr->fcip_port_info;
4503 ASSERT(mutex_owned(&fptr->fcip_mutex));
4518 fptr->fcip_broadcast_did = fcip_get_broadcast_did(fptr);
4519 mutex_exit(&fptr->fcip_mutex);
4520 (void) fcip_dest_add_broadcast_entry(fptr, 0);
4521 mutex_enter(&fptr->fcip_mutex);
4526 fptr->fcip_instance, fport->fcipp_topology));
4546 fptr->fcip_port_state = FCIP_PORT_ONLINE;
4553 mutex_exit(&fptr->fcip_mutex);
4554 fcip_rt_update(fptr, port_map, listlen);
4555 mutex_enter(&fptr->fcip_mutex);
4580 fptr->fcip_port_state = FCIP_PORT_ONLINE;
4582 if (!(fptr->fcip_flags & FCIP_REG_INPROGRESS)) {
4583 fptr->fcip_flags |= FCIP_REG_INPROGRESS;
4584 if (taskq_dispatch(fptr->fcip_tq, fcip_port_ns,
4585 fptr, KM_NOSLEEP) == 0) {
4586 fptr->fcip_flags &= ~FCIP_REG_INPROGRESS;
4597 fptr->fcip_port_state = FCIP_PORT_ONLINE;
4604 mutex_exit(&fptr->fcip_mutex);
4605 fcip_rt_update(fptr, port_map, listlen);
4606 mutex_enter(&fptr->fcip_mutex);
4625 struct fcip *fptr = (struct fcip *)arg;
4626 fcip_port_info_t *fport = fptr->fcip_port_info;
4631 mutex_enter(&fptr->fcip_mutex);
4632 if ((fptr->fcip_flags & (FCIP_DETACHING | FCIP_DETACHED)) ||
4633 (fptr->fcip_flags & (FCIP_SUSPENDED | FCIP_POWER_DOWN))) {
4634 fptr->fcip_flags &= ~FCIP_REG_INPROGRESS;
4635 mutex_exit(&fptr->fcip_mutex);
4638 mutex_exit(&fptr->fcip_mutex);
4665 (void) fc_ulp_port_ns(fptr->fcip_port_info->fcipp_handle,
4668 mutex_enter(&fptr->fcip_mutex);
4669 fptr->fcip_flags &= ~FCIP_REG_INPROGRESS;
4670 mutex_exit(&fptr->fcip_mutex);
4681 fcip_init_port(struct fcip *fptr)
4684 fcip_port_info_t *fport = fptr->fcip_port_info;
4692 mutex_enter(&fptr->fcip_mutex);
4701 if (fcip_setup_mac_addr(fptr) == FCIP_INVALID_WWN) {
4702 fptr->fcip_port_state = FCIP_PORT_OFFLINE;
4710 fcip_rt_flush(fptr);
4715 fcip_kstat_init(fptr);
4720 fptr->fcip_ub_nbufs = fcip_ub_nbufs;
4721 tok_buf_size = sizeof (*fptr->fcip_ub_tokens) * fcip_ub_nbufs;
4730 fptr->fcip_ub_tokens = kmem_zalloc(tok_buf_size, KM_SLEEP);
4732 if (fptr->fcip_ub_tokens == NULL) {
4736 fptr->fcip_instance));
4739 rval = fc_ulp_uballoc(fport->fcipp_handle, &fptr->fcip_ub_nbufs,
4740 fcip_ub_size, FC_TYPE_IS8802_SNAP, fptr->fcip_ub_tokens);
4745 fptr->fcip_instance, rval));
4753 fptr->fcip_port_state = FCIP_PORT_OFFLINE;
4769 if (fptr->fcip_ub_nbufs != fcip_ub_nbufs) {
4790 (void) sprintf(buf, "fcip%d_cache", fptr->fcip_instance);
4791 fptr->fcip_xmit_cache = kmem_cache_create(buf,
4796 (void) sprintf(buf, "fcip%d_sendup_cache", fptr->fcip_instance);
4797 fptr->fcip_sendup_cache = kmem_cache_create(buf,
4801 if (fptr->fcip_xmit_cache == NULL) {
4804 tnf_int, instance, fptr->fcip_instance));
4807 fptr->fcip_instance));
4817 fcip_handle_topology(fptr);
4818 mutex_exit(&fptr->fcip_mutex);
4819 if (fcip_dest_add_broadcast_entry(fptr, 1) != FC_SUCCESS) {
4822 fptr->fcip_instance));
4823 mutex_enter(&fptr->fcip_mutex);
4836 if (fptr->fcip_kstatp) {
4837 kstat_delete(fptr->fcip_kstatp);
4838 fptr->fcip_kstatp = NULL;
4841 if (fptr->fcip_xmit_cache) {
4842 kmem_cache_destroy(fptr->fcip_xmit_cache);
4843 fptr->fcip_xmit_cache = NULL;
4846 if (fptr->fcip_sendup_cache) {
4847 kmem_cache_destroy(fptr->fcip_sendup_cache);
4848 fptr->fcip_sendup_cache = NULL;
4852 if (fptr->fcip_ub_tokens) {
4853 uint64_t *tokens = fptr->fcip_ub_tokens;
4854 fptr->fcip_ub_tokens = NULL;
4856 mutex_exit(&fptr->fcip_mutex);
4857 (void) fc_ulp_ubfree(fport->fcipp_handle, fptr->fcip_ub_nbufs,
4862 mutex_exit(&fptr->fcip_mutex);
4872 fcip_setup_mac_addr(struct fcip *fptr)
4874 fcip_port_info_t *fport = fptr->fcip_port_info;
4876 ASSERT(mutex_owned(&fptr->fcip_mutex));
4878 fptr->fcip_addrflags = 0;
4891 wwn_to_ether(&fport->fcipp_nwwn, &fptr->fcip_macaddr);
4892 fcip_ether_to_str(&fptr->fcip_macaddr, etherstr);
4896 fptr->fcip_addrflags = (FCIP_FACTADDR_PRESENT |
4915 fcip_rt_flush(struct fcip *fptr)
4919 mutex_enter(&fptr->fcip_rt_mutex);
4922 frtp = fptr->fcip_rtable[index];
4928 fptr->fcip_rtable[index] = NULL;
4930 mutex_exit(&fptr->fcip_rt_mutex);
4949 struct fcip *fptr = NULL;
4959 fptr = fport->fcipp_fcip;
4964 if (fptr) {
4965 mutex_enter(&fptr->fcip_mutex);
4966 instance = ddi_get_instance(fptr->fcip_dip);
4971 tid = fptr->fcip_timeout_id;
4972 fptr->fcip_timeout_id = NULL;
4974 mutex_exit(&fptr->fcip_mutex);
4976 mutex_enter(&fptr->fcip_mutex);
4984 mutex_enter(&fptr->fcip_sendup_mutex);
4985 if (fptr->fcip_sendup_thr_initted) {
4986 fptr->fcip_sendup_thr_initted = 0;
4987 cv_signal(&fptr->fcip_sendup_cv);
4988 cv_wait(&fptr->fcip_sendup_cv,
4989 &fptr->fcip_sendup_mutex);
4991 ASSERT(fptr->fcip_sendup_head == NULL);
4992 fptr->fcip_sendup_head = fptr->fcip_sendup_tail = NULL;
4993 mutex_exit(&fptr->fcip_sendup_mutex);
4998 if (fptr->fcip_tq) {
4999 taskq_t *tq = fptr->fcip_tq;
5001 fptr->fcip_tq = NULL;
5003 mutex_exit(&fptr->fcip_mutex);
5005 mutex_enter(&fptr->fcip_mutex);
5008 if (fptr->fcip_kstatp) {
5009 kstat_delete(fptr->fcip_kstatp);
5010 fptr->fcip_kstatp = NULL;
5014 fcip_rt_flush(fptr);
5016 if (fptr->fcip_xmit_cache) {
5017 kmem_cache_destroy(fptr->fcip_xmit_cache);
5018 fptr->fcip_xmit_cache = NULL;
5021 if (fptr->fcip_sendup_cache) {
5022 kmem_cache_destroy(fptr->fcip_sendup_cache);
5023 fptr->fcip_sendup_cache = NULL;
5026 fcip_cleanup_dest(fptr);
5029 if (fptr->fcip_ub_tokens) {
5030 uint64_t *tokens = fptr->fcip_ub_tokens;
5032 fptr->fcip_ub_tokens = NULL;
5033 mutex_exit(&fptr->fcip_mutex);
5044 fptr->fcip_ub_nbufs, tokens);
5049 mutex_exit(&fptr->fcip_mutex);
5052 mutex_destroy(&fptr->fcip_mutex);
5053 mutex_destroy(&fptr->fcip_ub_mutex);
5054 mutex_destroy(&fptr->fcip_rt_mutex);
5055 mutex_destroy(&fptr->fcip_dest_mutex);
5056 mutex_destroy(&fptr->fcip_sendup_mutex);
5057 cv_destroy(&fptr->fcip_farp_cv);
5058 cv_destroy(&fptr->fcip_sendup_cv);
5059 cv_destroy(&fptr->fcip_ub_cv);
5122 struct fcip *fptr;
5131 fptr = slp->sl_fcip;
5162 if (fptr) {
5163 fcip_ether_to_str(&fptr->fcip_macaddr, etherstr);
5166 ether_bcopy(&fptr->fcip_macaddr, &dlap->dl_phys);
5187 struct fcip *fptr;
5211 fptr = slp->sl_fcip;
5213 if (fptr == NULL) {
5218 fport = fptr->fcip_port_info;
5246 fdestp = fcip_get_dest(fptr, &wwn);
5275 ether_to_wwn(&fptr->fcip_macaddr, &wwn);
5338 (void) fcip_start(wq, mp, fptr, fdestp, KM_SLEEP);
5352 struct fcip *fptr;
5378 if ((fptr = fport->fcipp_fcip) == NULL) {
5382 ddi_get_instance(fptr->fcip_dip)));
5384 if (ppa == ddi_get_instance(fptr->fcip_dip)) {
5411 fptr = ddi_get_soft_state(fcip_softp, ppa);
5412 if (fptr == NULL) {
5422 slp->sl_fcip = fptr;
5428 mutex_enter(&fptr->fcip_mutex);
5429 if (fptr->fcip_flags & FCIP_LINK_DOWN) {
5432 mutex_exit(&fptr->fcip_mutex);
5473 struct fcip *fptr;
5491 fptr = slp->sl_fcip;
5493 if (fptr == NULL) {
5520 ether_bcopy(&fptr->fcip_macaddr, &fcipaddr.dl_phys);
5523 fcip_setipq(fptr);
5564 struct fcip *fptr;
5577 fptr = slp->sl_fcip;
5579 if (fptr == NULL) {
5584 fport = fptr->fcip_port_info;
5596 ether_bcopy(&fptr->fcip_macaddr, &addr);
5619 struct fcip *fptr;
5655 if ((fptr = slp->sl_fcip) == NULL) {
5687 if (fc_ulp_port_ns(fptr->fcip_port_info->fcipp_handle,
5734 struct fcip *fptr;
5741 fptr = slp->sl_fcip;
5742 if (fptr == NULL) {
5757 fport = fptr->fcip_port_info;
5839 struct fcip *fptr;
5845 fptr = fport->fcipp_fcip;
5859 fcip_pkt->fcip_pkt_fptr = fptr;
5898 struct fcip *fptr;
5902 fptr = fport->fcipp_fcip;
5904 ASSERT(fptr == fcip_pkt->fcip_pkt_fptr);
5917 fcip_get_dest(struct fcip *fptr, la_wwn_t *pwwn)
5938 if (fcip_check_port_exists(fptr)) {
5939 /* fptr is stale, return fdestp */
5942 fport = fptr->fcip_port_info;
5948 mutex_enter(&fptr->fcip_dest_mutex);
5949 fdestp = fptr->fcip_dest[hash_bucket];
5958 mutex_exit(&fptr->fcip_dest_mutex);
5965 mutex_exit(&fptr->fcip_dest_mutex);
5972 mutex_enter(&fptr->fcip_rt_mutex);
5973 frp = fcip_lookup_rtable(fptr, pwwn, FCIP_COMPARE_NWWN);
5974 mutex_exit(&fptr->fcip_rt_mutex);
6049 fcip_rt_update(fptr, &map, 1);
6051 mutex_enter(&fptr->fcip_rt_mutex);
6052 frp = fcip_lookup_rtable(fptr, pwwn,
6054 mutex_exit(&fptr->fcip_rt_mutex);
6056 fdestp = fcip_add_dest(fptr, frp);
6064 fdestp = fcip_do_farp(fptr, pwwn, NULL,
6073 fdestp = fcip_add_dest(fptr, frp);
6116 fcip_add_dest(struct fcip *fptr, struct fcip_routing_table *frp)
6128 mutex_enter(&fptr->fcip_dest_mutex);
6135 fdestp = fptr->fcip_dest[hash_bucket];
6142 mutex_exit(&fptr->fcip_dest_mutex);
6156 fdest_new->fcipd_next = fptr->fcip_dest[hash_bucket];
6160 fptr->fcip_dest[hash_bucket] = fdest_new;
6163 mutex_exit(&fptr->fcip_dest_mutex);
6171 fcip_cleanup_dest(struct fcip *fptr)
6177 mutex_enter(&fptr->fcip_dest_mutex);
6180 fdestp = fptr->fcip_dest[i];
6186 fptr->fcip_dest[i] = NULL;
6189 mutex_exit(&fptr->fcip_dest_mutex);
6203 fcip_do_farp(struct fcip *fptr, la_wwn_t *pwwn, char *ip_addr,
6208 fcip_port_info_t *fport = fptr->fcip_port_info;
6218 bdestp = fcip_get_dest(fptr, &broadcast_wwn);
6224 fcip_pkt = fcip_ipkt_alloc(fptr, sizeof (la_els_farp_t),
6316 mutex_enter(&fptr->fcip_mutex);
6317 fptr->fcip_farp_rsp_flag = 0;
6318 while (!fptr->fcip_farp_rsp_flag) {
6319 if (cv_timedwait(&fptr->fcip_farp_cv, &fptr->fcip_mutex,
6325 fptr->fcip_farp_rsp_flag = 1;
6332 mutex_enter(&fptr->fcip_rt_mutex);
6333 frp = fcip_lookup_rtable(fptr, pwwn, FCIP_COMPARE_NWWN);
6334 mutex_exit(&fptr->fcip_rt_mutex);
6338 fdestp = fcip_get_dest(fptr, pwwn);
6344 fptr->fcip_farp_rsp_flag = 0;
6348 mutex_exit(&fptr->fcip_mutex);
6369 fcip_do_plogi(struct fcip *fptr, struct fcip_routing_table *frp)
6373 fcip_port_info_t *fport = fptr->fcip_port_info;
6395 fcip_pkt = fcip_ipkt_alloc(fptr, sizeof (la_els_logi_t),
6429 fcip_pkt->fcip_pkt_ttl = fptr->fcip_timeout_ticks + fc_pkt->pkt_timeout;
6471 struct fcip *fptr;
6485 fptr = fcip_pkt->fcip_pkt_fptr;
6486 fport = fptr->fcip_port_info;
6498 mutex_enter(&fptr->fcip_rt_mutex);
6500 frp->fcipr_invalid_timeout = fptr->fcip_timeout_ticks +
6502 mutex_exit(&fptr->fcip_rt_mutex);
6512 mutex_enter(&fptr->fcip_rt_mutex);
6517 mutex_exit(&fptr->fcip_rt_mutex);
6530 fcip_pkt_alloc(struct fcip *fptr, mblk_t *bp, int flags, int datalen)
6537 fcip_port_info_t *fport = fptr->fcip_port_info;
6539 fcip_pkt = kmem_cache_alloc(fptr->fcip_xmit_cache, flags);
6613 struct fcip *fptr = fcip_pkt->fcip_pkt_fptr;
6627 (void) fc_ulp_uninit_packet(fptr->fcip_port_info->fcipp_handle, fc_pkt);
6629 kmem_cache_free(fptr->fcip_xmit_cache, (void *)fcip_pkt);
6637 fcip_ipkt_alloc(struct fcip *fptr, int cmdlen, int resplen,
6643 fcip_port_info_t *fport = fptr->fcip_port_info;
6662 fcip_pkt->fcip_pkt_fptr = fptr;
6674 if (ddi_dma_alloc_handle(fptr->fcip_dip,
6728 if (ddi_dma_alloc_handle(fptr->fcip_dip,
6801 if (!MUTEX_HELD(&fptr->fcip_mutex)) {
6803 mutex_enter(&fptr->fcip_mutex);
6806 fptr->fcip_num_ipkts_pending++;
6809 mutex_exit(&fptr->fcip_mutex);
6827 struct fcip *fptr = fcip_pkt->fcip_pkt_fptr;
6828 fcip_port_info_t *fport = fptr->fcip_port_info;
6830 ASSERT(fptr != NULL);
6831 ASSERT(!mutex_owned(&fptr->fcip_mutex));
6834 mutex_enter(&fptr->fcip_mutex);
6835 if (fptr->fcip_num_ipkts_pending) /* Safety check */
6836 fptr->fcip_num_ipkts_pending--;
6837 mutex_exit(&fptr->fcip_mutex);
6872 struct fcip *fptr = fcip_pkt->fcip_pkt_fptr;
6900 fcip_pkt->fcip_pkt_ttl = fptr->fcip_timeout_ticks + fc_pkt->pkt_timeout;
6912 struct fcip *fptr = fcip_pkt->fcip_pkt_fptr;
6913 fcip_port_info_t *fport = fptr->fcip_port_info;
6933 did = fptr->fcip_broadcast_did;
6958 fcip_pkt->fcip_pkt_ttl = fptr->fcip_timeout_ticks + fc_pkt->pkt_timeout;
7035 fcip_dest_add_broadcast_entry(struct fcip *fptr, int new_flag)
7046 did = fptr->fcip_broadcast_did;
7063 fcip_rt_update(fptr, &map, 1);
7064 mutex_enter(&fptr->fcip_rt_mutex);
7065 frp = fcip_lookup_rtable(fptr, &broadcast_wwn, FCIP_COMPARE_NWWN);
7066 mutex_exit(&fptr->fcip_rt_mutex);
7070 (void) fcip_add_dest(fptr, frp);
7082 fcip_rt_update(fptr, &map, 1);
7083 mutex_enter(&fptr->fcip_rt_mutex);
7084 frp = fcip_lookup_rtable(fptr, &broadcast_wwn, FCIP_COMPARE_NWWN);
7085 mutex_exit(&fptr->fcip_rt_mutex);
7089 (void) fcip_add_dest(fptr, frp);
7099 fcip_get_broadcast_did(struct fcip *fptr)
7101 fcip_port_info_t *fport = fptr->fcip_port_info;
7107 tnf_opaque, fptr, fptr));
7171 fptr->fcip_instance));
7197 struct fcip *fptr = (struct fcip *)arg;
7205 mutex_enter(&fptr->fcip_mutex);
7207 fptr->fcip_flags |= FCIP_IN_TIMEOUT;
7208 fptr->fcip_timeout_ticks += fcip_tick_incr;
7210 if (fptr->fcip_flags & (FCIP_DETACHED | FCIP_DETACHING | \
7212 fptr->fcip_flags &= ~(FCIP_IN_TIMEOUT);
7213 mutex_exit(&fptr->fcip_mutex);
7217 if (fptr->fcip_port_state == FCIP_PORT_OFFLINE) {
7218 if (fptr->fcip_timeout_ticks > fptr->fcip_mark_offline) {
7219 fptr->fcip_flags |= FCIP_LINK_DOWN;
7222 if (!fptr->fcip_flags & FCIP_RTE_REMOVING) {
7225 mutex_exit(&fptr->fcip_mutex);
7238 mutex_enter(&fptr->fcip_rt_mutex);
7240 frtp = fptr->fcip_rtable[index];
7243 (fptr->fcip_timeout_ticks >
7254 mutex_enter(&fptr->fcip_mutex);
7255 fptr->fcip_flags |= FCIP_RTE_REMOVING;
7256 mutex_exit(&fptr->fcip_mutex);
7258 if (taskq_dispatch(fptr->fcip_tq,
7259 fcip_rte_remove_deferred, fptr,
7268 mutex_enter(&fptr->fcip_mutex);
7269 fptr->fcip_flags &=
7271 mutex_exit(&fptr->fcip_mutex);
7277 mutex_exit(&fptr->fcip_rt_mutex);
7280 mutex_enter(&fptr->fcip_dest_mutex);
7286 fdestp = fptr->fcip_dest[i];
7296 if (fptr->fcip_timeout_ticks >
7302 if (taskq_dispatch(fptr->fcip_tq,
7334 mutex_exit(&fptr->fcip_dest_mutex);
7339 mutex_enter(&fptr->fcip_mutex);
7341 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
7343 fptr->fcip_flags &= ~(FCIP_IN_TIMEOUT);
7344 mutex_exit(&fptr->fcip_mutex);
7357 struct fcip *fptr;
7363 fptr = fcip_pkt->fcip_pkt_fptr;
7364 fport = fptr->fcip_port_info;
7420 struct fcip *fptr = (struct fcip *)arg;
7428 mutex_enter(&fptr->fcip_rt_mutex);
7430 frtp = fptr->fcip_rtable[index];
7441 mutex_enter(&fptr->fcip_dest_mutex);
7446 fdestp = fptr->fcip_dest[hash_bucket];
7462 mutex_exit(&fptr->fcip_dest_mutex);
7496 fptr->fcip_rtable[index] =
7512 mutex_exit(&fptr->fcip_rt_mutex);
7516 mutex_enter(&fptr->fcip_mutex);
7517 fptr->fcip_flags &= ~FCIP_RTE_REMOVING;
7518 mutex_exit(&fptr->fcip_mutex);
7526 fcip_port_get_num_pkts(struct fcip *fptr)
7532 ASSERT(mutex_owned(&fptr->fcip_dest_mutex));
7535 fdestp = fptr->fcip_dest[i];
7558 fcip_plogi_in_progress(struct fcip *fptr)
7563 ASSERT(mutex_owned(&fptr->fcip_rt_mutex));
7566 frp = fptr->fcip_rtable[i];
7584 fcip_check_port_exists(struct fcip *fptr)
7590 fport = fptr->fcip_port_info;