From 8dea78da5cee153b8af9c07a2745f6c55057fe12 Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Thu, 17 Jan 2013 16:15:55 -0500 Subject: Patched in Tegra support. --- drivers/scsi/libfc/fc_disc.c | 14 +- drivers/scsi/libfc/fc_elsct.c | 5 +- drivers/scsi/libfc/fc_exch.c | 170 +++++++---------- drivers/scsi/libfc/fc_fcp.c | 44 ++--- drivers/scsi/libfc/fc_frame.c | 2 +- drivers/scsi/libfc/fc_libfc.c | 9 +- drivers/scsi/libfc/fc_libfc.h | 2 +- drivers/scsi/libfc/fc_lport.c | 412 +++++++++--------------------------------- drivers/scsi/libfc/fc_npiv.c | 1 - drivers/scsi/libfc/fc_rport.c | 11 +- 10 files changed, 184 insertions(+), 486 deletions(-) (limited to 'drivers/scsi/libfc') diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8e561e6a557..b9cb8140b39 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -61,7 +60,7 @@ static void fc_disc_restart(struct fc_disc *); * Locking Note: This function expects that the lport mutex is locked before * calling it. */ -static void fc_disc_stop_rports(struct fc_disc *disc) +void fc_disc_stop_rports(struct fc_disc *disc) { struct fc_lport *lport; struct fc_rport_priv *rdata; @@ -337,13 +336,6 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp) schedule_delayed_work(&disc->disc_work, delay); } else fc_disc_done(disc, DISC_EV_FAILED); - } else if (PTR_ERR(fp) == -FC_EX_CLOSED) { - /* - * if discovery fails due to lport reset, clear - * pending flag so that subsequent discovery can - * continue - */ - disc->pending = 0; } } @@ -689,7 +681,7 @@ static int fc_disc_single(struct fc_lport *lport, struct fc_disc_port *dp) * fc_disc_stop() - Stop discovery for a given lport * @lport: The local port that discovery should stop on */ -static void fc_disc_stop(struct fc_lport *lport) +void fc_disc_stop(struct fc_lport *lport) { struct fc_disc *disc = &lport->disc; @@ -705,7 +697,7 @@ static void fc_disc_stop(struct fc_lport *lport) * This function will block until discovery has been * completely stopped and all rports have been deleted. */ -static void fc_disc_stop_final(struct fc_lport *lport) +void fc_disc_stop_final(struct fc_lport *lport) { fc_disc_stop(lport); lport->tt.rport_flush_queue(); diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c index c2384d50147..9b25969e2ad 100644 --- a/drivers/scsi/libfc/fc_elsct.c +++ b/drivers/scsi/libfc/fc_elsct.c @@ -21,14 +21,12 @@ * Provide interface to send ELS/CT FC frames */ -#include #include #include #include #include #include #include -#include "fc_libfc.h" /** * fc_elsct_send() - Send an ELS or CT frame @@ -56,7 +54,8 @@ struct fc_seq *fc_elsct_send(struct fc_lport *lport, u32 did, rc = fc_els_fill(lport, did, fp, op, &r_ctl, &fh_type); else { /* CT requests */ - rc = fc_ct_fill(lport, did, fp, op, &r_ctl, &fh_type, &did); + rc = fc_ct_fill(lport, did, fp, op, &r_ctl, &fh_type); + did = FC_FID_DIR_SERV; } if (rc) { diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index c772d8d2715..d261e982a2f 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -26,7 +26,6 @@ #include #include #include -#include #include @@ -66,15 +65,16 @@ static struct workqueue_struct *fc_exch_workqueue; * assigned range of exchanges to per cpu pool. */ struct fc_exch_pool { - spinlock_t lock; - struct list_head ex_list; u16 next_index; u16 total_exches; /* two cache of free slot in exch array */ u16 left; u16 right; -} ____cacheline_aligned_in_smp; + + spinlock_t lock; + struct list_head ex_list; +}; /** * struct fc_exch_mgr - The Exchange Manager (EM). @@ -91,14 +91,19 @@ struct fc_exch_pool { * It manages the allocation of exchange IDs. */ struct fc_exch_mgr { - struct fc_exch_pool __percpu *pool; - mempool_t *ep_pool; enum fc_class class; struct kref kref; u16 min_xid; u16 max_xid; + mempool_t *ep_pool; u16 pool_max_index; + struct fc_exch_pool *pool; + /* + * currently exchange mgr stats are updated but not used. + * either stats can be expose via sysfs or remove them + * all together if not used XXX + */ struct { atomic_t no_free_exch; atomic_t no_free_exch_xid; @@ -119,7 +124,7 @@ struct fc_exch_mgr { * for each anchor to determine if that EM should be used. The last * anchor in the list will always match to handle any exchanges not * handled by other EMs. The non-default EMs would be added to the - * anchor list by HW that provides offloads. + * anchor list by HW that provides FCoE offloads. */ struct fc_exch_mgr_anchor { struct list_head ema_list; @@ -333,52 +338,6 @@ static void fc_exch_release(struct fc_exch *ep) } } -/** - * fc_exch_timer_cancel() - cancel exch timer - * @ep: The exchange whose timer to be canceled - */ -static inline void fc_exch_timer_cancel(struct fc_exch *ep) -{ - if (cancel_delayed_work(&ep->timeout_work)) { - FC_EXCH_DBG(ep, "Exchange timer canceled\n"); - atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ - } -} - -/** - * fc_exch_timer_set_locked() - Start a timer for an exchange w/ the - * the exchange lock held - * @ep: The exchange whose timer will start - * @timer_msec: The timeout period - * - * Used for upper level protocols to time out the exchange. - * The timer is cancelled when it fires or when the exchange completes. - */ -static inline void fc_exch_timer_set_locked(struct fc_exch *ep, - unsigned int timer_msec) -{ - if (ep->state & (FC_EX_RST_CLEANUP | FC_EX_DONE)) - return; - - FC_EXCH_DBG(ep, "Exchange timer armed : %d msecs\n", timer_msec); - - if (queue_delayed_work(fc_exch_workqueue, &ep->timeout_work, - msecs_to_jiffies(timer_msec))) - fc_exch_hold(ep); /* hold for timer */ -} - -/** - * fc_exch_timer_set() - Lock the exchange and set the timer - * @ep: The exchange whose timer will start - * @timer_msec: The timeout period - */ -static void fc_exch_timer_set(struct fc_exch *ep, unsigned int timer_msec) -{ - spin_lock_bh(&ep->ex_lock); - fc_exch_timer_set_locked(ep, timer_msec); - spin_unlock_bh(&ep->ex_lock); -} - /** * fc_exch_done_locked() - Complete an exchange with the exchange lock held * @ep: The exchange that is complete @@ -400,7 +359,8 @@ static int fc_exch_done_locked(struct fc_exch *ep) if (!(ep->esb_stat & ESB_ST_REC_QUAL)) { ep->state |= FC_EX_DONE; - fc_exch_timer_cancel(ep); + if (cancel_delayed_work(&ep->timeout_work)) + atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ rc = 0; } return rc; @@ -463,6 +423,40 @@ static void fc_exch_delete(struct fc_exch *ep) fc_exch_release(ep); /* drop hold for exch in mp */ } +/** + * fc_exch_timer_set_locked() - Start a timer for an exchange w/ the + * the exchange lock held + * @ep: The exchange whose timer will start + * @timer_msec: The timeout period + * + * Used for upper level protocols to time out the exchange. + * The timer is cancelled when it fires or when the exchange completes. + */ +static inline void fc_exch_timer_set_locked(struct fc_exch *ep, + unsigned int timer_msec) +{ + if (ep->state & (FC_EX_RST_CLEANUP | FC_EX_DONE)) + return; + + FC_EXCH_DBG(ep, "Exchange timer armed\n"); + + if (queue_delayed_work(fc_exch_workqueue, &ep->timeout_work, + msecs_to_jiffies(timer_msec))) + fc_exch_hold(ep); /* hold for timer */ +} + +/** + * fc_exch_timer_set() - Lock the exchange and set the timer + * @ep: The exchange whose timer will start + * @timer_msec: The timeout period + */ +static void fc_exch_timer_set(struct fc_exch *ep, unsigned int timer_msec) +{ + spin_lock_bh(&ep->ex_lock); + fc_exch_timer_set_locked(ep, timer_msec); + spin_unlock_bh(&ep->ex_lock); +} + /** * fc_seq_send() - Send a frame using existing sequence/exchange pair * @lport: The local port that the exchange will be sent on @@ -476,7 +470,6 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, struct fc_frame_header *fh = fc_frame_header_get(fp); int error; u32 f_ctl; - u8 fh_type = fh->fh_type; ep = fc_seq_exch(sp); WARN_ON((ep->esb_stat & ESB_ST_SEQ_INIT) != ESB_ST_SEQ_INIT); @@ -501,7 +494,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, */ error = lport->tt.frame_send(lport, fp); - if (fh_type == FC_TYPE_BLS) + if (fh->fh_type == FC_TYPE_BLS) return error; /* @@ -992,7 +985,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport, /* * Update sequence_id based on incoming last * frame of sequence exchange. This is needed - * for FC target where DDP has been used + * for FCoE target where DDP has been used * on target where, stack is indicated only * about last frame's (payload _header) header. * Whereas "seq_id" which is part of @@ -1555,10 +1548,8 @@ static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) FC_EXCH_DBG(ep, "exch: BLS rctl %x - %s\n", fh->fh_r_ctl, fc_exch_rctl_name(fh->fh_r_ctl)); - if (cancel_delayed_work_sync(&ep->timeout_work)) { - FC_EXCH_DBG(ep, "Exchange timer canceled\n"); + if (cancel_delayed_work_sync(&ep->timeout_work)) fc_exch_release(ep); /* release from pending timer hold */ - } spin_lock_bh(&ep->ex_lock); switch (fh->fh_r_ctl) { @@ -1650,10 +1641,9 @@ static void fc_exch_recv_bls(struct fc_exch_mgr *mp, struct fc_frame *fp) case FC_RCTL_ACK_0: break; default: - if (ep) - FC_EXCH_DBG(ep, "BLS rctl %x - %s received", - fh->fh_r_ctl, - fc_exch_rctl_name(fh->fh_r_ctl)); + FC_EXCH_DBG(ep, "BLS rctl %x - %s received", + fh->fh_r_ctl, + fc_exch_rctl_name(fh->fh_r_ctl)); break; } fc_frame_free(fp); @@ -1745,7 +1735,8 @@ static void fc_exch_reset(struct fc_exch *ep) spin_lock_bh(&ep->ex_lock); fc_exch_abort_locked(ep, 0); ep->state |= FC_EX_RST_CLEANUP; - fc_exch_timer_cancel(ep); + if (cancel_delayed_work(&ep->timeout_work)) + atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ resp = ep->resp; ep->resp = NULL; if (ep->esb_stat & ESB_ST_REC_QUAL) @@ -1802,9 +1793,6 @@ restart: goto restart; } } - pool->next_index = 0; - pool->left = FC_XID_UNKNOWN; - pool->right = FC_XID_UNKNOWN; spin_unlock_bh(&pool->lock); } @@ -2140,8 +2128,10 @@ static void fc_exch_els_rrq(struct fc_frame *fp) ep->esb_stat &= ~ESB_ST_REC_QUAL; atomic_dec(&ep->ex_refcnt); /* drop hold for rec qual */ } - if (ep->esb_stat & ESB_ST_COMPLETE) - fc_exch_timer_cancel(ep); + if (ep->esb_stat & ESB_ST_COMPLETE) { + if (cancel_delayed_work(&ep->timeout_work)) + atomic_dec(&ep->ex_refcnt); /* drop timer hold */ + } spin_unlock_bh(&ep->ex_lock); @@ -2160,31 +2150,6 @@ out: fc_exch_release(ep); /* drop hold from fc_exch_find */ } -/** - * fc_exch_update_stats() - update exches stats to lport - * @lport: The local port to update exchange manager stats - */ -void fc_exch_update_stats(struct fc_lport *lport) -{ - struct fc_host_statistics *st; - struct fc_exch_mgr_anchor *ema; - struct fc_exch_mgr *mp; - - st = &lport->host_stats; - - list_for_each_entry(ema, &lport->ema_list, ema_list) { - mp = ema->mp; - st->fc_no_free_exch += atomic_read(&mp->stats.no_free_exch); - st->fc_no_free_exch_xid += - atomic_read(&mp->stats.no_free_exch_xid); - st->fc_xid_not_found += atomic_read(&mp->stats.xid_not_found); - st->fc_xid_busy += atomic_read(&mp->stats.xid_busy); - st->fc_seq_not_found += atomic_read(&mp->stats.seq_not_found); - st->fc_non_bls_resp += atomic_read(&mp->stats.non_bls_resp); - } -} -EXPORT_SYMBOL(fc_exch_update_stats); - /** * fc_exch_mgr_add() - Add an exchange manager to a local port's list of EMs * @lport: The local port to add the exchange manager to @@ -2293,18 +2258,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport, mp->class = class; /* adjust em exch xid range for offload */ mp->min_xid = min_xid; - - /* reduce range so per cpu pool fits into PCPU_MIN_UNIT_SIZE pool */ - pool_exch_range = (PCPU_MIN_UNIT_SIZE - sizeof(*pool)) / - sizeof(struct fc_exch *); - if ((max_xid - min_xid + 1) / (fc_cpu_mask + 1) > pool_exch_range) { - mp->max_xid = pool_exch_range * (fc_cpu_mask + 1) + - min_xid - 1; - } else { - mp->max_xid = max_xid; - pool_exch_range = (mp->max_xid - mp->min_xid + 1) / - (fc_cpu_mask + 1); - } + mp->max_xid = max_xid; mp->ep_pool = mempool_create_slab_pool(2, fc_em_cachep); if (!mp->ep_pool) @@ -2315,6 +2269,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport, * divided across all cpus. The exch pointers array memory is * allocated for exch range per pool. */ + pool_exch_range = (mp->max_xid - mp->min_xid + 1) / (fc_cpu_mask + 1); mp->pool_max_index = pool_exch_range - 1; /* @@ -2326,7 +2281,6 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport, goto free_mempool; for_each_possible_cpu(cpu) { pool = per_cpu_ptr(mp->pool, cpu); - pool->next_index = 0; pool->left = FC_XID_UNKNOWN; pool->right = FC_XID_UNKNOWN; spin_lock_init(&pool->lock); diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index fcb9d0b20ee..4c41ee816f0 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c @@ -155,12 +155,8 @@ static struct fc_fcp_pkt *fc_fcp_pkt_alloc(struct fc_lport *lport, gfp_t gfp) fsp->xfer_ddp = FC_XID_UNKNOWN; atomic_set(&fsp->ref_cnt, 1); init_timer(&fsp->timer); - fsp->timer.data = (unsigned long)fsp; INIT_LIST_HEAD(&fsp->list); spin_lock_init(&fsp->scsi_pkt_lock); - } else { - per_cpu_ptr(lport->stats, get_cpu())->FcpPktAllocFails++; - put_cpu(); } return fsp; } @@ -267,9 +263,6 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp) if (!fsp->seq_ptr) return -EINVAL; - per_cpu_ptr(fsp->lp->stats, get_cpu())->FcpPktAborts++; - put_cpu(); - fsp->state |= FC_SRB_ABORT_PENDING; return fsp->lp->tt.seq_exch_abort(fsp->seq_ptr, 0); } @@ -426,8 +419,6 @@ static inline struct fc_frame *fc_fcp_frame_alloc(struct fc_lport *lport, if (likely(fp)) return fp; - per_cpu_ptr(lport->stats, get_cpu())->FcpFrameAllocFails++; - put_cpu(); /* error case */ fc_fcp_can_queue_ramp_down(lport); return NULL; @@ -442,7 +433,7 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp) { struct scsi_cmnd *sc = fsp->cmd; struct fc_lport *lport = fsp->lp; - struct fc_stats *stats; + struct fcoe_dev_stats *stats; struct fc_frame_header *fh; size_t start_offset; size_t offset; @@ -493,18 +484,18 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp) if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED)) { copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents, - &offset, NULL); + &offset, KM_SOFTIRQ0, NULL); } else { crc = crc32(~0, (u8 *) fh, sizeof(*fh)); copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents, - &offset, &crc); + &offset, KM_SOFTIRQ0, &crc); buf = fc_frame_payload_get(fp, 0); if (len % 4) crc = crc32(crc, buf + len, 4 - (len % 4)); if (~crc != le32_to_cpu(fr_crc(fp))) { crc_err: - stats = per_cpu_ptr(lport->stats, get_cpu()); + stats = per_cpu_ptr(lport->dev_stats, get_cpu()); stats->ErrorFrames++; /* per cpu count, not total count, but OK for limit */ if (stats->InvalidCRCCount++ < FC_MAX_ERROR_CNT) @@ -658,10 +649,10 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq, * The scatterlist item may be bigger than PAGE_SIZE, * but we must not cross pages inside the kmap. */ - page_addr = kmap_atomic(page); + page_addr = kmap_atomic(page, KM_SOFTIRQ0); memcpy(data, (char *)page_addr + (off & ~PAGE_MASK), sg_bytes); - kunmap_atomic(page_addr); + kunmap_atomic(page_addr, KM_SOFTIRQ0); data += sg_bytes; } offset += sg_bytes; @@ -768,6 +759,7 @@ static void fc_fcp_recv(struct fc_seq *seq, struct fc_frame *fp, void *arg) goto out; if (fc_fcp_lock_pkt(fsp)) goto out; + fsp->last_pkt_time = jiffies; if (fh->fh_type == FC_TYPE_BLS) { fc_fcp_abts_resp(fsp, fp); @@ -851,8 +843,7 @@ static void fc_fcp_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_rp_info = (struct fcp_resp_rsp_info *)(rp_ex + 1); if (flags & FCP_RSP_LEN_VAL) { respl = ntohl(rp_ex->fr_rsp_len); - if ((respl != FCP_RESP_RSP_INFO_LEN4) && - (respl != FCP_RESP_RSP_INFO_LEN8)) + if (respl != sizeof(*fc_rp_info)) goto len_err; if (fsp->wait_for_comp) { /* Abuse cdb_status for rsp code */ @@ -1083,7 +1074,8 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK; - int_to_scsilun(fsp->cmd->device->lun, &fsp->cdb_cmd.fc_lun); + int_to_scsilun(fsp->cmd->device->lun, + (struct scsi_lun *)fsp->cdb_cmd.fc_lun); memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); spin_lock_irqsave(&si->scsi_queue_lock, flags); @@ -1156,6 +1148,7 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp, rc = -1; goto unlock; } + fsp->last_pkt_time = jiffies; fsp->seq_ptr = seq; fc_fcp_pkt_hold(fsp); /* hold for fc_fcp_pkt_destroy */ @@ -1265,7 +1258,7 @@ static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp, fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET; - int_to_scsilun(lun, &fsp->cdb_cmd.fc_lun); + int_to_scsilun(lun, (struct scsi_lun *)fsp->cdb_cmd.fc_lun); fsp->wait_for_comp = 1; init_completion(&fsp->tm_done); @@ -1381,10 +1374,10 @@ static void fc_fcp_timeout(unsigned long data) fsp->state |= FC_SRB_FCP_PROCESSING_TMO; - if (fsp->state & FC_SRB_RCV_STATUS) - fc_fcp_complete_locked(fsp); - else if (rpriv->flags & FC_RP_FLAGS_REC_SUPPORTED) + if (rpriv->flags & FC_RP_FLAGS_REC_SUPPORTED) fc_fcp_rec(fsp); + else if (fsp->state & FC_SRB_RCV_STATUS) + fc_fcp_complete_locked(fsp); else fc_fcp_recovery(fsp, FC_TIMED_OUT); fsp->state &= ~FC_SRB_FCP_PROCESSING_TMO; @@ -1795,7 +1788,7 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) struct fc_rport_libfc_priv *rpriv; int rval; int rc = 0; - struct fc_stats *stats; + struct fcoe_dev_stats *stats; rval = fc_remote_port_chkready(rport); if (rval) { @@ -1844,7 +1837,7 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) /* * setup the data direction */ - stats = per_cpu_ptr(lport->stats, get_cpu()); + stats = per_cpu_ptr(lport->dev_stats, get_cpu()); if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) { fsp->req_flags = FC_SRB_READ; stats->InputRequests++; @@ -1859,6 +1852,9 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) } put_cpu(); + init_timer(&fsp->timer); + fsp->timer.data = (unsigned long)fsp; + /* * send it to the lower layer * if we get -1 return then put the request in the pending diff --git a/drivers/scsi/libfc/fc_frame.c b/drivers/scsi/libfc/fc_frame.c index 0382ac06906..981329a17c4 100644 --- a/drivers/scsi/libfc/fc_frame.c +++ b/drivers/scsi/libfc/fc_frame.c @@ -49,7 +49,7 @@ u32 fc_frame_crc_check(struct fc_frame *fp) EXPORT_SYMBOL(fc_frame_crc_check); /* - * Allocate a frame intended to be sent. + * Allocate a frame intended to be sent via fcoe_xmit. * Get an sk_buff for the frame and set the length. */ struct fc_frame *_fc_frame_alloc(size_t len) diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c index 8d65a51a759..b7735129f1f 100644 --- a/drivers/scsi/libfc/fc_libfc.c +++ b/drivers/scsi/libfc/fc_libfc.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -105,13 +104,14 @@ module_exit(libfc_exit); * @sg: pointer to the pointer of the SG list. * @nents: pointer to the remaining number of entries in the SG list. * @offset: pointer to the current offset in the SG list. + * @km_type: dedicated page table slot type for kmap_atomic. * @crc: pointer to the 32-bit crc value. * If crc is NULL, CRC is not calculated. */ u32 fc_copy_buffer_to_sglist(void *buf, size_t len, struct scatterlist *sg, u32 *nents, size_t *offset, - u32 *crc) + enum km_type km_type, u32 *crc) { size_t remaining = len; u32 copy_len = 0; @@ -141,11 +141,12 @@ u32 fc_copy_buffer_to_sglist(void *buf, size_t len, off = *offset + sg->offset; sg_bytes = min(sg_bytes, (size_t)(PAGE_SIZE - (off & ~PAGE_MASK))); - page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT)); + page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT), + km_type); if (crc) *crc = crc32(*crc, buf, sg_bytes); memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes); - kunmap_atomic(page_addr); + kunmap_atomic(page_addr, km_type); buf += sg_bytes; *offset += sg_bytes; remaining -= sg_bytes; diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h index c2830cc66d6..c7d071289af 100644 --- a/drivers/scsi/libfc/fc_libfc.h +++ b/drivers/scsi/libfc/fc_libfc.h @@ -134,6 +134,6 @@ extern void fc_fc4_conf_lport_params(struct fc_lport *, enum fc_fh_type); u32 fc_copy_buffer_to_sglist(void *buf, size_t len, struct scatterlist *sg, u32 *nents, size_t *offset, - u32 *crc); + enum km_type km_type, u32 *crc); #endif /* _FC_LIBFC_H_ */ diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index f04d15c67df..628f347404f 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -89,7 +89,6 @@ #include #include -#include #include #include @@ -116,8 +115,6 @@ static void fc_lport_enter_ns(struct fc_lport *, enum fc_lport_state); static void fc_lport_enter_scr(struct fc_lport *); static void fc_lport_enter_ready(struct fc_lport *); static void fc_lport_enter_logo(struct fc_lport *); -static void fc_lport_enter_fdmi(struct fc_lport *lport); -static void fc_lport_enter_ms(struct fc_lport *, enum fc_lport_state); static const char *fc_lport_state_names[] = { [LPORT_ST_DISABLED] = "disabled", @@ -128,11 +125,6 @@ static const char *fc_lport_state_names[] = { [LPORT_ST_RSPN_ID] = "RSPN_ID", [LPORT_ST_RFT_ID] = "RFT_ID", [LPORT_ST_RFF_ID] = "RFF_ID", - [LPORT_ST_FDMI] = "FDMI", - [LPORT_ST_RHBA] = "RHBA", - [LPORT_ST_RPA] = "RPA", - [LPORT_ST_DHBA] = "DHBA", - [LPORT_ST_DPRT] = "DPRT", [LPORT_ST_SCR] = "SCR", [LPORT_ST_READY] = "Ready", [LPORT_ST_LOGO] = "LOGO", @@ -190,14 +182,11 @@ static void fc_lport_rport_callback(struct fc_lport *lport, if (lport->state == LPORT_ST_DNS) { lport->dns_rdata = rdata; fc_lport_enter_ns(lport, LPORT_ST_RNN_ID); - } else if (lport->state == LPORT_ST_FDMI) { - lport->ms_rdata = rdata; - fc_lport_enter_ms(lport, LPORT_ST_DHBA); } else { FC_LPORT_DBG(lport, "Received an READY event " "on port (%6.6x) for the directory " "server, but the lport is not " - "in the DNS or FDMI state, it's in the " + "in the DNS state, it's in the " "%d state", rdata->ids.port_id, lport->state); lport->tt.rport_logoff(rdata); @@ -206,10 +195,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport, case RPORT_EV_LOGO: case RPORT_EV_FAILED: case RPORT_EV_STOP: - if (rdata->ids.port_id == FC_FID_DIR_SERV) - lport->dns_rdata = NULL; - else if (rdata->ids.port_id == FC_FID_MGMT_SERV) - lport->ms_rdata = NULL; + lport->dns_rdata = NULL; break; case RPORT_EV_NONE: break; @@ -299,54 +285,47 @@ EXPORT_SYMBOL(fc_get_host_speed); */ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost) { - struct fc_host_statistics *fc_stats; + struct fc_host_statistics *fcoe_stats; struct fc_lport *lport = shost_priv(shost); struct timespec v0, v1; unsigned int cpu; u64 fcp_in_bytes = 0; u64 fcp_out_bytes = 0; - fc_stats = &lport->host_stats; - memset(fc_stats, 0, sizeof(struct fc_host_statistics)); + fcoe_stats = &lport->host_stats; + memset(fcoe_stats, 0, sizeof(struct fc_host_statistics)); jiffies_to_timespec(jiffies, &v0); jiffies_to_timespec(lport->boot_time, &v1); - fc_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); + fcoe_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); for_each_possible_cpu(cpu) { - struct fc_stats *stats; - - stats = per_cpu_ptr(lport->stats, cpu); - - fc_stats->tx_frames += stats->TxFrames; - fc_stats->tx_words += stats->TxWords; - fc_stats->rx_frames += stats->RxFrames; - fc_stats->rx_words += stats->RxWords; - fc_stats->error_frames += stats->ErrorFrames; - fc_stats->invalid_crc_count += stats->InvalidCRCCount; - fc_stats->fcp_input_requests += stats->InputRequests; - fc_stats->fcp_output_requests += stats->OutputRequests; - fc_stats->fcp_control_requests += stats->ControlRequests; + struct fcoe_dev_stats *stats; + + stats = per_cpu_ptr(lport->dev_stats, cpu); + + fcoe_stats->tx_frames += stats->TxFrames; + fcoe_stats->tx_words += stats->TxWords; + fcoe_stats->rx_frames += stats->RxFrames; + fcoe_stats->rx_words += stats->RxWords; + fcoe_stats->error_frames += stats->ErrorFrames; + fcoe_stats->invalid_crc_count += stats->InvalidCRCCount; + fcoe_stats->fcp_input_requests += stats->InputRequests; + fcoe_stats->fcp_output_requests += stats->OutputRequests; + fcoe_stats->fcp_control_requests += stats->ControlRequests; fcp_in_bytes += stats->InputBytes; fcp_out_bytes += stats->OutputBytes; - fc_stats->fcp_packet_alloc_failures += stats->FcpPktAllocFails; - fc_stats->fcp_packet_aborts += stats->FcpPktAborts; - fc_stats->fcp_frame_alloc_failures += stats->FcpFrameAllocFails; - fc_stats->link_failure_count += stats->LinkFailureCount; + fcoe_stats->link_failure_count += stats->LinkFailureCount; } - fc_stats->fcp_input_megabytes = div_u64(fcp_in_bytes, 1000000); - fc_stats->fcp_output_megabytes = div_u64(fcp_out_bytes, 1000000); - fc_stats->lip_count = -1; - fc_stats->nos_count = -1; - fc_stats->loss_of_sync_count = -1; - fc_stats->loss_of_signal_count = -1; - fc_stats->prim_seq_protocol_err_count = -1; - fc_stats->dumped_frames = -1; - - /* update exches stats */ - fc_exch_update_stats(lport); - - return fc_stats; + fcoe_stats->fcp_input_megabytes = div_u64(fcp_in_bytes, 1000000); + fcoe_stats->fcp_output_megabytes = div_u64(fcp_out_bytes, 1000000); + fcoe_stats->lip_count = -1; + fcoe_stats->nos_count = -1; + fcoe_stats->loss_of_sync_count = -1; + fcoe_stats->loss_of_signal_count = -1; + fcoe_stats->prim_seq_protocol_err_count = -1; + fcoe_stats->dumped_frames = -1; + return fcoe_stats; } EXPORT_SYMBOL(fc_get_host_stats); @@ -655,7 +634,6 @@ int fc_lport_destroy(struct fc_lport *lport) lport->tt.fcp_abort_io(lport); lport->tt.disc_stop_final(lport); lport->tt.exch_mgr_reset(lport, 0, 0); - cancel_delayed_work_sync(&lport->retry_work); fc_fc4_del_lport(lport); return 0; } @@ -698,8 +676,7 @@ EXPORT_SYMBOL(fc_set_mfs); * @lport: The local port receiving the event * @event: The discovery event */ -static void fc_lport_disc_callback(struct fc_lport *lport, - enum fc_disc_event event) +void fc_lport_disc_callback(struct fc_lport *lport, enum fc_disc_event event) { switch (event) { case DISC_EV_SUCCESS: @@ -980,8 +957,7 @@ drop: rcu_read_unlock(); FC_LPORT_DBG(lport, "dropping unexpected frame type %x\n", fh->fh_type); fc_frame_free(fp); - if (sp) - lport->tt.exch_done(sp); + lport->tt.exch_done(sp); } /** @@ -1054,8 +1030,16 @@ static void fc_lport_enter_reset(struct fc_lport *lport) FCH_EVT_LIPRESET, 0); fc_vports_linkchange(lport); fc_lport_reset_locked(lport); - if (lport->link_up) + if (lport->link_up) { + /* + * Wait upto resource allocation time out before + * doing re-login since incomplete FIP exchanged + * from last session may collide with exchanges + * in new session. + */ + msleep(lport->r_a_tov); fc_lport_enter_flogi(lport); + } } /** @@ -1170,96 +1154,14 @@ static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp, fc_lport_enter_ns(lport, LPORT_ST_RFF_ID); break; case LPORT_ST_RFF_ID: - if (lport->fdmi_enabled) - fc_lport_enter_fdmi(lport); - else - fc_lport_enter_scr(lport); - break; - default: - /* should have already been caught by state checks */ - break; - } - else - fc_lport_error(lport, fp); -out: - fc_frame_free(fp); -err: - mutex_unlock(&lport->lp_mutex); -} - -/** - * fc_lport_ms_resp() - Handle response to a management server - * exchange - * @sp: current sequence in exchange - * @fp: response frame - * @lp_arg: Fibre Channel host port instance - * - * Locking Note: This function will be called without the lport lock - * held, but it will lock, call an _enter_* function or fc_lport_error() - * and then unlock the lport. - */ -static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp, - void *lp_arg) -{ - struct fc_lport *lport = lp_arg; - struct fc_frame_header *fh; - struct fc_ct_hdr *ct; - - FC_LPORT_DBG(lport, "Received a ms %s\n", fc_els_resp_type(fp)); - - if (fp == ERR_PTR(-FC_EX_CLOSED)) - return; - - mutex_lock(&lport->lp_mutex); - - if (lport->state < LPORT_ST_RHBA || lport->state > LPORT_ST_DPRT) { - FC_LPORT_DBG(lport, "Received a management server response, " - "but in state %s\n", fc_lport_state(lport)); - if (IS_ERR(fp)) - goto err; - goto out; - } - - if (IS_ERR(fp)) { - fc_lport_error(lport, fp); - goto err; - } - - fh = fc_frame_header_get(fp); - ct = fc_frame_payload_get(fp, sizeof(*ct)); - - if (fh && ct && fh->fh_type == FC_TYPE_CT && - ct->ct_fs_type == FC_FST_MGMT && - ct->ct_fs_subtype == FC_FDMI_SUBTYPE) { - FC_LPORT_DBG(lport, "Received a management server response, " - "reason=%d explain=%d\n", - ct->ct_reason, - ct->ct_explan); - - switch (lport->state) { - case LPORT_ST_RHBA: - if (ntohs(ct->ct_cmd) == FC_FS_ACC) - fc_lport_enter_ms(lport, LPORT_ST_RPA); - else /* Error Skip RPA */ - fc_lport_enter_scr(lport); - break; - case LPORT_ST_RPA: fc_lport_enter_scr(lport); break; - case LPORT_ST_DPRT: - fc_lport_enter_ms(lport, LPORT_ST_RHBA); - break; - case LPORT_ST_DHBA: - fc_lport_enter_ms(lport, LPORT_ST_DPRT); - break; default: /* should have already been caught by state checks */ break; } - } else { - /* Invalid Frame? */ + else fc_lport_error(lport, fp); - } out: fc_frame_free(fp); err: @@ -1442,123 +1344,6 @@ err: fc_lport_error(lport, NULL); } -/** - * fc_lport_enter_ms() - management server commands - * @lport: Fibre Channel local port to register - * - * Locking Note: The lport lock is expected to be held before calling - * this routine. - */ -static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) -{ - struct fc_frame *fp; - enum fc_fdmi_req cmd; - int size = sizeof(struct fc_ct_hdr); - size_t len; - int numattrs; - - FC_LPORT_DBG(lport, "Entered %s state from %s state\n", - fc_lport_state_names[state], - fc_lport_state(lport)); - - fc_lport_state_enter(lport, state); - - switch (state) { - case LPORT_ST_RHBA: - cmd = FC_FDMI_RHBA; - /* Number of HBA Attributes */ - numattrs = 10; - len = sizeof(struct fc_fdmi_rhba); - len -= sizeof(struct fc_fdmi_attr_entry); - len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); - len += FC_FDMI_HBA_ATTR_NODENAME_LEN; - len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN; - len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN; - len += FC_FDMI_HBA_ATTR_MODEL_LEN; - len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN; - len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN; - len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN; - len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN; - len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN; - len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN; - - size += len; - break; - case LPORT_ST_RPA: - cmd = FC_FDMI_RPA; - /* Number of Port Attributes */ - numattrs = 6; - len = sizeof(struct fc_fdmi_rpa); - len -= sizeof(struct fc_fdmi_attr_entry); - len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); - len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN; - len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN; - len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN; - len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN; - len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN; - len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN; - - size += len; - break; - case LPORT_ST_DPRT: - cmd = FC_FDMI_DPRT; - len = sizeof(struct fc_fdmi_dprt); - size += len; - break; - case LPORT_ST_DHBA: - cmd = FC_FDMI_DHBA; - len = sizeof(struct fc_fdmi_dhba); - size += len; - break; - default: - fc_lport_error(lport, NULL); - return; - } - - FC_LPORT_DBG(lport, "Cmd=0x%x Len %d size %d\n", - cmd, (int)len, size); - fp = fc_frame_alloc(lport, size); - if (!fp) { - fc_lport_error(lport, fp); - return; - } - - if (!lport->tt.elsct_send(lport, FC_FID_MGMT_SERV, fp, cmd, - fc_lport_ms_resp, - lport, 3 * lport->r_a_tov)) - fc_lport_error(lport, fp); -} - -/** - * fc_rport_enter_fdmi() - Create a fc_rport for the management server - * @lport: The local port requesting a remote port for the management server - * - * Locking Note: The lport lock is expected to be held before calling - * this routine. - */ -static void fc_lport_enter_fdmi(struct fc_lport *lport) -{ - struct fc_rport_priv *rdata; - - FC_LPORT_DBG(lport, "Entered FDMI state from %s state\n", - fc_lport_state(lport)); - - fc_lport_state_enter(lport, LPORT_ST_FDMI); - - mutex_lock(&lport->disc.disc_mutex); - rdata = lport->tt.rport_create(lport, FC_FID_MGMT_SERV); - mutex_unlock(&lport->disc.disc_mutex); - if (!rdata) - goto err; - - rdata->ops = &fc_lport_rport_ops; - lport->tt.rport_login(rdata); - return; - -err: - fc_lport_error(lport, NULL); -} - /** * fc_lport_timeout() - Handler for the retry_work timer * @work: The work struct of the local port @@ -1573,6 +1358,7 @@ static void fc_lport_timeout(struct work_struct *work) switch (lport->state) { case LPORT_ST_DISABLED: + WARN_ON(1); break; case LPORT_ST_READY: break; @@ -1591,16 +1377,6 @@ static void fc_lport_timeout(struct work_struct *work) case LPORT_ST_RFF_ID: fc_lport_enter_ns(lport, lport->state); break; - case LPORT_ST_FDMI: - fc_lport_enter_fdmi(lport); - break; - case LPORT_ST_RHBA: - case LPORT_ST_RPA: - case LPORT_ST_DHBA: - case LPORT_ST_DPRT: - FC_LPORT_DBG(lport, "Skipping lport state %s to SCR\n", - fc_lport_state(lport)); - /* fall thru */ case LPORT_ST_SCR: fc_lport_enter_scr(lport); break; @@ -1705,7 +1481,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg) { struct fc_lport *lport = lp_arg; - struct fc_frame_header *fh; struct fc_els_flogi *flp; u32 did; u16 csp_flags; @@ -1733,66 +1508,49 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, goto err; } - fh = fc_frame_header_get(fp); did = fc_frame_did(fp); - if (fh->fh_r_ctl != FC_RCTL_ELS_REP || did == 0 || - fc_frame_payload_op(fp) != ELS_LS_ACC) { - FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); - fc_lport_error(lport, fp); - goto err; - } - - flp = fc_frame_payload_get(fp, sizeof(*flp)); - if (!flp) { - FC_LPORT_DBG(lport, "FLOGI bad response\n"); - fc_lport_error(lport, fp); - goto err; - } - - mfs = ntohs(flp->fl_csp.sp_bb_data) & - FC_SP_BB_DATA_MASK; - - if (mfs < FC_SP_MIN_MAX_PAYLOAD || mfs > FC_SP_MAX_MAX_PAYLOAD) { - FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " - "lport->mfs:%hu\n", mfs, lport->mfs); - fc_lport_error(lport, fp); - goto err; - } - - if (mfs <= lport->mfs) { - lport->mfs = mfs; - fc_host_maxframe_size(lport->host) = mfs; - } - - csp_flags = ntohs(flp->fl_csp.sp_features); - r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); - e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); - if (csp_flags & FC_SP_FT_EDTR) - e_d_tov /= 1000000; - - lport->npiv_enabled = !!(csp_flags & FC_SP_FT_NPIV_ACC); - - if ((csp_flags & FC_SP_FT_FPORT) == 0) { - if (e_d_tov > lport->e_d_tov) - lport->e_d_tov = e_d_tov; - lport->r_a_tov = 2 * e_d_tov; - fc_lport_set_port_id(lport, did, fp); - printk(KERN_INFO "host%d: libfc: " - "Port (%6.6x) entered " - "point-to-point mode\n", - lport->host->host_no, did); - fc_lport_ptp_setup(lport, fc_frame_sid(fp), - get_unaligned_be64( - &flp->fl_wwpn), - get_unaligned_be64( - &flp->fl_wwnn)); + if (fc_frame_payload_op(fp) == ELS_LS_ACC && did) { + flp = fc_frame_payload_get(fp, sizeof(*flp)); + if (flp) { + mfs = ntohs(flp->fl_csp.sp_bb_data) & + FC_SP_BB_DATA_MASK; + if (mfs >= FC_SP_MIN_MAX_PAYLOAD && + mfs < lport->mfs) + lport->mfs = mfs; + csp_flags = ntohs(flp->fl_csp.sp_features); + r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); + e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); + if (csp_flags & FC_SP_FT_EDTR) + e_d_tov /= 1000000; + + lport->npiv_enabled = !!(csp_flags & FC_SP_FT_NPIV_ACC); + + if ((csp_flags & FC_SP_FT_FPORT) == 0) { + if (e_d_tov > lport->e_d_tov) + lport->e_d_tov = e_d_tov; + lport->r_a_tov = 2 * e_d_tov; + fc_lport_set_port_id(lport, did, fp); + printk(KERN_INFO "host%d: libfc: " + "Port (%6.6x) entered " + "point-to-point mode\n", + lport->host->host_no, did); + fc_lport_ptp_setup(lport, fc_frame_sid(fp), + get_unaligned_be64( + &flp->fl_wwpn), + get_unaligned_be64( + &flp->fl_wwnn)); + } else { + lport->e_d_tov = e_d_tov; + lport->r_a_tov = r_a_tov; + fc_host_fabric_name(lport->host) = + get_unaligned_be64(&flp->fl_wwnn); + fc_lport_set_port_id(lport, did, fp); + fc_lport_enter_dns(lport); + } + } } else { - lport->e_d_tov = e_d_tov; - lport->r_a_tov = r_a_tov; - fc_host_fabric_name(lport->host) = - get_unaligned_be64(&flp->fl_wwnn); - fc_lport_set_port_id(lport, did, fp); - fc_lport_enter_dns(lport); + FC_LPORT_DBG(lport, "FLOGI RJT or bad response\n"); + fc_lport_error(lport, fp); } out: @@ -1809,7 +1567,7 @@ EXPORT_SYMBOL(fc_lport_flogi_resp); * Locking Note: The lport lock is expected to be held before calling * this routine. */ -static void fc_lport_enter_flogi(struct fc_lport *lport) +void fc_lport_enter_flogi(struct fc_lport *lport) { struct fc_frame *fp; @@ -1938,7 +1696,7 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp, job->reply->reply_payload_rcv_len += fc_copy_buffer_to_sglist(buf, len, info->sg, &info->nents, - &info->offset, NULL); + &info->offset, KM_BIO_SRC_IRQ, NULL); if (fr_eof(fp) == FC_EOF_T && (ntoh24(fh->fh_f_ctl) & (FC_FC_LAST_SEQ | FC_FC_END_SEQ)) == diff --git a/drivers/scsi/libfc/fc_npiv.c b/drivers/scsi/libfc/fc_npiv.c index 9fbf78ed821..f33b897e478 100644 --- a/drivers/scsi/libfc/fc_npiv.c +++ b/drivers/scsi/libfc/fc_npiv.c @@ -22,7 +22,6 @@ */ #include -#include /** * fc_vport_create() - Create a new NPIV vport instance diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 83aa1efec87..760db761944 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -51,7 +51,6 @@ #include #include #include -#include #include #include @@ -391,7 +390,7 @@ static void fc_rport_work(struct work_struct *work) * If it appears we are already logged in, ADISC is used to verify * the setup. */ -static int fc_rport_login(struct fc_rport_priv *rdata) +int fc_rport_login(struct fc_rport_priv *rdata) { mutex_lock(&rdata->rp_mutex); @@ -451,7 +450,7 @@ static void fc_rport_enter_delete(struct fc_rport_priv *rdata, * function will hold the rport lock, call an _enter_* * function and then unlock the rport. */ -static int fc_rport_logoff(struct fc_rport_priv *rdata) +int fc_rport_logoff(struct fc_rport_priv *rdata) { mutex_lock(&rdata->rp_mutex); @@ -653,8 +652,8 @@ static int fc_rport_login_complete(struct fc_rport_priv *rdata, * @fp: The FLOGI response frame * @rp_arg: The remote port that received the FLOGI response */ -static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, - void *rp_arg) +void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, + void *rp_arg) { struct fc_rport_priv *rdata = rp_arg; struct fc_lport *lport = rdata->local_port; @@ -1520,7 +1519,7 @@ reject: * * Locking Note: Called with the lport lock held. */ -static void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp) +void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp) { struct fc_seq_els_data els_data; -- cgit v1.2.2