fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / scsi / lpfc / lpfc_sli.h
index abd9a8c..a435499 100644 (file)
@@ -1,27 +1,23 @@
 /*******************************************************************
  * 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_sli.h 1.42 2005/03/21 02:01:28EST sf_support Exp  $
- */
-
 /* forward declaration for LPFC_IOCB_t's use */
 struct lpfc_hba;
 
@@ -37,13 +33,15 @@ typedef enum _lpfc_ctx_cmd {
 struct lpfc_iocbq {
        /* lpfc_iocbqs are used in double linked lists */
        struct list_head list;
+       uint16_t iotag;         /* pre-assigned IO tag */
+       uint16_t rsvd1;
+
        IOCB_t iocb;            /* IOCB cmd */
        uint8_t retry;          /* retry counter for IOCB cmd - if needed */
        uint8_t iocb_flag;
-#define LPFC_IO_POLL   1       /* Polling mode iocb */
-#define LPFC_IO_LIBDFC 2       /* libdfc iocb */
-#define LPFC_IO_WAIT   4
-#define LPFC_IO_HIPRI  8       /* High Priority Queue signal flag */
+#define LPFC_IO_LIBDFC 1       /* libdfc iocb */
+#define LPFC_IO_WAKE   2       /* High Priority Queue signal flag */
+#define LPFC_IO_FCP    4       /* FCP command -- iocbq in scsi_buf */
 
        uint8_t abort_count;
        uint8_t rsvd2;
@@ -52,8 +50,7 @@ struct lpfc_iocbq {
        void *context2;         /* caller context information */
        void *context3;         /* caller context information */
        union {
-               wait_queue_head_t *hipri_wait_queue; /* High Priority Queue wait
-                                                       queue */
+               wait_queue_head_t  *wait_queue;
                struct lpfc_iocbq  *rsp_iocb;
                struct lpfcMboxq   *mbox;
        } context_un;
@@ -64,7 +61,6 @@ struct lpfc_iocbq {
 };
 
 #define SLI_IOCB_RET_IOCB      1       /* Return IOCB if cmd ring full */
-#define SLI_IOCB_HIGH_PRIORITY 2       /* High priority command */
 
 #define IOCB_SUCCESS        0
 #define IOCB_BUSY           1
@@ -129,18 +125,16 @@ struct lpfc_sli_ring {
 
        uint32_t local_getidx;   /* last available cmd index (from cmdGetInx) */
        uint32_t next_cmdidx;    /* next_cmd index */
+       uint32_t rspidx;        /* current index in response ring */
+       uint32_t cmdidx;        /* current index in command ring */
        uint8_t rsvd;
        uint8_t ringno;         /* ring number */
-       uint8_t rspidx;         /* current index in response ring */
-       uint8_t cmdidx;         /* current index in command ring */
        uint16_t numCiocb;      /* number of command iocb's per ring */
        uint16_t numRiocb;      /* number of rsp iocb's per ring */
 
        uint32_t fast_iotag;    /* max fastlookup based iotag           */
        uint32_t iotag_ctr;     /* keeps track of the next iotag to use */
        uint32_t iotag_max;     /* max iotag value to use               */
-       struct lpfc_iocbq ** fast_lookup; /* array of IOCB ptrs indexed by
-                                          iotag */
        struct list_head txq;
        uint16_t txq_cnt;       /* current length of queue */
        uint16_t txq_max;       /* max length */
@@ -178,6 +172,18 @@ struct lpfc_sli_stat {
        uint32_t mbox_busy;      /* Mailbox cmd busy */
 };
 
+/* Structure to store link status values when port stats are reset */
+struct lpfc_lnk_stat {
+       uint32_t link_failure_count;
+       uint32_t loss_of_sync_count;
+       uint32_t loss_of_signal_count;
+       uint32_t prim_seq_protocol_err_count;
+       uint32_t invalid_tx_word_count;
+       uint32_t invalid_crc_count;
+       uint32_t error_frames;
+       uint32_t link_events;
+};
+
 /* Structure used to hold SLI information */
 struct lpfc_sli {
        uint32_t num_rings;
@@ -192,7 +198,7 @@ struct lpfc_sli {
        int fcp_ring;           /* ring used for FCP initiator commands */
        int next_ring;
 
-       int ip_ring;            /* ring used for IP network drv cmds */
+       int extra_ring;         /* extra ring used for other protocols */
 
        struct lpfc_sli_stat slistat;   /* SLI statistical info */
        struct list_head mboxq;
@@ -203,7 +209,12 @@ struct lpfc_sli {
        struct timer_list mbox_tmo;     /* Hold clk to timeout active mbox
                                           cmd */
 
-       uint32_t *MBhostaddr;   /* virtual address for mbox cmds */
+#define LPFC_IOCBQ_LOOKUP_INCREMENT  1024
+       struct lpfc_iocbq ** iocbq_lookup; /* array to lookup IOCB by IOTAG */
+       size_t iocbq_lookup_len;           /* current lengs of the array */
+       uint16_t  last_iotag;              /* last allocated IOTAG */
+       unsigned long  stats_start;        /* in seconds */
+       struct lpfc_lnk_stat lnk_stat_offsets;
 };
 
 /* Given a pointer to the start of the ring, and the slot number of
@@ -214,3 +225,9 @@ struct lpfc_sli {
 
 #define LPFC_MBOX_TMO           30     /* Sec tmo for outstanding mbox
                                           command */
+#define LPFC_MBOX_TMO_FLASH_CMD 300     /* Sec tmo for outstanding FLASH write
+                                        * or erase cmds. This is especially
+                                        * long because of the potential of
+                                        * multiple flash erases that can be
+                                        * spawned.
+                                        */