bnx2fc_debug.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* bnx2fc_debug.c: QLogic Linux FCoE offload driver.
  2. * Handles operations such as session offload/upload etc, and manages
  3. * session resources such as connection id and qp resources.
  4. *
  5. * Copyright (c) 2008-2013 Broadcom Corporation
  6. * Copyright (c) 2014-2016 QLogic Corporation
  7. * Copyright (c) 2016-2017 Cavium Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation.
  12. *
  13. */
  14. #include "bnx2fc.h"
  15. void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...)
  16. {
  17. struct va_format vaf;
  18. va_list args;
  19. if (likely(!(bnx2fc_debug_level & LOG_IO)))
  20. return;
  21. va_start(args, fmt);
  22. vaf.fmt = fmt;
  23. vaf.va = &args;
  24. if (io_req && io_req->port && io_req->port->lport &&
  25. io_req->port->lport->host)
  26. shost_printk(KERN_INFO, io_req->port->lport->host,
  27. PFX "xid:0x%x %pV",
  28. io_req->xid, &vaf);
  29. else
  30. pr_info("NULL %pV", &vaf);
  31. va_end(args);
  32. }
  33. void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...)
  34. {
  35. struct va_format vaf;
  36. va_list args;
  37. if (likely(!(bnx2fc_debug_level & LOG_TGT)))
  38. return;
  39. va_start(args, fmt);
  40. vaf.fmt = fmt;
  41. vaf.va = &args;
  42. if (tgt && tgt->port && tgt->port->lport && tgt->port->lport->host &&
  43. tgt->rport)
  44. shost_printk(KERN_INFO, tgt->port->lport->host,
  45. PFX "port:%x %pV",
  46. tgt->rport->port_id, &vaf);
  47. else
  48. pr_info("NULL %pV", &vaf);
  49. va_end(args);
  50. }
  51. void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...)
  52. {
  53. struct va_format vaf;
  54. va_list args;
  55. if (likely(!(bnx2fc_debug_level & LOG_HBA)))
  56. return;
  57. va_start(args, fmt);
  58. vaf.fmt = fmt;
  59. vaf.va = &args;
  60. if (lport && lport->host)
  61. shost_printk(KERN_INFO, lport->host, PFX "%pV", &vaf);
  62. else
  63. pr_info("NULL %pV", &vaf);
  64. va_end(args);
  65. }