Lines Matching full:vdev

26 void *vnic_dev_priv(struct vnic_dev *vdev)  in vnic_dev_priv()  argument
28 return vdev->priv; in vnic_dev_priv()
31 static int vnic_dev_discover_res(struct vnic_dev *vdev, in vnic_dev_discover_res() argument
43 vdev_err(vdev, "vNIC BAR0 res hdr length error\n"); in vnic_dev_discover_res()
50 vdev_err(vdev, "vNIC BAR0 res hdr not mem-mapped\n"); in vnic_dev_discover_res()
59 vdev_err(vdev, "vNIC BAR0 res magic/version error exp (%lx/%lx) or (%lx/%lx), curr (%x/%x)\n", in vnic_dev_discover_res()
96 vdev_err(vdev, "vNIC BAR0 resource %d out-of-bounds, offset 0x%x + size 0x%x > bar len 0x%lx\n", in vnic_dev_discover_res()
111 vdev->res[type].count = count; in vnic_dev_discover_res()
112 vdev->res[type].vaddr = (char __iomem *)bar[bar_num].vaddr + in vnic_dev_discover_res()
114 vdev->res[type].bus_addr = bar[bar_num].bus_addr + bar_offset; in vnic_dev_discover_res()
120 unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev, in vnic_dev_get_res_count() argument
123 return vdev->res[type].count; in vnic_dev_get_res_count()
127 void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type, in vnic_dev_get_res() argument
130 if (!vdev->res[type].vaddr) in vnic_dev_get_res()
138 return (char __iomem *)vdev->res[type].vaddr + in vnic_dev_get_res()
141 return (char __iomem *)vdev->res[type].vaddr; in vnic_dev_get_res()
178 int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, in vnic_dev_alloc_desc_ring() argument
183 ring->descs_unaligned = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_alloc_desc_ring()
189 vdev_err(vdev, "Failed to allocate ring (size=%d), aborting\n", in vnic_dev_alloc_desc_ring()
206 void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring) in vnic_dev_free_desc_ring() argument
209 dma_free_coherent(&vdev->pdev->dev, ring->size_unaligned, in vnic_dev_free_desc_ring()
216 static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in _vnic_dev_cmd() argument
219 struct vnic_devcmd __iomem *devcmd = vdev->devcmd; in _vnic_dev_cmd()
231 vdev_neterr(vdev, "Busy devcmd %d\n", _CMD_N(cmd)); in _vnic_dev_cmd()
237 writeq(vdev->args[i], &devcmd->args[i]); in _vnic_dev_cmd()
265 vdev_neterr(vdev, "Error %d devcmd %d\n", in _vnic_dev_cmd()
273 vdev->args[i] = readq(&devcmd->args[i]); in _vnic_dev_cmd()
280 vdev_neterr(vdev, "Timedout devcmd %d\n", _CMD_N(cmd)); in _vnic_dev_cmd()
284 static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in _vnic_dev_cmd2() argument
287 struct devcmd2_controller *dc2c = vdev->devcmd2; in _vnic_dev_cmd2()
303 vdev_neterr(vdev, "devcmd2 %d: wq is full. fetch index: %u, posted index: %u\n", in _vnic_dev_cmd2()
314 dc2c->cmd_ring[posted].args[i] = vdev->args[i]; in _vnic_dev_cmd2()
342 vdev_neterr(vdev, "Error %d devcmd %d\n", in _vnic_dev_cmd2()
348 vdev->args[i] = result->results[i]; in _vnic_dev_cmd2()
355 vdev_neterr(vdev, "devcmd %d timed out\n", _CMD_N(cmd)); in _vnic_dev_cmd2()
360 static int vnic_dev_init_devcmd1(struct vnic_dev *vdev) in vnic_dev_init_devcmd1() argument
362 vdev->devcmd = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD, 0); in vnic_dev_init_devcmd1()
363 if (!vdev->devcmd) in vnic_dev_init_devcmd1()
365 vdev->devcmd_rtn = _vnic_dev_cmd; in vnic_dev_init_devcmd1()
370 static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) in vnic_dev_init_devcmd2() argument
375 if (vdev->devcmd2) in vnic_dev_init_devcmd2()
378 vdev->devcmd2 = kzalloc(sizeof(*vdev->devcmd2), GFP_KERNEL); in vnic_dev_init_devcmd2()
379 if (!vdev->devcmd2) in vnic_dev_init_devcmd2()
382 vdev->devcmd2->color = 1; in vnic_dev_init_devcmd2()
383 vdev->devcmd2->result_size = DEVCMD2_RING_SIZE; in vnic_dev_init_devcmd2()
384 err = enic_wq_devcmd2_alloc(vdev, &vdev->devcmd2->wq, DEVCMD2_RING_SIZE, in vnic_dev_init_devcmd2()
389 fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index); in vnic_dev_init_devcmd2()
391 vdev_err(vdev, "Fatal error in devcmd2 init - hardware surprise removal\n"); in vnic_dev_init_devcmd2()
396 enic_wq_init_start(&vdev->devcmd2->wq, 0, fetch_index, fetch_index, 0, in vnic_dev_init_devcmd2()
398 vdev->devcmd2->posted = fetch_index; in vnic_dev_init_devcmd2()
399 vnic_wq_enable(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
401 err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, in vnic_dev_init_devcmd2()
406 vdev->devcmd2->result = vdev->devcmd2->results_ring.descs; in vnic_dev_init_devcmd2()
407 vdev->devcmd2->cmd_ring = vdev->devcmd2->wq.ring.descs; in vnic_dev_init_devcmd2()
408 vdev->devcmd2->wq_ctrl = vdev->devcmd2->wq.ctrl; in vnic_dev_init_devcmd2()
409 vdev->args[0] = (u64)vdev->devcmd2->results_ring.base_addr | in vnic_dev_init_devcmd2()
411 vdev->args[1] = DEVCMD2_RING_SIZE; in vnic_dev_init_devcmd2()
413 err = _vnic_dev_cmd2(vdev, CMD_INITIALIZE_DEVCMD2, 1000); in vnic_dev_init_devcmd2()
417 vdev->devcmd_rtn = _vnic_dev_cmd2; in vnic_dev_init_devcmd2()
422 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); in vnic_dev_init_devcmd2()
424 vnic_wq_disable(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
426 vnic_wq_free(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
428 kfree(vdev->devcmd2); in vnic_dev_init_devcmd2()
429 vdev->devcmd2 = NULL; in vnic_dev_init_devcmd2()
434 static void vnic_dev_deinit_devcmd2(struct vnic_dev *vdev) in vnic_dev_deinit_devcmd2() argument
436 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); in vnic_dev_deinit_devcmd2()
437 vnic_wq_disable(&vdev->devcmd2->wq); in vnic_dev_deinit_devcmd2()
438 vnic_wq_free(&vdev->devcmd2->wq); in vnic_dev_deinit_devcmd2()
439 kfree(vdev->devcmd2); in vnic_dev_deinit_devcmd2()
442 static int vnic_dev_cmd_proxy(struct vnic_dev *vdev, in vnic_dev_cmd_proxy() argument
449 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_cmd_proxy()
451 vdev->args[0] = vdev->proxy_index; in vnic_dev_cmd_proxy()
452 vdev->args[1] = cmd; in vnic_dev_cmd_proxy()
453 vdev->args[2] = *a0; in vnic_dev_cmd_proxy()
454 vdev->args[3] = *a1; in vnic_dev_cmd_proxy()
456 err = vdev->devcmd_rtn(vdev, proxy_cmd, wait); in vnic_dev_cmd_proxy()
460 status = (u32)vdev->args[0]; in vnic_dev_cmd_proxy()
462 err = (int)vdev->args[1]; in vnic_dev_cmd_proxy()
465 vdev_neterr(vdev, "Error %d proxy devcmd %d\n", in vnic_dev_cmd_proxy()
470 *a0 = vdev->args[1]; in vnic_dev_cmd_proxy()
471 *a1 = vdev->args[2]; in vnic_dev_cmd_proxy()
476 static int vnic_dev_cmd_no_proxy(struct vnic_dev *vdev, in vnic_dev_cmd_no_proxy() argument
481 vdev->args[0] = *a0; in vnic_dev_cmd_no_proxy()
482 vdev->args[1] = *a1; in vnic_dev_cmd_no_proxy()
484 err = vdev->devcmd_rtn(vdev, cmd, wait); in vnic_dev_cmd_no_proxy()
486 *a0 = vdev->args[0]; in vnic_dev_cmd_no_proxy()
487 *a1 = vdev->args[1]; in vnic_dev_cmd_no_proxy()
492 void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index) in vnic_dev_cmd_proxy_by_index_start() argument
494 vdev->proxy = PROXY_BY_INDEX; in vnic_dev_cmd_proxy_by_index_start()
495 vdev->proxy_index = index; in vnic_dev_cmd_proxy_by_index_start()
498 void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev) in vnic_dev_cmd_proxy_end() argument
500 vdev->proxy = PROXY_NONE; in vnic_dev_cmd_proxy_end()
501 vdev->proxy_index = 0; in vnic_dev_cmd_proxy_end()
504 int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in vnic_dev_cmd() argument
507 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_cmd()
509 switch (vdev->proxy) { in vnic_dev_cmd()
511 return vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_INDEX, cmd, in vnic_dev_cmd()
514 return vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_BDF, cmd, in vnic_dev_cmd()
518 return vnic_dev_cmd_no_proxy(vdev, cmd, a0, a1, wait); in vnic_dev_cmd()
522 static int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd) in vnic_dev_capable() argument
528 err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait); in vnic_dev_capable()
533 int vnic_dev_fw_info(struct vnic_dev *vdev, in vnic_dev_fw_info() argument
540 if (!vdev->fw_info) { in vnic_dev_fw_info()
541 vdev->fw_info = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_fw_info()
543 &vdev->fw_info_pa, GFP_ATOMIC); in vnic_dev_fw_info()
544 if (!vdev->fw_info) in vnic_dev_fw_info()
547 a0 = vdev->fw_info_pa; in vnic_dev_fw_info()
551 if (vnic_dev_capable(vdev, CMD_MCPU_FW_INFO)) in vnic_dev_fw_info()
552 err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO, in vnic_dev_fw_info()
555 err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO_OLD, in vnic_dev_fw_info()
559 *fw_info = vdev->fw_info; in vnic_dev_fw_info()
564 int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, in vnic_dev_spec() argument
574 err = vnic_dev_cmd(vdev, CMD_DEV_SPEC, &a0, &a1, wait); in vnic_dev_spec()
587 int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) in vnic_dev_stats_dump() argument
592 if (!vdev->stats) { in vnic_dev_stats_dump()
593 vdev->stats = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_stats_dump()
595 &vdev->stats_pa, GFP_ATOMIC); in vnic_dev_stats_dump()
596 if (!vdev->stats) in vnic_dev_stats_dump()
600 *stats = vdev->stats; in vnic_dev_stats_dump()
601 a0 = vdev->stats_pa; in vnic_dev_stats_dump()
604 return vnic_dev_cmd(vdev, CMD_STATS_DUMP, &a0, &a1, wait); in vnic_dev_stats_dump()
607 int vnic_dev_close(struct vnic_dev *vdev) in vnic_dev_close() argument
611 return vnic_dev_cmd(vdev, CMD_CLOSE, &a0, &a1, wait); in vnic_dev_close()
614 int vnic_dev_enable_wait(struct vnic_dev *vdev) in vnic_dev_enable_wait() argument
619 if (vnic_dev_capable(vdev, CMD_ENABLE_WAIT)) in vnic_dev_enable_wait()
620 return vnic_dev_cmd(vdev, CMD_ENABLE_WAIT, &a0, &a1, wait); in vnic_dev_enable_wait()
622 return vnic_dev_cmd(vdev, CMD_ENABLE, &a0, &a1, wait); in vnic_dev_enable_wait()
625 int vnic_dev_disable(struct vnic_dev *vdev) in vnic_dev_disable() argument
629 return vnic_dev_cmd(vdev, CMD_DISABLE, &a0, &a1, wait); in vnic_dev_disable()
632 int vnic_dev_open(struct vnic_dev *vdev, int arg) in vnic_dev_open() argument
636 return vnic_dev_cmd(vdev, CMD_OPEN, &a0, &a1, wait); in vnic_dev_open()
639 int vnic_dev_open_done(struct vnic_dev *vdev, int *done) in vnic_dev_open_done() argument
647 err = vnic_dev_cmd(vdev, CMD_OPEN_STATUS, &a0, &a1, wait); in vnic_dev_open_done()
656 int vnic_dev_soft_reset(struct vnic_dev *vdev, int arg) in vnic_dev_soft_reset() argument
660 return vnic_dev_cmd(vdev, CMD_SOFT_RESET, &a0, &a1, wait); in vnic_dev_soft_reset()
663 int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) in vnic_dev_soft_reset_done() argument
671 err = vnic_dev_cmd(vdev, CMD_SOFT_RESET_STATUS, &a0, &a1, wait); in vnic_dev_soft_reset_done()
680 int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg) in vnic_dev_hang_reset() argument
686 if (vnic_dev_capable(vdev, CMD_HANG_RESET)) { in vnic_dev_hang_reset()
687 return vnic_dev_cmd(vdev, CMD_HANG_RESET, in vnic_dev_hang_reset()
690 err = vnic_dev_soft_reset(vdev, arg); in vnic_dev_hang_reset()
693 return vnic_dev_init(vdev, 0); in vnic_dev_hang_reset()
697 int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done) in vnic_dev_hang_reset_done() argument
705 if (vnic_dev_capable(vdev, CMD_HANG_RESET_STATUS)) { in vnic_dev_hang_reset_done()
706 err = vnic_dev_cmd(vdev, CMD_HANG_RESET_STATUS, in vnic_dev_hang_reset_done()
711 return vnic_dev_soft_reset_done(vdev, done); in vnic_dev_hang_reset_done()
719 int vnic_dev_hang_notify(struct vnic_dev *vdev) in vnic_dev_hang_notify() argument
723 return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); in vnic_dev_hang_notify()
726 int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) in vnic_dev_get_mac_addr() argument
735 err = vnic_dev_cmd(vdev, CMD_GET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_get_mac_addr()
745 int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, in vnic_dev_packet_filter() argument
758 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); in vnic_dev_packet_filter()
760 vdev_neterr(vdev, "Can't set packet filter\n"); in vnic_dev_packet_filter()
765 int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr) in vnic_dev_add_addr() argument
775 err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); in vnic_dev_add_addr()
777 vdev_neterr(vdev, "Can't add addr [%pM], %d\n", addr, err); in vnic_dev_add_addr()
782 int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr) in vnic_dev_del_addr() argument
792 err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); in vnic_dev_del_addr()
794 vdev_neterr(vdev, "Can't del addr [%pM], %d\n", addr, err); in vnic_dev_del_addr()
799 int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev, in vnic_dev_set_ig_vlan_rewrite_mode() argument
805 if (vnic_dev_capable(vdev, CMD_IG_VLAN_REWRITE_MODE)) in vnic_dev_set_ig_vlan_rewrite_mode()
806 return vnic_dev_cmd(vdev, CMD_IG_VLAN_REWRITE_MODE, in vnic_dev_set_ig_vlan_rewrite_mode()
812 static int vnic_dev_notify_setcmd(struct vnic_dev *vdev, in vnic_dev_notify_setcmd() argument
820 vdev->notify = notify_addr; in vnic_dev_notify_setcmd()
821 vdev->notify_pa = notify_pa; in vnic_dev_notify_setcmd()
827 r = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); in vnic_dev_notify_setcmd()
828 vdev->notify_sz = (r == 0) ? (u32)a1 : 0; in vnic_dev_notify_setcmd()
832 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) in vnic_dev_notify_set() argument
837 if (vdev->notify || vdev->notify_pa) { in vnic_dev_notify_set()
838 vdev_neterr(vdev, "notify block %p still allocated\n", in vnic_dev_notify_set()
839 vdev->notify); in vnic_dev_notify_set()
843 notify_addr = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_notify_set()
849 return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr); in vnic_dev_notify_set()
852 static int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev) in vnic_dev_notify_unsetcmd() argument
862 err = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); in vnic_dev_notify_unsetcmd()
863 vdev->notify = NULL; in vnic_dev_notify_unsetcmd()
864 vdev->notify_pa = 0; in vnic_dev_notify_unsetcmd()
865 vdev->notify_sz = 0; in vnic_dev_notify_unsetcmd()
870 int vnic_dev_notify_unset(struct vnic_dev *vdev) in vnic_dev_notify_unset() argument
872 if (vdev->notify) { in vnic_dev_notify_unset()
873 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_notify_unset()
875 vdev->notify, vdev->notify_pa); in vnic_dev_notify_unset()
878 return vnic_dev_notify_unsetcmd(vdev); in vnic_dev_notify_unset()
881 static int vnic_dev_notify_ready(struct vnic_dev *vdev) in vnic_dev_notify_ready() argument
884 unsigned int nwords = vdev->notify_sz / 4; in vnic_dev_notify_ready()
888 if (!vdev->notify || !vdev->notify_sz) in vnic_dev_notify_ready()
893 memcpy(&vdev->notify_copy, vdev->notify, vdev->notify_sz); in vnic_dev_notify_ready()
894 words = (u32 *)&vdev->notify_copy; in vnic_dev_notify_ready()
902 int vnic_dev_init(struct vnic_dev *vdev, int arg) in vnic_dev_init() argument
908 if (vnic_dev_capable(vdev, CMD_INIT)) in vnic_dev_init()
909 r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait); in vnic_dev_init()
911 vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait); in vnic_dev_init()
916 vnic_dev_cmd(vdev, CMD_GET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_init()
917 vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); in vnic_dev_init()
923 int vnic_dev_deinit(struct vnic_dev *vdev) in vnic_dev_deinit() argument
928 return vnic_dev_cmd(vdev, CMD_DEINIT, &a0, &a1, wait); in vnic_dev_deinit()
931 void vnic_dev_intr_coal_timer_info_default(struct vnic_dev *vdev) in vnic_dev_intr_coal_timer_info_default() argument
934 vdev->intr_coal_timer_info.mul = 2; in vnic_dev_intr_coal_timer_info_default()
935 vdev->intr_coal_timer_info.div = 3; in vnic_dev_intr_coal_timer_info_default()
936 vdev->intr_coal_timer_info.max_usec = in vnic_dev_intr_coal_timer_info_default()
937 vnic_dev_intr_coal_timer_hw_to_usec(vdev, 0xffff); in vnic_dev_intr_coal_timer_info_default()
940 int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev) in vnic_dev_intr_coal_timer_info() argument
945 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_intr_coal_timer_info()
947 if (vnic_dev_capable(vdev, CMD_INTR_COAL_CONVERT)) in vnic_dev_intr_coal_timer_info()
948 err = vdev->devcmd_rtn(vdev, CMD_INTR_COAL_CONVERT, wait); in vnic_dev_intr_coal_timer_info()
956 (!err && !(vdev->args[0] && vdev->args[1] && vdev->args[2]))) { in vnic_dev_intr_coal_timer_info()
957 vdev_netwarn(vdev, "Using default conversion factor for interrupt coalesce timer\n"); in vnic_dev_intr_coal_timer_info()
958 vnic_dev_intr_coal_timer_info_default(vdev); in vnic_dev_intr_coal_timer_info()
963 vdev->intr_coal_timer_info.mul = (u32) vdev->args[0]; in vnic_dev_intr_coal_timer_info()
964 vdev->intr_coal_timer_info.div = (u32) vdev->args[1]; in vnic_dev_intr_coal_timer_info()
965 vdev->intr_coal_timer_info.max_usec = (u32) vdev->args[2]; in vnic_dev_intr_coal_timer_info()
971 int vnic_dev_link_status(struct vnic_dev *vdev) in vnic_dev_link_status() argument
973 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_link_status()
976 return vdev->notify_copy.link_state; in vnic_dev_link_status()
979 u32 vnic_dev_port_speed(struct vnic_dev *vdev) in vnic_dev_port_speed() argument
981 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_port_speed()
984 return vdev->notify_copy.port_speed; in vnic_dev_port_speed()
987 u32 vnic_dev_msg_lvl(struct vnic_dev *vdev) in vnic_dev_msg_lvl() argument
989 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_msg_lvl()
992 return vdev->notify_copy.msglvl; in vnic_dev_msg_lvl()
995 u32 vnic_dev_mtu(struct vnic_dev *vdev) in vnic_dev_mtu() argument
997 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_mtu()
1000 return vdev->notify_copy.mtu; in vnic_dev_mtu()
1003 void vnic_dev_set_intr_mode(struct vnic_dev *vdev, in vnic_dev_set_intr_mode() argument
1006 vdev->intr_mode = intr_mode; in vnic_dev_set_intr_mode()
1010 struct vnic_dev *vdev) in vnic_dev_get_intr_mode() argument
1012 return vdev->intr_mode; in vnic_dev_get_intr_mode()
1015 u32 vnic_dev_intr_coal_timer_usec_to_hw(struct vnic_dev *vdev, u32 usec) in vnic_dev_intr_coal_timer_usec_to_hw() argument
1017 return (usec * vdev->intr_coal_timer_info.mul) / in vnic_dev_intr_coal_timer_usec_to_hw()
1018 vdev->intr_coal_timer_info.div; in vnic_dev_intr_coal_timer_usec_to_hw()
1021 u32 vnic_dev_intr_coal_timer_hw_to_usec(struct vnic_dev *vdev, u32 hw_cycles) in vnic_dev_intr_coal_timer_hw_to_usec() argument
1023 return (hw_cycles * vdev->intr_coal_timer_info.div) / in vnic_dev_intr_coal_timer_hw_to_usec()
1024 vdev->intr_coal_timer_info.mul; in vnic_dev_intr_coal_timer_hw_to_usec()
1027 u32 vnic_dev_get_intr_coal_timer_max(struct vnic_dev *vdev) in vnic_dev_get_intr_coal_timer_max() argument
1029 return vdev->intr_coal_timer_info.max_usec; in vnic_dev_get_intr_coal_timer_max()
1032 void vnic_dev_unregister(struct vnic_dev *vdev) in vnic_dev_unregister() argument
1034 if (vdev) { in vnic_dev_unregister()
1035 if (vdev->notify) in vnic_dev_unregister()
1036 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_unregister()
1038 vdev->notify, vdev->notify_pa); in vnic_dev_unregister()
1039 if (vdev->stats) in vnic_dev_unregister()
1040 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_unregister()
1042 vdev->stats, vdev->stats_pa); in vnic_dev_unregister()
1043 if (vdev->fw_info) in vnic_dev_unregister()
1044 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_unregister()
1046 vdev->fw_info, vdev->fw_info_pa); in vnic_dev_unregister()
1047 if (vdev->devcmd2) in vnic_dev_unregister()
1048 vnic_dev_deinit_devcmd2(vdev); in vnic_dev_unregister()
1050 kfree(vdev); in vnic_dev_unregister()
1055 struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, in vnic_dev_register() argument
1059 if (!vdev) { in vnic_dev_register()
1060 vdev = kzalloc(sizeof(struct vnic_dev), GFP_KERNEL); in vnic_dev_register()
1061 if (!vdev) in vnic_dev_register()
1065 vdev->priv = priv; in vnic_dev_register()
1066 vdev->pdev = pdev; in vnic_dev_register()
1068 if (vnic_dev_discover_res(vdev, bar, num_bars)) in vnic_dev_register()
1071 return vdev; in vnic_dev_register()
1074 vnic_dev_unregister(vdev); in vnic_dev_register()
1079 struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev) in vnic_dev_get_pdev() argument
1081 return vdev->pdev; in vnic_dev_get_pdev()
1085 int vnic_devcmd_init(struct vnic_dev *vdev) in vnic_devcmd_init() argument
1090 res = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD2, 0); in vnic_devcmd_init()
1092 err = vnic_dev_init_devcmd2(vdev); in vnic_devcmd_init()
1094 vdev_warn(vdev, "DEVCMD2 init failed: %d, Using DEVCMD1\n", in vnic_devcmd_init()
1099 vdev_warn(vdev, "DEVCMD2 resource not found (old firmware?) Using DEVCMD1\n"); in vnic_devcmd_init()
1101 err = vnic_dev_init_devcmd1(vdev); in vnic_devcmd_init()
1103 vdev_err(vdev, "DEVCMD1 initialization failed: %d\n", err); in vnic_devcmd_init()
1108 int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len) in vnic_dev_init_prov2() argument
1116 prov_buf = dma_alloc_coherent(&vdev->pdev->dev, len, &prov_pa, GFP_ATOMIC); in vnic_dev_init_prov2()
1124 ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO2, &a0, &a1, wait); in vnic_dev_init_prov2()
1126 dma_free_coherent(&vdev->pdev->dev, len, prov_buf, prov_pa); in vnic_dev_init_prov2()
1131 int vnic_dev_enable2(struct vnic_dev *vdev, int active) in vnic_dev_enable2() argument
1138 return vnic_dev_cmd(vdev, CMD_ENABLE2, &a0, &a1, wait); in vnic_dev_enable2()
1141 static int vnic_dev_cmd_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in vnic_dev_cmd_status() argument
1148 ret = vnic_dev_cmd(vdev, CMD_STATUS, &a0, &a1, wait); in vnic_dev_cmd_status()
1155 int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status) in vnic_dev_enable2_done() argument
1157 return vnic_dev_cmd_status(vdev, CMD_ENABLE2, status); in vnic_dev_enable2_done()
1160 int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status) in vnic_dev_deinit_done() argument
1162 return vnic_dev_cmd_status(vdev, CMD_DEINIT, status); in vnic_dev_deinit_done()
1165 int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) in vnic_dev_set_mac_addr() argument
1174 return vnic_dev_cmd(vdev, CMD_SET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_set_mac_addr()
1178 * @vdev: vdev of the device
1191 int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry, in vnic_dev_classifier() argument
1206 tlv_va = dma_alloc_coherent(&vdev->pdev->dev, tlv_size, in vnic_dev_classifier()
1228 ret = vnic_dev_cmd(vdev, CMD_ADD_FILTER, &a0, &a1, wait); in vnic_dev_classifier()
1230 dma_free_coherent(&vdev->pdev->dev, tlv_size, tlv_va, tlv_pa); in vnic_dev_classifier()
1233 ret = vnic_dev_cmd(vdev, CMD_DEL_FILTER, &a0, &a1, wait); in vnic_dev_classifier()
1239 int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev, u8 overlay, u8 config) in vnic_dev_overlay_offload_ctrl() argument
1245 return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CTRL, &a0, &a1, wait); in vnic_dev_overlay_offload_ctrl()
1248 int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay, in vnic_dev_overlay_offload_cfg() argument
1255 return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CFG, &a0, &a1, wait); in vnic_dev_overlay_offload_cfg()
1258 int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature, in vnic_dev_get_supported_feature_ver() argument
1265 ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, a1, wait); in vnic_dev_get_supported_feature_ver()
1272 int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type) in vnic_dev_capable_rss_hash_type() argument
1278 err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait); in vnic_dev_capable_rss_hash_type()