Commit 383ab92f authored by Vasanthy Kolluri's avatar Vasanthy Kolluri Committed by David S. Miller

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: default avatarScott Feldman <scofeldm@cisco.com>
Signed-off-by: default avatarVasanthy Kolluri <vkolluri@cisco.com>
Signed-off-by: default avatarRoopa Prabhu <roprabhu@cisco.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 99ef5639
This diff is collapsed.
...@@ -103,17 +103,7 @@ int enic_get_vnic_config(struct enic *enic) ...@@ -103,17 +103,7 @@ int enic_get_vnic_config(struct enic *enic)
return 0; return 0;
} }
void enic_add_multicast_addr(struct enic *enic, u8 *addr) int enic_add_vlan(struct enic *enic, u16 vlanid)
{
vnic_dev_add_addr(enic->vdev, addr);
}
void enic_del_multicast_addr(struct enic *enic, u8 *addr)
{
vnic_dev_del_addr(enic->vdev, addr);
}
void enic_add_vlan(struct enic *enic, u16 vlanid)
{ {
u64 a0 = vlanid, a1 = 0; u64 a0 = vlanid, a1 = 0;
int wait = 1000; int wait = 1000;
...@@ -122,9 +112,11 @@ void enic_add_vlan(struct enic *enic, u16 vlanid) ...@@ -122,9 +112,11 @@ void enic_add_vlan(struct enic *enic, u16 vlanid)
err = vnic_dev_cmd(enic->vdev, CMD_VLAN_ADD, &a0, &a1, wait); err = vnic_dev_cmd(enic->vdev, CMD_VLAN_ADD, &a0, &a1, wait);
if (err) if (err)
printk(KERN_ERR PFX "Can't add vlan id, %d\n", err); printk(KERN_ERR PFX "Can't add vlan id, %d\n", err);
return err;
} }
void enic_del_vlan(struct enic *enic, u16 vlanid) int enic_del_vlan(struct enic *enic, u16 vlanid)
{ {
u64 a0 = vlanid, a1 = 0; u64 a0 = vlanid, a1 = 0;
int wait = 1000; int wait = 1000;
...@@ -133,6 +125,8 @@ void enic_del_vlan(struct enic *enic, u16 vlanid) ...@@ -133,6 +125,8 @@ void enic_del_vlan(struct enic *enic, u16 vlanid)
err = vnic_dev_cmd(enic->vdev, CMD_VLAN_DEL, &a0, &a1, wait); err = vnic_dev_cmd(enic->vdev, CMD_VLAN_DEL, &a0, &a1, wait);
if (err) if (err)
printk(KERN_ERR PFX "Can't delete vlan id, %d\n", err); printk(KERN_ERR PFX "Can't delete vlan id, %d\n", err);
return err;
} }
int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type, int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type,
...@@ -304,11 +298,6 @@ void enic_init_vnic_resources(struct enic *enic) ...@@ -304,11 +298,6 @@ void enic_init_vnic_resources(struct enic *enic)
enic->config.intr_timer_type, enic->config.intr_timer_type,
mask_on_assertion); mask_on_assertion);
} }
/* Clear LIF stats
*/
vnic_dev_stats_clear(enic->vdev);
} }
int enic_alloc_vnic_resources(struct enic *enic) int enic_alloc_vnic_resources(struct enic *enic)
......
...@@ -131,10 +131,8 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq, ...@@ -131,10 +131,8 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq,
struct enic; struct enic;
int enic_get_vnic_config(struct enic *); int enic_get_vnic_config(struct enic *);
void enic_add_multicast_addr(struct enic *enic, u8 *addr); int enic_add_vlan(struct enic *enic, u16 vlanid);
void enic_del_multicast_addr(struct enic *enic, u8 *addr); int enic_del_vlan(struct enic *enic, u16 vlanid);
void enic_add_vlan(struct enic *enic, u16 vlanid);
void enic_del_vlan(struct enic *enic, u16 vlanid);
int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type, int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type,
u8 rss_hash_bits, u8 rss_base_cpu, u8 rss_enable, u8 tso_ipid_split_en, u8 rss_hash_bits, u8 rss_base_cpu, u8 rss_enable, u8 tso_ipid_split_en,
u8 ig_vlan_strip_en); u8 ig_vlan_strip_en);
......
...@@ -550,7 +550,7 @@ int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) ...@@ -550,7 +550,7 @@ int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)
return 0; return 0;
} }
void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
int broadcast, int promisc, int allmulti) int broadcast, int promisc, int allmulti)
{ {
u64 a0, a1 = 0; u64 a0, a1 = 0;
...@@ -566,6 +566,8 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, ...@@ -566,6 +566,8 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait);
if (err) if (err)
printk(KERN_ERR "Can't set packet filter\n"); printk(KERN_ERR "Can't set packet filter\n");
return err;
} }
int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) int 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,22 +672,25 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr); return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr);
} }
void vnic_dev_notify_unsetcmd(struct vnic_dev *vdev) int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev)
{ {
u64 a0, a1; u64 a0, a1;
int wait = 1000; int wait = 1000;
int err;
a0 = 0; /* paddr = 0 to unset notify buffer */ a0 = 0; /* paddr = 0 to unset notify buffer */
a1 = 0x0000ffff00000000ULL; /* intr num = -1 to unreg for intr */ a1 = 0x0000ffff00000000ULL; /* intr num = -1 to unreg for intr */
a1 += sizeof(struct vnic_devcmd_notify); a1 += sizeof(struct vnic_devcmd_notify);
vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); err = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait);
vdev->notify = NULL; vdev->notify = NULL;
vdev->notify_pa = 0; vdev->notify_pa = 0;
vdev->notify_sz = 0; vdev->notify_sz = 0;
return err;
} }
void vnic_dev_notify_unset(struct vnic_dev *vdev) int vnic_dev_notify_unset(struct vnic_dev *vdev)
{ {
if (vdev->notify) { if (vdev->notify) {
pci_free_consistent(vdev->pdev, pci_free_consistent(vdev->pdev,
...@@ -694,7 +699,7 @@ void vnic_dev_notify_unset(struct vnic_dev *vdev) ...@@ -694,7 +699,7 @@ void vnic_dev_notify_unset(struct vnic_dev *vdev)
vdev->notify_pa); vdev->notify_pa);
} }
vnic_dev_notify_unsetcmd(vdev); return vnic_dev_notify_unsetcmd(vdev);
} }
static int vnic_dev_notify_ready(struct vnic_dev *vdev) static int vnic_dev_notify_ready(struct vnic_dev *vdev)
...@@ -839,6 +844,14 @@ u32 vnic_dev_notify_status(struct vnic_dev *vdev) ...@@ -839,6 +844,14 @@ u32 vnic_dev_notify_status(struct vnic_dev *vdev)
return vdev->notify_copy.status; return vdev->notify_copy.status;
} }
u32 vnic_dev_uif(struct vnic_dev *vdev)
{
if (!vnic_dev_notify_ready(vdev))
return 0;
return vdev->notify_copy.uif;
}
void vnic_dev_set_intr_mode(struct vnic_dev *vdev, void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
enum vnic_dev_intr_mode intr_mode) enum vnic_dev_intr_mode intr_mode)
{ {
......
...@@ -101,7 +101,7 @@ int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, ...@@ -101,7 +101,7 @@ int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size,
int vnic_dev_stats_clear(struct vnic_dev *vdev); int vnic_dev_stats_clear(struct vnic_dev *vdev);
int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats); int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats);
int vnic_dev_hang_notify(struct vnic_dev *vdev); int vnic_dev_hang_notify(struct vnic_dev *vdev);
void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
int broadcast, int promisc, int allmulti); int broadcast, int promisc, int allmulti);
int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr); int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr);
int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr); int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr);
...@@ -110,14 +110,15 @@ int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr); ...@@ -110,14 +110,15 @@ int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr);
int vnic_dev_notify_setcmd(struct vnic_dev *vdev, int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
void *notify_addr, dma_addr_t notify_pa, u16 intr); void *notify_addr, dma_addr_t notify_pa, u16 intr);
int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr); int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr);
void vnic_dev_notify_unsetcmd(struct vnic_dev *vdev); int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev);
void vnic_dev_notify_unset(struct vnic_dev *vdev); int vnic_dev_notify_unset(struct vnic_dev *vdev);
int vnic_dev_link_status(struct vnic_dev *vdev); int vnic_dev_link_status(struct vnic_dev *vdev);
u32 vnic_dev_port_speed(struct vnic_dev *vdev); u32 vnic_dev_port_speed(struct vnic_dev *vdev);
u32 vnic_dev_msg_lvl(struct vnic_dev *vdev); u32 vnic_dev_msg_lvl(struct vnic_dev *vdev);
u32 vnic_dev_mtu(struct vnic_dev *vdev); u32 vnic_dev_mtu(struct vnic_dev *vdev);
u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev); u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev);
u32 vnic_dev_notify_status(struct vnic_dev *vdev); u32 vnic_dev_notify_status(struct vnic_dev *vdev);
u32 vnic_dev_uif(struct vnic_dev *vdev);
int vnic_dev_close(struct vnic_dev *vdev); int vnic_dev_close(struct vnic_dev *vdev);
int vnic_dev_enable(struct vnic_dev *vdev); int vnic_dev_enable(struct vnic_dev *vdev);
int vnic_dev_disable(struct vnic_dev *vdev); int vnic_dev_disable(struct vnic_dev *vdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment