From: Rosen Penev <rosenp@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: Saurav Kashyap <skashyap@marvell.com>,
Javed Hasan <jhasan@marvell.com>,
GR-QLogic-Storage-Upstream@marvell.com (maintainer:BROADCOM
BNX2FC 10 GIGABIT FCOE DRIVER),
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 3/3] scsi: bnx2fc: tgt_ofld_list to FAM
Date: Thu, 30 Apr 2026 14:02:45 -0700 [thread overview]
Message-ID: <20260430210245.29840-4-rosenp@gmail.com> (raw)
In-Reply-To: <20260430210245.29840-1-rosenp@gmail.com>
Simplify allocation slightly by allocating tgt_ofld_list with hba. No
need to kfree separately.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/scsi/bnx2fc/bnx2fc.h | 6 +++---
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 14 ++------------
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 9a5de1048542..31bb701cc5ea 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -224,9 +224,6 @@ struct bnx2fc_hba {
char *dummy_buffer;
dma_addr_t dummy_buf_dma;
- /* Active list of offloaded sessions */
- struct bnx2fc_rport **tgt_ofld_list;
-
/* statistics */
struct bnx2fc_fw_stats bfw_stats;
struct fcoe_statistics_params prev_stats;
@@ -246,6 +243,9 @@ struct bnx2fc_hba {
struct list_head vports;
char chip_num[BCM_CHIP_LEN];
+
+ /* Active list of offloaded sessions */
+ struct bnx2fc_rport *tgt_ofld_list[];
};
struct bnx2fc_interface {
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 26e0ff380860..7e740ac6bf1b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1337,7 +1337,6 @@ static void bnx2fc_hba_destroy(struct bnx2fc_hba *hba)
bnx2fc_cmd_mgr_free(hba->cmd_mgr);
hba->cmd_mgr = NULL;
}
- kfree(hba->tgt_ofld_list);
bnx2fc_unbind_pcidev(hba);
kfree(hba);
}
@@ -1356,7 +1355,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic)
struct fcoe_capabilities *fcoe_cap;
int rc;
- hba = kzalloc_obj(*hba);
+ hba = kzalloc_flex(*hba, tgt_ofld_list, BNX2FC_NUM_MAX_SESS);
if (!hba) {
printk(KERN_ERR PFX "Unable to allocate hba structure\n");
return NULL;
@@ -1380,19 +1379,12 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic)
hba->phys_dev = cnic->netdev;
hba->next_conn_id = 0;
- hba->tgt_ofld_list =
- kzalloc_objs(struct bnx2fc_rport *, BNX2FC_NUM_MAX_SESS);
- if (!hba->tgt_ofld_list) {
- printk(KERN_ERR PFX "Unable to allocate tgt offload list\n");
- goto tgtofld_err;
- }
-
hba->num_ofld_sess = 0;
hba->cmd_mgr = bnx2fc_cmd_mgr_alloc(hba);
if (!hba->cmd_mgr) {
printk(KERN_ERR PFX "em_config:bnx2fc_cmd_mgr_alloc failed\n");
- goto cmgr_err;
+ goto tgtofld_err;
}
fcoe_cap = &hba->fcoe_cap;
@@ -1416,8 +1408,6 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic)
return hba;
-cmgr_err:
- kfree(hba->tgt_ofld_list);
tgtofld_err:
bnx2fc_unbind_pcidev(hba);
bind_err:
--
2.54.0
prev parent reply other threads:[~2026-04-30 21:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 21:02 [PATCH 0/3] scsi: bnx2fc: simplify allocation Rosen Penev
2026-04-30 21:02 ` [PATCH 1/3] scsi: bnx2fc: simplify allocation of cmgr Rosen Penev
2026-04-30 21:02 ` [PATCH 2/3] scsi: bnx2fc: no double pointer for io_bdt_pool Rosen Penev
2026-04-30 21:02 ` Rosen Penev [this message]
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=20260430210245.29840-4-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jhasan@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=skashyap@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