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/vnic_dev.c | |
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/vnic_dev.c')
-rw-r--r-- | drivers/net/enic/vnic_dev.c | 33 |
1 files changed, 29 insertions, 4 deletions
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: |