]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_ct.c
[SCSI] lpfc 8.1.2: Code style changes for Discovery code
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_ct.c
index c40cb239c16db370bfa5629f5dd1b3c876185c5a..eab087bf826ed28d4b17204e3b92ddde8f9fa29b 100644 (file)
@@ -1,26 +1,24 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
- * Enterprise Fibre Channel Host Bus Adapters.                     *
- * Refer to the README file included with this package for         *
- * driver version and adapter support.                             *
- * Copyright (C) 2004 Emulex Corporation.                          *
+ * Fibre Channel Host Bus Adapters.                                *
+ * Copyright (C) 2004-2006 Emulex.  All rights reserved.           *
+ * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
  * This program is free software; you can redistribute it and/or   *
- * modify it under the terms of the GNU General Public License     *
- * as published by the Free Software Foundation; either version 2  *
- * of the License, or (at your option) any later version.          *
- *                                                                 *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of  *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
- * GNU General Public License for more details, a copy of which    *
- * can be found in the file COPYING included with this package.    *
+ * modify it under the terms of version 2 of the GNU General       *
+ * Public License as published by the Free Software Foundation.    *
+ * This program is distributed in the hope that it will be useful. *
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
+ * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
+ * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
+ * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
+ * more details, a copy of which can be found in the file COPYING  *
+ * included with this package.                                     *
  *******************************************************************/
 
 /*
- * $Id: lpfc_ct.c 1.161 2005/04/13 11:59:01EDT sf_support Exp  $
- *
  * Fibre Channel SCSI LAN Device Driver CT support
  */
 
 #include <linux/interrupt.h>
 #include <linux/utsname.h>
 
+#include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport_fc.h>
 
 #include "lpfc_hw.h"
 #include "lpfc_sli.h"
@@ -224,18 +224,16 @@ lpfc_gen_req(struct lpfc_hba *phba, struct lpfc_dmabuf *bmp,
 
        struct lpfc_sli *psli = &phba->sli;
        struct lpfc_sli_ring *pring = &psli->ring[LPFC_ELS_RING];
-       struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;
        IOCB_t *icmd;
-       struct lpfc_iocbq *geniocb = NULL;
+       struct lpfc_iocbq *geniocb;
 
        /* Allocate buffer for  command iocb */
        spin_lock_irq(phba->host->host_lock);
-       list_remove_head(lpfc_iocb_list, geniocb, struct lpfc_iocbq, list);
+       geniocb = lpfc_sli_get_iocbq(phba);
        spin_unlock_irq(phba->host->host_lock);
 
        if (geniocb == NULL)
                return 1;
-       memset(geniocb, 0, sizeof (struct lpfc_iocbq));
 
        icmd = &geniocb->iocb;
        icmd->un.genreq64.bdl.ulpIoTag32 = 0;
@@ -262,8 +260,10 @@ lpfc_gen_req(struct lpfc_hba *phba, struct lpfc_dmabuf *bmp,
        icmd->un.genreq64.w5.hcsw.Rctl = FC_UNSOL_CTL;
        icmd->un.genreq64.w5.hcsw.Type = FC_COMMON_TRANSPORT_ULP;
 
-       if (!tmo)
-               tmo = (2 * phba->fc_ratov) + 1;
+       if (!tmo) {
+                /* FC spec states we need 3 * ratov for CT requests */
+               tmo = (3 * phba->fc_ratov);
+       }
        icmd->ulpTimeout = tmo;
        icmd->ulpBdeCount = 1;
        icmd->ulpLe = 1;
@@ -279,7 +279,7 @@ lpfc_gen_req(struct lpfc_hba *phba, struct lpfc_dmabuf *bmp,
        geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT;
        spin_lock_irq(phba->host->host_lock);
        if (lpfc_sli_issue_iocb(phba, pring, geniocb, 0) == IOCB_ERROR) {
-               list_add_tail(&geniocb->list, lpfc_iocb_list);
+               lpfc_sli_release_iocbq(phba, geniocb);
                spin_unlock_irq(phba->host->host_lock);
                return 1;
        }
@@ -451,6 +451,11 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
                CTrsp = (struct lpfc_sli_ct_request *) outp->virt;
                if (CTrsp->CommandResponse.bits.CmdRsp ==
                    be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
+                       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
+                                       "%d:0239 NameServer Rsp "
+                                       "Data: x%x\n",
+                                       phba->brd_no,
+                                       phba->fc_flag);
                        lpfc_ns_rsp(phba, outp,
                                    (uint32_t) (irsp->un.genreq64.bdl.bdeSize));
                } else if (CTrsp->CommandResponse.bits.CmdRsp ==
@@ -487,7 +492,7 @@ out:
        kfree(inp);
        kfree(bmp);
        spin_lock_irq(phba->host->host_lock);
-       list_add_tail(&cmdiocb->list, &phba->lpfc_iocb_list);
+       lpfc_sli_release_iocbq(phba, cmdiocb);
        spin_unlock_irq(phba->host->host_lock);
        return;
 }
@@ -526,7 +531,7 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
        kfree(inp);
        kfree(bmp);
        spin_lock_irq(phba->host->host_lock);
-       list_add_tail(&cmdiocb->list, &phba->lpfc_iocb_list);
+       lpfc_sli_release_iocbq(phba, cmdiocb);
        spin_unlock_irq(phba->host->host_lock);
        return;
 }
@@ -735,7 +740,7 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba,
        kfree(inp);
        kfree(bmp);
        spin_lock_irq(phba->host->host_lock);
-       list_add_tail(&cmdiocb->list, &phba->lpfc_iocb_list);
+       lpfc_sli_release_iocbq(phba, cmdiocb);
        spin_unlock_irq(phba->host->host_lock);
        return;
 }