[SCSI] bnx2fc: Fix MTU issue by using static MTU
[linux-2.6.git] / drivers / scsi / bfa / bfad_im.c
index d950ee4..c2b3617 100644 (file)
  * General Public License for more details.
  */
 
-/**
+/*
  *  bfad_im.c Linux driver IM module.
  */
 
 #include "bfad_drv.h"
 #include "bfad_im.h"
-#include "bfa_cb_ioim.h"
 #include "bfa_fcs.h"
 
 BFA_TRC_FILE(LDRV, IM);
@@ -30,8 +29,7 @@ DEFINE_IDR(bfad_im_port_index);
 struct scsi_transport_template *bfad_im_scsi_transport_template;
 struct scsi_transport_template *bfad_im_scsi_vport_transport_template;
 static void bfad_im_itnim_work_handler(struct work_struct *work);
-static int bfad_im_queuecommand(struct scsi_cmnd *cmnd,
-                               void (*done)(struct scsi_cmnd *));
+static int bfad_im_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmnd);
 static int bfad_im_slave_alloc(struct scsi_device *sdev);
 static void bfad_im_fc_rport_add(struct bfad_im_port_s  *im_port,
                                struct bfad_itnim_s *itnim);
@@ -94,10 +92,10 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio,
                if (!cmnd->result && itnim &&
                         (bfa_lun_queue_depth > cmnd->device->queue_depth)) {
                        /* Queue depth adjustment for good status completion */
-                       bfad_os_ramp_up_qdepth(itnim, cmnd->device);
+                       bfad_ramp_up_qdepth(itnim, cmnd->device);
                } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) {
                        /* qfull handling */
-                       bfad_os_handle_qfull(itnim, cmnd->device);
+                       bfad_handle_qfull(itnim, cmnd->device);
                }
        }
 
@@ -125,7 +123,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio)
                if (itnim_data) {
                        itnim = itnim_data->itnim;
                        if (itnim)
-                               bfad_os_ramp_up_qdepth(itnim, cmnd->device);
+                               bfad_ramp_up_qdepth(itnim, cmnd->device);
                }
        }
 
@@ -164,10 +162,10 @@ bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,
                wake_up(wq);
 }
 
-/**
+/*
  *  Scsi_Host_template SCSI host template
  */
-/**
+/*
  * Scsi_Host template entry, returns BFAD PCI info.
  */
 static const char *
@@ -184,7 +182,7 @@ bfad_im_info(struct Scsi_Host *shost)
        bfa_get_adapter_model(bfa, model);
 
        memset(bfa_buf, 0, sizeof(bfa_buf));
-       if (ioc->ctdev)
+       if (ioc->ctdev && !ioc->fcmode)
                snprintf(bfa_buf, sizeof(bfa_buf),
                "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s",
                 model, bfad->pci_name, BFAD_DRIVER_VERSION);
@@ -196,7 +194,7 @@ bfad_im_info(struct Scsi_Host *shost)
        return bfa_buf;
 }
 
