aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/vnic_dev.c
diff options
context:
space:
mode:
authorVasanthy Kolluri <vkolluri@cisco.com>2010-06-24 06:50:12 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-25 23:46:40 -0400
commit383ab92f11dd78d365ed05cf4d83ca2acc069a1f (patch)
tree484b3957d2a28a7f5a67e37871fc729484e67d59 /drivers/net/enic/vnic_dev.c
parent99ef563901a18d44a6c2eadd2b958e2e83aeca51 (diff)
enic: Clean up: Add wrapper routines for firmware devcmd calls
Add wrapper routines that issue devcmds to firmware and ensure that a devcmd lock is held for each devcmd call. Signed-off-by: Scott Feldman <scofeldm@cisco.com> Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com> Signed-off-by: Roopa Prabhu <roprabhu@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.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
index c93012f2faa9..bebadb325b9c 100644
--- a/drivers/net/enic/vnic_dev.c
+++ b/drivers/net/enic/vnic_dev.c
@@ -550,7 +550,7 @@ int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)
550 return 0; 550 return 0;
551} 551}
552 552
553void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, 553int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
554 int broadcast, int promisc, int allmulti) 554 int broadcast, int promisc, int allmulti)
555{ 555{
556 u64 a0, a1 = 0; 556 u64 a0, a1 = 0;
@@ -566,6 +566,8 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
566 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); 566 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait);
567 if (err) 567 if (err)
568 printk(KERN_ERR "Can't set packet filter\n"); 568 printk(KERN_ERR "Can't set packet filter\n");
569
570 return err;
569} 571}
570 572
571int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) 573int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)
@@ -670,22 +672,25 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
670 return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr); 672 return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr);
671} 673}
672 674
673void vnic_dev_notify_unsetcmd(struct vnic_dev *vdev) 675int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev)
674{ 676{
675 u64 a0, a1; 677 u64 a0, a1;
676 int wait = 1000; 678 int wait = 1000;
679 int err;
677 680
678 a0 = 0; /* paddr = 0 to unset notify buffer */ 681 a0 = 0; /* paddr = 0 to unset notify buffer */
679 a1 = 0x0000ffff00000000ULL; /* intr num = -1 to unreg for intr */ 682 a1 = 0x0000ffff00000000ULL; /* intr num = -1 to unreg for intr */
680 a1 += sizeof(struct vnic_devcmd_notify); 683 a1 += sizeof(struct vnic_devcmd_notify);
681 684
682 vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); 685 err = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait);
683 vdev->notify = NULL; 686 vdev->notify = NULL;
684 vdev->notify_pa = 0; 687 vdev->notify_pa = 0;
685 vdev->notify_sz = 0; 688 vdev->notify_sz = 0;
689
690 return err;
686} 691}
687 692
688void vnic_dev_notify_unset(struct vnic_dev *vdev) 693int vnic_dev_notify_unset(struct vnic_dev *vdev)
689{ 694{
690 if (vdev->notify) { 695 if (vdev->notify) {
691 pci_free_consistent(vdev->pdev, 696 pci_free_consistent(vdev->pdev,
@@ -694,7 +699,7 @@ void vnic_dev_notify_unset(struct vnic_dev *vdev)
694 vdev->notify_pa); 699 vdev->notify_pa);
695 } 700 }
696 701
697 vnic_dev_notify_unsetcmd(vdev); 702 return vnic_dev_notify_unsetcmd(vdev);
698} 703}
699 704
700static int vnic_dev_notify_ready(struct vnic_dev *vdev) 705static int vnic_dev_notify_ready(struct vnic_dev *vdev)
@@ -839,6 +844,14 @@ u32 vnic_dev_notify_status(struct vnic_dev *vdev)
839 return vdev->notify_copy.status; 844 return vdev->notify_copy.status;
840} 845}
841 846
847u32 vnic_dev_uif(struct vnic_dev *vdev)
848{
849 if (!vnic_dev_notify_ready(vdev))
850 return 0;
851
852 return vdev->notify_copy.uif;
853}
854
842void vnic_dev_set_intr_mode(struct vnic_dev *vdev, 855void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
843 enum vnic_dev_intr_mode intr_mode) 856 enum vnic_dev_intr_mode intr_mode)
844{ 857{