1133 if ((fcip_num_instances == 1) &&
1134 (fcip_minor_node_created == 1)) {
1135 /* Remove minor node iff this is the last instance */
1136 ddi_remove_minor_node(fcip_module_dip, NULL);
1137 }
1138
1139 mutex_exit(&fcip_global_mutex);
1140
1141 goto port_attach_cleanup;
1142 }
1143
1144 mutex_enter(&fptr->fcip_mutex);
1145 fptr->fcip_flags &= ~FCIP_ATTACHING;
1146 fptr->fcip_flags |= FCIP_INITED;
1147 fptr->fcip_timeout_ticks = 0;
1148
1149 /*
1150 * start the timeout threads
1151 */
1152 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
1153 drv_usectohz(1000000));
1154
1155 mutex_exit(&fptr->fcip_mutex);
1156 mutex_enter(&fcip_global_mutex);
1157 fcip_num_attaching--;
1158 ASSERT(fcip_num_attaching >= 0);
1159 mutex_exit(&fcip_global_mutex);
1160 rval = FC_SUCCESS;
1161 return (rval);
1162
1163 port_attach_cleanup:
1164 mutex_enter(&fcip_global_mutex);
1165 (void) fcip_softstate_free(fport);
1166 fcip_num_attaching--;
1167 ASSERT(fcip_num_attaching >= 0);
1168 mutex_exit(&fcip_global_mutex);
1169 rval = FC_FAILURE;
1170 return (rval);
1171 }
1172
1173
1243 }
1244 frp = frp->fcipr_next;
1245 }
1246 }
1247 mutex_exit(&fptr->fcip_rt_mutex);
1248
1249 /*
1250 * fcip_handle_topology will update the port entries in the
1251 * routing table.
1252 * fcip_handle_topology also takes care of resetting the
1253 * fcipr_state field in the routing table structure. The entries
1254 * were set to RT_INVALID during suspend.
1255 */
1256 fcip_handle_topology(fptr);
1257
1258 done:
1259 /*
1260 * Restart the timeout thread
1261 */
1262 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
1263 drv_usectohz(1000000));
1264 mutex_exit(&fptr->fcip_mutex);
1265 return (rval);
1266 }
1267
1268
1269 /*
1270 * Insert a destination port entry into the routing table for
1271 * this port
1272 */
1273 static void
1274 fcip_rt_update(struct fcip *fptr, fc_portmap_t *devlist, uint32_t listlen)
1275 {
1276 struct fcip_routing_table *frp;
1277 fcip_port_info_t *fport = fptr->fcip_port_info;
1278 int hash_bucket, i;
1279 fc_portmap_t *pmap;
1280 char wwn_buf[20];
1281
1282 FCIP_TNF_PROBE_2((fcip_rt_update, "fcip io", /* CSTYLED */,
1283 tnf_string, msg, "enter",
7322 * not-to-be-timedout packets quickly
7323 */
7324 fcip_pkt = fdestp->fcipd_head;
7325 if (fcip_pkt == NULL) {
7326 break;
7327 }
7328 }
7329 }
7330 mutex_exit(&fdestp->fcipd_mutex);
7331 fdestp = fdestp->fcipd_next;
7332 }
7333 }
7334 mutex_exit(&fptr->fcip_dest_mutex);
7335
7336 /*
7337 * reschedule the timeout thread
7338 */
7339 mutex_enter(&fptr->fcip_mutex);
7340
7341 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
7342 drv_usectohz(1000000));
7343 fptr->fcip_flags &= ~(FCIP_IN_TIMEOUT);
7344 mutex_exit(&fptr->fcip_mutex);
7345 }
7346
7347
7348 /*
7349 * This routine is either called from taskq or directly from fcip_timeout
7350 * does the actual job of aborting the packet
7351 */
7352 static void
7353 fcip_pkt_timeout(void *arg)
7354 {
7355 fcip_pkt_t *fcip_pkt = (fcip_pkt_t *)arg;
7356 struct fcip_dest *fdestp;
7357 struct fcip *fptr;
7358 fc_packet_t *fc_pkt;
7359 fcip_port_info_t *fport;
7360 int rval;
7361
7362 fdestp = fcip_pkt->fcip_pkt_dest;
|
1133 if ((fcip_num_instances == 1) &&
1134 (fcip_minor_node_created == 1)) {
1135 /* Remove minor node iff this is the last instance */
1136 ddi_remove_minor_node(fcip_module_dip, NULL);
1137 }
1138
1139 mutex_exit(&fcip_global_mutex);
1140
1141 goto port_attach_cleanup;
1142 }
1143
1144 mutex_enter(&fptr->fcip_mutex);
1145 fptr->fcip_flags &= ~FCIP_ATTACHING;
1146 fptr->fcip_flags |= FCIP_INITED;
1147 fptr->fcip_timeout_ticks = 0;
1148
1149 /*
1150 * start the timeout threads
1151 */
1152 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
1153 drv_sectohz(1));
1154
1155 mutex_exit(&fptr->fcip_mutex);
1156 mutex_enter(&fcip_global_mutex);
1157 fcip_num_attaching--;
1158 ASSERT(fcip_num_attaching >= 0);
1159 mutex_exit(&fcip_global_mutex);
1160 rval = FC_SUCCESS;
1161 return (rval);
1162
1163 port_attach_cleanup:
1164 mutex_enter(&fcip_global_mutex);
1165 (void) fcip_softstate_free(fport);
1166 fcip_num_attaching--;
1167 ASSERT(fcip_num_attaching >= 0);
1168 mutex_exit(&fcip_global_mutex);
1169 rval = FC_FAILURE;
1170 return (rval);
1171 }
1172
1173
1243 }
1244 frp = frp->fcipr_next;
1245 }
1246 }
1247 mutex_exit(&fptr->fcip_rt_mutex);
1248
1249 /*
1250 * fcip_handle_topology will update the port entries in the
1251 * routing table.
1252 * fcip_handle_topology also takes care of resetting the
1253 * fcipr_state field in the routing table structure. The entries
1254 * were set to RT_INVALID during suspend.
1255 */
1256 fcip_handle_topology(fptr);
1257
1258 done:
1259 /*
1260 * Restart the timeout thread
1261 */
1262 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
1263 drv_sectohz(1));
1264 mutex_exit(&fptr->fcip_mutex);
1265 return (rval);
1266 }
1267
1268
1269 /*
1270 * Insert a destination port entry into the routing table for
1271 * this port
1272 */
1273 static void
1274 fcip_rt_update(struct fcip *fptr, fc_portmap_t *devlist, uint32_t listlen)
1275 {
1276 struct fcip_routing_table *frp;
1277 fcip_port_info_t *fport = fptr->fcip_port_info;
1278 int hash_bucket, i;
1279 fc_portmap_t *pmap;
1280 char wwn_buf[20];
1281
1282 FCIP_TNF_PROBE_2((fcip_rt_update, "fcip io", /* CSTYLED */,
1283 tnf_string, msg, "enter",
7322 * not-to-be-timedout packets quickly
7323 */
7324 fcip_pkt = fdestp->fcipd_head;
7325 if (fcip_pkt == NULL) {
7326 break;
7327 }
7328 }
7329 }
7330 mutex_exit(&fdestp->fcipd_mutex);
7331 fdestp = fdestp->fcipd_next;
7332 }
7333 }
7334 mutex_exit(&fptr->fcip_dest_mutex);
7335
7336 /*
7337 * reschedule the timeout thread
7338 */
7339 mutex_enter(&fptr->fcip_mutex);
7340
7341 fptr->fcip_timeout_id = timeout(fcip_timeout, fptr,
7342 drv_sectohz(1));
7343 fptr->fcip_flags &= ~(FCIP_IN_TIMEOUT);
7344 mutex_exit(&fptr->fcip_mutex);
7345 }
7346
7347
7348 /*
7349 * This routine is either called from taskq or directly from fcip_timeout
7350 * does the actual job of aborting the packet
7351 */
7352 static void
7353 fcip_pkt_timeout(void *arg)
7354 {
7355 fcip_pkt_t *fcip_pkt = (fcip_pkt_t *)arg;
7356 struct fcip_dest *fdestp;
7357 struct fcip *fptr;
7358 fc_packet_t *fc_pkt;
7359 fcip_port_info_t *fport;
7360 int rval;
7361
7362 fdestp = fcip_pkt->fcip_pkt_dest;
|