1de909d87SChad Dupuis /* bnx2fc_debug.c: QLogic Linux FCoE offload driver.
217d87c45SSaurav Kashyap * Handles operations such as session offload/upload etc, and manages
317d87c45SSaurav Kashyap * session resources such as connection id and qp resources.
417d87c45SSaurav Kashyap *
517d87c45SSaurav Kashyap * Copyright (c) 2008-2013 Broadcom Corporation
6*21144b80SChad Dupuis * Copyright (c) 2014-2016 QLogic Corporation
7*21144b80SChad Dupuis * Copyright (c) 2016-2017 Cavium Inc.
817d87c45SSaurav Kashyap *
917d87c45SSaurav Kashyap * This program is free software; you can redistribute it and/or modify
1017d87c45SSaurav Kashyap * it under the terms of the GNU General Public License as published by
1117d87c45SSaurav Kashyap * the Free Software Foundation.
1217d87c45SSaurav Kashyap *
1317d87c45SSaurav Kashyap */
1417d87c45SSaurav Kashyap
153db8cc10SJoe Perches #include "bnx2fc.h"
163db8cc10SJoe Perches
BNX2FC_IO_DBG(const struct bnx2fc_cmd * io_req,const char * fmt,...)173db8cc10SJoe Perches void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...)
183db8cc10SJoe Perches {
193db8cc10SJoe Perches struct va_format vaf;
203db8cc10SJoe Perches va_list args;
213db8cc10SJoe Perches
223db8cc10SJoe Perches if (likely(!(bnx2fc_debug_level & LOG_IO)))
233db8cc10SJoe Perches return;
243db8cc10SJoe Perches
253db8cc10SJoe Perches va_start(args, fmt);
263db8cc10SJoe Perches
273db8cc10SJoe Perches vaf.fmt = fmt;
283db8cc10SJoe Perches vaf.va = &args;
293db8cc10SJoe Perches
303db8cc10SJoe Perches if (io_req && io_req->port && io_req->port->lport &&
313db8cc10SJoe Perches io_req->port->lport->host)
323db8cc10SJoe Perches shost_printk(KERN_INFO, io_req->port->lport->host,
333db8cc10SJoe Perches PFX "xid:0x%x %pV",
343db8cc10SJoe Perches io_req->xid, &vaf);
353db8cc10SJoe Perches else
363db8cc10SJoe Perches pr_info("NULL %pV", &vaf);
373db8cc10SJoe Perches
383db8cc10SJoe Perches va_end(args);
393db8cc10SJoe Perches }
403db8cc10SJoe Perches
BNX2FC_TGT_DBG(const struct bnx2fc_rport * tgt,const char * fmt,...)413db8cc10SJoe Perches void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...)
423db8cc10SJoe Perches {
433db8cc10SJoe Perches struct va_format vaf;
443db8cc10SJoe Perches va_list args;
453db8cc10SJoe Perches
463db8cc10SJoe Perches if (likely(!(bnx2fc_debug_level & LOG_TGT)))
473db8cc10SJoe Perches return;
483db8cc10SJoe Perches
493db8cc10SJoe Perches va_start(args, fmt);
503db8cc10SJoe Perches
513db8cc10SJoe Perches vaf.fmt = fmt;
523db8cc10SJoe Perches vaf.va = &args;
533db8cc10SJoe Perches
543db8cc10SJoe Perches if (tgt && tgt->port && tgt->port->lport && tgt->port->lport->host &&
553db8cc10SJoe Perches tgt->rport)
563db8cc10SJoe Perches shost_printk(KERN_INFO, tgt->port->lport->host,
573db8cc10SJoe Perches PFX "port:%x %pV",
583db8cc10SJoe Perches tgt->rport->port_id, &vaf);
593db8cc10SJoe Perches else
603db8cc10SJoe Perches pr_info("NULL %pV", &vaf);
613db8cc10SJoe Perches
623db8cc10SJoe Perches va_end(args);
633db8cc10SJoe Perches }
643db8cc10SJoe Perches
BNX2FC_HBA_DBG(const struct fc_lport * lport,const char * fmt,...)653db8cc10SJoe Perches void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...)
663db8cc10SJoe Perches {
673db8cc10SJoe Perches struct va_format vaf;
683db8cc10SJoe Perches va_list args;
693db8cc10SJoe Perches
703db8cc10SJoe Perches if (likely(!(bnx2fc_debug_level & LOG_HBA)))
713db8cc10SJoe Perches return;
723db8cc10SJoe Perches
733db8cc10SJoe Perches va_start(args, fmt);
743db8cc10SJoe Perches
753db8cc10SJoe Perches vaf.fmt = fmt;
763db8cc10SJoe Perches vaf.va = &args;
773db8cc10SJoe Perches
783db8cc10SJoe Perches if (lport && lport->host)
793db8cc10SJoe Perches shost_printk(KERN_INFO, lport->host, PFX "%pV", &vaf);
803db8cc10SJoe Perches else
813db8cc10SJoe Perches pr_info("NULL %pV", &vaf);
823db8cc10SJoe Perches
833db8cc10SJoe Perches va_end(args);
843db8cc10SJoe Perches }
85