Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / scsi / lpfc / lpfc_disc.h
index 0b7ae7f..41cf5d3 100644 (file)
@@ -1,91 +1,73 @@
 /*******************************************************************
  * 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_disc.h 1.45 2004/11/10 11:40:40EST sf_support Exp  $
- */
-
-#ifndef  _H_LPFC_DISC
-#define  _H_LPFC_DISC
-
-#include "lpfc_hw.h"
-
-struct lpfc_target;
-
 #define FC_MAX_HOLD_RSCN     32              /* max number of deferred RSCNs */
 #define FC_MAX_NS_RSP        65536    /* max size NameServer rsp */
 #define FC_MAXLOOP           126      /* max devices supported on a fc loop */
 #define LPFC_DISC_FLOGI_TMO  10              /* Discovery FLOGI ratov */
 
-/* Defines for failMask bitmask
- * These are reasons that the device is not currently available
- * for I/O to be sent.
- */
-#define LPFC_DEV_LINK_DOWN       0x1   /* Link is down */
-#define LPFC_DEV_DISAPPEARED     0x2   /* Device disappeared from mapped
-                                          list */
-#define LPFC_DEV_DISCOVERY_INP   0x4   /* Device to go through discovery */
-#define LPFC_DEV_DISCONNECTED    0x8   /* noactive connection to remote dev */
-
-/* These defines are used for set failMask routines */
-#define LPFC_SET_BITMASK               1
-#define LPFC_CLR_BITMASK               2
-
-/* Provide an enumeration for the Types of addresses a FARP can resolve. */
-typedef enum lpfc_farp_addr_type {
-       LPFC_FARP_BY_IEEE,
-       LPFC_FARP_BY_WWPN,
-       LPFC_FARP_BY_WWNN,
-} LPFC_FARP_ADDR_TYPE;
 
 /* This is the protocol dependent definition for a Node List Entry.
  * This is used by Fibre Channel protocol to support FCP.
  */
 
