zfcp_dbf.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. /*
  2. *
  3. * linux/drivers/s390/scsi/zfcp_dbf.c
  4. *
  5. * FCP adapter driver for IBM eServer zSeries
  6. *
  7. * Debugging facilities
  8. *
  9. * (C) Copyright IBM Corp. 2005
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2, or (at your option)
  14. * any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. */
  25. #include <asm/debug.h>
  26. #include <linux/ctype.h>
  27. #include "zfcp_ext.h"
  28. static u32 dbfsize = 4;
  29. module_param(dbfsize, uint, 0400);
  30. MODULE_PARM_DESC(dbfsize,
  31. "number of pages for each debug feature area (default 4)");
  32. #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
  33. static inline int
  34. zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck)
  35. {
  36. unsigned long long sec;
  37. struct timespec xtime;
  38. int len = 0;
  39. stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
  40. sec = stck >> 12;
  41. do_div(sec, 1000000);
  42. xtime.tv_sec = sec;
  43. stck -= (sec * 1000000) << 12;
  44. xtime.tv_nsec = ((stck * 1000) >> 12);
  45. len += sprintf(out_buf + len, "%-24s%011lu:%06lu\n",
  46. label, xtime.tv_sec, xtime.tv_nsec);
  47. return len;
  48. }
  49. static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag)
  50. {
  51. int len = 0, i;
  52. len += sprintf(out_buf + len, "%-24s", label);
  53. for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++)
  54. len += sprintf(out_buf + len, "%c", tag[i]);
  55. len += sprintf(out_buf + len, "\n");
  56. return len;
  57. }
  58. static int
  59. zfcp_dbf_view(char *out_buf, const char *label, const char *format, ...)
  60. {
  61. va_list arg;
  62. int len = 0;
  63. len += sprintf(out_buf + len, "%-24s", label);
  64. va_start(arg, format);
  65. len += vsprintf(out_buf + len, format, arg);
  66. va_end(arg);
  67. len += sprintf(out_buf + len, "\n");
  68. return len;
  69. }
  70. static int
  71. zfcp_dbf_view_dump(char *out_buf, const char *label,
  72. char *buffer, int buflen, int offset, int total_size)
  73. {
  74. int len = 0;
  75. if (offset == 0)
  76. len += sprintf(out_buf + len, "%-24s ", label);
  77. while (buflen--) {
  78. if (offset > 0) {
  79. if ((offset % 32) == 0)
  80. len += sprintf(out_buf + len, "\n%-24c ", ' ');
  81. else if ((offset % 4) == 0)
  82. len += sprintf(out_buf + len, " ");
  83. }
  84. len += sprintf(out_buf + len, "%02x", *buffer++);
  85. if (++offset == total_size) {
  86. len += sprintf(out_buf + len, "\n");
  87. break;
  88. }
  89. }
  90. if (total_size == 0)
  91. len += sprintf(out_buf + len, "\n");
  92. return len;
  93. }
  94. static inline int
  95. zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area,
  96. debug_entry_t * entry, char *out_buf)
  97. {
  98. struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry);
  99. int len = 0;
  100. if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) {
  101. len += zfcp_dbf_stck(out_buf + len, "timestamp",
  102. entry->id.stck);
  103. len += zfcp_dbf_view(out_buf + len, "cpu", "%02i",
  104. entry->id.fields.cpuid);
  105. } else {
  106. len += zfcp_dbf_view_dump(out_buf + len, NULL,
  107. dump->data,
  108. dump->size,
  109. dump->offset, dump->total_size);
  110. if ((dump->offset + dump->size) == dump->total_size)
  111. len += sprintf(out_buf + len, "\n");
  112. }
  113. return len;
  114. }
  115. inline void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
  116. {
  117. struct zfcp_adapter *adapter = fsf_req->adapter;
  118. struct fsf_qtcb *qtcb = fsf_req->qtcb;
  119. union fsf_prot_status_qual *prot_status_qual =
  120. &qtcb->prefix.prot_status_qual;
  121. union fsf_status_qual *fsf_status_qual = &qtcb->header.fsf_status_qual;
  122. struct scsi_cmnd *scsi_cmnd;
  123. struct zfcp_port *port;
  124. struct zfcp_unit *unit;
  125. struct zfcp_send_els *send_els;
  126. struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
  127. struct zfcp_hba_dbf_record_response *response = &rec->type.response;
  128. int level;
  129. unsigned long flags;
  130. spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  131. memset(rec, 0, sizeof(struct zfcp_hba_dbf_record));
  132. strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
  133. if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
  134. (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
  135. strncpy(rec->tag2, "perr", ZFCP_DBF_TAG_SIZE);
  136. level = 1;
  137. } else if (qtcb->header.fsf_status != FSF_GOOD) {
  138. strncpy(rec->tag2, "ferr", ZFCP_DBF_TAG_SIZE);
  139. level = 1;
  140. } else if ((fsf_req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
  141. (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) {
  142. strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE);
  143. level = 4;
  144. } else if ((prot_status_qual->doubleword[0] != 0) ||
  145. (prot_status_qual->doubleword[1] != 0) ||
  146. (fsf_status_qual->doubleword[0] != 0) ||
  147. (fsf_status_qual->doubleword[1] != 0)) {
  148. strncpy(rec->tag2, "qual", ZFCP_DBF_TAG_SIZE);
  149. level = 3;
  150. } else {
  151. strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE);
  152. level = 6;
  153. }
  154. response->fsf_command = fsf_req->fsf_command;
  155. response->fsf_reqid = (unsigned long)fsf_req;
  156. response->fsf_seqno = fsf_req->seq_no;
  157. response->fsf_issued = fsf_req->issued;
  158. response->fsf_prot_status = qtcb->prefix.prot_status;
  159. response->fsf_status = qtcb->header.fsf_status;
  160. memcpy(response->fsf_prot_status_qual,
  161. prot_status_qual, FSF_PROT_STATUS_QUAL_SIZE);
  162. memcpy(response->fsf_status_qual,
  163. fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE);
  164. response->fsf_req_status = fsf_req->status;
  165. response->sbal_first = fsf_req->sbal_first;
  166. response->sbal_curr = fsf_req->sbal_curr;
  167. response->sbal_last = fsf_req->sbal_last;
  168. response->pool = fsf_req->pool != NULL;
  169. response->erp_action = (unsigned long)fsf_req->erp_action;
  170. switch (fsf_req->fsf_command) {
  171. case FSF_QTCB_FCP_CMND:
  172. if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
  173. break;
  174. scsi_cmnd = (struct scsi_cmnd *)fsf_req->data;
  175. if (scsi_cmnd != NULL) {
  176. response->data.send_fcp.scsi_cmnd
  177. = (unsigned long)scsi_cmnd;
  178. response->data.send_fcp.scsi_serial
  179. = scsi_cmnd->serial_number;
  180. }
  181. break;
  182. case FSF_QTCB_OPEN_PORT_WITH_DID:
  183. case FSF_QTCB_CLOSE_PORT:
  184. case FSF_QTCB_CLOSE_PHYSICAL_PORT:
  185. port = (struct zfcp_port *)fsf_req->data;
  186. response->data.port.wwpn = port->wwpn;
  187. response->data.port.d_id = port->d_id;
  188. response->data.port.port_handle = qtcb->header.port_handle;
  189. break;
  190. case FSF_QTCB_OPEN_LUN:
  191. case FSF_QTCB_CLOSE_LUN:
  192. unit = (struct zfcp_unit *)fsf_req->data;
  193. port = unit->port;
  194. response->data.unit.wwpn = port->wwpn;
  195. response->data.unit.fcp_lun = unit->fcp_lun;
  196. response->data.unit.port_handle = qtcb->header.port_handle;
  197. response->data.unit.lun_handle = qtcb->header.lun_handle;
  198. break;
  199. case FSF_QTCB_SEND_ELS:
  200. send_els = (struct zfcp_send_els *)fsf_req->data;
  201. response->data.send_els.d_id = qtcb->bottom.support.d_id;
  202. response->data.send_els.ls_code = send_els->ls_code >> 24;
  203. break;
  204. case FSF_QTCB_ABORT_FCP_CMND:
  205. case FSF_QTCB_SEND_GENERIC:
  206. case FSF_QTCB_EXCHANGE_CONFIG_DATA:
  207. case FSF_QTCB_EXCHANGE_PORT_DATA:
  208. case FSF_QTCB_DOWNLOAD_CONTROL_FILE:
  209. case FSF_QTCB_UPLOAD_CONTROL_FILE:
  210. break;
  211. }
  212. debug_event(adapter->hba_dbf, level,
  213. rec, sizeof(struct zfcp_hba_dbf_record));
  214. spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  215. }
  216. inline void
  217. zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
  218. struct fsf_status_read_buffer *status_buffer)
  219. {
  220. struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
  221. unsigned long flags;
  222. spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  223. memset(rec, 0, sizeof(struct zfcp_hba_dbf_record));
  224. strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
  225. strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
  226. rec->type.status.failed = adapter->status_read_failed;
  227. if (status_buffer != NULL) {
  228. rec->type.status.status_type = status_buffer->status_type;
  229. rec->type.status.status_subtype = status_buffer->status_subtype;
  230. memcpy(&rec->type.status.queue_designator,
  231. &status_buffer->queue_designator,
  232. sizeof(struct fsf_queue_designator));
  233. switch (status_buffer->status_type) {
  234. case FSF_STATUS_READ_SENSE_DATA_AVAIL:
  235. rec->type.status.payload_size =
  236. ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL;
  237. break;
  238. case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
  239. rec->type.status.payload_size =
  240. ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD;
  241. break;
  242. case FSF_STATUS_READ_LINK_DOWN:
  243. switch (status_buffer->status_subtype) {
  244. case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
  245. case FSF_STATUS_READ_SUB_FDISC_FAILED:
  246. rec->type.status.payload_size =
  247. sizeof(struct fsf_link_down_info);
  248. }
  249. break;
  250. case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
  251. rec->type.status.payload_size =
  252. ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT;
  253. break;
  254. }
  255. memcpy(&rec->type.status.payload,
  256. &status_buffer->payload, rec->type.status.payload_size);
  257. }
  258. debug_event(adapter->hba_dbf, 2,
  259. rec, sizeof(struct zfcp_hba_dbf_record));
  260. spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  261. }
  262. inline void
  263. zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status,
  264. unsigned int qdio_error, unsigned int siga_error,
  265. int sbal_index, int sbal_count)
  266. {
  267. struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
  268. unsigned long flags;
  269. spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  270. memset(rec, 0, sizeof(struct zfcp_hba_dbf_record));
  271. strncpy(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE);
  272. rec->type.qdio.status = status;
  273. rec->type.qdio.qdio_error = qdio_error;
  274. rec->type.qdio.siga_error = siga_error;
  275. rec->type.qdio.sbal_index = sbal_index;
  276. rec->type.qdio.sbal_count = sbal_count;
  277. debug_event(adapter->hba_dbf, 0,
  278. rec, sizeof(struct zfcp_hba_dbf_record));
  279. spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  280. }
  281. static inline int
  282. zfcp_hba_dbf_view_response(char *out_buf,
  283. struct zfcp_hba_dbf_record_response *rec)
  284. {
  285. int len = 0;
  286. len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x",
  287. rec->fsf_command);
  288. len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx",
  289. rec->fsf_reqid);
  290. len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
  291. rec->fsf_seqno);
  292. len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued);
  293. len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x",
  294. rec->fsf_prot_status);
  295. len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x",
  296. rec->fsf_status);
  297. len += zfcp_dbf_view_dump(out_buf + len, "fsf_prot_status_qual",
  298. rec->fsf_prot_status_qual,
  299. FSF_PROT_STATUS_QUAL_SIZE,
  300. 0, FSF_PROT_STATUS_QUAL_SIZE);
  301. len += zfcp_dbf_view_dump(out_buf + len, "fsf_status_qual",
  302. rec->fsf_status_qual,
  303. FSF_STATUS_QUALIFIER_SIZE,
  304. 0, FSF_STATUS_QUALIFIER_SIZE);
  305. len += zfcp_dbf_view(out_buf + len, "fsf_req_status", "0x%08x",
  306. rec->fsf_req_status);
  307. len += zfcp_dbf_view(out_buf + len, "sbal_first", "0x%02x",
  308. rec->sbal_first);
  309. len += zfcp_dbf_view(out_buf + len, "sbal_curr", "0x%02x",
  310. rec->sbal_curr);
  311. len += zfcp_dbf_view(out_buf + len, "sbal_last", "0x%02x",
  312. rec->sbal_last);
  313. len += zfcp_dbf_view(out_buf + len, "pool", "0x%02x", rec->pool);
  314. switch (rec->fsf_command) {
  315. case FSF_QTCB_FCP_CMND:
  316. if (rec->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
  317. break;
  318. len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx",
  319. rec->data.send_fcp.scsi_cmnd);
  320. len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx",
  321. rec->data.send_fcp.scsi_serial);
  322. break;
  323. case FSF_QTCB_OPEN_PORT_WITH_DID:
  324. case FSF_QTCB_CLOSE_PORT:
  325. case FSF_QTCB_CLOSE_PHYSICAL_PORT:
  326. len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx",
  327. rec->data.port.wwpn);
  328. len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x",
  329. rec->data.port.d_id);
  330. len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x",
  331. rec->data.port.port_handle);
  332. break;
  333. case FSF_QTCB_OPEN_LUN:
  334. case FSF_QTCB_CLOSE_LUN:
  335. len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx",
  336. rec->data.unit.wwpn);
  337. len += zfcp_dbf_view(out_buf + len, "fcp_lun", "0x%016Lx",
  338. rec->data.unit.fcp_lun);
  339. len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x",
  340. rec->data.unit.port_handle);
  341. len += zfcp_dbf_view(out_buf + len, "lun_handle", "0x%08x",
  342. rec->data.unit.lun_handle);
  343. break;
  344. case FSF_QTCB_SEND_ELS:
  345. len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x",
  346. rec->data.send_els.d_id);
  347. len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x",
  348. rec->data.send_els.ls_code);
  349. break;
  350. case FSF_QTCB_ABORT_FCP_CMND:
  351. case FSF_QTCB_SEND_GENERIC:
  352. case FSF_QTCB_EXCHANGE_CONFIG_DATA:
  353. case FSF_QTCB_EXCHANGE_PORT_DATA:
  354. case FSF_QTCB_DOWNLOAD_CONTROL_FILE:
  355. case FSF_QTCB_UPLOAD_CONTROL_FILE:
  356. break;
  357. }
  358. return len;
  359. }
  360. static inline int
  361. zfcp_hba_dbf_view_status(char *out_buf, struct zfcp_hba_dbf_record_status *rec)
  362. {
  363. int len = 0;
  364. len += zfcp_dbf_view(out_buf + len, "failed", "0x%02x", rec->failed);
  365. len += zfcp_dbf_view(out_buf + len, "status_type", "0x%08x",
  366. rec->status_type);
  367. len += zfcp_dbf_view(out_buf + len, "status_subtype", "0x%08x",
  368. rec->status_subtype);
  369. len += zfcp_dbf_view_dump(out_buf + len, "queue_designator",
  370. (char *)&rec->queue_designator,
  371. sizeof(struct fsf_queue_designator),
  372. 0, sizeof(struct fsf_queue_designator));
  373. len += zfcp_dbf_view_dump(out_buf + len, "payload",
  374. (char *)&rec->payload,
  375. rec->payload_size, 0, rec->payload_size);
  376. return len;
  377. }
  378. static inline int
  379. zfcp_hba_dbf_view_qdio(char *out_buf, struct zfcp_hba_dbf_record_qdio *rec)
  380. {
  381. int len = 0;
  382. len += zfcp_dbf_view(out_buf + len, "status", "0x%08x", rec->status);
  383. len += zfcp_dbf_view(out_buf + len, "qdio_error", "0x%08x",
  384. rec->qdio_error);
  385. len += zfcp_dbf_view(out_buf + len, "siga_error", "0x%08x",
  386. rec->siga_error);
  387. len += zfcp_dbf_view(out_buf + len, "sbal_index", "0x%02x",
  388. rec->sbal_index);
  389. len += zfcp_dbf_view(out_buf + len, "sbal_count", "0x%02x",
  390. rec->sbal_count);
  391. return len;
  392. }
  393. static int
  394. zfcp_hba_dbf_view_format(debug_info_t * id, struct debug_view *view,
  395. char *out_buf, const char *in_buf)
  396. {
  397. struct zfcp_hba_dbf_record *rec = (struct zfcp_hba_dbf_record *)in_buf;
  398. int len = 0;
  399. if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
  400. return 0;
  401. len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag);
  402. if (isalpha(rec->tag2[0]))
  403. len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2);
  404. if (strncmp(rec->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0)
  405. len += zfcp_hba_dbf_view_response(out_buf + len,
  406. &rec->type.response);
  407. else if (strncmp(rec->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0)
  408. len += zfcp_hba_dbf_view_status(out_buf + len,
  409. &rec->type.status);
  410. else if (strncmp(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0)
  411. len += zfcp_hba_dbf_view_qdio(out_buf + len, &rec->type.qdio);
  412. len += sprintf(out_buf + len, "\n");
  413. return len;
  414. }
  415. struct debug_view zfcp_hba_dbf_view = {
  416. "structured",
  417. NULL,
  418. &zfcp_dbf_view_header,
  419. &zfcp_hba_dbf_view_format,
  420. NULL,
  421. NULL
  422. };
  423. inline void
  424. _zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
  425. u32 s_id, u32 d_id, void *buffer, int buflen)
  426. {
  427. struct zfcp_send_ct *send_ct = (struct zfcp_send_ct *)fsf_req->data;
  428. struct zfcp_port *port = send_ct->port;
  429. struct zfcp_adapter *adapter = port->adapter;
  430. struct ct_hdr *header = (struct ct_hdr *)buffer;
  431. struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf;
  432. struct zfcp_san_dbf_record_ct *ct = &rec->type.ct;
  433. unsigned long flags;
  434. spin_lock_irqsave(&adapter->san_dbf_lock, flags);
  435. memset(rec, 0, sizeof(struct zfcp_san_dbf_record));
  436. strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
  437. rec->fsf_reqid = (unsigned long)fsf_req;
  438. rec->fsf_seqno = fsf_req->seq_no;
  439. rec->s_id = s_id;
  440. rec->d_id = d_id;
  441. if (strncmp(tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) {
  442. ct->type.request.cmd_req_code = header->cmd_rsp_code;
  443. ct->type.request.revision = header->revision;
  444. ct->type.request.gs_type = header->gs_type;
  445. ct->type.request.gs_subtype = header->gs_subtype;
  446. ct->type.request.options = header->options;
  447. ct->type.request.max_res_size = header->max_res_size;
  448. } else if (strncmp(tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) {
  449. ct->type.response.cmd_rsp_code = header->cmd_rsp_code;
  450. ct->type.response.revision = header->revision;
  451. ct->type.response.reason_code = header->reason_code;
  452. ct->type.response.reason_code_expl = header->reason_code_expl;
  453. ct->type.response.vendor_unique = header->vendor_unique;
  454. }
  455. ct->payload_size =
  456. min(buflen - (int)sizeof(struct ct_hdr), ZFCP_DBF_CT_PAYLOAD);
  457. memcpy(ct->payload, buffer + sizeof(struct ct_hdr), ct->payload_size);
  458. debug_event(adapter->san_dbf, 3,
  459. rec, sizeof(struct zfcp_san_dbf_record));
  460. spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
  461. }
  462. inline void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req)
  463. {
  464. struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
  465. struct zfcp_port *port = ct->port;
  466. struct zfcp_adapter *adapter = port->adapter;
  467. _zfcp_san_dbf_event_common_ct("octc", fsf_req,
  468. fc_host_port_id(adapter->scsi_host),
  469. port->d_id, zfcp_sg_to_address(ct->req),
  470. ct->req->length);
  471. }
  472. inline void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
  473. {
  474. struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
  475. struct zfcp_port *port = ct->port;
  476. struct zfcp_adapter *adapter = port->adapter;
  477. _zfcp_san_dbf_event_common_ct("rctc", fsf_req, port->d_id,
  478. fc_host_port_id(adapter->scsi_host),
  479. zfcp_sg_to_address(ct->resp),
  480. ct->resp->length);
  481. }
  482. static inline void
  483. _zfcp_san_dbf_event_common_els(const char *tag, int level,
  484. struct zfcp_fsf_req *fsf_req, u32 s_id,
  485. u32 d_id, u8 ls_code, void *buffer, int buflen)
  486. {
  487. struct zfcp_adapter *adapter = fsf_req->adapter;
  488. struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf;
  489. struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec;
  490. unsigned long flags;
  491. int offset = 0;
  492. spin_lock_irqsave(&adapter->san_dbf_lock, flags);
  493. do {
  494. memset(rec, 0, sizeof(struct zfcp_san_dbf_record));
  495. if (offset == 0) {
  496. strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
  497. rec->fsf_reqid = (unsigned long)fsf_req;
  498. rec->fsf_seqno = fsf_req->seq_no;
  499. rec->s_id = s_id;
  500. rec->d_id = d_id;
  501. rec->type.els.ls_code = ls_code;
  502. buflen = min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD);
  503. rec->type.els.payload_size = buflen;
  504. memcpy(rec->type.els.payload,
  505. buffer, min(buflen, ZFCP_DBF_ELS_PAYLOAD));
  506. offset += min(buflen, ZFCP_DBF_ELS_PAYLOAD);
  507. } else {
  508. strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
  509. dump->total_size = buflen;
  510. dump->offset = offset;
  511. dump->size = min(buflen - offset,
  512. (int)sizeof(struct zfcp_san_dbf_record)
  513. - (int)sizeof(struct zfcp_dbf_dump));
  514. memcpy(dump->data, buffer + offset, dump->size);
  515. offset += dump->size;
  516. }
  517. debug_event(adapter->san_dbf, level,
  518. rec, sizeof(struct zfcp_san_dbf_record));
  519. } while (offset < buflen);
  520. spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
  521. }
  522. inline void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req)
  523. {
  524. struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data;
  525. _zfcp_san_dbf_event_common_els("oels", 2, fsf_req,
  526. fc_host_port_id(els->adapter->scsi_host),
  527. els->d_id,
  528. *(u8 *) zfcp_sg_to_address(els->req),
  529. zfcp_sg_to_address(els->req),
  530. els->req->length);
  531. }
  532. inline void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req)
  533. {
  534. struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data;
  535. _zfcp_san_dbf_event_common_els("rels", 2, fsf_req, els->d_id,
  536. fc_host_port_id(els->adapter->scsi_host),
  537. *(u8 *) zfcp_sg_to_address(els->req),
  538. zfcp_sg_to_address(els->resp),
  539. els->resp->length);
  540. }
  541. inline void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req)
  542. {
  543. struct zfcp_adapter *adapter = fsf_req->adapter;
  544. struct fsf_status_read_buffer *status_buffer =
  545. (struct fsf_status_read_buffer *)fsf_req->data;
  546. int length = (int)status_buffer->length -
  547. (int)((void *)&status_buffer->payload - (void *)status_buffer);
  548. _zfcp_san_dbf_event_common_els("iels", 1, fsf_req, status_buffer->d_id,
  549. fc_host_port_id(adapter->scsi_host),
  550. *(u8 *) status_buffer->payload,
  551. (void *)status_buffer->payload, length);
  552. }
  553. static int
  554. zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view,
  555. char *out_buf, const char *in_buf)
  556. {
  557. struct zfcp_san_dbf_record *rec = (struct zfcp_san_dbf_record *)in_buf;
  558. char *buffer = NULL;
  559. int buflen = 0, total = 0;
  560. int len = 0;
  561. if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
  562. return 0;
  563. len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag);
  564. len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx",
  565. rec->fsf_reqid);
  566. len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
  567. rec->fsf_seqno);
  568. len += zfcp_dbf_view(out_buf + len, "s_id", "0x%06x", rec->s_id);
  569. len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", rec->d_id);
  570. if (strncmp(rec->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) {
  571. len += zfcp_dbf_view(out_buf + len, "cmd_req_code", "0x%04x",
  572. rec->type.ct.type.request.cmd_req_code);
  573. len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x",
  574. rec->type.ct.type.request.revision);
  575. len += zfcp_dbf_view(out_buf + len, "gs_type", "0x%02x",
  576. rec->type.ct.type.request.gs_type);
  577. len += zfcp_dbf_view(out_buf + len, "gs_subtype", "0x%02x",
  578. rec->type.ct.type.request.gs_subtype);
  579. len += zfcp_dbf_view(out_buf + len, "options", "0x%02x",
  580. rec->type.ct.type.request.options);
  581. len += zfcp_dbf_view(out_buf + len, "max_res_size", "0x%04x",
  582. rec->type.ct.type.request.max_res_size);
  583. total = rec->type.ct.payload_size;
  584. buffer = rec->type.ct.payload;
  585. buflen = min(total, ZFCP_DBF_CT_PAYLOAD);
  586. } else if (strncmp(rec->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) {
  587. len += zfcp_dbf_view(out_buf + len, "cmd_rsp_code", "0x%04x",
  588. rec->type.ct.type.response.cmd_rsp_code);
  589. len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x",
  590. rec->type.ct.type.response.revision);
  591. len += zfcp_dbf_view(out_buf + len, "reason_code", "0x%02x",
  592. rec->type.ct.type.response.reason_code);
  593. len +=
  594. zfcp_dbf_view(out_buf + len, "reason_code_expl", "0x%02x",
  595. rec->type.ct.type.response.reason_code_expl);
  596. len +=
  597. zfcp_dbf_view(out_buf + len, "vendor_unique", "0x%02x",
  598. rec->type.ct.type.response.vendor_unique);
  599. total = rec->type.ct.payload_size;
  600. buffer = rec->type.ct.payload;
  601. buflen = min(total, ZFCP_DBF_CT_PAYLOAD);
  602. } else if (strncmp(rec->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 ||
  603. strncmp(rec->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 ||
  604. strncmp(rec->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) {
  605. len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x",
  606. rec->type.els.ls_code);
  607. total = rec->type.els.payload_size;
  608. buffer = rec->type.els.payload;
  609. buflen = min(total, ZFCP_DBF_ELS_PAYLOAD);
  610. }
  611. len += zfcp_dbf_view_dump(out_buf + len, "payload",
  612. buffer, buflen, 0, total);
  613. if (buflen == total)
  614. len += sprintf(out_buf + len, "\n");
  615. return len;
  616. }
  617. struct debug_view zfcp_san_dbf_view = {
  618. "structured",
  619. NULL,
  620. &zfcp_dbf_view_header,
  621. &zfcp_san_dbf_view_format,
  622. NULL,
  623. NULL
  624. };
  625. static inline void
  626. _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
  627. struct zfcp_adapter *adapter,
  628. struct scsi_cmnd *scsi_cmnd,
  629. struct zfcp_fsf_req *fsf_req,
  630. struct zfcp_fsf_req *old_fsf_req)
  631. {
  632. struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf;
  633. struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec;
  634. unsigned long flags;
  635. struct fcp_rsp_iu *fcp_rsp;
  636. char *fcp_rsp_info = NULL, *fcp_sns_info = NULL;
  637. int offset = 0, buflen = 0;
  638. spin_lock_irqsave(&adapter->scsi_dbf_lock, flags);
  639. do {
  640. memset(rec, 0, sizeof(struct zfcp_scsi_dbf_record));
  641. if (offset == 0) {
  642. strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
  643. strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE);
  644. if (scsi_cmnd != NULL) {
  645. if (scsi_cmnd->device) {
  646. rec->scsi_id = scsi_cmnd->device->id;
  647. rec->scsi_lun = scsi_cmnd->device->lun;
  648. }
  649. rec->scsi_result = scsi_cmnd->result;
  650. rec->scsi_cmnd = (unsigned long)scsi_cmnd;
  651. rec->scsi_serial = scsi_cmnd->serial_number;
  652. memcpy(rec->scsi_opcode, &scsi_cmnd->cmnd,
  653. min((int)scsi_cmnd->cmd_len,
  654. ZFCP_DBF_SCSI_OPCODE));
  655. rec->scsi_retries = scsi_cmnd->retries;
  656. rec->scsi_allowed = scsi_cmnd->allowed;
  657. }
  658. if (fsf_req != NULL) {
  659. fcp_rsp = (struct fcp_rsp_iu *)
  660. &(fsf_req->qtcb->bottom.io.fcp_rsp);
  661. fcp_rsp_info =
  662. zfcp_get_fcp_rsp_info_ptr(fcp_rsp);
  663. fcp_sns_info =
  664. zfcp_get_fcp_sns_info_ptr(fcp_rsp);
  665. rec->type.fcp.rsp_validity =
  666. fcp_rsp->validity.value;
  667. rec->type.fcp.rsp_scsi_status =
  668. fcp_rsp->scsi_status;
  669. rec->type.fcp.rsp_resid = fcp_rsp->fcp_resid;
  670. if (fcp_rsp->validity.bits.fcp_rsp_len_valid)
  671. rec->type.fcp.rsp_code =
  672. *(fcp_rsp_info + 3);
  673. if (fcp_rsp->validity.bits.fcp_sns_len_valid) {
  674. buflen = min((int)fcp_rsp->fcp_sns_len,
  675. ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO);
  676. rec->type.fcp.sns_info_len = buflen;
  677. memcpy(rec->type.fcp.sns_info,
  678. fcp_sns_info,
  679. min(buflen,
  680. ZFCP_DBF_SCSI_FCP_SNS_INFO));
  681. offset += min(buflen,
  682. ZFCP_DBF_SCSI_FCP_SNS_INFO);
  683. }
  684. rec->fsf_reqid = (unsigned long)fsf_req;
  685. rec->fsf_seqno = fsf_req->seq_no;
  686. rec->fsf_issued = fsf_req->issued;
  687. }
  688. rec->type.old_fsf_reqid =
  689. (unsigned long) old_fsf_req;
  690. } else {
  691. strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
  692. dump->total_size = buflen;
  693. dump->offset = offset;
  694. dump->size = min(buflen - offset,
  695. (int)sizeof(struct
  696. zfcp_scsi_dbf_record) -
  697. (int)sizeof(struct zfcp_dbf_dump));
  698. memcpy(dump->data, fcp_sns_info + offset, dump->size);
  699. offset += dump->size;
  700. }
  701. debug_event(adapter->scsi_dbf, level,
  702. rec, sizeof(struct zfcp_scsi_dbf_record));
  703. } while (offset < buflen);
  704. spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags);
  705. }
  706. inline void
  707. zfcp_scsi_dbf_event_result(const char *tag, int level,
  708. struct zfcp_adapter *adapter,
  709. struct scsi_cmnd *scsi_cmnd,
  710. struct zfcp_fsf_req *fsf_req)
  711. {
  712. _zfcp_scsi_dbf_event_common("rslt", tag, level,
  713. adapter, scsi_cmnd, fsf_req, NULL);
  714. }
  715. inline void
  716. zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter,
  717. struct scsi_cmnd *scsi_cmnd,
  718. struct zfcp_fsf_req *new_fsf_req,
  719. struct zfcp_fsf_req *old_fsf_req)
  720. {
  721. _zfcp_scsi_dbf_event_common("abrt", tag, 1,
  722. adapter, scsi_cmnd, new_fsf_req, old_fsf_req);
  723. }
  724. inline void
  725. zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, struct zfcp_unit *unit,
  726. struct scsi_cmnd *scsi_cmnd)
  727. {
  728. struct zfcp_adapter *adapter = unit->port->adapter;
  729. _zfcp_scsi_dbf_event_common(flag == FCP_TARGET_RESET ? "trst" : "lrst",
  730. tag, 1, adapter, scsi_cmnd, NULL, NULL);
  731. }
  732. static int
  733. zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
  734. char *out_buf, const char *in_buf)
  735. {
  736. struct zfcp_scsi_dbf_record *rec =
  737. (struct zfcp_scsi_dbf_record *)in_buf;
  738. int len = 0;
  739. if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
  740. return 0;
  741. len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag);
  742. len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2);
  743. len += zfcp_dbf_view(out_buf + len, "scsi_id", "0x%08x", rec->scsi_id);
  744. len += zfcp_dbf_view(out_buf + len, "scsi_lun", "0x%08x",
  745. rec->scsi_lun);
  746. len += zfcp_dbf_view(out_buf + len, "scsi_result", "0x%08x",
  747. rec->scsi_result);
  748. len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx",
  749. rec->scsi_cmnd);
  750. len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx",
  751. rec->scsi_serial);
  752. len += zfcp_dbf_view_dump(out_buf + len, "scsi_opcode",
  753. rec->scsi_opcode,
  754. ZFCP_DBF_SCSI_OPCODE,
  755. 0, ZFCP_DBF_SCSI_OPCODE);
  756. len += zfcp_dbf_view(out_buf + len, "scsi_retries", "0x%02x",
  757. rec->scsi_retries);
  758. len += zfcp_dbf_view(out_buf + len, "scsi_allowed", "0x%02x",
  759. rec->scsi_allowed);
  760. if (strncmp(rec->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) {
  761. len += zfcp_dbf_view(out_buf + len, "old_fsf_reqid", "0x%0Lx",
  762. rec->type.old_fsf_reqid);
  763. }
  764. len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx",
  765. rec->fsf_reqid);
  766. len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
  767. rec->fsf_seqno);
  768. len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued);
  769. if (strncmp(rec->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) {
  770. len +=
  771. zfcp_dbf_view(out_buf + len, "fcp_rsp_validity", "0x%02x",
  772. rec->type.fcp.rsp_validity);
  773. len +=
  774. zfcp_dbf_view(out_buf + len, "fcp_rsp_scsi_status",
  775. "0x%02x", rec->type.fcp.rsp_scsi_status);
  776. len +=
  777. zfcp_dbf_view(out_buf + len, "fcp_rsp_resid", "0x%08x",
  778. rec->type.fcp.rsp_resid);
  779. len +=
  780. zfcp_dbf_view(out_buf + len, "fcp_rsp_code", "0x%08x",
  781. rec->type.fcp.rsp_code);
  782. len +=
  783. zfcp_dbf_view(out_buf + len, "fcp_sns_info_len", "0x%08x",
  784. rec->type.fcp.sns_info_len);
  785. len +=
  786. zfcp_dbf_view_dump(out_buf + len, "fcp_sns_info",
  787. rec->type.fcp.sns_info,
  788. min((int)rec->type.fcp.sns_info_len,
  789. ZFCP_DBF_SCSI_FCP_SNS_INFO), 0,
  790. rec->type.fcp.sns_info_len);
  791. }
  792. len += sprintf(out_buf + len, "\n");
  793. return len;
  794. }
  795. struct debug_view zfcp_scsi_dbf_view = {
  796. "structured",
  797. NULL,
  798. &zfcp_dbf_view_header,
  799. &zfcp_scsi_dbf_view_format,
  800. NULL,
  801. NULL
  802. };
  803. /**
  804. * zfcp_adapter_debug_register - registers debug feature for an adapter
  805. * @adapter: pointer to adapter for which debug features should be registered
  806. * return: -ENOMEM on error, 0 otherwise
  807. */
  808. int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
  809. {
  810. char dbf_name[DEBUG_MAX_NAME_LEN];
  811. /* debug feature area which records recovery activity */
  812. sprintf(dbf_name, "zfcp_%s_erp", zfcp_get_busid_by_adapter(adapter));
  813. adapter->erp_dbf = debug_register(dbf_name, dbfsize, 2,
  814. sizeof(struct zfcp_erp_dbf_record));
  815. if (!adapter->erp_dbf)
  816. goto failed;
  817. debug_register_view(adapter->erp_dbf, &debug_hex_ascii_view);
  818. debug_set_level(adapter->erp_dbf, 3);
  819. /* debug feature area which records HBA (FSF and QDIO) conditions */
  820. sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter));
  821. adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1,
  822. sizeof(struct zfcp_hba_dbf_record));
  823. if (!adapter->hba_dbf)
  824. goto failed;
  825. debug_register_view(adapter->hba_dbf, &debug_hex_ascii_view);
  826. debug_register_view(adapter->hba_dbf, &zfcp_hba_dbf_view);
  827. debug_set_level(adapter->hba_dbf, 3);
  828. /* debug feature area which records SAN command failures and recovery */
  829. sprintf(dbf_name, "zfcp_%s_san", zfcp_get_busid_by_adapter(adapter));
  830. adapter->san_dbf = debug_register(dbf_name, dbfsize, 1,
  831. sizeof(struct zfcp_san_dbf_record));
  832. if (!adapter->san_dbf)
  833. goto failed;
  834. debug_register_view(adapter->san_dbf, &debug_hex_ascii_view);
  835. debug_register_view(adapter->san_dbf, &zfcp_san_dbf_view);
  836. debug_set_level(adapter->san_dbf, 6);
  837. /* debug feature area which records SCSI command failures and recovery */
  838. sprintf(dbf_name, "zfcp_%s_scsi", zfcp_get_busid_by_adapter(adapter));
  839. adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1,
  840. sizeof(struct zfcp_scsi_dbf_record));
  841. if (!adapter->scsi_dbf)
  842. goto failed;
  843. debug_register_view(adapter->scsi_dbf, &debug_hex_ascii_view);
  844. debug_register_view(adapter->scsi_dbf, &zfcp_scsi_dbf_view);
  845. debug_set_level(adapter->scsi_dbf, 3);
  846. return 0;
  847. failed:
  848. zfcp_adapter_debug_unregister(adapter);
  849. return -ENOMEM;
  850. }
  851. /**
  852. * zfcp_adapter_debug_unregister - unregisters debug feature for an adapter
  853. * @adapter: pointer to adapter for which debug features should be unregistered
  854. */
  855. void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
  856. {
  857. debug_unregister(adapter->scsi_dbf);
  858. debug_unregister(adapter->san_dbf);
  859. debug_unregister(adapter->hba_dbf);
  860. debug_unregister(adapter->erp_dbf);
  861. adapter->scsi_dbf = NULL;
  862. adapter->san_dbf = NULL;
  863. adapter->hba_dbf = NULL;
  864. adapter->erp_dbf = NULL;
  865. }
  866. #undef ZFCP_LOG_AREA