bnx2fc_debug.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "bnx2fc.h"
  2. void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...)
  3. {
  4. struct va_format vaf;
  5. va_list args;
  6. if (likely(!(bnx2fc_debug_level & LOG_IO)))
  7. return;
  8. va_start(args, fmt);
  9. vaf.fmt = fmt;
  10. vaf.va = &args;
  11. if (io_req && io_req->port && io_req->port->lport &&
  12. io_req->port->lport->host)
  13. shost_printk(KERN_INFO, io_req->port->lport->host,
  14. PFX "xid:0x%x %pV",
  15. io_req->xid, &vaf);
  16. else
  17. pr_info("NULL %pV", &vaf);
  18. va_end(args);
  19. }
  20. void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...)
  21. {
  22. struct va_format vaf;
  23. va_list args;
  24. if (likely(!(bnx2fc_debug_level & LOG_TGT)))
  25. return;
  26. va_start(args, fmt);
  27. vaf.fmt = fmt;
  28. vaf.va = &args;
  29. if (tgt && tgt->port && tgt->port->lport && tgt->port->lport->host &&
  30. tgt->rport)
  31. shost_printk(KERN_INFO, tgt->port->lport->host,
  32. PFX "port:%x %pV",
  33. tgt->rport->port_id, &vaf);
  34. else
  35. pr_info("NULL %pV", &vaf);
  36. va_end(args);
  37. }
  38. void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...)
  39. {
  40. struct va_format vaf;
  41. va_list args;
  42. if (likely(!(bnx2fc_debug_level & LOG_HBA)))
  43. return;
  44. va_start(args, fmt);
  45. vaf.fmt = fmt;
  46. vaf.va = &args;
  47. if (lport && lport->host)
  48. shost_printk(KERN_INFO, lport->host, PFX "%pV", &vaf);
  49. else
  50. pr_info("NULL %pV", &vaf);
  51. va_end(args);
  52. }