From: "Dmitry Kravkov" <dmitry@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: "Dmitry Kravkov" <dmitry@broadcom.com>,
"Eilon Greenstein" <eilong@broadcom.com>
Subject: [PATCH v3 net-next 04/12] bnx2x: separate FCoE and iSCSI license initialization.
Date: Sun, 13 Nov 2011 16:34:24 +0200 [thread overview]
Message-ID: <1321194872-8276-5-git-send-email-dmitry@broadcom.com> (raw)
In-Reply-To: <1321194872-8276-1-git-send-email-dmitry@broadcom.com>
FCoE license info must be initialized at probe(), but
iSCSI at open().
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 10 +++++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 45 ++++++++++++++++-----
3 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f946a6e..3f80c11 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -1934,6 +1934,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
mod_timer(&bp->timer, jiffies + bp->current_interval);
#ifdef BCM_CNIC
+ /* re-read iscsi info */
+ bnx2x_get_iscsi_info(bp);
bnx2x_setup_cnic_irq_info(bp);
if (bp->state == BNX2X_STATE_OPEN)
bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 4a16757..c1d7833 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -1489,4 +1489,14 @@ static inline u16 bnx2x_extract_max_cfg(struct bnx2x *bp, u32 mf_cfg)
return max_cfg;
}
+#ifdef BCM_CNIC
+/**
+ * bnx2x_get_iscsi_info - update iSCSI params according to licensing info.
+ *
+ * @bp: driver handle
+ *
+ */
+void bnx2x_get_iscsi_info(struct bnx2x *bp);
+#endif
+
#endif /* BNX2X_CMN_H */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 1d185f2..26dc539 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9268,21 +9268,38 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
}
#ifdef BCM_CNIC
-static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
+void bnx2x_get_iscsi_info(struct bnx2x *bp)
{
int port = BP_PORT(bp);
- int func = BP_ABS_FUNC(bp);
u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
drv_lic_key[port].max_iscsi_conn);
- u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
- drv_lic_key[port].max_fcoe_conn);
- /* Get the number of maximum allowed iSCSI and FCoE connections */
+ /* Get the number of maximum allowed iSCSI connections */
bp->cnic_eth_dev.max_iscsi_conn =
(max_iscsi_conn & BNX2X_MAX_ISCSI_INIT_CONN_MASK) >>
BNX2X_MAX_ISCSI_INIT_CONN_SHIFT;
+ BNX2X_DEV_INFO("max_iscsi_conn 0x%x\n",
+ bp->cnic_eth_dev.max_iscsi_conn);
+
+ /*
+ * If maximum allowed number of connections is zero -
+ * disable the feature.
+ */
+ if (!bp->cnic_eth_dev.max_iscsi_conn)
+ bp->flags |= NO_ISCSI_FLAG;
+}
+
+static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp)
+{
+ int port = BP_PORT(bp);
+ int func = BP_ABS_FUNC(bp);
+
+ u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
+ drv_lic_key[port].max_fcoe_conn);
+
+ /* Get the number of maximum allowed FCoE connections */
bp->cnic_eth_dev.max_fcoe_conn =
(max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >>
BNX2X_MAX_FCOE_INIT_CONN_SHIFT;
@@ -9334,20 +9351,26 @@ static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
}
}
- BNX2X_DEV_INFO("max_iscsi_conn 0x%x max_fcoe_conn 0x%x\n",
- bp->cnic_eth_dev.max_iscsi_conn,
- bp->cnic_eth_dev.max_fcoe_conn);
+ BNX2X_DEV_INFO("max_fcoe_conn 0x%x\n", bp->cnic_eth_dev.max_fcoe_conn);
/*
* If maximum allowed number of connections is zero -
* disable the feature.
*/
- if (!bp->cnic_eth_dev.max_iscsi_conn)
- bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;
-
if (!bp->cnic_eth_dev.max_fcoe_conn)
bp->flags |= NO_FCOE_FLAG;
}
+
+static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
+{
+ /*
+ * iSCSI may be dynamically disabled but reading
+ * info here we will decrease memory usage by driver
+ * if the feature is disabled for good
+ */
+ bnx2x_get_iscsi_info(bp);
+ bnx2x_get_fcoe_info(bp);
+}
#endif
static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
--
1.7.7.2
next prev parent reply other threads:[~2011-11-13 14:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-13 14:34 [PATCH v3 net-next 00/12] bnx2x series Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 01/12] bnx2x: allow FCoE and DCB for 578xx Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 02/12] bnx2x: use rx_queue index for skb_record_rx_queue() Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 03/12] bnx2x: remove unused variable Dmitry Kravkov
2011-11-13 14:34 ` Dmitry Kravkov [this message]
2011-11-13 14:34 ` [PATCH v3 net-next 05/12] bnx2x: propagate DCBX negotiation Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 06/12] bnx2x: DCBX: use #define instead of magic Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 07/12] bnx2x: simplify definition of RX_SGE_MASK_LEN and use it Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 08/12] bnx2x: remove unused #define Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 09/12] bnx2x: add fan failure event handling Dmitry Kravkov
2011-11-13 21:11 ` Joe Perches
[not found] ` <80A6ED01A151614884EE6C5D6AF0F2E9099806AF42@SJEXCHCCR01.corp.ad.broadcom.com>
2011-11-14 8:28 ` Dmitry Kravkov
2011-11-14 8:37 ` David Miller
2011-11-13 14:34 ` [PATCH v3 net-next 10/12] bnx2x: prevent race in statistics flow Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 11/12] bnx2x: Remove on-stack napi struct variable Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 12/12] bnx2x: update driver version to 1.70.35-0 Dmitry Kravkov
2011-11-13 21:06 ` [PATCH v3 net-next 00/12] bnx2x series David Miller
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=1321194872-8276-5-git-send-email-dmitry@broadcom.com \
--to=dmitry@broadcom.com \
--cc=davem@davemloft.net \
--cc=eilong@broadcom.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).