From: Nihar Panda <niharp@linux.ibm.com>
To: "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Nihar Panda <nihar.panda@ibm.com>
Subject: [PATCH 2/3] zfcp: Trace plogi and prli within open port response as payload
Date: Thu, 11 Jun 2026 07:05:24 +0200 [thread overview]
Message-ID: <20260611050550.796772-4-niharp@linux.ibm.com> (raw)
In-Reply-To: <20260611050550.796772-1-niharp@linux.ibm.com>
From: Steffen Maier <maier@linux.ibm.com>
The FCP channel optionally returns the content of PLOGI and PRLI within
open port response. This information is needed to debug unexpected open
port responses. Pack both PLOGI and PRLI information back-to-back into a
PAYload trace record of type "fsf_els" within existing HBA trace record.
The length of both parts, and thus also the offset of the second part,
are added to the corresponding HBA trace record. Be extra careful
regarding bounds checking.
Since auto port scan in multi-initiator zoning environments can cause a
lot of failed open port responses and trace is enabled by default in the
HBA trace area, chose a trace level 4 above the default of 3 for the
corresponding PAYload trace record to contain PLOGI/PRLI data. This way,
it avoids flooding the PAY area by default.
In the spirit of commit 35f040df97fa ("zfcp: retain trace level for SCSI
and HBA FSF response records"), pass the level here. For this, introduce
an additional argument 'level' for zfcp_dbf_pl_write().
zfcpdbf tool partial trace example with PLOGI/PRLI log info after changes:
PLOGI length : 116
PRLI length : 20
Payload time : 2026-01-29-06:19:15:626629
PLOGI/PRLIinfo : 02000000 00000000 80000800 000a0002
00000000 2002000e 1115c62f 2001000e
1115c62f 00000000 00000000 00000000
00000000 80000000 00000000 00000000
00000000 80000000 00000000 000a0000
00010000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 02100014 08002100 00000000
00000000 00000112
Reviewed-by: M Nikhil <nikh1092@linux.ibm.com>
Reviewed-by: Nihar Panda <niharp@linux.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Co-developed-by: Chinmaya Kajagar <chinmayk@linux.ibm.com>
Signed-off-by: Chinmaya Kajagar <chinmayk@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
---
drivers/s390/scsi/zfcp_dbf.c | 37 ++++++++++++++++++++++++++++++------
drivers/s390/scsi/zfcp_dbf.h | 4 +++-
2 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 89b859176b8b..4217b74baa38 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -4,7 +4,7 @@
*
* Debug traces for zfcp.
*
- * Copyright IBM Corp. 2002, 2023
+ * Copyright IBM Corp. 2002, 2026
*/
#define pr_fmt(fmt) "zfcp: " fmt
@@ -35,13 +35,18 @@ static inline unsigned int zfcp_dbf_plen(unsigned int offset)
return sizeof(struct zfcp_dbf_pay) + offset - ZFCP_DBF_PAY_MAX_REC;
}
+#define ZFCP_DBF_PAY_LEVEL 1
+
static inline
void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 length, char *area,
- u64 req_id)
+ u64 req_id, int level)
{
struct zfcp_dbf_pay *pl = &dbf->pay_buf;
u16 offset = 0, rec_length;
+ if (unlikely(!debug_level_enabled(dbf->pay, level)))
+ return;
+
spin_lock(&dbf->pay_lock);
memset(pl, 0, sizeof(*pl));
pl->fsf_req_id = req_id;
@@ -51,7 +56,7 @@ void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 length, char *area,
rec_length = min((u16) ZFCP_DBF_PAY_MAX_REC,
(u16) (length - offset));
memcpy(pl->data, data + offset, rec_length);
- debug_event(dbf->pay, 1, pl, zfcp_dbf_plen(rec_length));
+ debug_event(dbf->pay, level, pl, zfcp_dbf_plen(rec_length));
offset += rec_length;
pl->counter++;
@@ -96,7 +101,27 @@ void zfcp_dbf_hba_fsf_res(char *tag, int level, struct zfcp_fsf_req *req)
rec->pl_len = q_head->log_length;
zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start,
- rec->pl_len, "fsf_res", req->req_id);
+ rec->pl_len, "fsf_res", req->req_id,
+ ZFCP_DBF_PAY_LEVEL);
+
+ if (q_head->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) {
+ struct fsf_qtcb_bottom_support *q_bott =
+ &req->qtcb->bottom.support;
+ u32 plogi_len = 0, prli_len = 0;
+
+ if (q_bott->els1_length) {
+ rec->u.res.plogi_len = q_bott->els1_length;
+ plogi_len = min_t(u32, q_bott->els1_length,
+ sizeof(q_bott->els));
+ }
+ if (q_bott->els2_length) {
+ rec->u.res.prli_len = q_bott->els2_length;
+ prli_len = min_t(u32, q_bott->els2_length,
+ sizeof(q_bott->els) - plogi_len);
+ }
+ zfcp_dbf_pl_write(dbf, q_bott->els, plogi_len + prli_len,
+ "fsf_els", req->req_id, 4);
+ }
debug_event(dbf->hba, level, rec, sizeof(*rec));
spin_unlock_irqrestore(&dbf->hba_lock, flags);
@@ -234,7 +259,7 @@ void zfcp_dbf_hba_fsf_uss(char *tag, struct zfcp_fsf_req *req)
if (rec->pl_len)
zfcp_dbf_pl_write(dbf, srb->payload.data, rec->pl_len,
- "fsf_uss", req->req_id);
+ "fsf_uss", req->req_id, ZFCP_DBF_PAY_LEVEL);
log:
debug_event(dbf->hba, level, rec, sizeof(*rec));
spin_unlock_irqrestore(&dbf->hba_lock, flags);
@@ -739,7 +764,7 @@ void zfcp_dbf_scsi_common(char *tag, int level, struct scsi_device *sdev,
min_t(u16, max_t(u16, rec->pl_len,
ZFCP_DBF_PAY_MAX_REC),
FSF_FCP_RSP_SIZE),
- "fcp_riu", fsf->req_id);
+ "fcp_riu", fsf->req_id, ZFCP_DBF_PAY_LEVEL);
}
debug_event(dbf->scsi, level, rec, sizeof(*rec));
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index 44ebad8c761c..c84f076440a8 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -3,7 +3,7 @@
* zfcp device driver
* debug feature declarations
*
- * Copyright IBM Corp. 2008, 2020
+ * Copyright IBM Corp. 2008, 2026
*/
#ifndef ZFCP_DBF_H
@@ -140,6 +140,8 @@ struct zfcp_dbf_hba_res {
u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE];
u32 port_handle;
u32 lun_handle;
+ u32 plogi_len;
+ u32 prli_len;
} __packed;
/**
--
2.53.0
next prev parent reply other threads:[~2026-06-11 5:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 5:05 Nihar Panda
2026-06-11 5:05 ` [PATCH 0/3] zfcp: Enhanced tracing for debugging Nihar Panda
2026-06-11 5:05 ` [PATCH 1/3] zfcp: Enhance fsf status read buffer tracing Nihar Panda
2026-06-11 5:26 ` sashiko-bot
2026-06-11 5:05 ` Nihar Panda [this message]
2026-06-11 5:24 ` [PATCH 2/3] zfcp: Trace plogi and prli within open port response as payload sashiko-bot
2026-06-11 5:05 ` [PATCH 3/3] zfcp: trace return values of sysfs unit add store Nihar Panda
2026-06-11 5:31 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611050550.796772-4-niharp@linux.ibm.com \
--to=niharp@linux.ibm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nihar.panda@ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox