From: Roopa Prabhu <roprabhu@cisco.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [net-next-2.6 PATCH 2/7] enic: Add support for firmware management device
Date: Tue, 10 Aug 2010 21:55:00 -0700 [thread overview]
Message-ID: <20100811045500.3877.42493.stgit@savbu-pc100.cisco.com> (raw)
In-Reply-To: <20100811045436.3877.51650.stgit@savbu-pc100.cisco.com>
From: Roopa Prabhu <roprabhu@cisco.com>
This patch adds support for firmware management device in enic driver.
A management device is a virtual PCIe device that firmware can present
to the host as its management endpoint. It provides the interface between
the host and adapter firmware for all management operations.
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
---
drivers/net/enic/vnic_dev.c | 25 ++++++++++++++++++-------
drivers/net/enic/vnic_resource.h | 13 +++++++++++++
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
index 6a5b578..08d5d42 100644
--- a/drivers/net/enic/vnic_dev.c
+++ b/drivers/net/enic/vnic_dev.c
@@ -74,6 +74,7 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
struct vnic_dev_bar *bar, unsigned int num_bars)
{
struct vnic_resource_header __iomem *rh;
+ struct mgmt_barmap_hdr __iomem *mrh;
struct vnic_resource __iomem *r;
u8 type;
@@ -85,22 +86,32 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
return -EINVAL;
}
- rh = bar->vaddr;
+ rh = bar->vaddr;
+ mrh = bar->vaddr;
if (!rh) {
pr_err("vNIC BAR0 res hdr not mem-mapped\n");
return -EINVAL;
}
- if (ioread32(&rh->magic) != VNIC_RES_MAGIC ||
- ioread32(&rh->version) != VNIC_RES_VERSION) {
- pr_err("vNIC BAR0 res magic/version error "
- "exp (%lx/%lx) curr (%x/%x)\n",
+ /* Check for mgmt vnic in addition to normal vnic */
+ if ((ioread32(&rh->magic) != VNIC_RES_MAGIC) ||
+ (ioread32(&rh->version) != VNIC_RES_VERSION)) {
+ if ((ioread32(&mrh->magic) != MGMTVNIC_MAGIC) ||
+ (ioread32(&mrh->version) != MGMTVNIC_VERSION)) {
+ pr_err("vNIC BAR0 res magic/version error "
+ "exp (%lx/%lx) or (%lx/%lx), curr (%x/%x)\n",
VNIC_RES_MAGIC, VNIC_RES_VERSION,
+ MGMTVNIC_MAGIC, MGMTVNIC_VERSION,
ioread32(&rh->magic), ioread32(&rh->version));
- return -EINVAL;
+ return -EINVAL;
+ }
}
- r = (struct vnic_resource __iomem *)(rh + 1);
+ if (ioread32(&mrh->magic) == MGMTVNIC_MAGIC)
+ r = (struct vnic_resource __iomem *)(mrh + 1);
+ else
+ r = (struct vnic_resource __iomem *)(rh + 1);
+
while ((type = ioread8(&r->type)) != RES_TYPE_EOL) {
diff --git a/drivers/net/enic/vnic_resource.h b/drivers/net/enic/vnic_resource.h
index 810287b..e0a73f1 100644
--- a/drivers/net/enic/vnic_resource.h
+++ b/drivers/net/enic/vnic_resource.h
@@ -22,6 +22,11 @@
#define VNIC_RES_MAGIC 0x766E6963L /* 'vnic' */
#define VNIC_RES_VERSION 0x00000000L
+#define MGMTVNIC_MAGIC 0x544d474dL /* 'MGMT' */
+#define MGMTVNIC_VERSION 0x00000000L
+
+/* The MAC address assigned to the CFG vNIC is fixed. */
+#define MGMTVNIC_MAC { 0x02, 0x00, 0x54, 0x4d, 0x47, 0x4d }
/* vNIC resource types */
enum vnic_res_type {
@@ -52,6 +57,14 @@ struct vnic_resource_header {
u32 version;
};
+struct mgmt_barmap_hdr {
+ u32 magic; /* magic number */
+ u32 version; /* header format version */
+ u16 lif; /* loopback lif for mgmt frames */
+ u16 pci_slot; /* installed pci slot */
+ char serial[16]; /* card serial number */
+};
+
struct vnic_resource {
u8 type;
u8 bar;
next prev parent reply other threads:[~2010-08-11 4:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
2010-08-11 4:54 ` [net-next-2.6 PATCH 1/7] enic: Add set mac address Roopa Prabhu
2010-08-11 4:55 ` Roopa Prabhu [this message]
2010-08-11 4:55 ` [net-next-2.6 PATCH 3/7] enic: Add new firmware devcmds Roopa Prabhu
2010-08-11 4:55 ` [net-next-2.6 PATCH 4/7] enic: Use offsetof macro in vic tlv length calculation Roopa Prabhu
2010-08-11 4:55 ` [net-next-2.6 PATCH 5/7] enic: Clean up: remove enic_dev_stats_clear Roopa Prabhu
2010-08-11 4:55 ` [net-next-2.6 PATCH 6/7] enic: Check if rq/wq buf not NULL before freeing them Roopa Prabhu
2010-08-11 4:55 ` [net-next-2.6 PATCH 7/7] enic: Mark intr_timer in vnic_enet_config as deprecated Roopa Prabhu
2010-08-17 9:35 ` [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 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=20100811045500.3877.42493.stgit@savbu-pc100.cisco.com \
--to=roprabhu@cisco.com \
--cc=davem@davemloft.net \
--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