netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rasesh Mody <rmody@brocade.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <adapter_linux_open_src_team@brocade.com>, <dradovan@brocade.com>,
	Rasesh Mody <rmody@brocade.com>
Subject: [PATCH 37/45] bna: Adpater and Port Mode Settings
Date: Mon, 18 Jul 2011 01:22:57 -0700	[thread overview]
Message-ID: <1310977385-5268-27-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1310977385-5268-1-git-send-email-rmody@brocade.com>

Change details:
  - Cache the port mode (active and configured) and capability info in
    bfa_ioc_attr eliminating need to go to fw. This info will be initialize
    to their default value during pci init time, and will be update during
    ioc enable reply time and port mode change reply time.

Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/bna/bfa_defs.h |   25 +++++++++++++++++++++++--
 drivers/net/bna/bfa_ioc.c  |   35 ++++++++++++++++++++++++++++++++++-
 drivers/net/bna/bfa_ioc.h  |    3 +++
 drivers/net/bna/bfi.h      |    6 ++++--
 4 files changed, 64 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bna/bfa_defs.h b/drivers/net/bna/bfa_defs.h
index 3e5d096..ebe5e6c 100644
--- a/drivers/net/bna/bfa_defs.h
+++ b/drivers/net/bna/bfa_defs.h
@@ -180,8 +180,23 @@ struct bfa_ioc_attr {
 	struct bfa_adapter_attr adapter_attr;	/*!< HBA attributes */
 	struct bfa_ioc_driver_attr driver_attr;	/*!< driver attr    */
 	struct bfa_ioc_pci_attr pci_attr;
-	u8				port_id;	/*!< port number    */
-	u8				rsvd[7];	/*!< 64bit align    */
+	u8				port_id;	/*!< port number */
+	u8				port_mode;	/*!< enum bfa_mode */
+	u8				cap_bm;		/*!< capability */
+	u8				port_mode_cfg;	/*!< enum bfa_mode */
+	u8				rsvd[4];	/*!< 64bit align */
+};
+
+/**
+ * Adapter capability mask definition
+ */
+enum {
+	BFA_CM_HBA	=	0x01,
+	BFA_CM_CNA	=	0x02,
+	BFA_CM_NIC	=	0x04,
+	BFA_CM_FC16G	=	0x08,
+	BFA_CM_SRIOV	=	0x10,
+	BFA_CM_MEZZ	=	0x20,
 };
 
 /**
@@ -271,4 +286,10 @@ enum {
 	BFA_PCI_CT2_SSID_FC		= 0x24,
 };
 
+enum bfa_mode {
+	BFA_MODE_HBA		= 1,
+	BFA_MODE_CNA		= 2,
+	BFA_MODE_NIC		= 3
+};
+
 #endif /* __BFA_DEFS_H__ */
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c
index d35b91b..6e17abd 100644
--- a/drivers/net/bna/bfa_ioc.c
+++ b/drivers/net/bna/bfa_ioc.c
@@ -1706,6 +1706,20 @@ bfa_ioc_reset(struct bfa_ioc *ioc, bool force)
 }
 
 /**
+ * BFA ioc enable reply by firmware
+ */
+static void
+bfa_ioc_enable_reply(struct bfa_ioc *ioc, enum bfa_mode port_mode,
+			u8 cap_bm)
+{
+	struct bfa_iocpf *iocpf = &ioc->iocpf;
+
+	ioc->port_mode = ioc->port_mode_cfg = port_mode;
+	ioc->ad_cap_bm = cap_bm;
+	bfa_fsm_send_event(iocpf, IOCPF_E_FWRSP_ENABLE);
+}
+
+/**
  * @brief
  * Update BFA configuration from firmware configuration.
  */
@@ -1937,7 +1951,9 @@ bfa_ioc_isr(struct bfa_ioc *ioc, struct bfi_mbmsg *m)
 		break;
 
 	case BFI_IOC_I2H_ENABLE_REPLY:
