bnx2fc_debug.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* bnx2fc_debug.c: QLogic NetXtreme II 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, QLogic Corporation
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation.
  11. *
  12. */
  13. #include "bnx2fc.h"
  14. void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...)
  15. {
  16. struct va_format vaf;
  17. va_list args;
  18. if (likely(!(bnx2fc_debug_level & LOG_IO)))
  19. return;
  20. va_start(args, fmt);
  21. vaf.fmt = fmt;
  22. vaf.va = &args;
  23. if (io_req && io_req->port && io_req->port->lport &&
  24. io_req->port->lport->host)
  25. shost_printk(KERN_INFO, io_req->port->lport->host,
  26. PFX "xid:0x%x %pV",
  27. io_req->xid, &vaf);
  28. else
  29. pr_info("NULL %pV", &vaf);
  30. va_end(args);
  31. }
  32. void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...)
  33. {
  34. struct va_format vaf;
  35. va_list args;
  36. if (likely(!(bnx2fc_debug_level & LOG_TGT)))
  37. return;
  38. va_start(args, fmt);
  39. vaf.fmt = fmt;
  40. vaf.va = &args;
  41. if (tgt && tgt->port && tgt->port->lport && tgt->port->lport->host &&
  42. tgt->rport)
  43. shost_printk(KERN_INFO, tgt->port->lport->host,
  44. PFX "port:%x %pV",
  45. tgt->rport->port_id, &vaf);
  46. else
  47. pr_info("NULL %pV", &vaf);
  48. va_end(args);
  49. }
  50. void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...)
  51. {
  52. struct va_format vaf;
  53. va_list args;
  54. if (likely(!(bnx2fc_debug_level & LOG_HBA)))
  55. return;
  56. va_start(args, fmt);
  57. vaf.fmt = fmt;
  58. vaf.va = &args;
  59. if (lport && lport->host)
  60. shost_printk(KERN_INFO, lport->host, PFX "%pV", &vaf);
  61. else
  62. pr_info("NULL %pV", &vaf);
  63. va_end(args);
  64. }