From: Christoph Hellwig <hch@lst.de>
To: Michael Bommarito <michael.bommarito@gmail.com>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
Nilesh Javali <njavali@marvell.com>,
Himanshu Madhani <himanshu.madhani@oracle.com>,
Shyam Sundar <ssundar@marvell.com>,
James Smart <james.smart@broadcom.com>,
Hannes Reinecke <hare@kernel.org>,
John Meneghini <jmeneghi@redhat.com>,
Bryan Gurney <bgurney@redhat.com>,
Justin Tee <justin.tee@broadcom.com>,
Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
Kees Cook <kees@kernel.org>,
linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: scsi_transport_fc: widen FPIN pname walker counter to u32
Date: Tue, 19 May 2026 09:21:26 +0200 [thread overview]
Message-ID: <20260519072126.GA10436@lst.de> (raw)
In-Reply-To: <20260518140945.2751273-2-michael.bommarito@gmail.com>
> + if (pname_count > max_count)
> + pname_count = max_count;
Use min/min_t here?
> + for (i = 0; i < pname_count; i++) {
> + wwpn = be64_to_cpu(li_desc->pname_list[i]);
> + rport = fc_find_rport_by_wwpn(shost, wwpn);
> + if (rport &&
> + (rport->roles & FC_PORT_ROLE_FCP_TARGET ||
> + rport->roles & FC_PORT_ROLE_NVME_TARGET)) {
> + if (rport == attach_rport)
> + continue;
> + fc_li_stats_update(event_type,
> + &rport->fpin_stats);
> }
> + pname_count = be32_to_cpu(pc_desc->pname_count);
> + desc_len = be32_to_cpu(pc_desc->desc_len);
> + if (desc_len < sizeof(*pc_desc) - FC_TLV_DESC_HDR_SZ)
> + max_count = 0;
> + else
> + max_count = (desc_len -
> + (sizeof(*pc_desc) - FC_TLV_DESC_HDR_SZ)) /
> + sizeof(pc_desc->pname_list[0]);
> + if (pname_count > max_count)
> + pname_count = max_count;
> +
> + for (i = 0; i < pname_count; i++) {
> + wwpn = be64_to_cpu(pc_desc->pname_list[i]);
> + rport = fc_find_rport_by_wwpn(shost, wwpn);
> + if (rport &&
> + (rport->roles & FC_PORT_ROLE_FCP_TARGET ||
> + rport->roles & FC_PORT_ROLE_NVME_TARGET)) {
> + if (rport == attach_rport)
> + continue;
> + fc_cn_stats_update(event_type,
> + &rport->fpin_stats);
> }
> }
Am I missing something or is this code entirely duplicate except
for the different stats updates helper? Maybe use the chance
to factor it into a common helper in a follow on patch?
next prev parent reply other threads:[~2026-05-19 7:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 14:09 [DRAFT][PATCH] scsi: scsi_transport_fc: widen FPIN pname walker counter to u32 Michael Bommarito
2026-05-18 14:09 ` [PATCH] " Michael Bommarito
2026-05-19 7:21 ` Christoph Hellwig [this message]
2026-05-18 14:37 ` [PATCH v2] " Michael Bommarito
2026-05-19 7:22 ` Christoph Hellwig
2026-05-19 19:06 ` [PATCH v3] " Michael Bommarito
2026-05-20 12:58 ` David Laight
2026-05-20 13:30 ` [PATCH v4] " Michael Bommarito
2026-05-22 9:22 ` Christoph Hellwig
2026-05-22 10:11 ` John Garry
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=20260519072126.GA10436@lst.de \
--to=hch@lst.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bgurney@redhat.com \
--cc=hare@kernel.org \
--cc=himanshu.madhani@oracle.com \
--cc=james.smart@broadcom.com \
--cc=jmeneghi@redhat.com \
--cc=justin.tee@broadcom.com \
--cc=kbusch@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.bommarito@gmail.com \
--cc=njavali@marvell.com \
--cc=ssundar@marvell.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