diff options
Diffstat (limited to 'drivers/scsi/bnx2fc')
-rw-r--r-- | drivers/scsi/bnx2fc/Makefile | 3 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc.h | 13 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_debug.c | 70 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_debug.h | 73 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 100 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_hwi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_io.c | 25 | ||||
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_tgt.c | 40 |
8 files changed, 209 insertions, 119 deletions
diff --git a/drivers/scsi/bnx2fc/Makefile b/drivers/scsi/bnx2fc/Makefile index a92695a25176..141149e8cdad 100644 --- a/drivers/scsi/bnx2fc/Makefile +++ b/drivers/scsi/bnx2fc/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_SCSI_BNX2X_FCOE) += bnx2fc.o -bnx2fc-y := bnx2fc_els.o bnx2fc_fcoe.o bnx2fc_hwi.o bnx2fc_io.o bnx2fc_tgt.o +bnx2fc-y := bnx2fc_els.o bnx2fc_fcoe.o bnx2fc_hwi.o bnx2fc_io.o bnx2fc_tgt.o \ + bnx2fc_debug.o diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h index 0578fa0dc14b..3486845ba301 100644 --- a/drivers/scsi/bnx2fc/bnx2fc.h +++ b/drivers/scsi/bnx2fc/bnx2fc.h @@ -11,6 +11,8 @@ * Written by: Bhanu Prakash Gollapudi (bprakash@broadcom.com) */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -57,12 +59,12 @@ #include <scsi/fc/fc_fcp.h> #include "57xx_hsi_bnx2fc.h" -#include "bnx2fc_debug.h" #include "../../net/ethernet/broadcom/cnic_if.h" +#include "../../net/ethernet/broadcom/bnx2x/bnx2x_mfw_req.h" #include "bnx2fc_constants.h" #define BNX2FC_NAME "bnx2fc" -#define BNX2FC_VERSION "1.0.11" +#define BNX2FC_VERSION "1.0.12" #define PFX "bnx2fc: " @@ -84,6 +86,8 @@ #define BNX2FC_NUM_MAX_SESS 1024 #define BNX2FC_NUM_MAX_SESS_LOG (ilog2(BNX2FC_NUM_MAX_SESS)) +#define BNX2FC_MAX_NPIV 256 + #define BNX2FC_MAX_OUTSTANDING_CMNDS 2048 #define BNX2FC_CAN_QUEUE BNX2FC_MAX_OUTSTANDING_CMNDS #define BNX2FC_ELSTM_XIDS BNX2FC_CAN_QUEUE @@ -206,6 +210,7 @@ struct bnx2fc_hba { struct fcoe_statistics_params *stats_buffer; dma_addr_t stats_buf_dma; struct completion stat_req_done; + struct fcoe_capabilities fcoe_cap; /*destroy handling */ struct timer_list destroy_timer; @@ -274,6 +279,7 @@ struct bnx2fc_rport { #define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x6 #define BNX2FC_FLAG_UPLD_REQ_COMPL 0x7 #define BNX2FC_FLAG_EXPL_LOGO 0x8 +#define BNX2FC_FLAG_DISABLE_FAILED 0x9 u8 src_addr[ETH_ALEN]; u32 max_sqes; @@ -554,4 +560,7 @@ void bnx2fc_process_seq_cleanup_compl(struct bnx2fc_cmd *seq_clnup_req, int bnx2fc_initiate_seq_cleanup(struct bnx2fc_cmd *orig_io_req, u32 offset, enum fc_rctl r_ctl); + +#include "bnx2fc_debug.h" + #endif diff --git a/drivers/scsi/bnx2fc/bnx2fc_debug.c b/drivers/scsi/bnx2fc/bnx2fc_debug.c new file mode 100644 index 000000000000..0cbee1b23ee2 --- /dev/null +++ b/drivers/scsi/bnx2fc/bnx2fc_debug.c @@ -0,0 +1,70 @@ +#include "bnx2fc.h" + +void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + if (likely(!(bnx2fc_debug_level & LOG_IO))) + return; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + if (io_req && io_req->port && io_req->port->lport && + io_req->port->lport->host) + shost_printk(KERN_INFO, io_req->port->lport->host, + PFX "xid:0x%x %pV", + io_req->xid, &vaf); + else + pr_info("NULL %pV", &vaf); + + va_end(args); +} + +void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + if (likely(!(bnx2fc_debug_level & LOG_TGT))) + return; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + if (tgt && tgt->port && tgt->port->lport && tgt->port->lport->host && + tgt->rport) + shost_printk(KERN_INFO, tgt->port->lport->host, + PFX "port:%x %pV", + tgt->rport->port_id, &vaf); + else + pr_info("NULL %pV", &vaf); + + va_end(args); +} + +void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + if (likely(!(bnx2fc_debug_level & LOG_HBA))) + return; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + if (lport && lport->host) + shost_printk(KERN_INFO, lport->host, PFX "%pV", &vaf); + else + pr_info("NULL %pV", &vaf); + + va_end(args); +} diff --git a/drivers/scsi/bnx2fc/bnx2fc_debug.h b/drivers/scsi/bnx2fc/bnx2fc_debug.h index 3416d9a746c7..4808ff99621f 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_debug.h +++ b/drivers/scsi/bnx2fc/bnx2fc_debug.h @@ -11,60 +11,23 @@ extern unsigned int bnx2fc_debug_level; -#define BNX2FC_CHK_LOGGING(LEVEL, CMD) \ - do { \ - if (unlikely(bnx2fc_debug_level & LEVEL)) \ - do { \ - CMD; \ - } while (0); \ - } while (0) - -#define BNX2FC_ELS_DBG(fmt, arg...) \ - BNX2FC_CHK_LOGGING(LOG_ELS, \ - printk(KERN_INFO PFX fmt, ##arg)) - -#define BNX2FC_MISC_DBG(fmt, arg...) \ - BNX2FC_CHK_LOGGING(LOG_MISC, \ - printk(KERN_INFO PFX fmt, ##arg)) - -#define BNX2FC_IO_DBG(io_req, fmt, arg...) \ - do { \ - if (!io_req || !io_req->port || !io_req->port->lport || \ - !io_req->port->lport->host) \ - BNX2FC_CHK_LOGGING(LOG_IO, \ - printk(KERN_INFO PFX "NULL " fmt, ##arg)); \ - else \ - BNX2FC_CHK_LOGGING(LOG_IO, \ - shost_printk(KERN_INFO, \ - (io_req)->port->lport->host, \ - PFX "xid:0x%x " fmt, \ - (io_req)->xid, ##arg)); \ - } while (0) - -#define BNX2FC_TGT_DBG(tgt, fmt, arg...) \ - do { \ - if (!tgt || !tgt->port || !tgt->port->lport || \ - !tgt->port->lport->host || !tgt->rport) \ - BNX2FC_CHK_LOGGING(LOG_TGT, \ - printk(KERN_INFO PFX "NULL " fmt, ##arg)); \ - else \ - BNX2FC_CHK_LOGGING(LOG_TGT, \ - shost_printk(KERN_INFO, \ - (tgt)->port->lport->host, \ - PFX "port:%x " fmt, \ - (tgt)->rport->port_id, ##arg)); \ - } while (0) - - -#define BNX2FC_HBA_DBG(lport, fmt, arg...) \ - do { \ - if (!lport || !lport->host) \ - BNX2FC_CHK_LOGGING(LOG_HBA, \ - printk(KERN_INFO PFX "NULL " fmt, ##arg)); \ - else \ - BNX2FC_CHK_LOGGING(LOG_HBA, \ - shost_printk(KERN_INFO, lport->host, \ - PFX fmt, ##arg)); \ - } while (0) +#define BNX2FC_ELS_DBG(fmt, ...) \ +do { \ + if (unlikely(bnx2fc_debug_level & LOG_ELS)) \ + pr_info(fmt, ##__VA_ARGS__); \ +} while (0) + +#define BNX2FC_MISC_DBG(fmt, ...) \ +do { \ + if (unlikely(bnx2fc_debug_level & LOG_MISC)) \ + pr_info(fmt, ##__VA_ARGS__); \ +} while (0) + +__printf(2, 3) +void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...); +__printf(2, 3) +void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...); +__printf(2, 3) +void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...); #endif diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index f52f668fd247..ae1cb7639d99 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu); #define DRV_MODULE_NAME "bnx2fc" #define DRV_MODULE_VERSION BNX2FC_VERSION -#define DRV_MODULE_RELDATE "Apr 24, 2012" +#define DRV_MODULE_RELDATE "Jun 04, 2012" static char version[] __devinitdata = @@ -286,7 +286,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) struct fcoe_port *port; struct fcoe_hdr *hp; struct bnx2fc_rport *tgt; - struct fcoe_dev_stats *stats; + struct fc_stats *stats; u8 sof, eof; u32 crc; unsigned int hlen, tlen, elen; @@ -412,7 +412,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp) } /*update tx stats */ - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); + stats = per_cpu_ptr(lport->stats, get_cpu()); stats->TxFrames++; stats->TxWords += wlen; put_cpu(); @@ -522,7 +522,7 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) u32 fr_len; struct fc_lport *lport; struct fcoe_rcv_info *fr; - struct fcoe_dev_stats *stats; + struct fc_stats *stats; struct fc_frame_header *fh; struct fcoe_crc_eof crc_eof; struct fc_frame *fp; @@ -551,7 +551,7 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) skb_pull(skb, sizeof(struct fcoe_hdr)); fr_len = skb->len - sizeof(struct fcoe_crc_eof); - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); + stats = per_cpu_ptr(lport->stats, get_cpu()); stats->RxFrames++; stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; @@ -942,7 +942,7 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event, FC_PORTTYPE_UNKNOWN; mutex_unlock(&lport->lp_mutex); fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN; - per_cpu_ptr(lport->dev_stats, + per_cpu_ptr(lport->stats, get_cpu())->LinkFailureCount++; put_cpu(); fcoe_clean_pending_queue(lport); @@ -1326,6 +1326,7 @@ static void bnx2fc_hba_destroy(struct bnx2fc_hba *hba) static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic) { struct bnx2fc_hba *hba; + struct fcoe_capabilities *fcoe_cap; int rc; hba = kzalloc(sizeof(*hba), GFP_KERNEL); @@ -1361,6 +1362,21 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic) printk(KERN_ERR PFX "em_config:bnx2fc_cmd_mgr_alloc failed\n"); goto cmgr_err; } + fcoe_cap = &hba->fcoe_cap; + + fcoe_cap->capability1 = BNX2FC_TM_MAX_SQES << + FCOE_IOS_PER_CONNECTION_SHIFT; + fcoe_cap->capability1 |= BNX2FC_NUM_MAX_SESS << + FCOE_LOGINS_PER_PORT_SHIFT; + fcoe_cap->capability2 = BNX2FC_MAX_OUTSTANDING_CMNDS << + FCOE_NUMBER_OF_EXCHANGES_SHIFT; + fcoe_cap->capability2 |= BNX2FC_MAX_NPIV << + FCOE_NPIV_WWN_PER_PORT_SHIFT; + fcoe_cap->capability3 = BNX2FC_NUM_MAX_SESS << + FCOE_TARGETS_SUPPORTED_SHIFT; + fcoe_cap->capability3 |= BNX2FC_MAX_OUTSTANDING_CMNDS << + FCOE_OUTSTANDING_COMMANDS_SHIFT; + fcoe_cap->capability4 = FCOE_CAPABILITY4_STATEFUL; init_waitqueue_head(&hba->shutdown_wait); init_waitqueue_head(&hba->destroy_wait); @@ -1691,6 +1707,32 @@ static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba) hba->pcidev = NULL; } +/** + * bnx2fc_ulp_get_stats - cnic callback to populate FCoE stats + * + * @handle: transport handle pointing to adapter struture + */ +static int bnx2fc_ulp_get_stats(void *handle) +{ + struct bnx2fc_hba *hba = handle; + struct cnic_dev *cnic; + struct fcoe_stats_info *stats_addr; + + if (!hba) + return -EINVAL; + + cnic = hba->cnic; + stats_addr = &cnic->stats_addr->fcoe_stat; + if (!stats_addr) + return -EINVAL; + + strncpy(stats_addr->version, BNX2FC_VERSION, + sizeof(stats_addr->version)); + stats_addr->txq_size = BNX2FC_SQ_WQES_MAX; + stats_addr->rxq_size = BNX2FC_CQ_WQES_MAX; + + return 0; +} /** @@ -1944,6 +1986,7 @@ static void bnx2fc_ulp_init(struct cnic_dev *dev) adapter_count++; mutex_unlock(&bnx2fc_dev_lock); + dev->fcoe_cap = &hba->fcoe_cap; clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic); rc = dev->register_device(dev, CNIC_ULP_FCOE, (void *) hba); @@ -2019,11 +2062,11 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) struct fcoe_ctlr *ctlr; struct bnx2fc_interface *interface; struct bnx2fc_hba *hba; - struct net_device *phys_dev; + struct net_device *phys_dev = netdev; struct fc_lport *lport; struct ethtool_drvinfo drvinfo; int rc = 0; - int vlan_id; + int vlan_id = 0; BNX2FC_MISC_DBG("Entered bnx2fc_create\n"); if (fip_mode != FIP_MODE_FABRIC) { @@ -2041,14 +2084,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) } /* obtain physical netdev */ - if (netdev->priv_flags & IFF_802_1Q_VLAN) { + if (netdev->priv_flags & IFF_802_1Q_VLAN) phys_dev = vlan_dev_real_dev(netdev); - vlan_id = vlan_dev_vlan_id(netdev); - } else { - printk(KERN_ERR PFX "Not a vlan device\n"); - rc = -EINVAL; - goto netdev_err; - } + /* verify if the physical device is a netxtreme2 device */ if (phys_dev->ethtool_ops && phys_dev->ethtool_ops->get_drvinfo) { memset(&drvinfo, 0, sizeof(drvinfo)); @@ -2083,9 +2121,13 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) goto ifput_err; } + if (netdev->priv_flags & IFF_802_1Q_VLAN) { + vlan_id = vlan_dev_vlan_id(netdev); + interface->vlan_enabled = 1; + } + ctlr = bnx2fc_to_ctlr(interface); interface->vlan_id = vlan_id; - interface->vlan_enabled = 1; interface->timer_work_queue = create_singlethread_workqueue("bnx2fc_timer_wq"); @@ -2152,13 +2194,10 @@ mod_err: **/ static struct bnx2fc_hba *bnx2fc_find_hba_for_cnic(struct cnic_dev *cnic) { - struct list_head *list; - struct list_head *temp; struct bnx2fc_hba *hba; /* Called with bnx2fc_dev_lock held */ - list_for_each_safe(list, temp, &adapter_list) { - hba = (struct bnx2fc_hba *)list; + list_for_each_entry(hba, &adapter_list, list) { if (hba->cnic == cnic) return hba; } @@ -2252,15 +2291,17 @@ static int bnx2fc_fcoe_reset(struct Scsi_Host *shost) static bool bnx2fc_match(struct net_device *netdev) { + struct net_device *phys_dev = netdev; + mutex_lock(&bnx2fc_dev_lock); - if (netdev->priv_flags & IFF_802_1Q_VLAN) { - struct net_device *phys_dev = vlan_dev_real_dev(netdev); + if (netdev->priv_flags & IFF_802_1Q_VLAN) + phys_dev = vlan_dev_real_dev(netdev); - if (bnx2fc_hba_lookup(phys_dev)) { - mutex_unlock(&bnx2fc_dev_lock); - return true; - } + if (bnx2fc_hba_lookup(phys_dev)) { + mutex_unlock(&bnx2fc_dev_lock); + return true; } + mutex_unlock(&bnx2fc_dev_lock); return false; } @@ -2290,9 +2331,9 @@ static void bnx2fc_percpu_thread_create(unsigned int cpu) p = &per_cpu(bnx2fc_percpu, cpu); - thread = kthread_create(bnx2fc_percpu_io_thread, - (void *)p, - "bnx2fc_thread/%d", cpu); + thread = kthread_create_on_node(bnx2fc_percpu_io_thread, + (void *)p, cpu_to_node(cpu), + "bnx2fc_thread/%d", cpu); /* bind thread to the cpu */ if (likely(!IS_ERR(thread))) { kthread_bind(thread, cpu); @@ -2643,4 +2684,5 @@ static struct cnic_ulp_ops bnx2fc_cnic_cb = { .cnic_stop = bnx2fc_ulp_stop, .indicate_kcqes = bnx2fc_indicate_kcqe, .indicate_netevent = bnx2fc_indicate_netevent, + .cnic_get_stats = bnx2fc_ulp_get_stats, }; diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index 2ca6bfe4ce5e..6d6eee42ac7d 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c @@ -1244,7 +1244,9 @@ static void bnx2fc_process_conn_disable_cmpl(struct bnx2fc_hba *hba, if (disable_kcqe->completion_status) { printk(KERN_ERR PFX "Disable failed with cmpl status %d\n", disable_kcqe->completion_status); - return; + set_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags); + set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags); + wake_up_interruptible(&tgt->upld_wait); } else { /* disable successful */ BNX2FC_TGT_DBG(tgt, "disable successful\n"); diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 4f7453b9e41e..73f231ccd45b 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c @@ -405,11 +405,10 @@ free_cmd_pool: goto free_cmgr; for (i = 0; i < num_possible_cpus() + 1; i++) { - struct list_head *list; - struct list_head *tmp; + struct bnx2fc_cmd *tmp, *io_req; - list_for_each_safe(list, tmp, &cmgr->free_list[i]) { - struct bnx2fc_cmd *io_req = (struct bnx2fc_cmd *)list; + list_for_each_entry_safe(io_req, tmp, + &cmgr->free_list[i], link) { list_del(&io_req->link); kfree(io_req); } @@ -1436,9 +1435,7 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req) { struct scsi_cmnd *sc_cmd = io_req->sc_cmd; struct bnx2fc_rport *tgt = io_req->tgt; - struct list_head *list; - struct list_head *tmp; - struct bnx2fc_cmd *cmd; + struct bnx2fc_cmd *cmd, *tmp; int tm_lun = sc_cmd->device->lun; int rc = 0; int lun; @@ -1449,9 +1446,8 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req) * Walk thru the active_ios queue and ABORT the IO * that matches with the LUN that was reset */ - list_for_each_safe(list, tmp, &tgt->active_cmd_queue) { + list_for_each_entry_safe(cmd, tmp, &tgt->active_cmd_queue, link) { BNX2FC_TGT_DBG(tgt, "LUN RST cmpl: scan for pending IOs\n"); - cmd = (struct bnx2fc_cmd *)list; lun = cmd->sc_cmd->device->lun; if (lun == tm_lun) { /* Initiate ABTS on this cmd */ @@ -1476,9 +1472,7 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req) static void bnx2fc_tgt_reset_cmpl(struct bnx2fc_cmd *io_req) { struct bnx2fc_rport *tgt = io_req->tgt; - struct list_head *list; - struct list_head *tmp; - struct bnx2fc_cmd *cmd; + struct bnx2fc_cmd *cmd, *tmp; int rc = 0; /* called with tgt_lock held */ @@ -1487,9 +1481,8 @@ static void bnx2fc_tgt_reset_cmpl(struct bnx2fc_cmd *io_req) * Walk thru the active_ios queue and ABORT the IO * that matches with the LUN that was reset */ - list_for_each_safe(list, tmp, &tgt->active_cmd_queue) { + list_for_each_entry_safe(cmd, tmp, &tgt->active_cmd_queue, link) { BNX2FC_TGT_DBG(tgt, "TGT RST cmpl: scan for pending IOs\n"); - cmd = (struct bnx2fc_cmd *)list; /* Initiate ABTS */ if (!test_and_set_bit(BNX2FC_FLAG_ISSUE_ABTS, &cmd->req_flags)) { @@ -1980,7 +1973,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, struct bnx2fc_interface *interface = port->priv; struct bnx2fc_hba *hba = interface->hba; struct fc_lport *lport = port->lport; - struct fcoe_dev_stats *stats; + struct fc_stats *stats; int task_idx, index; u16 xid; @@ -1991,7 +1984,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, io_req->data_xfer_len = scsi_bufflen(sc_cmd); sc_cmd->SCp.ptr = (char *)io_req; - stats = per_cpu_ptr(lport->dev_stats, get_cpu()); + stats = per_cpu_ptr(lport->stats, get_cpu()); if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) { io_req->io_req_flags = BNX2FC_READ; stats->InputRequests++; diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c index 082a25c3117e..b9d0d9cb17f9 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c @@ -150,8 +150,7 @@ tgt_init_err: void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) { struct bnx2fc_cmd *io_req; - struct list_head *list; - struct list_head *tmp; + struct bnx2fc_cmd *tmp; int rc; int i = 0; BNX2FC_TGT_DBG(tgt, "Entered flush_active_ios - %d\n", @@ -160,9 +159,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) spin_lock_bh(&tgt->tgt_lock); tgt->flush_in_prog = 1; - list_for_each_safe(list, tmp, &tgt->active_cmd_queue) { + list_for_each_entry_safe(io_req, tmp, &tgt->active_cmd_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list; list_del_init(&io_req->link); io_req->on_active_queue = 0; BNX2FC_IO_DBG(io_req, "cmd_queue cleanup\n"); @@ -181,13 +179,18 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) set_bit(BNX2FC_FLAG_IO_COMPL, &io_req->req_flags); set_bit(BNX2FC_FLAG_IO_CLEANUP, &io_req->req_flags); - rc = bnx2fc_initiate_cleanup(io_req); - BUG_ON(rc); + + /* Do not issue cleanup when disable request failed */ + if (test_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags)) + bnx2fc_process_cleanup_compl(io_req, io_req->task, 0); + else { + rc = bnx2fc_initiate_cleanup(io_req); + BUG_ON(rc); + } } - list_for_each_safe(list, tmp, &tgt->active_tm_queue) { + list_for_each_entry_safe(io_req, tmp, &tgt->active_tm_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list; list_del_init(&io_req->link); io_req->on_tmf_queue = 0; BNX2FC_IO_DBG(io_req, "tm_queue cleanup\n"); @@ -195,9 +198,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) complete(&io_req->tm_done); } - list_for_each_safe(list, tmp, &tgt->els_queue) { + list_for_each_entry_safe(io_req, tmp, &tgt->els_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list; list_del_init(&io_req->link); io_req->on_active_queue = 0; @@ -212,13 +214,17 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) io_req->cb_arg = NULL; } - rc = bnx2fc_initiate_cleanup(io_req); - BUG_ON(rc); + /* Do not issue cleanup when disable request failed */ + if (test_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags)) + bnx2fc_process_cleanup_compl(io_req, io_req->task, 0); + else { + rc = bnx2fc_initiate_cleanup(io_req); + BUG_ON(rc); + } } - list_for_each_safe(list, tmp, &tgt->io_retire_queue) { + list_for_each_entry_safe(io_req, tmp, &tgt->io_retire_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list; list_del_init(&io_req->link); BNX2FC_IO_DBG(io_req, "retire_queue flush\n"); @@ -321,9 +327,13 @@ static void bnx2fc_upload_session(struct fcoe_port *port, del_timer_sync(&tgt->upld_timer); - } else + } else if (test_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags)) { + printk(KERN_ERR PFX "ERROR!! DISABLE req failed, destroy" + " not sent to FW\n"); + } else { printk(KERN_ERR PFX "ERROR!! DISABLE req timed out, destroy" " not sent to FW\n"); + } /* Free session resources */ bnx2fc_free_session_resc(hba, tgt); |