From: Karan Tilak Kumar <kartilak@cisco.com>
To: sebaddel@cisco.com
Cc: arulponn@cisco.com, djhawar@cisco.com, gcboffa@cisco.com,
mkai2@cisco.com, satishkh@cisco.com, aeasi@cisco.com,
jejb@linux.ibm.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
jmeneghi@redhat.com, revers@redhat.com, adakopou@redhat.com,
lduncan@suse.com, Karan Tilak Kumar <kartilak@cisco.com>,
Hannes Reinecke <hare@kernel.org>
Subject: [PATCH v5 03/13] scsi: fnic: Decode firmware role configuration
Date: Tue, 23 Jun 2026 21:43:24 -0700 [thread overview]
Message-ID: <20260624044334.3079-4-kartilak@cisco.com> (raw)
In-Reply-To: <20260624044334.3079-1-kartilak@cisco.com>
Add FNIC_ROLE_CONFIG_MASK and use it to decode firmware role bits
when reading vNIC configuration and probing the PCI device.
Accept FCP and NVMe initiator roles, report FC target and FC-NVMe target
roles explicitly as unsupported, and keep truly undefined role settings
on the existing FC initiator default path.
Log the configured role flags and expose role names for trace output.
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Co-developed-by: Hannes Reinecke <hare@kernel.org>
---
Incorporate review comments from Hannes:
Decode target roles explicitly and report unsupported roles.
Changes between v3 and v4:
Incorporate review comments from Sashiko:
Keep role strings private and const
---
drivers/scsi/fnic/fnic.h | 1 +
drivers/scsi/fnic/fnic_main.c | 23 +++++++++++++++++++++--
drivers/scsi/fnic/fnic_res.c | 29 +++++++++++++++++++++++++++--
drivers/scsi/fnic/fnic_trace.c | 3 ++-
4 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index ad152fb4c15f..54ee52c453ba 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -43,6 +43,7 @@
#define FNIC_DFLT_QUEUE_DEPTH 256
#define FNIC_STATS_RATE_LIMIT 4 /* limit rate at which stats are pulled up */
#define LUN0_DELAY_TIME 9
+#define FNIC_ROLE_CONFIG_MASK (0xFF0)
/*
* Tag bits used for special requests.
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 7c7f9ea5267b..3a365ea455b1 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -844,7 +844,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_fnic_get_config;
}
- switch (fnic->config.flags & 0xff0) {
+ switch (fnic->config.flags & FNIC_ROLE_CONFIG_MASK) {
case VFCF_FC_INITIATOR:
{
host =
@@ -863,8 +863,27 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fnic->fnic_num);
}
break;
+ case VFCF_FC_TARGET:
+ dev_info(&fnic->pdev->dev,
+ "fnic: %d is scsi target\n",
+ fnic->fnic_num);
+ err = -EOPNOTSUPP;
+ goto err_out_fnic_role;
+ case VFCF_FC_NVME_INITIATOR:
+ fnic->role = FNIC_ROLE_NVME_INITIATOR;
+ dev_info(&fnic->pdev->dev, "fnic: %d is NVME initiator\n",
+ fnic->fnic_num);
+ break;
+ case VFCF_FC_NVME_TARGET:
+ dev_info(&fnic->pdev->dev,
+ "fnic: %d is NVME target\n",
+ fnic->fnic_num);
+ err = -EOPNOTSUPP;
+ goto err_out_fnic_role;
default:
- dev_info(&fnic->pdev->dev, "fnic: %d has no role defined\n", fnic->fnic_num);
+ dev_info(&fnic->pdev->dev,
+ "fnic: %d has no role defined (0x%x)\n",
+ fnic->fnic_num, fnic->config.flags & FNIC_ROLE_CONFIG_MASK);
err = -EINVAL;
goto err_out_fnic_role;
}
diff --git a/drivers/scsi/fnic/fnic_res.c b/drivers/scsi/fnic/fnic_res.c
index 9801e5fbb0dd..18353fbb5f98 100644
--- a/drivers/scsi/fnic/fnic_res.c
+++ b/drivers/scsi/fnic/fnic_res.c
@@ -22,6 +22,7 @@
int fnic_get_vnic_config(struct fnic *fnic)
{
struct vnic_fc_config *c = &fnic->config;
+ u32 role;
int err;
#define GET_CONFIG(m) \
@@ -58,9 +59,31 @@ int fnic_get_vnic_config(struct fnic *fnic)
GET_CONFIG(intr_mode);
GET_CONFIG(wq_copy_count);
- if ((c->flags & (VFCF_FC_INITIATOR)) == 0) {
- dev_info(&fnic->pdev->dev, "vNIC role not defined (def role: FC Init)\n");
+ role = c->flags & FNIC_ROLE_CONFIG_MASK;
+ switch (role) {
+ case 0:
+ dev_info(&fnic->pdev->dev,
+ "vNIC role not defined (def role: FC Init)\n");
c->flags |= VFCF_FC_INITIATOR;
+ break;
+ case VFCF_FC_INITIATOR:
+ case VFCF_FC_NVME_INITIATOR:
+ break;
+ case VFCF_FC_TARGET:
+ dev_info(&fnic->pdev->dev,
+ "vNIC role is FC Target (unsupported)\n");
+ break;
+ case VFCF_FC_NVME_TARGET:
+ dev_info(&fnic->pdev->dev,
+ "vNIC role is FC-NVMe Target (unsupported)\n");
+ break;
+ default:
+ dev_info(&fnic->pdev->dev,
+ "vNIC role not supported (0x%x), defaulting to FC Init\n",
+ role);
+ c->flags &= ~FNIC_ROLE_CONFIG_MASK;
+ c->flags |= VFCF_FC_INITIATOR;
+ break;
}
c->wq_enet_desc_count =
@@ -163,6 +186,8 @@ int fnic_get_vnic_config(struct fnic *fnic)
c->port_down_io_retries, c->port_down_timeout);
dev_info(&fnic->pdev->dev, "fNIC wq_copy_count: %d\n", c->wq_copy_count);
dev_info(&fnic->pdev->dev, "fNIC intr mode: %d\n", c->intr_mode);
+ dev_info(&fnic->pdev->dev, "fNIC role flags: 0x%x\n",
+ (c->flags & FNIC_ROLE_CONFIG_MASK));
return 0;
}
diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index 4ed57ea1f854..a3f583703664 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -31,7 +31,8 @@ int fnic_fc_trace_cleared = 1;
static DEFINE_SPINLOCK(fnic_fc_trace_lock);
static const char * const fnic_role_str[] = {
- [FNIC_ROLE_FCP_INITIATOR] = "FCP_Initiator",
+ [FNIC_ROLE_FCP_INITIATOR] = "FCP_Initiator",
+ [FNIC_ROLE_NVME_INITIATOR] = "NVMeF_Initiator",
};
const char *fnic_role_to_str(unsigned int role)
--
2.47.1
next prev parent reply other threads:[~2026-06-24 4:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 4:43 [PATCH v5 00/13] Introduce functionality for NVMe initiator Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 01/13] scsi: fnic: Make debug logging protocol independent Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 02/13] scsi: fnic: Use fnic_num for non-SCSI identifiers Karan Tilak Kumar
2026-06-24 4:43 ` Karan Tilak Kumar [this message]
2026-06-24 4:43 ` [PATCH v5 04/13] scsi: fnic: Advertise NVMe initiator service parameters Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 05/13] scsi: fnic: Add FDLS role handling for NVMe initiators Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 06/13] scsi: fnic: Add the NVMe/FC transport path Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 07/13] scsi: fnic: Route completions and resets by initiator role Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 08/13] scsi: fnic: Handle NVMe LS frames in FDLS Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 09/13] scsi: fnic: Send NVMe LS requests through FDLS Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 10/13] scsi: fnic: Abort timed-out NVMe LS requests Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 11/13] scsi: fnic: Track NVMe transport statistics Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 12/13] scsi: fnic: Expose NVMe transport state in debugfs Karan Tilak Kumar
2026-06-24 4:43 ` [PATCH v5 13/13] scsi: fnic: Bump up version number Karan Tilak Kumar
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=20260624044334.3079-4-kartilak@cisco.com \
--to=kartilak@cisco.com \
--cc=adakopou@redhat.com \
--cc=aeasi@cisco.com \
--cc=arulponn@cisco.com \
--cc=djhawar@cisco.com \
--cc=gcboffa@cisco.com \
--cc=hare@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=jmeneghi@redhat.com \
--cc=lduncan@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mkai2@cisco.com \
--cc=revers@redhat.com \
--cc=satishkh@cisco.com \
--cc=sebaddel@cisco.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
all inboxes | Powered by JetHome®