-/**
+/*
  * Scsi_Host template entry, aborts the specified SCSI command.
  *
  * Returns: SUCCESS or FAILED.
@@ -226,7 +224,8 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd)
        }
 
        bfa_trc(bfad, hal_io->iotag);
-       BFA_LOG(KERN_INFO, bfad, log_level, "scsi%d: abort cmnd %p iotag %x\n",
+       BFA_LOG(KERN_INFO, bfad, bfa_log_level,
+               "scsi%d: abort cmnd %p iotag %x\n",
                im_port->shost->host_no, cmnd, hal_io->iotag);
        (void) bfa_ioim_abort(hal_io);
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
@@ -242,7 +241,7 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd)
 
        cmnd->scsi_done(cmnd);
        bfa_trc(bfad, hal_io->iotag);
-       BFA_LOG(KERN_INFO, bfad, log_level,
+       BFA_LOG(KERN_INFO, bfad, bfa_log_level,
                "scsi%d: complete abort 0x%p iotag 0x%x\n",
                im_port->shost->host_no, cmnd, hal_io->iotag);
        return SUCCESS;
@@ -258,10 +257,11 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,
        struct bfa_tskim_s *tskim;
        struct bfa_itnim_s *bfa_itnim;
        bfa_status_t    rc = BFA_STATUS_OK;
+       struct scsi_lun scsilun;
 
        tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd);
        if (!tskim) {
-               BFA_LOG(KERN_ERR, bfad, log_level,
+               BFA_LOG(KERN_ERR, bfad, bfa_log_level,
                        "target reset, fail to allocate tskim\n");
                rc = BFA_STATUS_FAILED;
                goto out;
@@ -274,13 +274,14 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,
        cmnd->host_scribble = NULL;
        cmnd->SCp.Status = 0;
        bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
-       bfa_tskim_start(tskim, bfa_itnim, (lun_t)0,
+       memset(&scsilun, 0, sizeof(scsilun));
+       bfa_tskim_start(tskim, bfa_itnim, scsilun,
                            FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO);
 out:
        return rc;
 }
 
-/**
+/*
  * Scsi_Host template entry, resets a LUN and abort its all commands.
  *
  * Returns: SUCCESS or FAILED.
@@ -301,6 +302,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
        int             rc = SUCCESS;
        unsigned long   flags;
        enum bfi_tskim_status task_status;
+       struct scsi_lun scsilun;
 
        spin_lock_irqsave(&bfad->bfad_lock, flags);
        itnim = itnim_data->itnim;
@@ -312,14 +314,14 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
 
        tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd);
        if (!tskim) {
-               BFA_LOG(KERN_ERR, bfad, log_level,
+               BFA_LOG(KERN_ERR, bfad, bfa_log_level,
                                "LUN reset, fail to allocate tskim");
                spin_unlock_irqrestore(&bfad->bfad_lock, flags);
                rc = FAILED;
                goto out;
        }
 
-       /**
+       /*
         * Set host_scribble to NULL to avoid aborting a task command
         * if happens.
         */
@@ -327,8 +329,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
        cmnd->SCp.ptr = (char *)&wq;
        cmnd->SCp.Status = 0;
        bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
-       bfa_tskim_start(tskim, bfa_itnim,
-                           bfad_int_to_lun(cmnd->device->lun),
+       int_to_scsilun(cmnd->device->lun, &scsilun);
+       bfa_tskim_start(tskim, bfa_itnim, scsilun,
                            FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 
@@ -337,7 +339,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
 
        task_status = cmnd->SCp.Status >> 1;
        if (task_status != BFI_TSKIM_STS_OK) {
-               BFA_LOG(KERN_ERR, bfad, log_level,
+               BFA_LOG(KERN_ERR, bfad, bfa_log_level,
                        "LUN reset failure, status: %d\n", task_status);
                rc = FAILED;
        }
@@ -346,7 +348,7 @@ out:
        return rc;
 }
 
-/**
+/*
  * Scsi_Host template entry, resets the bus and abort all commands.
  */
 static int
@@ -364,7 +366,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd)
 
        spin_lock_irqsave(&bfad->bfad_lock, flags);
        for (i = 0; i < MAX_FCP_TARGET; i++) {
-               itnim = bfad_os_get_itnim(im_port, i);
+               itnim = bfad_get_itnim(im_port, i);
                if (itnim) {
                        cmnd->SCp.ptr = (char *)&wq;
                        rc = bfad_im_target_reset_send(bfad, cmnd, itnim);
@@ -381,7 +383,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd)
 
                        task_status = cmnd->SCp.Status >> 1;
                        if (task_status != BFI_TSKIM_STS_OK) {
-                               BFA_LOG(KERN_ERR, bfad, log_level,
+                               BFA_LOG(KERN_ERR, bfad, bfa_log_level,
                                        "target reset failure,"
                                        " status: %d\n", task_status);
                                err_cnt++;
@@ -396,7 +398,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd)
        return SUCCESS;
 }
 
-/**
+/*
  * Scsi_Host template entry slave_destroy.
  */
 static void
@@ -406,11 +408,11 @@ bfad_im_slave_destroy(struct scsi_device *sdev)
        return;
 }
 
-/**
+/*
  *  BFA FCS itnim callbacks
  */
 
-/**
+/*
  * BFA FCS itnim alloc callback, after successful PRLI
  * Context: Interrupt
  */
@@ -433,7 +435,7 @@ bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
        bfad->bfad_flags |= BFAD_RPORT_ONLINE;
 }
 
