mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
scsi: zfcp: Trace PLOGI and PRLI within open port response as payload
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 35f040df97 ("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>
Link: https://patch.msgid.link/20260728044857.2532646-3-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
5994844195
commit
3efec904df
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user