Merge patch series "Request to queue zfcp enhancements for upstream merge window"

Nihar Panda <niharp@linux.ibm.com> says:

Hi Martin and James,

We are submitting zfcp enhancement designed to improve trace logging
for the upcoming v7.3 release.

Regarding the sashiko bot feedback: the majority of the reported
findings are legacy issues rather than regressions caused by this
series. We plan to resolve those separately.

Link: https://patch.msgid.link/20260728044857.2532646-1-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Martin K. Petersen
2026-07-28 22:15:48 -04:00
5 changed files with 126 additions and 15 deletions

View File

@@ -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);
@@ -220,6 +245,13 @@ void zfcp_dbf_hba_fsf_uss(char *tag, struct zfcp_fsf_req *req)
rec->u.uss.lun = srb->fcp_lun;
memcpy(&rec->u.uss.queue_designator, &srb->queue_designator,
sizeof(rec->u.uss.queue_designator));
rec->u.uss.length = srb->length;
rec->u.uss.res1 = srb->res1;
rec->u.uss.res2 = srb->res2;
rec->u.uss.class = srb->class;
rec->u.uss.res3 = srb->res3;
rec->u.uss.s_id = ntoh24(srb->s_id);
memcpy(&rec->u.uss.res4, &srb->res4, sizeof(rec->u.uss.res4));
/* status read buffer payload length */
rec->pl_len = (!srb->length) ? 0 : srb->length -
@@ -227,12 +259,48 @@ 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);
}
/**
* zfcp_dbf_hba_uas - trace event for sysfs unit add store
* @tag: tag indicating which kind of unit add store condition occurred
* @level: debug trace level
* @adapter: pointer to struct zfcp_adapter
* @wwpn: remote port wwn
* @fcp_lun: FCP LUN
* @ret: return value
*/
void zfcp_dbf_hba_uas(char *tag, int level, struct zfcp_adapter *adapter,
u64 wwpn, u64 fcp_lun, int ret)
{
struct zfcp_dbf *dbf = adapter->dbf;
struct zfcp_dbf_hba *rec = &dbf->hba_buf;
unsigned long flags;
if (unlikely(!debug_level_enabled(dbf->hba, level)))
return;
spin_lock_irqsave(&dbf->hba_lock, flags);
memset(rec, 0, sizeof(*rec));
memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
rec->id = ZFCP_DBF_HBA_UAS;
rec->fsf_req_id = ~0u;
rec->fsf_req_status = ~0u;
rec->fsf_cmd = ~0u;
rec->fsf_seq_no = ~0u;
rec->u.uas.wwpn = wwpn;
rec->u.uas.fcp_lun = fcp_lun;
rec->u.uas.ret = ret;
debug_event(dbf->hba, level, rec, sizeof(*rec));
spin_unlock_irqrestore(&dbf->hba_lock, flags);
}
/**
* zfcp_dbf_hba_bit_err - trace event for bit error conditions
* @tag: tag indicating which kind of bit error unsolicited status was received
@@ -732,7 +800,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));

View File

@@ -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;
/**
@@ -149,6 +151,13 @@ struct zfcp_dbf_hba_res {
* @d_id: destination ID
* @lun: logical unit number
* @queue_designator: queue designator
* @length: buffer length
* @res1: reserved field 1
* @res2: reserved field 2
* @class: class of service
* @res3: reserved field 3
* @s_id: source ID
* @res4: reserved field 4
*/
struct zfcp_dbf_hba_uss {
u32 status_type;
@@ -156,6 +165,25 @@ struct zfcp_dbf_hba_uss {
u32 d_id;
u64 lun;
u64 queue_designator;
u32 length;
u32 res1;
u8 res2;
u32 class;
u8 res3;
u32 s_id;
u8 res4[20];
} __packed;
/**
* struct zfcp_dbf_hba_uas - trace record for sysfs unit add store
* @wwpn: remote port wwn
* @fcp_lun: FCP LUN
* @ret: return value
*/
struct zfcp_dbf_hba_uas {
u64 wwpn;
u64 fcp_lun;
u32 ret;
} __packed;
/**
@@ -184,6 +212,7 @@ struct zfcp_dbf_hba_fces {
* @ZFCP_DBF_HBA_BIT: bit error trace record
* @ZFCP_DBF_HBA_BASIC: basic adapter event, only trace tag, no other data
* @ZFCP_DBF_HBA_FCES: FC Endpoint Security trace record
* @ZFCP_DBF_HBA_UAS: unit add store trace record
*/
enum zfcp_dbf_hba_id {
ZFCP_DBF_HBA_RES = 1,
@@ -191,6 +220,7 @@ enum zfcp_dbf_hba_id {
ZFCP_DBF_HBA_BIT = 3,
ZFCP_DBF_HBA_BASIC = 4,
ZFCP_DBF_HBA_FCES = 5,
ZFCP_DBF_HBA_UAS = 6,
};
/**
@@ -207,6 +237,7 @@ enum zfcp_dbf_hba_id {
* @u.uss: data for unsolicited status buffer
* @u.be: data for bit error unsolicited status buffer
* @u.fces: data for FC Endpoint Security
* @u.uas: data for unit add store
*/
struct zfcp_dbf_hba {
u8 id;
@@ -221,6 +252,7 @@ struct zfcp_dbf_hba {
struct zfcp_dbf_hba_uss uss;
struct fsf_bit_error_payload be;
struct zfcp_dbf_hba_fces fces;
struct zfcp_dbf_hba_uas uas;
} u;
} __packed;

View File

@@ -4,7 +4,7 @@
*
* External function declarations.
*
* Copyright IBM Corp. 2002, 2023
* Copyright IBM Corp. 2002, 2026
*/
#ifndef ZFCP_EXT_H
@@ -49,6 +49,8 @@ extern void zfcp_dbf_hba_fsf_fces(char *tag, const struct zfcp_fsf_req *req,
extern void zfcp_dbf_hba_fsf_reqid(const char *const tag, const int level,
struct zfcp_adapter *const adapter,
const u64 req_id);
extern void zfcp_dbf_hba_uas(char *tag, int level, struct zfcp_adapter *adapter,
u64 wwpn, u64 fcp_lun, int ret);
extern void zfcp_dbf_hba_bit_err(char *, struct zfcp_fsf_req *);
extern void zfcp_dbf_hba_def_err(struct zfcp_adapter *, u64, u16, void **);
extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32);

View File

@@ -246,7 +246,9 @@ struct fsf_status_read_buffer {
u8 d_id[3];
u32 class;
u64 fcp_lun;
u8 res3[24];
u8 res3;
u8 s_id[3];
u8 res4[20];
union {
u8 data[FSF_STATUS_READ_PAYLOAD_SIZE];
u32 word[FSF_STATUS_READ_PAYLOAD_SIZE/sizeof(u32)];

View File

@@ -4,7 +4,7 @@
*
* sysfs attributes.
*
* Copyright IBM Corp. 2008, 2020
* Copyright IBM Corp. 2008, 2026
*/
#define pr_fmt(fmt) "zfcp: " fmt
@@ -442,17 +442,24 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
const char *buf, size_t count)
{
struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
u64 fcp_lun;
int retval;
struct zfcp_adapter *adapter = port->adapter;
u64 fcp_lun = 0;
int retval = -EINVAL;
if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
return -EINVAL;
if (kstrtoull(buf, 0, (unsigned long long *)&fcp_lun)) {
zfcp_dbf_hba_uas("syuast1", 3, adapter, port->wwpn,
fcp_lun, retval);
return retval;
}
flush_work(&port->rport_work);
retval = zfcp_unit_add(port, fcp_lun);
if (retval)
if (retval) {
zfcp_dbf_hba_uas("syuast2", 3, adapter, port->wwpn,
fcp_lun, retval);
return retval;
}
return count;
}