-		bfa_fsm_send_event(iocpf, IOCPF_E_FWRSP_ENABLE);
+		bfa_ioc_enable_reply(ioc,
+			(enum bfa_mode)msg->fw_event.port_mode,
+			(enum bfa_mode)msg->fw_event.cap_bm);
 		break;
 
 	case BFI_IOC_I2H_DISABLE_REPLY:
@@ -2012,6 +2028,8 @@ bfa_nw_ioc_pci_init(struct bfa_ioc *ioc, struct bfa_pcidev *pcidev,
 		ioc->asic_gen = BFI_ASIC_GEN_CT;
 		ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH;
 		ioc->asic_mode  = BFI_ASIC_MODE_ETH;
+		ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_CNA;
+		ioc->ad_cap_bm = BFA_CM_CNA;
 		break;
 
 	case BFA_PCI_DEVICE_ID_CT2:
@@ -2020,9 +2038,20 @@ bfa_nw_ioc_pci_init(struct bfa_ioc *ioc, struct bfa_pcidev *pcidev,
 			pcidev->ssid == BFA_PCI_CT2_SSID_FC) {
 			ioc->asic_mode  = BFI_ASIC_MODE_FC16;
 			ioc->fcmode = true;
+			ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA;
+			ioc->ad_cap_bm = BFA_CM_HBA;
 		} else {
 			ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH;
 			ioc->asic_mode  = BFI_ASIC_MODE_ETH;
+			if (pcidev->ssid == BFA_PCI_CT2_SSID_FCoE) {
+				ioc->port_mode =
+				ioc->port_mode_cfg = BFA_MODE_CNA;
+				ioc->ad_cap_bm = BFA_CM_CNA;
+			} else {
+				ioc->port_mode =
+				ioc->port_mode_cfg = BFA_MODE_NIC;
+				ioc->ad_cap_bm = BFA_CM_NIC;
+			}
 		}
 		break;
 
@@ -2382,6 +2411,10 @@ bfa_nw_ioc_get_attr(struct bfa_ioc *ioc, struct bfa_ioc_attr *ioc_attr)
 
 	ioc_attr->state = bfa_ioc_get_state(ioc);
 	ioc_attr->port_id = ioc->port_id;
+	ioc_attr->port_mode = ioc->port_mode;
+
+	ioc_attr->port_mode_cfg = ioc->port_mode_cfg;
+	ioc_attr->cap_bm = ioc->ad_cap_bm;
 
 	ioc_attr->ioc_type = bfa_nw_ioc_get_type(ioc);
 
diff --git a/drivers/net/bna/bfa_ioc.h b/drivers/net/bna/bfa_ioc.h
index 0f7dba1..9ae201a 100644
--- a/drivers/net/bna/bfa_ioc.h
+++ b/drivers/net/bna/bfa_ioc.h
@@ -208,6 +208,9 @@ struct bfa_ioc {
 	enum bfi_asic_mode	asic_mode;
 	enum bfi_port_mode	port0_mode;
 	enum bfi_port_mode	port1_mode;
+	enum bfa_mode		port_mode;
+	u8			ad_cap_bm;	/*!< adapter cap bit mask */
+	u8			port_mode_cfg;	/*!< config port mode */
 };
 
 struct bfa_ioc_hwif {
diff --git a/drivers/net/bna/bfi.h b/drivers/net/bna/bfi.h
index d422857..c534318 100644
--- a/drivers/net/bna/bfi.h
+++ b/drivers/net/bna/bfi.h
@@ -398,9 +398,11 @@ struct bfi_ioc_ctrl_req {
  * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
  */
 struct bfi_ioc_ctrl_reply {
-	struct bfi_mhdr mh;		/*!< Common msg header     */
+	struct bfi_mhdr mh;			/*!< Common msg header     */
 	u8			status;		/*!< enable/disable status */
-	u8			rsvd[3];
+	u8			port_mode;	/*!< bfa_mode */
+	u8			cap_bm;		/*!< capability bit mask */
+	u8			rsvd;
 };
 
 #define BFI_IOC_MSGSZ   8
-- 
1.7.1


  parent reply	other threads:[~2011-07-18  8:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18  8:22 [PATCH 11/45] bna: Brocade-1860 Fabric Adapter Enablement Rasesh Mody
2011-07-18  8:22 ` [PATCH 12/45] bna: Hardware Clock Setup Rasesh Mody
2011-07-18  8:22 ` [PATCH 13/45] bna: IOC PLL changes and init cleanup Rasesh Mody
2011-07-18  8:22 ` [PATCH 14/45] bna: Brocade 1860 Register and ASIC Mode Changes Rasesh Mody
2011-07-18  8:22 ` [PATCH 15/45] bna: Set MBOX MSIX Index to Zero Rasesh Mody
2011-07-18  8:22 ` [PATCH 16/45] bna: IOC PCI Init & Enable Changes Rasesh Mody
2011-07-18  8:22 ` [PATCH 17/45] bna: Mailbox Interface Changes and FW MBOX fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 18/45] bna: Implement Polling Mechanism for FW Ready Rasesh Mody
2011-07-18  8:22 ` [PATCH 19/45] bna: HW Type Check Fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 20/45] bna: MBOX IRQ Sync Vector Num Fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 21/45] bna: Remove Reset Call Back Rasesh Mody
2011-07-18  8:22 ` [PATCH 22/45] bna: Capability Map and MFG Block Changes for New HW Rasesh Mody
2011-07-18  8:22 ` [PATCH 23/45] bna: Added Defines for Multi TXQ Support Rasesh Mody
2011-07-18  8:22 ` [PATCH 24/45] bna: Mboxq Flush When Ioc Disabled Rasesh Mody
2011-07-18  8:22 ` [PATCH 25/45] bna: Move FW Init to HW Init and Disable Hang Unmapped Fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 26/45] bna: Ethfn LPU DMA Read Fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 27/45] bna: IOC Event Name Change Rasesh Mody
2011-07-18  8:22 ` [PATCH 28/45] bna: Add New IOC event Rasesh Mody
2011-07-18  8:22 ` [PATCH 29/45] bna: Add Sub-System Device ID Info Rasesh Mody
2011-07-18  8:22 ` [PATCH 30/45] bna: Add HW Semaphore Unlock Logic Rasesh Mody
2011-07-18  8:22 ` [PATCH 31/45] bna: Configuration changes Rasesh Mody
2011-07-18  8:22 ` [PATCH 32/45] bna: TxRx Coalesce Settings Fix and Reorg PCI Probe Failure Rasesh Mody
2011-07-18  8:22 ` [PATCH 33/45] bna: Device Init Fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 34/45] bna: Add Multiple Tx Queue Support Rasesh Mody
2011-07-18  8:22 ` [PATCH 35/45] bna: Change TxQ Select Logic and Interrupt Handling Rasesh Mody
2011-07-18  8:22 ` [PATCH 36/45] bna: Data Path and API Changes Rasesh Mody
2011-07-18  8:22 ` Rasesh Mody [this message]
2011-07-18  8:22 ` [PATCH 38/45] bna: HW Error Counter Fix Rasesh Mody
2011-07-18  8:22 ` [PATCH 39/45] bna: RX Path Changes Rasesh Mody
2011-07-18  8:23 ` [PATCH 40/45] bna: Add IOC MBOX Call Back to Client Rasesh Mody
2011-07-18  8:23 ` [PATCH 41/45] bna: Ethtool Ring Param Set changes and Add Stats Attr Rasesh Mody
2011-07-18  8:23 ` [PATCH 42/45] bna: PLL Init Fix and Add Stats Attributes Rasesh Mody
2011-07-18  8:23 ` [PATCH 43/45] bna: Dropped BUG_ONs and Rx id init fix Rasesh Mody
2011-07-18  8:23 ` [PATCH 44/45] bna: Header File and Unused Code Cleanup Rasesh Mody
2011-07-18  8:23 ` [PATCH 45/45] bna: Driver Version changed to 3.0.2.0 Rasesh Mody

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=1310977385-5268-27-git-send-email-rmody@brocade.com \
    --to=rmody@brocade.com \
    --cc=adapter_linux_open_src_team@brocade.com \
    --cc=davem@davemloft.net \
    --cc=dradovan@brocade.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).