* [net-next-2.6 PATCH 1/7] enic: Add set mac address
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 ` Roopa Prabhu
2010-08-11 4:55 ` [net-next-2.6 PATCH 2/7] enic: Add support for firmware management device Roopa Prabhu
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:54 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
This patch implements the ndo_set_mac_address netdev operation for an enic device
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/enic.h | 2 +-
drivers/net/enic/enic_main.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index f239aa8..75869ed 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -32,7 +32,7 @@
#define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION "1.4.1.1"
+#define DRV_VERSION "1.4.1.2"
#define DRV_COPYRIGHT "Copyright 2008-2010 Cisco Systems, Inc"
#define ENIC_BARS_MAX 6
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 77a7f87..07aa033 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -911,7 +911,9 @@ static int enic_set_mac_address_dynamic(struct net_device *netdev, void *p)
static int enic_set_mac_address(struct net_device *netdev, void *p)
{
- return -EOPNOTSUPP;
+ struct sockaddr *saddr = p;
+
+ return enic_set_mac_addr(netdev, (char *)saddr->sa_data);
}
static int enic_dev_packet_filter(struct enic *enic, int directed,
^ permalink raw reply related [flat|nested] 9+ messages in thread* [net-next-2.6 PATCH 2/7] enic: Add support for firmware management device
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
2010-08-11 4:55 ` [net-next-2.6 PATCH 3/7] enic: Add new firmware devcmds Roopa Prabhu
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:55 UTC (permalink / raw)
To: davem; +Cc: netdev
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;
^ permalink raw reply related [flat|nested] 9+ messages in thread* [net-next-2.6 PATCH 3/7] enic: Add new firmware devcmds
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 ` [net-next-2.6 PATCH 2/7] enic: Add support for firmware management device Roopa Prabhu
@ 2010-08-11 4:55 ` 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
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:55 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
Add new firmware devcmds: CMD_PROXY_BY_INDEX, CMD_CONFIG_INFO_GET
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_devcmd.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/net/enic/vnic_devcmd.h b/drivers/net/enic/vnic_devcmd.h
index 2066175..9abb3d5 100644
--- a/drivers/net/enic/vnic_devcmd.h
+++ b/drivers/net/enic/vnic_devcmd.h
@@ -238,6 +238,18 @@ enum vnic_devcmd_cmd {
* out: (u32)a0=status of proxied cmd
* a1-a15=out args of proxied cmd */
CMD_PROXY_BY_BDF = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 42),
+
+ /*
+ * As for BY_BDF except a0 is index of hvnlink subordinate vnic
+ * or SR-IOV virtual vnic */
+ CMD_PROXY_BY_INDEX = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43),
+
+ /*
+ * in: (u64)a0=paddr of buffer to put latest VIC VIF-CONFIG-INFO TLV in
+ * (u32)a1=length of buffer in a0
+ * out: (u64)a0=paddr of buffer with latest VIC VIF-CONFIG-INFO TLV
+ * (u32)a1=actual length of latest VIC VIF-CONFIG-INFO TLV */
+ CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44),
};
/* flags for CMD_OPEN */
^ permalink raw reply related [flat|nested] 9+ messages in thread* [net-next-2.6 PATCH 4/7] enic: Use offsetof macro in vic tlv length calculation
2010-08-11 4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
` (2 preceding siblings ...)
2010-08-11 4:55 ` [net-next-2.6 PATCH 3/7] enic: Add new firmware devcmds Roopa Prabhu
@ 2010-08-11 4:55 ` Roopa Prabhu
2010-08-11 4:55 ` [net-next-2.6 PATCH 5/7] enic: Clean up: remove enic_dev_stats_clear Roopa Prabhu
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:55 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
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_vic.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c
index 197c9d2..4725b79 100644
--- a/drivers/net/enic/vnic_vic.c
+++ b/drivers/net/enic/vnic_vic.c
@@ -54,8 +54,8 @@ int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
if (!vp || !value)
return -EINVAL;
- if (ntohl(vp->length) + sizeof(*tlv) + length >
- VIC_PROVINFO_MAX_TLV_DATA)
+ if (ntohl(vp->length) + offsetof(struct vic_provinfo_tlv, value) +
+ length > VIC_PROVINFO_MAX_TLV_DATA)
return -ENOMEM;
tlv = (struct vic_provinfo_tlv *)((u8 *)vp->tlv +
@@ -66,7 +66,8 @@ int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
memcpy(tlv->value, value, length);
vp->num_tlvs = htonl(ntohl(vp->num_tlvs) + 1);
- vp->length = htonl(ntohl(vp->length) + sizeof(*tlv) + length);
+ vp->length = htonl(ntohl(vp->length) +
+ offsetof(struct vic_provinfo_tlv, value) + length);
return 0;
}
^ permalink raw reply related [flat|nested] 9+ messages in thread* [net-next-2.6 PATCH 5/7] enic: Clean up: remove enic_dev_stats_clear
2010-08-11 4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
` (3 preceding siblings ...)
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 ` 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
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:55 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
Remove function enic_dev_stats_clear and its reference in enic device
init code. Firmware clears device stats on device open. So, no need for
the driver to do it again.
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/enic_main.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 07aa033..d08f362 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -2167,17 +2167,6 @@ void enic_dev_deinit(struct enic *enic)
enic_clear_intr_mode(enic);
}
-static int enic_dev_stats_clear(struct enic *enic)
-{
- int err;
-
- spin_lock(&enic->devcmd_lock);
- err = vnic_dev_stats_clear(enic->vdev);
- spin_unlock(&enic->devcmd_lock);
-
- return err;
-}
-
int enic_dev_init(struct enic *enic)
{
struct device *dev = enic_get_dev(enic);
@@ -2220,10 +2209,6 @@ int enic_dev_init(struct enic *enic)
enic_init_vnic_resources(enic);
- /* Clear LIF stats
- */
- enic_dev_stats_clear(enic);
-
err = enic_set_rq_alloc_buf(enic);
if (err) {
dev_err(dev, "Failed to set RQ buffer allocator, aborting\n");
^ permalink raw reply related [flat|nested] 9+ messages in thread* [net-next-2.6 PATCH 6/7] enic: Check if rq/wq buf not NULL before freeing them
2010-08-11 4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
` (4 preceding siblings ...)
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 ` 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
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:55 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
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_rq.c | 6 ++++--
drivers/net/enic/vnic_wq.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/enic/vnic_rq.c b/drivers/net/enic/vnic_rq.c
index dbb2aca..b236d7c 100644
--- a/drivers/net/enic/vnic_rq.c
+++ b/drivers/net/enic/vnic_rq.c
@@ -77,8 +77,10 @@ void vnic_rq_free(struct vnic_rq *rq)
vnic_dev_free_desc_ring(vdev, &rq->ring);
for (i = 0; i < VNIC_RQ_BUF_BLKS_MAX; i++) {
- kfree(rq->bufs[i]);
- rq->bufs[i] = NULL;
+ if (rq->bufs[i]) {
+ kfree(rq->bufs[i]);
+ rq->bufs[i] = NULL;
+ }
}
rq->ctrl = NULL;
diff --git a/drivers/net/enic/vnic_wq.c b/drivers/net/enic/vnic_wq.c
index 122e33b..4b2a6c6 100644
--- a/drivers/net/enic/vnic_wq.c
+++ b/drivers/net/enic/vnic_wq.c
@@ -77,8 +77,10 @@ void vnic_wq_free(struct vnic_wq *wq)
vnic_dev_free_desc_ring(vdev, &wq->ring);
for (i = 0; i < VNIC_WQ_BUF_BLKS_MAX; i++) {
- kfree(wq->bufs[i]);
- wq->bufs[i] = NULL;
+ if (wq->bufs[i]) {
+ kfree(wq->bufs[i]);
+ wq->bufs[i] = NULL;
+ }
}
wq->ctrl = NULL;
^ permalink raw reply related [flat|nested] 9+ messages in thread* [net-next-2.6 PATCH 7/7] enic: Mark intr_timer in vnic_enet_config as deprecated
2010-08-11 4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
` (5 preceding siblings ...)
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 ` Roopa Prabhu
2010-08-17 9:35 ` [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 David Miller
7 siblings, 0 replies; 9+ messages in thread
From: Roopa Prabhu @ 2010-08-11 4:55 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
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_enet.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/enic/vnic_enet.h b/drivers/net/enic/vnic_enet.h
index 3b32912..e8740e3 100644
--- a/drivers/net/enic/vnic_enet.h
+++ b/drivers/net/enic/vnic_enet.h
@@ -30,7 +30,7 @@ struct vnic_enet_config {
u32 wq_desc_count;
u32 rq_desc_count;
u16 mtu;
- u16 intr_timer;
+ u16 intr_timer_deprecated;
u8 intr_timer_type;
u8 intr_mode;
char devname[16];
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2
2010-08-11 4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
` (6 preceding siblings ...)
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 ` David Miller
7 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2010-08-17 9:35 UTC (permalink / raw)
To: roprabhu; +Cc: netdev
From: Roopa Prabhu <roprabhu@cisco.com>
Date: Tue, 10 Aug 2010 21:54:50 -0700
> This patch series implements the following enic driver updates:
>
> 01/7 - Add set mac address
> 02/7 - Add support for firmware management device
> 03/7 - Add new firmware devcmds
> 04/7 - Use offsetof macro in vic tlv length calculation
> 05/7 - Clean up: remove enic_dev_stats_clear
> 06/7 - Check if rq/wq buf not NULL before freeing them
> 07/7 - Mark intr_timer in vnic_enet_config as deprecated
>
>
> Signed-off-by: Scott Feldman <scofeldm@cisco.com>
> Signed-off-by: Roopa Prabhu<roprabhu@cisco.com>
> Signed-off-by: Vasanthy Kolluri<vkolluri@cisco.com>
All applied, thank you.
^ permalink raw reply [flat|nested] 9+ messages in thread