Lines Matching refs:lport

135 static struct fc_fcp_pkt *fc_fcp_pkt_alloc(struct fc_lport *lport, gfp_t gfp)  in fc_fcp_pkt_alloc()  argument
137 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); in fc_fcp_pkt_alloc()
143 fsp->lp = lport; in fc_fcp_pkt_alloc()
150 per_cpu_ptr(lport->stats, get_cpu())->FcpPktAllocFails++; in fc_fcp_pkt_alloc()
319 struct fc_lport *lport; in fc_fcp_ddp_setup() local
321 lport = fsp->lp; in fc_fcp_ddp_setup()
323 (lport->lro_enabled) && (lport->tt.ddp_setup)) { in fc_fcp_ddp_setup()
324 if (lport->tt.ddp_setup(lport, xid, scsi_sglist(fsp->cmd), in fc_fcp_ddp_setup()
337 struct fc_lport *lport; in fc_fcp_ddp_done() local
345 lport = fsp->lp; in fc_fcp_ddp_done()
346 if (lport->tt.ddp_done) { in fc_fcp_ddp_done()
347 fsp->xfer_len = lport->tt.ddp_done(lport, fsp->xfer_ddp); in fc_fcp_ddp_done()
356 static void fc_fcp_can_queue_ramp_up(struct fc_lport *lport) in fc_fcp_can_queue_ramp_up() argument
358 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); in fc_fcp_can_queue_ramp_up()
362 spin_lock_irqsave(lport->host->host_lock, flags); in fc_fcp_can_queue_ramp_up()
375 can_queue = lport->host->can_queue << 1; in fc_fcp_can_queue_ramp_up()
380 lport->host->can_queue = can_queue; in fc_fcp_can_queue_ramp_up()
381 shost_printk(KERN_ERR, lport->host, "libfc: increased " in fc_fcp_can_queue_ramp_up()
385 spin_unlock_irqrestore(lport->host->host_lock, flags); in fc_fcp_can_queue_ramp_up()
398 static bool fc_fcp_can_queue_ramp_down(struct fc_lport *lport) in fc_fcp_can_queue_ramp_down() argument
400 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); in fc_fcp_can_queue_ramp_down()
405 spin_lock_irqsave(lport->host->host_lock, flags); in fc_fcp_can_queue_ramp_down()
414 can_queue = lport->host->can_queue; in fc_fcp_can_queue_ramp_down()
418 lport->host->can_queue = can_queue; in fc_fcp_can_queue_ramp_down()
422 spin_unlock_irqrestore(lport->host->host_lock, flags); in fc_fcp_can_queue_ramp_down()
434 static inline struct fc_frame *fc_fcp_frame_alloc(struct fc_lport *lport, in fc_fcp_frame_alloc() argument
439 fp = fc_frame_alloc(lport, len); in fc_fcp_frame_alloc()
443 per_cpu_ptr(lport->stats, get_cpu())->FcpFrameAllocFails++; in fc_fcp_frame_alloc()
446 fc_fcp_can_queue_ramp_down(lport); in fc_fcp_frame_alloc()
447 shost_printk(KERN_ERR, lport->host, in fc_fcp_frame_alloc()
449 "reducing can_queue to %d.\n", lport->host->can_queue); in fc_fcp_frame_alloc()
477 struct fc_lport *lport = fsp->lp; in fc_fcp_recv_data() local
540 stats = per_cpu_ptr(lport->stats, get_cpu()); in fc_fcp_recv_data()
546 lport->port_id); in fc_fcp_recv_data()
601 struct fc_lport *lport = fsp->lp; in fc_fcp_send_data() local
612 int using_sg = lport->sg_supp; in fc_fcp_send_data()
634 if (lport->seq_offload) { in fc_fcp_send_data()
635 t_blen = min(seq_blen, (size_t)lport->lso_max); in fc_fcp_send_data()
637 fsp, seq_blen, lport->lso_max, t_blen); in fc_fcp_send_data()
669 fp = fc_frame_alloc(lport, using_sg ? 0 : tlen); in fc_fcp_send_data()
725 error = fc_seq_send(lport, seq, fp); in fc_fcp_send_data()
781 struct fc_lport *lport = fsp->lp; in fc_fcp_recv() local
795 if (lport->state != LPORT_ST_READY) { in fc_fcp_recv()
797 lport->state, r_ctl); in fc_fcp_recv()
985 struct fc_lport *lport = fsp->lp; in fc_fcp_complete_locked() local
1027 fc_seq_send(lport, csp, conf_frame); in fc_fcp_complete_locked()
1064 static void fc_fcp_cleanup_each_cmd(struct fc_lport *lport, unsigned int id, in fc_fcp_cleanup_each_cmd() argument
1067 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); in fc_fcp_cleanup_each_cmd()
1121 static void fc_fcp_abort_io(struct fc_lport *lport) in fc_fcp_abort_io() argument
1123 fc_fcp_cleanup_each_cmd(lport, -1, -1, FC_HRD_ERROR); in fc_fcp_abort_io()
1134 static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) in fc_fcp_pkt_send() argument
1136 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); in fc_fcp_pkt_send()
1150 rc = lport->tt.fcp_cmd_send(lport, fsp, fc_fcp_recv); in fc_fcp_pkt_send()
1167 static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp, in fc_fcp_cmd_send() argument
1182 fp = fc_fcp_frame_alloc(lport, sizeof(fsp->cdb_cmd)); in fc_fcp_cmd_send()
1198 seq = fc_exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy, fsp, 0); in fc_fcp_cmd_send()
1292 struct fc_lport *lport = fsp->lp; in fc_lun_reset_send() local
1294 if (lport->tt.fcp_cmd_send(lport, fsp, fc_tm_done)) { in fc_lun_reset_send()
1313 static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp, in fc_lun_reset() argument
1348 FC_SCSI_DBG(lport, "lun reset failed\n"); in fc_lun_reset()
1356 FC_SCSI_DBG(lport, "lun reset to lun %u completed\n", lun); in fc_lun_reset()
1357 fc_fcp_cleanup_each_cmd(lport, id, lun, FC_CMD_ABORTED); in fc_lun_reset()
1406 static void fc_fcp_cleanup(struct fc_lport *lport) in fc_fcp_cleanup() argument
1408 fc_fcp_cleanup_each_cmd(lport, -1, -1, FC_ERROR); in fc_fcp_cleanup()
1462 struct fc_lport *lport; in fc_fcp_rec() local
1467 lport = fsp->lp; in fc_fcp_rec()
1477 fp = fc_fcp_frame_alloc(lport, sizeof(struct fc_els_rec)); in fc_fcp_rec()
1485 if (lport->tt.elsct_send(lport, rport->port_id, fp, ELS_REC, in fc_fcp_rec()
1487 2 * lport->r_a_tov)) { in fc_fcp_rec()
1720 struct fc_lport *lport = fsp->lp; in fc_fcp_srr() local
1734 fp = fc_fcp_frame_alloc(lport, sizeof(*srr)); in fc_fcp_srr()
1750 seq = fc_exch_seq_send(lport, fp, fc_fcp_srr_resp, in fc_fcp_srr()
1847 static inline int fc_fcp_lport_queue_ready(struct fc_lport *lport) in fc_fcp_lport_queue_ready() argument
1850 return (lport->state == LPORT_ST_READY) && in fc_fcp_lport_queue_ready()
1851 lport->link_up && !lport->qfull; in fc_fcp_lport_queue_ready()
1863 struct fc_lport *lport = shost_priv(shost); in fc_queuecommand() local
1887 if (!fc_fcp_lport_queue_ready(lport)) { in fc_queuecommand()
1888 if (lport->qfull) { in fc_queuecommand()
1889 if (fc_fcp_can_queue_ramp_down(lport)) in fc_queuecommand()
1890 shost_printk(KERN_ERR, lport->host, in fc_queuecommand()
1893 lport->host->can_queue); in fc_queuecommand()
1899 fsp = fc_fcp_pkt_alloc(lport, GFP_ATOMIC); in fc_queuecommand()
1920 stats = per_cpu_ptr(lport->stats, get_cpu()); in fc_queuecommand()
1940 rval = fc_fcp_pkt_send(lport, fsp); in fc_queuecommand()
1962 struct fc_lport *lport; in fc_io_compl() local
1975 lport = fsp->lp; in fc_io_compl()
1976 si = fc_get_scsi_internal(lport); in fc_io_compl()
1983 fc_fcp_can_queue_ramp_up(lport); in fc_io_compl()
2083 if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE) in fc_io_compl()
2106 struct fc_lport *lport; in fc_eh_abort() local
2116 lport = shost_priv(sc_cmd->device->host); in fc_eh_abort()
2117 if (lport->state != LPORT_ST_READY) in fc_eh_abort()
2119 else if (!lport->link_up) in fc_eh_abort()
2122 si = fc_get_scsi_internal(lport); in fc_eh_abort()
2158 struct fc_lport *lport; in fc_eh_device_reset() local
2168 lport = shost_priv(sc_cmd->device->host); in fc_eh_device_reset()
2170 if (lport->state != LPORT_ST_READY) in fc_eh_device_reset()
2173 FC_SCSI_DBG(lport, "Resetting rport (%6.6x)\n", rport->port_id); in fc_eh_device_reset()
2175 fsp = fc_fcp_pkt_alloc(lport, GFP_NOIO); in fc_eh_device_reset()
2191 rc = fc_lun_reset(lport, fsp, scmd_id(sc_cmd), sc_cmd->device->lun); in fc_eh_device_reset()
2207 struct fc_lport *lport = shost_priv(shost); in fc_eh_host_reset() local
2210 FC_SCSI_DBG(lport, "Resetting host\n"); in fc_eh_host_reset()
2212 fc_lport_reset(lport); in fc_eh_host_reset()
2214 while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies, in fc_eh_host_reset()
2218 if (fc_fcp_lport_queue_ready(lport)) { in fc_eh_host_reset()
2220 "on port (%6.6x)\n", lport->port_id); in fc_eh_host_reset()
2225 lport->port_id); in fc_eh_host_reset()
2254 void fc_fcp_destroy(struct fc_lport *lport) in fc_fcp_destroy() argument
2256 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); in fc_fcp_destroy()
2260 "port (%6.6x)\n", lport->port_id); in fc_fcp_destroy()
2264 lport->scsi_priv = NULL; in fc_fcp_destroy()
2293 int fc_fcp_init(struct fc_lport *lport) in fc_fcp_init() argument
2298 if (!lport->tt.fcp_cmd_send) in fc_fcp_init()
2299 lport->tt.fcp_cmd_send = fc_fcp_cmd_send; in fc_fcp_init()
2301 if (!lport->tt.fcp_cleanup) in fc_fcp_init()
2302 lport->tt.fcp_cleanup = fc_fcp_cleanup; in fc_fcp_init()
2304 if (!lport->tt.fcp_abort_io) in fc_fcp_init()
2305 lport->tt.fcp_abort_io = fc_fcp_abort_io; in fc_fcp_init()
2310 lport->scsi_priv = si; in fc_fcp_init()
2311 si->max_can_queue = lport->host->can_queue; in fc_fcp_init()