-/**
+/*
  * BFA FCS itnim free callback.
  * Context: Interrupt. bfad_lock is held
  */
@@ -447,7 +449,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv)
        struct bfad_im_s        *im = itnim_drv->im;
 
        /* online to free state transtion should not happen */
-       bfa_assert(itnim_drv->state != ITNIM_STATE_ONLINE);
+       WARN_ON(itnim_drv->state == ITNIM_STATE_ONLINE);
 
        itnim_drv->queue_work = 1;
        /* offline request is not yet done, use the same request to free */
@@ -461,7 +463,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv)
        fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim);
        wwn2str(wwpn_str, wwpn);
        fcid2str(fcid_str, fcid);
-       BFA_LOG(KERN_INFO, bfad, log_level,
+       BFA_LOG(KERN_INFO, bfad, bfa_log_level,
                "ITNIM FREE scsi%d: FCID: %s WWPN: %s\n",
                port->im_port->shost->host_no,
                fcid_str, wwpn_str);
@@ -471,7 +473,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv)
                queue_work(im->drv_workq, &itnim_drv->itnim_work);
 }
 
-/**
+/*
  * BFA FCS itnim online callback.
  * Context: Interrupt. bfad_lock is held
  */
@@ -492,7 +494,7 @@ bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv)
                queue_work(im->drv_workq, &itnim_drv->itnim_work);
 }
 
-/**
+/*
  * BFA FCS itnim offline callback.
  * Context: Interrupt. bfad_lock is held
  */
@@ -519,7 +521,7 @@ bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv)
                queue_work(im->drv_workq, &itnim_drv->itnim_work);
 }
 
-/**
+/*
  * Allocate a Scsi_Host for a port.
  */
 int
@@ -545,7 +547,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
 
        mutex_unlock(&bfad_mutex);
 
-       im_port->shost = bfad_os_scsi_host_alloc(im_port, bfad);
+       im_port->shost = bfad_scsi_host_alloc(im_port, bfad);
        if (!im_port->shost) {
                error = 1;
                goto out_free_idr;
@@ -571,7 +573,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
        }
 
        /* setup host fixed attribute if the lk supports */
-       bfad_os_fc_host_init(im_port);
+       bfad_fc_host_init(im_port);
 
        return 0;
 
@@ -590,7 +592,7 @@ void
 bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
 {
        bfa_trc(bfad, bfad->inst_no);
-       BFA_LOG(KERN_INFO, bfad, log_level, "Free scsi%d\n",
+       BFA_LOG(KERN_INFO, bfad, bfa_log_level, "Free scsi%d\n",
                        im_port->shost->host_no);
 
        fc_remove_host(im_port->shost);
@@ -662,7 +664,7 @@ bfad_im_port_clean(struct bfad_im_port_s *im_port)
        }
 
        /* the itnim_mapped_list must be empty at this time */
-       bfa_assert(list_empty(&im_port->itnim_mapped_list));
+       WARN_ON(!list_empty(&im_port->itnim_mapped_list));
 
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 }
@@ -682,7 +684,7 @@ bfad_im_probe(struct bfad_s *bfad)
        bfad->im = im;
        im->bfad = bfad;
 
