Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 1 | /* |
Christof Schmitt | 553448f | 2008-06-10 18:20:58 +0200 | [diff] [blame] | 2 | * zfcp device driver |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 3 | * |
Christof Schmitt | 553448f | 2008-06-10 18:20:58 +0200 | [diff] [blame] | 4 | * Debug traces for zfcp. |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 5 | * |
Steffen Maier | bf3ea3a | 2013-04-26 16:13:53 +0200 | [diff] [blame] | 6 | * Copyright IBM Corp. 2002, 2013 |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
Christof Schmitt | ecf39d4 | 2008-12-25 13:39:53 +0100 | [diff] [blame] | 9 | #define KMSG_COMPONENT "zfcp" |
| 10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
| 11 | |
Heiko Carstens | 3a4c5d5 | 2011-07-30 09:25:15 +0200 | [diff] [blame] | 12 | #include <linux/module.h> |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 13 | #include <linux/ctype.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 14 | #include <linux/slab.h> |
Heiko Carstens | 364c855 | 2007-10-12 16:11:35 +0200 | [diff] [blame] | 15 | #include <asm/debug.h> |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 16 | #include "zfcp_dbf.h" |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 17 | #include "zfcp_ext.h" |
Christof Schmitt | bd0072e | 2009-11-24 16:54:11 +0100 | [diff] [blame] | 18 | #include "zfcp_fc.h" |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 19 | |
| 20 | static u32 dbfsize = 4; |
| 21 | |
| 22 | module_param(dbfsize, uint, 0400); |
| 23 | MODULE_PARM_DESC(dbfsize, |
| 24 | "number of pages for each debug feature area (default 4)"); |
| 25 | |
Steffen Maier | bf3ea3a | 2013-04-26 16:13:53 +0200 | [diff] [blame] | 26 | static u32 dbflevel = 3; |
| 27 | |
| 28 | module_param(dbflevel, uint, 0400); |
| 29 | MODULE_PARM_DESC(dbflevel, |
| 30 | "log level for each debug feature area " |
| 31 | "(default 3, range 0..6)"); |
| 32 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 33 | static inline unsigned int zfcp_dbf_plen(unsigned int offset) |
Martin Peschke | c15450e | 2008-03-27 14:21:55 +0100 | [diff] [blame] | 34 | { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 35 | return sizeof(struct zfcp_dbf_pay) + offset - ZFCP_DBF_PAY_MAX_REC; |
| 36 | } |
Martin Peschke | c15450e | 2008-03-27 14:21:55 +0100 | [diff] [blame] | 37 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 38 | static inline |
| 39 | void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 length, char *area, |
| 40 | u64 req_id) |
| 41 | { |
| 42 | struct zfcp_dbf_pay *pl = &dbf->pay_buf; |
| 43 | u16 offset = 0, rec_length; |
| 44 | |
| 45 | spin_lock(&dbf->pay_lock); |
| 46 | memset(pl, 0, sizeof(*pl)); |
| 47 | pl->fsf_req_id = req_id; |
| 48 | memcpy(pl->area, area, ZFCP_DBF_TAG_LEN); |
| 49 | |
| 50 | while (offset < length) { |
| 51 | rec_length = min((u16) ZFCP_DBF_PAY_MAX_REC, |
| 52 | (u16) (length - offset)); |
| 53 | memcpy(pl->data, data + offset, rec_length); |
| 54 | debug_event(dbf->pay, 1, pl, zfcp_dbf_plen(rec_length)); |
| 55 | |
| 56 | offset += rec_length; |
| 57 | pl->counter++; |
Martin Peschke | c15450e | 2008-03-27 14:21:55 +0100 | [diff] [blame] | 58 | } |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 59 | |
| 60 | spin_unlock(&dbf->pay_lock); |
Martin Peschke | c15450e | 2008-03-27 14:21:55 +0100 | [diff] [blame] | 61 | } |
| 62 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 63 | /** |
| 64 | * zfcp_dbf_hba_fsf_res - trace event for fsf responses |
| 65 | * @tag: tag indicating which kind of unsolicited status has been received |
| 66 | * @req: request for which a response was received |
| 67 | */ |
| 68 | void zfcp_dbf_hba_fsf_res(char *tag, struct zfcp_fsf_req *req) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 69 | { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 70 | struct zfcp_dbf *dbf = req->adapter->dbf; |
| 71 | struct fsf_qtcb_prefix *q_pref = &req->qtcb->prefix; |
| 72 | struct fsf_qtcb_header *q_head = &req->qtcb->header; |
| 73 | struct zfcp_dbf_hba *rec = &dbf->hba_buf; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 74 | unsigned long flags; |
| 75 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 76 | spin_lock_irqsave(&dbf->hba_lock, flags); |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 77 | memset(rec, 0, sizeof(*rec)); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 78 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 79 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 80 | rec->id = ZFCP_DBF_HBA_RES; |
| 81 | rec->fsf_req_id = req->req_id; |
| 82 | rec->fsf_req_status = req->status; |
| 83 | rec->fsf_cmd = req->fsf_command; |
| 84 | rec->fsf_seq_no = req->seq_no; |
| 85 | rec->u.res.req_issued = req->issued; |
| 86 | rec->u.res.prot_status = q_pref->prot_status; |
| 87 | rec->u.res.fsf_status = q_head->fsf_status; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 88 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 89 | memcpy(rec->u.res.prot_status_qual, &q_pref->prot_status_qual, |
| 90 | FSF_PROT_STATUS_QUAL_SIZE); |
| 91 | memcpy(rec->u.res.fsf_status_qual, &q_head->fsf_status_qual, |
| 92 | FSF_STATUS_QUALIFIER_SIZE); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 93 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 94 | if (req->fsf_command != FSF_QTCB_FCP_CMND) { |
| 95 | rec->pl_len = q_head->log_length; |
| 96 | zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start, |
| 97 | rec->pl_len, "fsf_res", req->req_id); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 98 | } |
| 99 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 100 | debug_event(dbf->hba, 1, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 101 | spin_unlock_irqrestore(&dbf->hba_lock, flags); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 102 | } |
| 103 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 104 | /** |
| 105 | * zfcp_dbf_hba_fsf_uss - trace event for an unsolicited status buffer |
| 106 | * @tag: tag indicating which kind of unsolicited status has been received |
| 107 | * @req: request providing the unsolicited status |
| 108 | */ |
| 109 | void zfcp_dbf_hba_fsf_uss(char *tag, struct zfcp_fsf_req *req) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 110 | { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 111 | struct zfcp_dbf *dbf = req->adapter->dbf; |
| 112 | struct fsf_status_read_buffer *srb = req->data; |
| 113 | struct zfcp_dbf_hba *rec = &dbf->hba_buf; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 114 | unsigned long flags; |
| 115 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 116 | spin_lock_irqsave(&dbf->hba_lock, flags); |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 117 | memset(rec, 0, sizeof(*rec)); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 118 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 119 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 120 | rec->id = ZFCP_DBF_HBA_USS; |
| 121 | rec->fsf_req_id = req->req_id; |
| 122 | rec->fsf_req_status = req->status; |
| 123 | rec->fsf_cmd = req->fsf_command; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 124 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 125 | if (!srb) |
| 126 | goto log; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 127 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 128 | rec->u.uss.status_type = srb->status_type; |
| 129 | rec->u.uss.status_subtype = srb->status_subtype; |
| 130 | rec->u.uss.d_id = ntoh24(srb->d_id); |
| 131 | rec->u.uss.lun = srb->fcp_lun; |
| 132 | memcpy(&rec->u.uss.queue_designator, &srb->queue_designator, |
| 133 | sizeof(rec->u.uss.queue_designator)); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 134 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 135 | /* status read buffer payload length */ |
| 136 | rec->pl_len = (!srb->length) ? 0 : srb->length - |
| 137 | offsetof(struct fsf_status_read_buffer, payload); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 138 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 139 | if (rec->pl_len) |
| 140 | zfcp_dbf_pl_write(dbf, srb->payload.data, rec->pl_len, |
| 141 | "fsf_uss", req->req_id); |
| 142 | log: |
| 143 | debug_event(dbf->hba, 2, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 144 | spin_unlock_irqrestore(&dbf->hba_lock, flags); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 145 | } |
| 146 | |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 147 | /** |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 148 | * zfcp_dbf_hba_bit_err - trace event for bit error conditions |
| 149 | * @tag: tag indicating which kind of unsolicited status has been received |
| 150 | * @req: request which caused the bit_error condition |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 151 | */ |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 152 | void zfcp_dbf_hba_bit_err(char *tag, struct zfcp_fsf_req *req) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 153 | { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 154 | struct zfcp_dbf *dbf = req->adapter->dbf; |
| 155 | struct zfcp_dbf_hba *rec = &dbf->hba_buf; |
Swen Schillig | 5706938 | 2008-10-01 12:42:21 +0200 | [diff] [blame] | 156 | struct fsf_status_read_buffer *sr_buf = req->data; |
Swen Schillig | 5706938 | 2008-10-01 12:42:21 +0200 | [diff] [blame] | 157 | unsigned long flags; |
| 158 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 159 | spin_lock_irqsave(&dbf->hba_lock, flags); |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 160 | memset(rec, 0, sizeof(*rec)); |
| 161 | |
| 162 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 163 | rec->id = ZFCP_DBF_HBA_BIT; |
| 164 | rec->fsf_req_id = req->req_id; |
| 165 | rec->fsf_req_status = req->status; |
| 166 | rec->fsf_cmd = req->fsf_command; |
| 167 | memcpy(&rec->u.be, &sr_buf->payload.bit_error, |
| 168 | sizeof(struct fsf_bit_error_payload)); |
| 169 | |
| 170 | debug_event(dbf->hba, 1, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 171 | spin_unlock_irqrestore(&dbf->hba_lock, flags); |
Swen Schillig | 5706938 | 2008-10-01 12:42:21 +0200 | [diff] [blame] | 172 | } |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 173 | |
Swen Schillig | 86a9668 | 2011-08-15 14:40:32 +0200 | [diff] [blame] | 174 | /** |
| 175 | * zfcp_dbf_hba_def_err - trace event for deferred error messages |
| 176 | * @adapter: pointer to struct zfcp_adapter |
| 177 | * @req_id: request id which caused the deferred error message |
| 178 | * @scount: number of sbals incl. the signaling sbal |
| 179 | * @pl: array of all involved sbals |
| 180 | */ |
| 181 | void zfcp_dbf_hba_def_err(struct zfcp_adapter *adapter, u64 req_id, u16 scount, |
| 182 | void **pl) |
| 183 | { |
| 184 | struct zfcp_dbf *dbf = adapter->dbf; |
| 185 | struct zfcp_dbf_pay *payload = &dbf->pay_buf; |
| 186 | unsigned long flags; |
| 187 | u16 length; |
| 188 | |
| 189 | if (!pl) |
| 190 | return; |
| 191 | |
| 192 | spin_lock_irqsave(&dbf->pay_lock, flags); |
| 193 | memset(payload, 0, sizeof(*payload)); |
| 194 | |
| 195 | memcpy(payload->area, "def_err", 7); |
| 196 | payload->fsf_req_id = req_id; |
| 197 | payload->counter = 0; |
| 198 | length = min((u16)sizeof(struct qdio_buffer), |
| 199 | (u16)ZFCP_DBF_PAY_MAX_REC); |
| 200 | |
Steffen Maier | 01e6052 | 2012-09-04 15:23:31 +0200 | [diff] [blame] | 201 | while (payload->counter < scount && (char *)pl[payload->counter]) { |
Swen Schillig | 86a9668 | 2011-08-15 14:40:32 +0200 | [diff] [blame] | 202 | memcpy(payload->data, (char *)pl[payload->counter], length); |
| 203 | debug_event(dbf->pay, 1, payload, zfcp_dbf_plen(length)); |
| 204 | payload->counter++; |
| 205 | } |
| 206 | |
| 207 | spin_unlock_irqrestore(&dbf->pay_lock, flags); |
| 208 | } |
| 209 | |
Steffen Maier | cb452149 | 2012-09-04 15:23:32 +0200 | [diff] [blame] | 210 | /** |
| 211 | * zfcp_dbf_hba_basic - trace event for basic adapter events |
| 212 | * @adapter: pointer to struct zfcp_adapter |
| 213 | */ |
| 214 | void zfcp_dbf_hba_basic(char *tag, struct zfcp_adapter *adapter) |
| 215 | { |
| 216 | struct zfcp_dbf *dbf = adapter->dbf; |
| 217 | struct zfcp_dbf_hba *rec = &dbf->hba_buf; |
| 218 | unsigned long flags; |
| 219 | |
| 220 | spin_lock_irqsave(&dbf->hba_lock, flags); |
| 221 | memset(rec, 0, sizeof(*rec)); |
| 222 | |
| 223 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 224 | rec->id = ZFCP_DBF_HBA_BASIC; |
| 225 | |
| 226 | debug_event(dbf->hba, 1, rec, sizeof(*rec)); |
| 227 | spin_unlock_irqrestore(&dbf->hba_lock, flags); |
| 228 | } |
| 229 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 230 | static void zfcp_dbf_set_common(struct zfcp_dbf_rec *rec, |
| 231 | struct zfcp_adapter *adapter, |
| 232 | struct zfcp_port *port, |
| 233 | struct scsi_device *sdev) |
Martin Peschke | d79a83d | 2008-03-27 14:22:00 +0100 | [diff] [blame] | 234 | { |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 235 | rec->adapter_status = atomic_read(&adapter->status); |
| 236 | if (port) { |
| 237 | rec->port_status = atomic_read(&port->status); |
| 238 | rec->wwpn = port->wwpn; |
| 239 | rec->d_id = port->d_id; |
Martin Peschke | d79a83d | 2008-03-27 14:22:00 +0100 | [diff] [blame] | 240 | } |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 241 | if (sdev) { |
| 242 | rec->lun_status = atomic_read(&sdev_to_zfcp(sdev)->status); |
| 243 | rec->lun = zfcp_scsi_dev_lun(sdev); |
| 244 | } |
Martin Peschke | 348447e | 2008-03-27 14:22:01 +0100 | [diff] [blame] | 245 | } |
| 246 | |
Christof Schmitt | aa0fec6 | 2008-05-19 12:17:47 +0200 | [diff] [blame] | 247 | /** |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 248 | * zfcp_dbf_rec_trig - trace event related to triggered recovery |
| 249 | * @tag: identifier for event |
| 250 | * @adapter: adapter on which the erp_action should run |
| 251 | * @port: remote port involved in the erp_action |
| 252 | * @sdev: scsi device involved in the erp_action |
| 253 | * @want: wanted erp_action |
| 254 | * @need: required erp_action |
| 255 | * |
| 256 | * The adapter->erp_lock has to be held. |
Christof Schmitt | aa0fec6 | 2008-05-19 12:17:47 +0200 | [diff] [blame] | 257 | */ |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 258 | void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter, |
| 259 | struct zfcp_port *port, struct scsi_device *sdev, |
| 260 | u8 want, u8 need) |
Martin Peschke | 9467a9b | 2008-03-27 14:22:03 +0100 | [diff] [blame] | 261 | { |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 262 | struct zfcp_dbf *dbf = adapter->dbf; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 263 | struct zfcp_dbf_rec *rec = &dbf->rec_buf; |
| 264 | struct list_head *entry; |
Martin Peschke | 9467a9b | 2008-03-27 14:22:03 +0100 | [diff] [blame] | 265 | unsigned long flags; |
| 266 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 267 | spin_lock_irqsave(&dbf->rec_lock, flags); |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 268 | memset(rec, 0, sizeof(*rec)); |
| 269 | |
| 270 | rec->id = ZFCP_DBF_REC_TRIG; |
| 271 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 272 | zfcp_dbf_set_common(rec, adapter, port, sdev); |
| 273 | |
| 274 | list_for_each(entry, &adapter->erp_ready_head) |
| 275 | rec->u.trig.ready++; |
| 276 | |
| 277 | list_for_each(entry, &adapter->erp_running_head) |
| 278 | rec->u.trig.running++; |
| 279 | |
| 280 | rec->u.trig.want = want; |
| 281 | rec->u.trig.need = need; |
| 282 | |
| 283 | debug_event(dbf->rec, 1, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 284 | spin_unlock_irqrestore(&dbf->rec_lock, flags); |
Martin Peschke | 9467a9b | 2008-03-27 14:22:03 +0100 | [diff] [blame] | 285 | } |
| 286 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 287 | |
Martin Peschke | 6f4f365 | 2008-03-27 14:22:04 +0100 | [diff] [blame] | 288 | /** |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 289 | * zfcp_dbf_rec_run - trace event related to running recovery |
| 290 | * @tag: identifier for event |
| 291 | * @erp: erp_action running |
Martin Peschke | 6f4f365 | 2008-03-27 14:22:04 +0100 | [diff] [blame] | 292 | */ |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 293 | void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp) |
Martin Peschke | 6f4f365 | 2008-03-27 14:22:04 +0100 | [diff] [blame] | 294 | { |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 295 | struct zfcp_dbf *dbf = erp->adapter->dbf; |
| 296 | struct zfcp_dbf_rec *rec = &dbf->rec_buf; |
Martin Peschke | 6f4f365 | 2008-03-27 14:22:04 +0100 | [diff] [blame] | 297 | unsigned long flags; |
| 298 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 299 | spin_lock_irqsave(&dbf->rec_lock, flags); |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 300 | memset(rec, 0, sizeof(*rec)); |
| 301 | |
| 302 | rec->id = ZFCP_DBF_REC_RUN; |
| 303 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 304 | zfcp_dbf_set_common(rec, erp->adapter, erp->port, erp->sdev); |
| 305 | |
| 306 | rec->u.run.fsf_req_id = erp->fsf_req_id; |
| 307 | rec->u.run.rec_status = erp->status; |
| 308 | rec->u.run.rec_step = erp->step; |
| 309 | rec->u.run.rec_action = erp->action; |
| 310 | |
| 311 | if (erp->sdev) |
| 312 | rec->u.run.rec_count = |
| 313 | atomic_read(&sdev_to_zfcp(erp->sdev)->erp_counter); |
| 314 | else if (erp->port) |
| 315 | rec->u.run.rec_count = atomic_read(&erp->port->erp_counter); |
| 316 | else |
| 317 | rec->u.run.rec_count = atomic_read(&erp->adapter->erp_counter); |
| 318 | |
| 319 | debug_event(dbf->rec, 1, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 320 | spin_unlock_irqrestore(&dbf->rec_lock, flags); |
Martin Peschke | 6f4f365 | 2008-03-27 14:22:04 +0100 | [diff] [blame] | 321 | } |
| 322 | |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 323 | static inline |
| 324 | void zfcp_dbf_san(char *tag, struct zfcp_dbf *dbf, void *data, u8 id, u16 len, |
| 325 | u64 req_id, u32 d_id) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 326 | { |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 327 | struct zfcp_dbf_san *rec = &dbf->san_buf; |
| 328 | u16 rec_len; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 329 | unsigned long flags; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 330 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 331 | spin_lock_irqsave(&dbf->san_lock, flags); |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 332 | memset(rec, 0, sizeof(*rec)); |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 333 | |
| 334 | rec->id = id; |
| 335 | rec->fsf_req_id = req_id; |
| 336 | rec->d_id = d_id; |
| 337 | rec_len = min(len, (u16)ZFCP_DBF_SAN_MAX_PAYLOAD); |
| 338 | memcpy(rec->payload, data, rec_len); |
| 339 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 340 | |
| 341 | debug_event(dbf->san, 1, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 342 | spin_unlock_irqrestore(&dbf->san_lock, flags); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 343 | } |
| 344 | |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 345 | /** |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 346 | * zfcp_dbf_san_req - trace event for issued SAN request |
Maxime Jayat | 3f79410 | 2013-10-12 01:29:46 +0200 | [diff] [blame] | 347 | * @tag: identifier for event |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 348 | * @fsf_req: request containing issued CT data |
| 349 | * d_id: destination ID |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 350 | */ |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 351 | void zfcp_dbf_san_req(char *tag, struct zfcp_fsf_req *fsf, u32 d_id) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 352 | { |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 353 | struct zfcp_dbf *dbf = fsf->adapter->dbf; |
| 354 | struct zfcp_fsf_ct_els *ct_els = fsf->data; |
| 355 | u16 length; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 356 | |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 357 | length = (u16)(ct_els->req->length + FC_CT_HDR_LEN); |
| 358 | zfcp_dbf_san(tag, dbf, sg_virt(ct_els->req), ZFCP_DBF_SAN_REQ, length, |
| 359 | fsf->req_id, d_id); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 360 | } |
| 361 | |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 362 | /** |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 363 | * zfcp_dbf_san_res - trace event for received SAN request |
Maxime Jayat | 3f79410 | 2013-10-12 01:29:46 +0200 | [diff] [blame] | 364 | * @tag: identifier for event |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 365 | * @fsf_req: request containing issued CT data |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 366 | */ |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 367 | void zfcp_dbf_san_res(char *tag, struct zfcp_fsf_req *fsf) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 368 | { |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 369 | struct zfcp_dbf *dbf = fsf->adapter->dbf; |
| 370 | struct zfcp_fsf_ct_els *ct_els = fsf->data; |
| 371 | u16 length; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 372 | |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 373 | length = (u16)(ct_els->resp->length + FC_CT_HDR_LEN); |
| 374 | zfcp_dbf_san(tag, dbf, sg_virt(ct_els->resp), ZFCP_DBF_SAN_RES, length, |
| 375 | fsf->req_id, 0); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 376 | } |
| 377 | |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 378 | /** |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 379 | * zfcp_dbf_san_in_els - trace event for incoming ELS |
Maxime Jayat | 3f79410 | 2013-10-12 01:29:46 +0200 | [diff] [blame] | 380 | * @tag: identifier for event |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 381 | * @fsf_req: request containing issued CT data |
Martin Peschke | bfab163 | 2008-03-31 11:15:31 +0200 | [diff] [blame] | 382 | */ |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 383 | void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 384 | { |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 385 | struct zfcp_dbf *dbf = fsf->adapter->dbf; |
| 386 | struct fsf_status_read_buffer *srb = |
| 387 | (struct fsf_status_read_buffer *) fsf->data; |
| 388 | u16 length; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 389 | |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 390 | length = (u16)(srb->length - |
| 391 | offsetof(struct fsf_status_read_buffer, payload)); |
| 392 | zfcp_dbf_san(tag, dbf, srb->payload.data, ZFCP_DBF_SAN_ELS, length, |
| 393 | fsf->req_id, ntoh24(srb->d_id)); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 394 | } |
| 395 | |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 396 | /** |
| 397 | * zfcp_dbf_scsi - trace event for scsi commands |
| 398 | * @tag: identifier for event |
| 399 | * @sc: pointer to struct scsi_cmnd |
| 400 | * @fsf: pointer to struct zfcp_fsf_req |
| 401 | */ |
| 402 | void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 403 | { |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 404 | struct zfcp_adapter *adapter = |
| 405 | (struct zfcp_adapter *) sc->device->host->hostdata[0]; |
| 406 | struct zfcp_dbf *dbf = adapter->dbf; |
| 407 | struct zfcp_dbf_scsi *rec = &dbf->scsi_buf; |
Christof Schmitt | 4318e08 | 2009-11-24 16:54:08 +0100 | [diff] [blame] | 408 | struct fcp_resp_with_ext *fcp_rsp; |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 409 | struct fcp_resp_rsp_info *fcp_rsp_info; |
| 410 | unsigned long flags; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 411 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 412 | spin_lock_irqsave(&dbf->scsi_lock, flags); |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 413 | memset(rec, 0, sizeof(*rec)); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 414 | |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 415 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
| 416 | rec->id = ZFCP_DBF_SCSI_CMND; |
| 417 | rec->scsi_result = sc->result; |
| 418 | rec->scsi_retries = sc->retries; |
| 419 | rec->scsi_allowed = sc->allowed; |
| 420 | rec->scsi_id = sc->device->id; |
Hannes Reinecke | 9cb78c1 | 2014-06-25 15:27:36 +0200 | [diff] [blame] | 421 | /* struct zfcp_dbf_scsi needs to be updated to handle 64bit LUNs */ |
| 422 | rec->scsi_lun = (u32)sc->device->lun; |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 423 | rec->host_scribble = (unsigned long)sc->host_scribble; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 424 | |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 425 | memcpy(rec->scsi_opcode, sc->cmnd, |
| 426 | min((int)sc->cmd_len, ZFCP_DBF_SCSI_OPCODE)); |
| 427 | |
| 428 | if (fsf) { |
| 429 | rec->fsf_req_id = fsf->req_id; |
| 430 | fcp_rsp = (struct fcp_resp_with_ext *) |
| 431 | &(fsf->qtcb->bottom.io.fcp_rsp); |
| 432 | memcpy(&rec->fcp_rsp, fcp_rsp, FCP_RESP_WITH_EXT); |
| 433 | if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL) { |
| 434 | fcp_rsp_info = (struct fcp_resp_rsp_info *) &fcp_rsp[1]; |
| 435 | rec->fcp_rsp_info = fcp_rsp_info->rsp_code; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 436 | } |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 437 | if (fcp_rsp->resp.fr_flags & FCP_SNS_LEN_VAL) { |
| 438 | rec->pl_len = min((u16)SCSI_SENSE_BUFFERSIZE, |
| 439 | (u16)ZFCP_DBF_PAY_MAX_REC); |
| 440 | zfcp_dbf_pl_write(dbf, sc->sense_buffer, rec->pl_len, |
| 441 | "fcp_sns", fsf->req_id); |
| 442 | } |
| 443 | } |
| 444 | |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 445 | debug_event(dbf->scsi, 1, rec, sizeof(*rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 446 | spin_unlock_irqrestore(&dbf->scsi_lock, flags); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 447 | } |
| 448 | |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 449 | static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size) |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 450 | { |
| 451 | struct debug_info *d; |
| 452 | |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 453 | d = debug_register(name, size, 1, rec_size); |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 454 | if (!d) |
| 455 | return NULL; |
| 456 | |
| 457 | debug_register_view(d, &debug_hex_ascii_view); |
Steffen Maier | bf3ea3a | 2013-04-26 16:13:53 +0200 | [diff] [blame] | 458 | debug_set_level(d, dbflevel); |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 459 | |
| 460 | return d; |
| 461 | } |
| 462 | |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 463 | static void zfcp_dbf_unregister(struct zfcp_dbf *dbf) |
| 464 | { |
| 465 | if (!dbf) |
| 466 | return; |
| 467 | |
| 468 | debug_unregister(dbf->scsi); |
| 469 | debug_unregister(dbf->san); |
| 470 | debug_unregister(dbf->hba); |
| 471 | debug_unregister(dbf->pay); |
| 472 | debug_unregister(dbf->rec); |
| 473 | kfree(dbf); |
| 474 | } |
| 475 | |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 476 | /** |
| 477 | * zfcp_adapter_debug_register - registers debug feature for an adapter |
| 478 | * @adapter: pointer to adapter for which debug features should be registered |
| 479 | * return: -ENOMEM on error, 0 otherwise |
| 480 | */ |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 481 | int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 482 | { |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 483 | char name[DEBUG_MAX_NAME_LEN]; |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 484 | struct zfcp_dbf *dbf; |
| 485 | |
Swen Schillig | d23948e | 2010-07-16 15:37:40 +0200 | [diff] [blame] | 486 | dbf = kzalloc(sizeof(struct zfcp_dbf), GFP_KERNEL); |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 487 | if (!dbf) |
| 488 | return -ENOMEM; |
| 489 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 490 | spin_lock_init(&dbf->pay_lock); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 491 | spin_lock_init(&dbf->hba_lock); |
| 492 | spin_lock_init(&dbf->san_lock); |
| 493 | spin_lock_init(&dbf->scsi_lock); |
| 494 | spin_lock_init(&dbf->rec_lock); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 495 | |
| 496 | /* debug feature area which records recovery activity */ |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 497 | sprintf(name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev)); |
| 498 | dbf->rec = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_rec)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 499 | if (!dbf->rec) |
| 500 | goto err_out; |
Martin Peschke | d79a83d | 2008-03-27 14:22:00 +0100 | [diff] [blame] | 501 | |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 502 | /* debug feature area which records HBA (FSF and QDIO) conditions */ |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 503 | sprintf(name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev)); |
| 504 | dbf->hba = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_hba)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 505 | if (!dbf->hba) |
| 506 | goto err_out; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 507 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 508 | /* debug feature area which records payload info */ |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 509 | sprintf(name, "zfcp_%s_pay", dev_name(&adapter->ccw_device->dev)); |
| 510 | dbf->pay = zfcp_dbf_reg(name, dbfsize * 2, sizeof(struct zfcp_dbf_pay)); |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 511 | if (!dbf->pay) |
| 512 | goto err_out; |
| 513 | |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 514 | /* debug feature area which records SAN command failures and recovery */ |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 515 | sprintf(name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev)); |
| 516 | dbf->san = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_san)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 517 | if (!dbf->san) |
| 518 | goto err_out; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 519 | |
| 520 | /* debug feature area which records SCSI command failures and recovery */ |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 521 | sprintf(name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev)); |
| 522 | dbf->scsi = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_scsi)); |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 523 | if (!dbf->scsi) |
| 524 | goto err_out; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 525 | |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 526 | adapter->dbf = dbf; |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 527 | |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 528 | return 0; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 529 | err_out: |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 530 | zfcp_dbf_unregister(dbf); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 531 | return -ENOMEM; |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * zfcp_adapter_debug_unregister - unregisters debug feature for an adapter |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 536 | * @adapter: pointer to adapter for which debug features should be unregistered |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 537 | */ |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 538 | void zfcp_dbf_adapter_unregister(struct zfcp_adapter *adapter) |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 539 | { |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 540 | struct zfcp_dbf *dbf = adapter->dbf; |
| 541 | |
| 542 | adapter->dbf = NULL; |
| 543 | zfcp_dbf_unregister(dbf); |
Maxim Shchetynin | 8a36e45 | 2005-09-13 21:50:38 +0200 | [diff] [blame] | 544 | } |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 545 | |