diff options
author | Scott Feldman <scofeldm@cisco.com> | 2009-02-10 02:25:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-10 02:25:33 -0500 |
commit | 4cdc44a231f906a6ec586637e6e4c4c216679da4 (patch) | |
tree | 3c9e54e57c82d2286e6327a428b8d58526f3993d /drivers/net/enic | |
parent | 68f717089a62ee4c51933f4be43e4ef7b31539fd (diff) |
enic: Add api for link down count and to get firmware notification status.
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/enic')
-rw-r--r-- | drivers/net/enic/enic_main.c | 2 | ||||
-rw-r--r-- | drivers/net/enic/vnic_dev.c | 33 | ||||
-rw-r--r-- | drivers/net/enic/vnic_dev.h | 2 | ||||
-rw-r--r-- | drivers/net/enic/vnic_devcmd.h | 8 |
4 files changed, 38 insertions, 7 deletions
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 83a7168deee4..03403a51f7ea 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -1866,7 +1866,6 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
1866 | if (using_dac) | 1866 | if (using_dac) |
1867 | netdev->features |= NETIF_F_HIGHDMA; | 1867 | netdev->features |= NETIF_F_HIGHDMA; |
1868 | 1868 | ||
1869 | |||
1870 | enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM); | 1869 | enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM); |
1871 | 1870 | ||
1872 | enic->lro_mgr.max_aggr = ENIC_LRO_MAX_AGGR; | 1871 | enic->lro_mgr.max_aggr = ENIC_LRO_MAX_AGGR; |
@@ -1878,7 +1877,6 @@ static int __devinit enic_probe(struct pci_dev *pdev, | |||
1878 | enic->lro_mgr.ip_summed = CHECKSUM_COMPLETE; | 1877 | enic->lro_mgr.ip_summed = CHECKSUM_COMPLETE; |
1879 | enic->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY; | 1878 | enic->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY; |
1880 | 1879 | ||
1881 | |||
1882 | err = register_netdev(netdev); | 1880 | err = register_netdev(netdev); |
1883 | if (err) { | 1881 | if (err) { |
1884 | printk(KERN_ERR PFX | 1882 | printk(KERN_ERR PFX |
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c index 11708579b6ce..e21b9d636aec 100644 --- a/drivers/net/enic/vnic_dev.c +++ b/drivers/net/enic/vnic_dev.c | |||
@@ -34,6 +34,9 @@ struct vnic_res { | |||
34 | unsigned int count; | 34 | unsigned int count; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define VNIC_DEV_CAP_INIT 0x0001 | ||
38 | #define VNIC_DEV_CAP_PERBI 0x0002 | ||
39 | |||
37 | struct vnic_dev { | 40 | struct vnic_dev { |
38 | void *priv; | 41 | void *priv; |
39 | struct pci_dev *pdev; | 42 | struct pci_dev *pdev; |
@@ -50,6 +53,7 @@ struct vnic_dev { | |||
50 | dma_addr_t stats_pa; | 53 | dma_addr_t stats_pa; |
51 | struct vnic_devcmd_fw_info *fw_info; | 54 | struct vnic_devcmd_fw_info *fw_info; |
52 | dma_addr_t fw_info_pa; | 55 | dma_addr_t fw_info_pa; |
56 | u32 cap_flags; | ||
53 | }; | 57 | }; |
54 | 58 | ||
55 | #define VNIC_MAX_RES_HDR_SIZE \ | 59 | #define VNIC_MAX_RES_HDR_SIZE \ |
@@ -575,9 +579,9 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg) | |||
575 | { | 579 | { |
576 | u64 a0 = (u32)arg, a1 = 0; | 580 | u64 a0 = (u32)arg, a1 = 0; |
577 | int wait = 1000; | 581 | int wait = 1000; |
578 | int r = 0; | 582 | int r = 0; |
579 | 583 | ||
580 | if (vnic_dev_capable(vdev, CMD_INIT)) | 584 | if (vdev->cap_flags & VNIC_DEV_CAP_INIT) |
581 | r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait); | 585 | r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait); |
582 | else { | 586 | else { |
583 | vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait); | 587 | vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait); |
@@ -587,8 +591,8 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg) | |||
587 | vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); | 591 | vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); |
588 | vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); | 592 | vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); |
589 | } | 593 | } |
590 | } | 594 | } |
591 | return r; | 595 | return r; |
592 | } | 596 | } |
593 | 597 | ||
594 | int vnic_dev_link_status(struct vnic_dev *vdev) | 598 | int vnic_dev_link_status(struct vnic_dev *vdev) |
@@ -626,6 +630,22 @@ u32 vnic_dev_mtu(struct vnic_dev *vdev) | |||
626 | return vdev->notify_copy.mtu; | 630 | return vdev->notify_copy.mtu; |
627 | } | 631 | } |
628 | 632 | ||
633 | u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev) | ||
634 | { | ||
635 | if (!vnic_dev_notify_ready(vdev)) | ||
636 | return 0; | ||
637 | |||
638 | return vdev->notify_copy.link_down_cnt; | ||
639 | } | ||
640 | |||
641 | u32 vnic_dev_notify_status(struct vnic_dev *vdev) | ||
642 | { | ||
643 | if (!vnic_dev_notify_ready(vdev)) | ||
644 | return 0; | ||
645 | |||
646 | return vdev->notify_copy.status; | ||
647 | } | ||
648 | |||
629 | void vnic_dev_set_intr_mode(struct vnic_dev *vdev, | 649 | void vnic_dev_set_intr_mode(struct vnic_dev *vdev, |
630 | enum vnic_dev_intr_mode intr_mode) | 650 | enum vnic_dev_intr_mode intr_mode) |
631 | { | 651 | { |
@@ -682,6 +702,11 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, | |||
682 | if (!vdev->devcmd) | 702 | if (!vdev->devcmd) |
683 | goto err_out; | 703 | goto err_out; |
684 | 704 | ||
705 | vdev->cap_flags = 0; | ||
706 | |||
707 | if (vnic_dev_capable(vdev, CMD_INIT)) | ||
708 | vdev->cap_flags |= VNIC_DEV_CAP_INIT; | ||
709 | |||
685 | return vdev; | 710 | return vdev; |
686 | 711 | ||
687 | err_out: | 712 | err_out: |
diff --git a/drivers/net/enic/vnic_dev.h b/drivers/net/enic/vnic_dev.h index b9dc1821c805..8aa8db2fd03f 100644 --- a/drivers/net/enic/vnic_dev.h +++ b/drivers/net/enic/vnic_dev.h | |||
@@ -102,6 +102,8 @@ int vnic_dev_link_status(struct vnic_dev *vdev); | |||
102 | u32 vnic_dev_port_speed(struct vnic_dev *vdev); | 102 | u32 vnic_dev_port_speed(struct vnic_dev *vdev); |
103 | u32 vnic_dev_msg_lvl(struct vnic_dev *vdev); | 103 | u32 vnic_dev_msg_lvl(struct vnic_dev *vdev); |
104 | u32 vnic_dev_mtu(struct vnic_dev *vdev); | 104 | u32 vnic_dev_mtu(struct vnic_dev *vdev); |
105 | u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev); | ||
106 | u32 vnic_dev_notify_status(struct vnic_dev *vdev); | ||
105 | int vnic_dev_close(struct vnic_dev *vdev); | 107 | int vnic_dev_close(struct vnic_dev *vdev); |
106 | int vnic_dev_enable(struct vnic_dev *vdev); | 108 | int vnic_dev_enable(struct vnic_dev *vdev); |
107 | int vnic_dev_disable(struct vnic_dev *vdev); | 109 | int vnic_dev_disable(struct vnic_dev *vdev); |
diff --git a/drivers/net/enic/vnic_devcmd.h b/drivers/net/enic/vnic_devcmd.h index 8062c75154e6..2587f34fbfbd 100644 --- a/drivers/net/enic/vnic_devcmd.h +++ b/drivers/net/enic/vnic_devcmd.h | |||
@@ -191,7 +191,7 @@ enum vnic_devcmd_cmd { | |||
191 | CMD_INIT_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31), | 191 | CMD_INIT_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31), |
192 | 192 | ||
193 | /* INT13 API: (u64)a0=paddr to vnic_int13_params struct | 193 | /* INT13 API: (u64)a0=paddr to vnic_int13_params struct |
194 | * (u8)a1=INT13_CMD_xxx */ | 194 | * (u32)a1=INT13_CMD_xxx */ |
195 | CMD_INT13 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32), | 195 | CMD_INT13 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32), |
196 | 196 | ||
197 | /* logical uplink enable/disable: (u64)a0: 0/1=disable/enable */ | 197 | /* logical uplink enable/disable: (u64)a0: 0/1=disable/enable */ |
@@ -207,6 +207,11 @@ enum vnic_devcmd_cmd { | |||
207 | * in: (u32)a0=cmd | 207 | * in: (u32)a0=cmd |
208 | * out: (u32)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits */ | 208 | * out: (u32)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits */ |
209 | CMD_CAPABILITY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36), | 209 | CMD_CAPABILITY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36), |
210 | |||
211 | /* persistent binding info | ||
212 | * in: (u64)a0=paddr of arg | ||
213 | * (u32)a1=CMD_PERBI_XXX */ | ||
214 | CMD_PERBI = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37), | ||
210 | }; | 215 | }; |
211 | 216 | ||
212 | /* flags for CMD_OPEN */ | 217 | /* flags for CMD_OPEN */ |
@@ -259,6 +264,7 @@ struct vnic_devcmd_notify { | |||
259 | u32 status; /* status bits (see VNIC_STF_*) */ | 264 | u32 status; /* status bits (see VNIC_STF_*) */ |
260 | u32 error; /* error code (see ERR_*) for first ERR */ | 265 | u32 error; /* error code (see ERR_*) for first ERR */ |
261 | u32 link_down_cnt; /* running count of link down transitions */ | 266 | u32 link_down_cnt; /* running count of link down transitions */ |
267 | u32 perbi_rebuild_cnt; /* running count of perbi rebuilds */ | ||
262 | }; | 268 | }; |
263 | #define VNIC_STF_FATAL_ERR 0x0001 /* fatal fw error */ | 269 | #define VNIC_STF_FATAL_ERR 0x0001 /* fatal fw error */ |
264 | #define VNIC_STF_STD_PAUSE 0x0002 /* standard link-level pause on */ | 270 | #define VNIC_STF_STD_PAUSE 0x0002 /* standard link-level pause on */ |