-       if (bfad_os_thread_workq(bfad) != BFA_STATUS_OK) {
+       if (bfad_thread_workq(bfad) != BFA_STATUS_OK) {
                kfree(im);
                rc = BFA_STATUS_FAILED;
        }
@@ -695,14 +697,14 @@ void
 bfad_im_probe_undo(struct bfad_s *bfad)
 {
        if (bfad->im) {
-               bfad_os_destroy_workq(bfad->im);
+               bfad_destroy_workq(bfad->im);
                kfree(bfad->im);
                bfad->im = NULL;
        }
 }
 
 struct Scsi_Host *
-bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
+bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
 {
        struct scsi_host_template *sht;
 
@@ -717,7 +719,7 @@ bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
 }
 
 void
-bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
+bfad_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
 {
        if (!(im_port->flags & BFAD_PORT_DELETE))
                flush_workqueue(bfad->im->drv_workq);
@@ -727,7 +729,7 @@ bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
 }
 
 void
-bfad_os_destroy_workq(struct bfad_im_s *im)
+bfad_destroy_workq(struct bfad_im_s *im)
 {
        if (im && im->drv_workq) {
                flush_workqueue(im->drv_workq);
@@ -737,7 +739,7 @@ bfad_os_destroy_workq(struct bfad_im_s *im)
 }
 
 bfa_status_t
-bfad_os_thread_workq(struct bfad_s *bfad)
+bfad_thread_workq(struct bfad_s *bfad)
 {
        struct bfad_im_s      *im = bfad->im;
 
@@ -751,7 +753,7 @@ bfad_os_thread_workq(struct bfad_s *bfad)
        return BFA_STATUS_OK;
 }
 
-/**
+/*
  * Scsi_Host template entry.
  *
  * Description:
@@ -841,7 +843,7 @@ bfad_im_module_exit(void)
 }
 
 void
-bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
+bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
 {
        struct scsi_device *tmp_sdev;
 
@@ -869,7 +871,7 @@ bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
 }
 
 void
-bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
+bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
 {
        struct scsi_device *tmp_sdev;
 
@@ -883,7 +885,7 @@ bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
 }
 
 struct bfad_itnim_s *
-bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id)
+bfad_get_itnim(struct bfad_im_port_s *im_port, int id)
 {
        struct bfad_itnim_s   *itnim = NULL;
 
@@ -896,7 +898,7 @@ bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id)
        return NULL;
 }
 
-/**
+/*
  * Scsi_Host template entry slave_alloc
  */
 static int
@@ -915,12 +917,16 @@ bfad_im_slave_alloc(struct scsi_device *sdev)
 static u32
 bfad_im_supported_speeds(struct bfa_s *bfa)
 {
-       struct bfa_ioc_attr_s ioc_attr;
+       struct bfa_ioc_attr_s *ioc_attr;
        u32 supported_speed = 0;
 
-       bfa_get_attr(bfa, &ioc_attr);
-       if (ioc_attr.adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) {
-               if (ioc_attr.adapter_attr.is_mezz) {
+       ioc_attr = kzalloc(sizeof(struct bfa_ioc_attr_s), GFP_KERNEL);
+       if (!ioc_attr)
+               return 0;
+
+       bfa_ioc_get_attr(&bfa->ioc, ioc_attr);
+       if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) {
+               if (ioc_attr->adapter_attr.is_mezz) {
                        supported_speed |= FC_PORTSPEED_8GBIT |
                                FC_PORTSPEED_4GBIT |
                                FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT;
@@ -929,29 +935,29 @@ bfad_im_supported_speeds(struct bfa_s *bfa)
                                FC_PORTSPEED_4GBIT |
                                FC_PORTSPEED_2GBIT;
                }
-       } else if (ioc_attr.adapter_attr.max_speed == BFA_PORT_SPEED_4GBPS) {
+       } else if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_4GBPS) {
                supported_speed |=  FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT |
                                FC_PORTSPEED_1GBIT;
-       } else if (ioc_attr.adapter_attr.max_speed == BFA_PORT_SPEED_10GBPS) {
+       } else if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_10GBPS) {
                supported_speed |= FC_PORTSPEED_10GBIT;
        }
+       kfree(ioc_attr);
        return supported_speed;
 }
 
 void
-bfad_os_fc_host_init(struct bfad_im_port_s *im_port)
+bfad_fc_host_init(struct bfad_im_port_s *im_port)
 {
        struct Scsi_Host *host = im_port->shost;
        struct bfad_s         *bfad = im_port->bfad;
        struct bfad_port_s    *port = im_port->port;
-       struct bfa_port_attr_s pattr;
-       struct bfa_lport_attr_s port_attr;
        char symname[BFA_SYMNAME_MAXLEN];
+       struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa);
 
        fc_host_node_name(host) =
-               bfa_os_htonll((bfa_fcs_lport_get_nwwn(port->fcs_port)));
+               cpu_to_be64((bfa_fcs_lport_get_nwwn(port->fcs_port)));
        fc_host_port_name(host) =
-               bfa_os_htonll((bfa_fcs_lport_get_pwwn(port->fcs_port)));
+               cpu_to_be64((bfa_fcs_lport_get_pwwn(port->fcs_port)));
        fc_host_max_npiv_vports(host) = bfa_lps_get_max_vport(&bfad->bfa);
 
        fc_host_supported_classes(host) = FC_COS_CLASS3;
@@ -964,15 +970,12 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port)
        /* For fibre channel services type 0x20 */
        fc_host_supported_fc4s(host)[7] = 1;
 
