zfcp: trace on request for open and close of WKA port
[pandora-kernel.git] / drivers / s390 / scsi / zfcp_dbf.c
index bdca8e6..e99b3d6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Debug traces for zfcp.
  *
- * Copyright IBM Corporation 2002, 2010
+ * Copyright IBM Corp. 2002, 2015
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -58,7 +58,7 @@ void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 length, char *area,
  * @tag: tag indicating which kind of unsolicited status has been received
  * @req: request for which a response was received
  */
-void zfcp_dbf_hba_fsf_res(char *tag, struct zfcp_fsf_req *req)
+void zfcp_dbf_hba_fsf_res(char *tag, int level, struct zfcp_fsf_req *req)
 {
        struct zfcp_dbf *dbf = req->adapter->dbf;
        struct fsf_qtcb_prefix *q_pref = &req->qtcb->prefix;
@@ -90,7 +90,7 @@ void zfcp_dbf_hba_fsf_res(char *tag, struct zfcp_fsf_req *req)
                                  rec->pl_len, "fsf_res", req->req_id);
        }
 
-       debug_event(dbf->hba, 1, rec, sizeof(*rec));
+       debug_event(dbf->hba, level, rec, sizeof(*rec));
        spin_unlock_irqrestore(&dbf->hba_lock, flags);
 }
 
@@ -200,6 +200,26 @@ void zfcp_dbf_hba_def_err(struct zfcp_adapter *adapter, u64 req_id, u16 scount,
        spin_unlock_irqrestore(&dbf->pay_lock, flags);
 }
 
+/**
+ * zfcp_dbf_hba_basic - trace event for basic adapter events
+ * @adapter: pointer to struct zfcp_adapter
+ */
+void zfcp_dbf_hba_basic(char *tag, struct zfcp_adapter *adapter)
+{
+       struct zfcp_dbf *dbf = adapter->dbf;
+       struct zfcp_dbf_hba *rec = &dbf->hba_buf;
+       unsigned long flags;
+
+       spin_lock_irqsave(&dbf->hba_lock, flags);
+       memset(rec, 0, sizeof(*rec));
+
+       memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
+       rec->id = ZFCP_DBF_HBA_BASIC;
+
+       debug_event(dbf->hba, 1, rec, sizeof(*rec));
+       spin_unlock_irqrestore(&dbf->hba_lock, flags);
+}
+
 static void zfcp_dbf_set_common(struct zfcp_dbf_rec *rec,
                                struct zfcp_adapter *adapter,
                                struct zfcp_port *port,
@@ -214,7 +234,8 @@ static void zfcp_dbf_set_common(struct zfcp_dbf_rec *rec,
        if (sdev) {
                rec->lun_status = atomic_read(&sdev_to_zfcp(sdev)->status);
                rec->lun = zfcp_scsi_dev_lun(sdev);
-       }
+       } else
+               rec->lun = ZFCP_DBF_INVALID_LUN;
 }
 
 /**
@@ -293,6 +314,38 @@ void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
        spin_unlock_irqrestore(&dbf->rec_lock, flags);
 }
 
+/**
+ * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery
+ * @tag: identifier for event
+ * @wka_port: well known address port
+ * @req_id: request ID to correlate with potential HBA trace record
+ */
+void zfcp_dbf_rec_run_wka(char *tag, struct zfcp_fc_wka_port *wka_port,
+                         u64 req_id)
+{
+       struct zfcp_dbf *dbf = wka_port->adapter->dbf;
+       struct zfcp_dbf_rec *rec = &dbf->rec_buf;
+       unsigned long flags;
+
+       spin_lock_irqsave(&dbf->rec_lock, flags);
+       memset(rec, 0, sizeof(*rec));
+
+       rec->id = ZFCP_DBF_REC_RUN;
+       memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
+       rec->port_status = wka_port->status;
+       rec->d_id = wka_port->d_id;
+       rec->lun = ZFCP_DBF_INVALID_LUN;
+
+       rec->u.run.fsf_req_id = req_id;
+       rec->u.run.rec_status = ~0;
+       rec->u.run.rec_step = ~0;
+       rec->u.run.rec_action = ~0;
+       rec->u.run.rec_count = ~0;
+
+       debug_event(dbf->rec, 1, rec, sizeof(*rec));
+       spin_unlock_irqrestore(&dbf->rec_lock, flags);
+}
+
 static inline
 void zfcp_dbf_san(char *tag, struct zfcp_dbf *dbf, void *data, u8 id, u16 len,
                  u64 req_id, u32 d_id)
@@ -372,7 +425,8 @@ void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf)
  * @sc: pointer to struct scsi_cmnd
  * @fsf: pointer to struct zfcp_fsf_req
  */
-void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf)
+void zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *sc,
+                  struct zfcp_fsf_req *fsf)
 {
        struct zfcp_adapter *adapter =
                (struct zfcp_adapter *) sc->device->host->hostdata[0];
@@ -414,7 +468,7 @@ void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf)
                }
        }
 
-       debug_event(dbf->scsi, 1, rec, sizeof(*rec));
+       debug_event(dbf->scsi, level, rec, sizeof(*rec));
        spin_unlock_irqrestore(&dbf->scsi_lock, flags);
 }