- Update to 2.6.25-rc3.
[linux-flexiantxendom0-3.2.10.git] / drivers / scsi / lpfc / lpfc_disc.h
index aacac9a..2db0b74 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2007 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2008 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -36,7 +36,6 @@ enum lpfc_work_type {
        LPFC_EVT_WARM_START,
        LPFC_EVT_KILL,
        LPFC_EVT_ELS_RETRY,
-       LPFC_EVT_DEV_LOSS_DELAY,
        LPFC_EVT_DEV_LOSS,
 };
 
@@ -74,6 +73,12 @@ struct lpfc_nodelist {
        uint8_t         nlp_fcp_info;           /* class info, bits 0-3 */
 #define NLP_FCP_2_DEVICE   0x10                        /* FCP-2 device */
 
+       uint16_t        nlp_usg_map;    /* ndlp management usage bitmap */
+#define NLP_USG_NODE_ACT_BIT   0x1     /* Indicate ndlp is actively used */
+#define NLP_USG_IACT_REQ_BIT   0x2     /* Request to inactivate ndlp */
+#define NLP_USG_FREE_REQ_BIT   0x4     /* Request to invoke ndlp memory free */
+#define NLP_USG_FREE_ACK_BIT   0x8     /* Indicate ndlp memory free invoked */
+
        struct timer_list   nlp_delayfunc;      /* Used for delayed ELS cmds */
        struct fc_rport *rport;                 /* Corresponding FC transport
                                                   port structure */
@@ -86,24 +91,51 @@ struct lpfc_nodelist {
 };
 
 /* Defines for nlp_flag (uint32) */
-#define NLP_PLOGI_SND      0x20                /* sent PLOGI request for this entry */
-#define NLP_PRLI_SND       0x40                /* sent PRLI request for this entry */
-#define NLP_ADISC_SND      0x80                /* sent ADISC request for this entry */
-#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_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_ACC_REGLOGIN   0x1000000   /* Issue Reg Login after successful
+#define NLP_PLOGI_SND      0x00000020  /* sent PLOGI request for this entry */
+#define NLP_PRLI_SND       0x00000040  /* sent PRLI request for this entry */
+#define NLP_ADISC_SND      0x00000080  /* sent ADISC request for this entry */
+#define NLP_LOGO_SND       0x00000100  /* sent LOGO request for this entry */
+#define NLP_RNID_SND       0x00000400  /* sent RNID request for this entry */
+#define NLP_ELS_SND_MASK   0x000007e0  /* sent ELS request for this entry */
+#define NLP_DEFER_RM       0x00010000  /* Remove this ndlp if no longer used */
+#define NLP_DELAY_TMO      0x00020000  /* delay timeout is running for node */
+#define NLP_NPR_2B_DISC    0x00040000  /* node is included in num_disc_nodes */
+#define NLP_RCV_PLOGI      0x00080000  /* Rcv'ed PLOGI from remote system */
+#define NLP_LOGO_ACC       0x00100000  /* Process LOGO after ACC completes */
+#define NLP_TGT_NO_SCSIID  0x00200000  /* good PRLI but no binding for scsid */
+#define NLP_ACC_REGLOGIN   0x01000000  /* Issue Reg Login after successful
                                           ACC */
-#define NLP_NPR_ADISC      0x2000000   /* Issue ADISC when dq'ed from
+#define NLP_NPR_ADISC      0x02000000  /* Issue ADISC when dq'ed from
                                           NPR list */
-#define NLP_RM_DFLT_RPI    0x4000000   /* need to remove leftover dflt RPI */
-#define NLP_NODEV_REMOVE   0x8000000   /* Defer removal till discovery ends */
+#define NLP_RM_DFLT_RPI    0x04000000  /* need to remove leftover dflt RPI */
+#define NLP_NODEV_REMOVE   0x08000000  /* Defer removal till discovery ends */
 #define NLP_TARGET_REMOVE  0x10000000   /* Target remove in process */
+#define NLP_SC_REQ         0x20000000  /* Target requires authentication */
+
+/* ndlp usage management macros */
+#define NLP_CHK_NODE_ACT(ndlp)         (((ndlp)->nlp_usg_map \
+                                               & NLP_USG_NODE_ACT_BIT) \
+                                       && \
+                                       !((ndlp)->nlp_usg_map \
+                                               & NLP_USG_FREE_ACK_BIT))
+#define NLP_SET_NODE_ACT(ndlp)         ((ndlp)->nlp_usg_map \
+                                               |= NLP_USG_NODE_ACT_BIT)
+#define NLP_INT_NODE_ACT(ndlp)         ((ndlp)->nlp_usg_map \
+                                               = NLP_USG_NODE_ACT_BIT)
+#define NLP_CLR_NODE_ACT(ndlp)         ((ndlp)->nlp_usg_map \
+                                               &= ~NLP_USG_NODE_ACT_BIT)
+#define NLP_CHK_IACT_REQ(ndlp)          ((ndlp)->nlp_usg_map \
+                                               & NLP_USG_IACT_REQ_BIT)
+#define NLP_SET_IACT_REQ(ndlp)          ((ndlp)->nlp_usg_map \
+                                               |= NLP_USG_IACT_REQ_BIT)
+#define NLP_CHK_FREE_REQ(ndlp)         ((ndlp)->nlp_usg_map \
+                                               & NLP_USG_FREE_REQ_BIT)
+#define NLP_SET_FREE_REQ(ndlp)         ((ndlp)->nlp_usg_map \
+                                               |= NLP_USG_FREE_REQ_BIT)
+#define NLP_CHK_FREE_ACK(ndlp)         ((ndlp)->nlp_usg_map \
+                                               & NLP_USG_FREE_ACK_BIT)
+#define NLP_SET_FREE_ACK(ndlp)         ((ndlp)->nlp_usg_map \
+                                               |= NLP_USG_FREE_ACK_BIT)
 
 /* There are 4 different double linked lists nodelist entries can reside on.
  * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used