-       bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr);
-       strncpy(symname, port_attr.port_cfg.sym_name.symname,
+       strncpy(symname, bfad->bfa_fcs.fabric.bport.port_cfg.sym_name.symname,
                BFA_SYMNAME_MAXLEN);
        sprintf(fc_host_symbolic_name(host), "%s", symname);
 
        fc_host_supported_speeds(host) = bfad_im_supported_speeds(&bfad->bfa);
-
-       bfa_fcport_get_attr(&bfad->bfa, &pattr);
-       fc_host_maxframe_size(host) = pattr.pport_cfg.maxfrsize;
+       fc_host_maxframe_size(host) = fcport->cfg.maxfrsize;
 }
 
 static void
@@ -983,11 +986,11 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim)
        struct bfad_itnim_data_s *itnim_data;
 
        rport_ids.node_name =
-               bfa_os_htonll(bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim));
+               cpu_to_be64(bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim));
        rport_ids.port_name =
-               bfa_os_htonll(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim));
+               cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim));
        rport_ids.port_id =
-               bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim));
+               bfa_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim));
        rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
 
        itnim->fc_rport = fc_rport =
@@ -1015,7 +1018,7 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim)
        return;
 }
 
-/**
+/*
  * Work queue handler using FC transport service
 * Context: kernel
  */
@@ -1048,7 +1051,7 @@ bfad_im_itnim_work_handler(struct work_struct *work)
                        fcid2str(fcid_str, fcid);
                        list_add_tail(&itnim->list_entry,
                                &im_port->itnim_mapped_list);
-                       BFA_LOG(KERN_INFO, bfad, log_level,
+                       BFA_LOG(KERN_INFO, bfad, bfa_log_level,
                                "ITNIM ONLINE Target: %d:0:%d "
                                "FCID: %s WWPN: %s\n",
                                im_port->shost->host_no,
@@ -1081,7 +1084,7 @@ bfad_im_itnim_work_handler(struct work_struct *work)
                        wwn2str(wwpn_str, wwpn);
                        fcid2str(fcid_str, fcid);
                        list_del(&itnim->list_entry);
-                       BFA_LOG(KERN_INFO, bfad, log_level,
+                       BFA_LOG(KERN_INFO, bfad, bfa_log_level,
                                "ITNIM OFFLINE Target: %d:0:%d "
                                "FCID: %s WWPN: %s\n",
                                im_port->shost->host_no,
@@ -1108,18 +1111,18 @@ bfad_im_itnim_work_handler(struct work_struct *work)
                kfree(itnim);
                break;
        default:
-               bfa_assert(0);
+               WARN_ON(1);
                break;
        }
 
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 }
 
-/**
+/*
  * Scsi_Host template entry, queue a SCSI command to the BFAD.
  */
 static int
-bfad_im_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
+bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
 {
        struct bfad_im_port_s *im_port =
                (struct bfad_im_port_s *) cmnd->device->host->hostdata[0];
@@ -1171,7 +1174,6 @@ bfad_im_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
        }
 
        cmnd->host_scribble = (char *)hal_io;
-       bfa_trc_fp(bfad, hal_io->iotag);
        bfa_ioim_start(hal_io);
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 
@@ -1186,8 +1188,10 @@ out_fail_cmd:
        return 0;
 }
 
+static DEF_SCSI_QCMD(bfad_im_queuecommand)
+
 void
-bfad_os_rport_online_wait(struct bfad_s *bfad)
+bfad_rport_online_wait(struct bfad_s *bfad)
 {
        int i;
        int rport_delay = 10;
@@ -1215,7 +1219,7 @@ bfad_os_rport_online_wait(struct bfad_s *bfad)
 }
 
 int
-bfad_os_get_linkup_delay(struct bfad_s *bfad)
+bfad_get_linkup_delay(struct bfad_s *bfad)
 {
        u8              nwwns = 0;
        wwn_t           wwns[BFA_PREBOOT_BOOTLUN_MAX];