[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250110091655.17643-1-kartilak@cisco.com>
Date: Fri, 10 Jan 2025 01:16:55 -0800
From: Karan Tilak Kumar <kartilak@...co.com>
To: sebaddel@...co.com
Cc: arulponn@...co.com,
djhawar@...co.com,
gcboffa@...co.com,
mkai2@...co.com,
satishkh@...co.com,
aeasi@...co.com,
jejb@...ux.ibm.com,
martin.petersen@...cle.com,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Dan Carpenter <dan.carpenter@...aro.org>,
Karan Tilak Kumar <kartilak@...co.com>
Subject: [PATCH] scsi: fnic: Remove always-true IS_FNIC_FCP_INITIATOR macro
From: Arun Easi <aeasi@...co.com>
IS_FNIC_FCP_INITIATOR macro is not applicable at this time.
Delete the macro.
Suggested-by: Dan Carpenter <dan.carpenter@...aro.org>
Reviewed-by: Sesidhar Baddela <sebaddel@...co.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@...co.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@...co.com>
Signed-off-by: Arun Easi <aeasi@...co.com>
Signed-off-by: Karan Tilak Kumar <kartilak@...co.com>
---
drivers/scsi/fnic/fdls_disc.c | 85 ++++++++++++++---------------------
drivers/scsi/fnic/fnic.h | 2 -
drivers/scsi/fnic/fnic_main.c | 14 +++---
3 files changed, 39 insertions(+), 62 deletions(-)
diff --git a/drivers/scsi/fnic/fdls_disc.c b/drivers/scsi/fnic/fdls_disc.c
index 2534af2fff53..721e0643abe2 100644
--- a/drivers/scsi/fnic/fdls_disc.c
+++ b/drivers/scsi/fnic/fdls_disc.c
@@ -1242,31 +1242,29 @@ bool fdls_delete_tport(struct fnic_iport_s *iport, struct fnic_tport_s *tport)
tport->timer_pending = 0;
}
- if (IS_FNIC_FCP_INITIATOR(fnic)) {
- spin_unlock_irqrestore(&fnic->fnic_lock, fnic->lock_flags);
- fnic_rport_exch_reset(iport->fnic, tport->fcid);
- spin_lock_irqsave(&fnic->fnic_lock, fnic->lock_flags);
+ spin_unlock_irqrestore(&fnic->fnic_lock, fnic->lock_flags);
+ fnic_rport_exch_reset(iport->fnic, tport->fcid);
+ spin_lock_irqsave(&fnic->fnic_lock, fnic->lock_flags);
- if (tport->flags & FNIC_FDLS_SCSI_REGISTERED) {
- tport_del_evt =
- kzalloc(sizeof(struct fnic_tport_event_s), GFP_ATOMIC);
- if (!tport_del_evt) {
- FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
- "Failed to allocate memory for tport fcid: 0x%0x\n",
- tport->fcid);
- return false;
- }
- tport_del_evt->event = TGT_EV_RPORT_DEL;
- tport_del_evt->arg1 = (void *) tport;
- list_add_tail(&tport_del_evt->links, &fnic->tport_event_list);
- queue_work(fnic_event_queue, &fnic->tport_work);
- } else {
+ if (tport->flags & FNIC_FDLS_SCSI_REGISTERED) {
+ tport_del_evt =
+ kzalloc(sizeof(struct fnic_tport_event_s), GFP_ATOMIC);
+ if (!tport_del_evt) {
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
- "tport 0x%x not reg with scsi_transport. Freeing locally",
+ "Failed to allocate memory for tport fcid: 0x%0x\n",
tport->fcid);
- list_del(&tport->links);
- kfree(tport);
+ return false;
}
+ tport_del_evt->event = TGT_EV_RPORT_DEL;
+ tport_del_evt->arg1 = (void *) tport;
+ list_add_tail(&tport_del_evt->links, &fnic->tport_event_list);
+ queue_work(fnic_event_queue, &fnic->tport_work);
+ } else {
+ FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
+ "tport 0x%x not reg with scsi_transport. Freeing locally",
+ tport->fcid);
+ list_del(&tport->links);
+ kfree(tport);
}
return true;
}
@@ -1388,8 +1386,7 @@ static void fdls_send_register_fc4_types(struct fnic_iport_s *iport)
"0x%x: FDLS send RFT with oxid: 0x%x", iport->fcid,
oxid);
- if (IS_FNIC_FCP_INITIATOR(fnic))
- prft_id->rft_id.fr_fts.ff_type_map[0] =
+ prft_id->rft_id.fr_fts.ff_type_map[0] =
cpu_to_be32(1 << FC_TYPE_FCP);
prft_id->rft_id.fr_fts.ff_type_map[1] =
@@ -1451,12 +1448,7 @@ static void fdls_send_register_fc4_features(struct fnic_iport_s *iport)
"0x%x: FDLS send RFF with oxid: 0x%x", iport->fcid,
oxid);
- if (IS_FNIC_FCP_INITIATOR(fnic)) {
- prff_id->rff_id.fr_type = FC_TYPE_FCP;
- } else {
- FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
- "0x%x: Unknown type", iport->fcid);
- }
+ prff_id->rff_id.fr_type = FC_TYPE_FCP;
fnic_send_fcoe_frame(iport, frame, frame_size);
@@ -2333,9 +2325,6 @@ static void fdls_send_delete_tport_msg(struct fnic_tport_s *tport)
struct fnic *fnic = iport->fnic;
struct fnic_tport_event_s *tport_del_evt;
- if (!IS_FNIC_FCP_INITIATOR(fnic))
- return;
-
tport_del_evt = kzalloc(sizeof(struct fnic_tport_event_s), GFP_ATOMIC);
if (!tport_del_evt) {
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
@@ -3489,11 +3478,9 @@ fdls_process_flogi_rsp(struct fnic_iport_s *iport,
"From fabric: R_A_TOV: %d E_D_TOV: %d",
iport->r_a_tov, iport->e_d_tov);
- if (IS_FNIC_FCP_INITIATOR(fnic)) {
- fc_host_fabric_name(iport->fnic->host) =
- get_unaligned_be64(&FNIC_LOGI_NODE_NAME(flogi_rsp->els));
- fc_host_port_id(iport->fnic->host) = iport->fcid;
- }
+ fc_host_fabric_name(iport->fnic->host) =
+ get_unaligned_be64(&FNIC_LOGI_NODE_NAME(flogi_rsp->els));
+ fc_host_port_id(iport->fnic->host) = iport->fcid;
fnic_fdls_learn_fcoe_macs(iport, rx_frame, fcid);
@@ -4531,11 +4518,9 @@ void fnic_fdls_disc_start(struct fnic_iport_s *iport)
{
struct fnic *fnic = iport->fnic;
- if (IS_FNIC_FCP_INITIATOR(fnic)) {
- fc_host_fabric_name(iport->fnic->host) = 0;
- fc_host_post_event(iport->fnic->host, fc_get_event_number(),
- FCH_EVT_LIPRESET, 0);
- }
+ fc_host_fabric_name(iport->fnic->host) = 0;
+ fc_host_post_event(iport->fnic->host, fc_get_event_number(),
+ FCH_EVT_LIPRESET, 0);
if (!iport->usefip) {
if (iport->flags & FNIC_FIRST_LINK_UP) {
@@ -4998,15 +4983,13 @@ void fnic_fdls_link_down(struct fnic_iport_s *iport)
fdls_set_state((&iport->fabric), FDLS_STATE_LINKDOWN);
iport->fabric.flags = 0;
- if (IS_FNIC_FCP_INITIATOR(fnic)) {
- spin_unlock_irqrestore(&fnic->fnic_lock, fnic->lock_flags);
- fnic_scsi_fcpio_reset(iport->fnic);
- spin_lock_irqsave(&fnic->fnic_lock, fnic->lock_flags);
- list_for_each_entry_safe(tport, next, &iport->tport_list, links) {
- FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
- "removing rport: 0x%x", tport->fcid);
- fdls_delete_tport(iport, tport);
- }
+ spin_unlock_irqrestore(&fnic->fnic_lock, fnic->lock_flags);
+ fnic_scsi_fcpio_reset(iport->fnic);
+ spin_lock_irqsave(&fnic->fnic_lock, fnic->lock_flags);
+ list_for_each_entry_safe(tport, next, &iport->tport_list, links) {
+ FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
+ "removing rport: 0x%x", tport->fcid);
+ fdls_delete_tport(iport, tport);
}
if ((fnic_fdmi_support == 1) && (iport->fabric.fdmi_pending > 0)) {
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 0feea9557934..6c5f6046b1f5 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -80,8 +80,6 @@
#define FNIC_DEV_RST_TERM_DONE BIT(20)
#define FNIC_DEV_RST_ABTS_PENDING BIT(21)
-#define IS_FNIC_FCP_INITIATOR(fnic) (fnic->role == FNIC_ROLE_FCP_INITIATOR)
-
#define FNIC_FW_RESET_TIMEOUT 60000 /* mSec */
#define FNIC_FCOE_MAX_CMD_LEN 16
/* Retry supported by rport (returned by PRLI service parameters) */
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 127aabedd90c..b5dca8e7e2e4 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -1031,7 +1031,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fnic_fdls_init(fnic, (fnic->config.flags & VFCF_FIP_CAPABLE));
- if (IS_FNIC_FCP_INITIATOR(fnic) && fnic_scsi_drv_init(fnic))
+ if (fnic_scsi_drv_init(fnic))
goto err_out_scsi_drv_init;
err = fnic_stats_debugfs_init(fnic);
@@ -1075,8 +1075,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_fnic_alloc_vnic_res:
fnic_clear_intr_mode(fnic);
err_out_fnic_set_intr_mode:
- if (IS_FNIC_FCP_INITIATOR(fnic))
- scsi_host_put(fnic->host);
+ scsi_host_put(fnic->host);
err_out_fnic_role:
err_out_scsi_host_alloc:
err_out_fnic_get_config:
@@ -1125,8 +1124,7 @@ static void fnic_remove(struct pci_dev *pdev)
*/
flush_workqueue(fnic_event_queue);
- if (IS_FNIC_FCP_INITIATOR(fnic))
- fnic_scsi_unload(fnic);
+ fnic_scsi_unload(fnic);
if (vnic_dev_get_intr_mode(fnic->vdev) == VNIC_DEV_INTR_MODE_MSI)
del_timer_sync(&fnic->notify_timer);
@@ -1171,10 +1169,8 @@ static void fnic_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
ida_free(&fnic_ida, fnic->fnic_num);
- if (IS_FNIC_FCP_INITIATOR(fnic)) {
- fnic_scsi_unload_cleanup(fnic);
- scsi_host_put(fnic->host);
- }
+ fnic_scsi_unload_cleanup(fnic);
+ scsi_host_put(fnic->host);
kfree(fnic);
}
--
2.47.1
Powered by blists - more mailing lists