-struct lpfc_bindlist {
-       struct list_head      nlp_listp;
-       struct lpfc_target    *nlp_Target;      /* ptr to the tgt structure */
-       struct lpfc_name      nlp_portname;     /* port name */
-       struct lpfc_name      nlp_nodename;     /* node name */
-       uint16_t              nlp_bind_type;
-       uint16_t              nlp_sid;          /* scsi id */
-       uint32_t              nlp_DID;          /* FibreChannel D_ID of entry */
+/* worker thread events */
+enum lpfc_work_type {
+       LPFC_EVT_NODEV_TMO,
+       LPFC_EVT_ONLINE,
+       LPFC_EVT_OFFLINE,
+       LPFC_EVT_WARM_START,
+       LPFC_EVT_KILL,
+       LPFC_EVT_ELS_RETRY,
+};
+
+/* structure used to queue event to the discovery tasklet */
+struct lpfc_work_evt {
+       struct list_head      evt_listp;
+       void                * evt_arg1;
+       void                * evt_arg2;
+       enum lpfc_work_type   evt;
 };
 
+
 struct lpfc_nodelist {
        struct list_head nlp_listp;
        struct lpfc_name nlp_portname;          /* port name */
        struct lpfc_name nlp_nodename;          /* node name */
-       uint32_t         nlp_failMask;          /* failure mask for device */
        uint32_t         nlp_flag;              /* entry  flags */
        uint32_t         nlp_DID;               /* FC D_ID of entry */
-       uint32_t         nlp_last_elscmd;       /* Last ELS cmd sent */
+       uint32_t         nlp_last_elscmd;       /* Last ELS cmd sent */
        uint16_t         nlp_type;
 #define NLP_FC_NODE        0x1                 /* entry is an FC node */
 #define NLP_FABRIC         0x4                 /* entry rep a Fabric entity */
 #define NLP_FCP_TARGET     0x8                 /* entry is an FCP target */
+#define NLP_FCP_INITIATOR  0x10                        /* entry is an FCP Initiator */
 
        uint16_t        nlp_rpi;
        uint16_t        nlp_state;              /* state transition indicator */
+       uint16_t        nlp_prev_state;         /* state transition indicator */
        uint16_t        nlp_xri;                /* output exchange id for RPI */
        uint16_t        nlp_sid;                /* scsi id */
+#define NLP_NO_SID             0xffff
+       uint16_t        nlp_maxframe;           /* Max RCV frame size */
+       uint8_t         nlp_class_sup;          /* Supported Classes */
        uint8_t         nlp_retry;              /* used for ELS retries */
        uint8_t         nlp_disc_refcnt;        /* used for DSM */
        uint8_t         nlp_fcp_info;           /* class info, bits 0-3 */
@@ -93,28 +75,13 @@ struct lpfc_nodelist {
 
        struct timer_list   nlp_delayfunc;      /* Used for delayed ELS cmds */
        struct timer_list   nlp_tmofunc;        /* Used for nodev tmo */
-       struct lpfc_target *nlp_Target;         /* Pointer to the target
-                                                  structure */
-
-       struct lpfc_bindlist *nlp_listp_bind;   /* Linked list bounded remote
-                                                  ports */
-       struct lpfc_nodelist *nlp_rpi_hash_next;
+       struct fc_rport *rport;                 /* Corresponding FC transport
+                                                  port structure */
        struct lpfc_hba      *nlp_phba;
-};
-
-/*++
- * lpfc_node_farp_list:
- *   This data structure defines the attributes associated with
- *   an outstanding FARP REQ to a remote node.
- *
- *   listentry - head of this list of pending farp requests.
- *   rnode_addr - The address of the remote node.  Either the IEEE, WWPN, or
- *                WWNN.  Used in the FARP request.
- *
- --*/
-struct lpfc_node_farp_pend {
-       struct list_head listentry;
-       struct lpfc_name rnode_addr;
+       struct lpfc_work_evt nodev_timeout_evt;
+       struct lpfc_work_evt els_retry_evt;
+       unsigned long last_ramp_up_time;        /* jiffy of last ramp up */
+       unsigned long last_q_full_time;         /* jiffy of last queue full */
 };
 
 /* Defines for nlp_flag (uint32) */
@@ -135,24 +102,18 @@ struct lpfc_node_farp_pend {
 #define NLP_LOGO_SND       0x100       /* sent LOGO request for this entry */
 #define NLP_RNID_SND       0x400       /* sent RNID request for this entry */
 #define NLP_ELS_SND_MASK   0x7e0       /* sent ELS request for this entry */
-#define NLP_AUTOMAP        0x800       /* Entry was automap'ed */
-#define NLP_SEED_WWPN      0x1000      /* Entry scsi id is seeded for WWPN */
-#define NLP_SEED_WWNN      0x2000      /* Entry scsi id is seeded for WWNN */
-#define NLP_SEED_DID       0x4000      /* Entry scsi id is seeded for DID */
-#define NLP_SEED_MASK      0x807000    /* mask for seeded flags */
-#define NLP_NS_NODE        0x8000      /* Authenticated entry by NameServer */
 #define NLP_NODEV_TMO      0x10000     /* nodev timeout is running for node */
 #define NLP_DELAY_TMO      0x20000     /* delay timeout is running for node */
 #define NLP_NPR_2B_DISC    0x40000     /* node is included in num_disc_nodes */
 #define NLP_RCV_PLOGI      0x80000     /* Rcv'ed PLOGI from remote system */
 #define NLP_LOGO_ACC       0x100000    /* Process LOGO after ACC completes */
 #define NLP_TGT_NO_SCSIID  0x200000    /* good PRLI but no binding for scsid */
-#define NLP_SEED_ALPA      0x800000    /* SCSI id is derived from alpa array */
 #define NLP_ACC_REGLOGIN   0x1000000   /* Issue Reg Login after successful
                                           ACC */
 #define NLP_NPR_ADISC      0x2000000   /* Issue ADISC when dq'ed from
                                           NPR list */
 #define NLP_DELAY_REMOVE   0x4000000   /* Defer removal till end of DSM */
+#define NLP_NODEV_REMOVE   0x8000000   /* Defer removal till discovery ends */
 
 /* Defines for list searchs */
 #define NLP_SEARCH_MAPPED    0x1       /* search mapped */
@@ -248,23 +209,3 @@ struct lpfc_node_farp_pend {
 #define NLP_EVT_DEVICE_RECOVERY   0xc  /* Device existence unknown */
 #define NLP_EVT_MAX_EVENT         0xd
 
-/* structure used to queue event to the discovery tasklet */
-struct lpfc_disc_evt {
-       struct list_head      evt_listp;
-       void                * evt_arg1;
-       void                * evt_arg2;
-       uint32_t              evt;
-};
-typedef struct lpfc_disc_evt LPFC_DISC_EVT_t;
-
-#define LPFC_EVT_MBOX          0x1
-#define LPFC_EVT_SOL_IOCB      0x2
-#define LPFC_EVT_UNSOL_IOCB    0x3
-#define LPFC_EVT_NODEV_TMO     0x4
-#define LPFC_EVT_SCAN          0x5
-
-/* Definitions for Binding Entry Type for lpfc_parse_binding_entry()  */
-#define LPFC_BIND_WW_NN_PN   0
-#define LPFC_BIND_DID        1
-
-#endif                         /* _H_LPFC_DISC */