Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213805
b: refs/heads/master
c: 90cf0b5
h: refs/heads/master
i:
  213803: ec0da4e
v: v3
  • Loading branch information
Roopa Prabhu authored and David S. Miller committed Aug 17, 2010
1 parent 209a19b commit 913a3b2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 294dab25e7068f9df80af53aceed332f9621c970
refs/heads/master: 90cf0b53d74ebca4f62d865ae39d21ed3bdbf877
25 changes: 18 additions & 7 deletions trunk/drivers/net/enic/vnic_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {

Expand Down
13 changes: 13 additions & 0 deletions trunk/drivers/net/enic/vnic_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 913a3b2

Please sign in to comment.