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()
174 int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, in vnic_dev_alloc_desc_ring() argument
179 ring->descs_unaligned = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_alloc_desc_ring()
185 vdev_err(vdev, "Failed to allocate ring (size=%d), aborting\n", in vnic_dev_alloc_desc_ring()
202 void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring) in vnic_dev_free_desc_ring() argument
205 dma_free_coherent(&vdev->pdev->dev, ring->size_unaligned, in vnic_dev_free_desc_ring()
212 static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in _vnic_dev_cmd() argument
215 struct vnic_devcmd __iomem *devcmd = vdev->devcmd; in _vnic_dev_cmd()
227 vdev_neterr(vdev, "Busy devcmd %d\n", _CMD_N(cmd)); in _vnic_dev_cmd()
233 writeq(vdev->args[i], &devcmd->args[i]); in _vnic_dev_cmd()
261 vdev_neterr(vdev, "Error %d devcmd %d\n", in _vnic_dev_cmd()
269 vdev->args[i] = readq(&devcmd->args[i]); in _vnic_dev_cmd()
276 vdev_neterr(vdev, "Timedout devcmd %d\n", _CMD_N(cmd)); in _vnic_dev_cmd()
280 static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in _vnic_dev_cmd2() argument
283 struct devcmd2_controller *dc2c = vdev->devcmd2; in _vnic_dev_cmd2()
299 vdev_neterr(vdev, "devcmd2 %d: wq is full. fetch index: %u, posted index: %u\n", in _vnic_dev_cmd2()
310 dc2c->cmd_ring[posted].args[i] = vdev->args[i]; in _vnic_dev_cmd2()
338 vdev_neterr(vdev, "Error %d devcmd %d\n", in _vnic_dev_cmd2()
344 vdev->args[i] = result->results[i]; in _vnic_dev_cmd2()
351 vdev_neterr(vdev, "devcmd %d timed out\n", _CMD_N(cmd)); in _vnic_dev_cmd2()
356 static int vnic_dev_init_devcmd1(struct vnic_dev *vdev) in vnic_dev_init_devcmd1() argument
358 vdev->devcmd = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD, 0); in vnic_dev_init_devcmd1()
359 if (!vdev->devcmd) in vnic_dev_init_devcmd1()
361 vdev->devcmd_rtn = _vnic_dev_cmd; in vnic_dev_init_devcmd1()
366 static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) in vnic_dev_init_devcmd2() argument
371 if (vdev->devcmd2) in vnic_dev_init_devcmd2()
374 vdev->devcmd2 = kzalloc(sizeof(*vdev->devcmd2), GFP_KERNEL); in vnic_dev_init_devcmd2()
375 if (!vdev->devcmd2) in vnic_dev_init_devcmd2()
378 vdev->devcmd2->color = 1; in vnic_dev_init_devcmd2()
379 vdev->devcmd2->result_size = DEVCMD2_RING_SIZE; in vnic_dev_init_devcmd2()
380 err = enic_wq_devcmd2_alloc(vdev, &vdev->devcmd2->wq, DEVCMD2_RING_SIZE, in vnic_dev_init_devcmd2()
385 fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index); in vnic_dev_init_devcmd2()
387 vdev_err(vdev, "Fatal error in devcmd2 init - hardware surprise removal\n"); in vnic_dev_init_devcmd2()
392 enic_wq_init_start(&vdev->devcmd2->wq, 0, fetch_index, fetch_index, 0, in vnic_dev_init_devcmd2()
394 vdev->devcmd2->posted = fetch_index; in vnic_dev_init_devcmd2()
395 vnic_wq_enable(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
397 err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, in vnic_dev_init_devcmd2()
402 vdev->devcmd2->result = vdev->devcmd2->results_ring.descs; in vnic_dev_init_devcmd2()
403 vdev->devcmd2->cmd_ring = vdev->devcmd2->wq.ring.descs; in vnic_dev_init_devcmd2()
404 vdev->devcmd2->wq_ctrl = vdev->devcmd2->wq.ctrl; in vnic_dev_init_devcmd2()
405 vdev->args[0] = (u64)vdev->devcmd2->results_ring.base_addr | in vnic_dev_init_devcmd2()
407 vdev->args[1] = DEVCMD2_RING_SIZE; in vnic_dev_init_devcmd2()
409 err = _vnic_dev_cmd2(vdev, CMD_INITIALIZE_DEVCMD2, 1000); in vnic_dev_init_devcmd2()
413 vdev->devcmd_rtn = _vnic_dev_cmd2; in vnic_dev_init_devcmd2()
418 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); in vnic_dev_init_devcmd2()
420 vnic_wq_disable(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
422 vnic_wq_free(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
424 kfree(vdev->devcmd2); in vnic_dev_init_devcmd2()
425 vdev->devcmd2 = NULL; in vnic_dev_init_devcmd2()
430 static void vnic_dev_deinit_devcmd2(struct vnic_dev *vdev) in vnic_dev_deinit_devcmd2() argument
432 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); in vnic_dev_deinit_devcmd2()
433 vnic_wq_disable(&vdev->devcmd2->wq); in vnic_dev_deinit_devcmd2()
434 vnic_wq_free(&vdev->devcmd2->wq); in vnic_dev_deinit_devcmd2()
435 kfree(vdev->devcmd2); in vnic_dev_deinit_devcmd2()
438 static int vnic_dev_cmd_proxy(struct vnic_dev *vdev, in vnic_dev_cmd_proxy() argument
445 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_cmd_proxy()
447 vdev->args[0] = vdev->proxy_index; in vnic_dev_cmd_proxy()
448 vdev->args[1] = cmd; in vnic_dev_cmd_proxy()
449 vdev->args[2] = *a0; in vnic_dev_cmd_proxy()
450 vdev->args[3] = *a1; in vnic_dev_cmd_proxy()
452 err = vdev->devcmd_rtn(vdev, proxy_cmd, wait); in vnic_dev_cmd_proxy()
456 status = (u32)vdev->args[0]; in vnic_dev_cmd_proxy()
458 err = (int)vdev->args[1]; in vnic_dev_cmd_proxy()
461 vdev_neterr(vdev, "Error %d proxy devcmd %d\n", in vnic_dev_cmd_proxy()
466 *a0 = vdev->args[1]; in vnic_dev_cmd_proxy()
467 *a1 = vdev->args[2]; in vnic_dev_cmd_proxy()
472 static int vnic_dev_cmd_no_proxy(struct vnic_dev *vdev, in vnic_dev_cmd_no_proxy() argument
477 vdev->args[0] = *a0; in vnic_dev_cmd_no_proxy()
478 vdev->args[1] = *a1; in vnic_dev_cmd_no_proxy()
480 err = vdev->devcmd_rtn(vdev, cmd, wait); in vnic_dev_cmd_no_proxy()
482 *a0 = vdev->args[0]; in vnic_dev_cmd_no_proxy()
483 *a1 = vdev->args[1]; in vnic_dev_cmd_no_proxy()
488 void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index) in vnic_dev_cmd_proxy_by_index_start() argument
490 vdev->proxy = PROXY_BY_INDEX; in vnic_dev_cmd_proxy_by_index_start()
491 vdev->proxy_index = index; in vnic_dev_cmd_proxy_by_index_start()
494 void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev) in vnic_dev_cmd_proxy_end() argument
496 vdev->proxy = PROXY_NONE; in vnic_dev_cmd_proxy_end()
497 vdev->proxy_index = 0; in vnic_dev_cmd_proxy_end()
500 int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in vnic_dev_cmd() argument
503 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_cmd()
505 switch (vdev->proxy) { in vnic_dev_cmd()
507 return vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_INDEX, cmd, in vnic_dev_cmd()
510 return vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_BDF, cmd, in vnic_dev_cmd()
514 return vnic_dev_cmd_no_proxy(vdev, cmd, a0, a1, wait); in vnic_dev_cmd()
518 static int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd) in vnic_dev_capable() argument
524 err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait); in vnic_dev_capable()
529 int vnic_dev_fw_info(struct vnic_dev *vdev, in vnic_dev_fw_info() argument
536 if (!vdev->fw_info) { in vnic_dev_fw_info()
537 vdev->fw_info = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_fw_info()
539 &vdev->fw_info_pa, GFP_ATOMIC); in vnic_dev_fw_info()
540 if (!vdev->fw_info) in vnic_dev_fw_info()
543 a0 = vdev->fw_info_pa; in vnic_dev_fw_info()
547 if (vnic_dev_capable(vdev, CMD_MCPU_FW_INFO)) in vnic_dev_fw_info()
548 err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO, in vnic_dev_fw_info()
551 err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO_OLD, in vnic_dev_fw_info()
555 *fw_info = vdev->fw_info; in vnic_dev_fw_info()
560 int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, in vnic_dev_spec() argument
570 err = vnic_dev_cmd(vdev, CMD_DEV_SPEC, &a0, &a1, wait); in vnic_dev_spec()
583 int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) in vnic_dev_stats_dump() argument
588 if (!vdev->stats) { in vnic_dev_stats_dump()
589 vdev->stats = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_stats_dump()
591 &vdev->stats_pa, GFP_ATOMIC); in vnic_dev_stats_dump()
592 if (!vdev->stats) in vnic_dev_stats_dump()
596 *stats = vdev->stats; in vnic_dev_stats_dump()
597 a0 = vdev->stats_pa; in vnic_dev_stats_dump()
600 return vnic_dev_cmd(vdev, CMD_STATS_DUMP, &a0, &a1, wait); in vnic_dev_stats_dump()
603 int vnic_dev_close(struct vnic_dev *vdev) in vnic_dev_close() argument
607 return vnic_dev_cmd(vdev, CMD_CLOSE, &a0, &a1, wait); in vnic_dev_close()
610 int vnic_dev_enable_wait(struct vnic_dev *vdev) in vnic_dev_enable_wait() argument
615 if (vnic_dev_capable(vdev, CMD_ENABLE_WAIT)) in vnic_dev_enable_wait()
616 return vnic_dev_cmd(vdev, CMD_ENABLE_WAIT, &a0, &a1, wait); in vnic_dev_enable_wait()
618 return vnic_dev_cmd(vdev, CMD_ENABLE, &a0, &a1, wait); in vnic_dev_enable_wait()
621 int vnic_dev_disable(struct vnic_dev *vdev) in vnic_dev_disable() argument
625 return vnic_dev_cmd(vdev, CMD_DISABLE, &a0, &a1, wait); in vnic_dev_disable()
628 int vnic_dev_open(struct vnic_dev *vdev, int arg) in vnic_dev_open() argument
632 return vnic_dev_cmd(vdev, CMD_OPEN, &a0, &a1, wait); in vnic_dev_open()
635 int vnic_dev_open_done(struct vnic_dev *vdev, int *done) in vnic_dev_open_done() argument
643 err = vnic_dev_cmd(vdev, CMD_OPEN_STATUS, &a0, &a1, wait); in vnic_dev_open_done()
652 int vnic_dev_soft_reset(struct vnic_dev *vdev, int arg) in vnic_dev_soft_reset() argument
656 return vnic_dev_cmd(vdev, CMD_SOFT_RESET, &a0, &a1, wait); in vnic_dev_soft_reset()
659 int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) in vnic_dev_soft_reset_done() argument
667 err = vnic_dev_cmd(vdev, CMD_SOFT_RESET_STATUS, &a0, &a1, wait); in vnic_dev_soft_reset_done()
676 int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg) in vnic_dev_hang_reset() argument
682 if (vnic_dev_capable(vdev, CMD_HANG_RESET)) { in vnic_dev_hang_reset()
683 return vnic_dev_cmd(vdev, CMD_HANG_RESET, in vnic_dev_hang_reset()
686 err = vnic_dev_soft_reset(vdev, arg); in vnic_dev_hang_reset()
689 return vnic_dev_init(vdev, 0); in vnic_dev_hang_reset()
693 int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done) in vnic_dev_hang_reset_done() argument
701 if (vnic_dev_capable(vdev, CMD_HANG_RESET_STATUS)) { in vnic_dev_hang_reset_done()
702 err = vnic_dev_cmd(vdev, CMD_HANG_RESET_STATUS, in vnic_dev_hang_reset_done()
707 return vnic_dev_soft_reset_done(vdev, done); in vnic_dev_hang_reset_done()
715 int vnic_dev_hang_notify(struct vnic_dev *vdev) in vnic_dev_hang_notify() argument
719 return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); in vnic_dev_hang_notify()
722 int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) in vnic_dev_get_mac_addr() argument
731 err = vnic_dev_cmd(vdev, CMD_GET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_get_mac_addr()
741 int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, in vnic_dev_packet_filter() argument
754 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); in vnic_dev_packet_filter()
756 vdev_neterr(vdev, "Can't set packet filter\n"); in vnic_dev_packet_filter()
761 int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr) in vnic_dev_add_addr() argument
771 err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); in vnic_dev_add_addr()
773 vdev_neterr(vdev, "Can't add addr [%pM], %d\n", addr, err); in vnic_dev_add_addr()
778 int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr) in vnic_dev_del_addr() argument
788 err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); in vnic_dev_del_addr()
790 vdev_neterr(vdev, "Can't del addr [%pM], %d\n", addr, err); in vnic_dev_del_addr()
795 int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev, in vnic_dev_set_ig_vlan_rewrite_mode() argument
801 if (vnic_dev_capable(vdev, CMD_IG_VLAN_REWRITE_MODE)) in vnic_dev_set_ig_vlan_rewrite_mode()
802 return vnic_dev_cmd(vdev, CMD_IG_VLAN_REWRITE_MODE, in vnic_dev_set_ig_vlan_rewrite_mode()
808 static int vnic_dev_notify_setcmd(struct vnic_dev *vdev, in vnic_dev_notify_setcmd() argument
816 vdev->notify = notify_addr; in vnic_dev_notify_setcmd()
817 vdev->notify_pa = notify_pa; in vnic_dev_notify_setcmd()
823 r = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); in vnic_dev_notify_setcmd()
824 vdev->notify_sz = (r == 0) ? (u32)a1 : 0; in vnic_dev_notify_setcmd()
828 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) in vnic_dev_notify_set() argument
833 if (vdev->notify || vdev->notify_pa) { in vnic_dev_notify_set()
834 vdev_neterr(vdev, "notify block %p still allocated\n", in vnic_dev_notify_set()
835 vdev->notify); in vnic_dev_notify_set()
839 notify_addr = dma_alloc_coherent(&vdev->pdev->dev, in vnic_dev_notify_set()
845 return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr); in vnic_dev_notify_set()
848 static int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev) in vnic_dev_notify_unsetcmd() argument
858 err = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); in vnic_dev_notify_unsetcmd()
859 vdev->notify = NULL; in vnic_dev_notify_unsetcmd()
860 vdev->notify_pa = 0; in vnic_dev_notify_unsetcmd()
861 vdev->notify_sz = 0; in vnic_dev_notify_unsetcmd()
866 int vnic_dev_notify_unset(struct vnic_dev *vdev) in vnic_dev_notify_unset() argument
868 if (vdev->notify) { in vnic_dev_notify_unset()
869 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_notify_unset()
871 vdev->notify, vdev->notify_pa); in vnic_dev_notify_unset()
874 return vnic_dev_notify_unsetcmd(vdev); in vnic_dev_notify_unset()
877 static int vnic_dev_notify_ready(struct vnic_dev *vdev) in vnic_dev_notify_ready() argument
880 unsigned int nwords = vdev->notify_sz / 4; in vnic_dev_notify_ready()
884 if (!vdev->notify || !vdev->notify_sz) in vnic_dev_notify_ready()
889 memcpy(&vdev->notify_copy, vdev->notify, vdev->notify_sz); in vnic_dev_notify_ready()
890 words = (u32 *)&vdev->notify_copy; in vnic_dev_notify_ready()
898 int vnic_dev_init(struct vnic_dev *vdev, int arg) in vnic_dev_init() argument
904 if (vnic_dev_capable(vdev, CMD_INIT)) in vnic_dev_init()
905 r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait); in vnic_dev_init()
907 vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait); in vnic_dev_init()
912 vnic_dev_cmd(vdev, CMD_GET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_init()
913 vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); in vnic_dev_init()
919 int vnic_dev_deinit(struct vnic_dev *vdev) in vnic_dev_deinit() argument
924 return vnic_dev_cmd(vdev, CMD_DEINIT, &a0, &a1, wait); in vnic_dev_deinit()
927 void vnic_dev_intr_coal_timer_info_default(struct vnic_dev *vdev) in vnic_dev_intr_coal_timer_info_default() argument
930 vdev->intr_coal_timer_info.mul = 2; in vnic_dev_intr_coal_timer_info_default()
931 vdev->intr_coal_timer_info.div = 3; in vnic_dev_intr_coal_timer_info_default()
932 vdev->intr_coal_timer_info.max_usec = in vnic_dev_intr_coal_timer_info_default()
933 vnic_dev_intr_coal_timer_hw_to_usec(vdev, 0xffff); in vnic_dev_intr_coal_timer_info_default()
936 int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev) in vnic_dev_intr_coal_timer_info() argument
941 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_intr_coal_timer_info()
943 if (vnic_dev_capable(vdev, CMD_INTR_COAL_CONVERT)) in vnic_dev_intr_coal_timer_info()
944 err = vdev->devcmd_rtn(vdev, CMD_INTR_COAL_CONVERT, wait); in vnic_dev_intr_coal_timer_info()
952 (!err && !(vdev->args[0] && vdev->args[1] && vdev->args[2]))) { in vnic_dev_intr_coal_timer_info()
953 vdev_netwarn(vdev, "Using default conversion factor for interrupt coalesce timer\n"); in vnic_dev_intr_coal_timer_info()
954 vnic_dev_intr_coal_timer_info_default(vdev); in vnic_dev_intr_coal_timer_info()
959 vdev->intr_coal_timer_info.mul = (u32) vdev->args[0]; in vnic_dev_intr_coal_timer_info()
960 vdev->intr_coal_timer_info.div = (u32) vdev->args[1]; in vnic_dev_intr_coal_timer_info()
961 vdev->intr_coal_timer_info.max_usec = (u32) vdev->args[2]; in vnic_dev_intr_coal_timer_info()
967 int vnic_dev_link_status(struct vnic_dev *vdev) in vnic_dev_link_status() argument
969 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_link_status()
972 return vdev->notify_copy.link_state; in vnic_dev_link_status()
975 u32 vnic_dev_port_speed(struct vnic_dev *vdev) in vnic_dev_port_speed() argument
977 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_port_speed()
980 return vdev->notify_copy.port_speed; in vnic_dev_port_speed()
983 u32 vnic_dev_msg_lvl(struct vnic_dev *vdev) in vnic_dev_msg_lvl() argument
985 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_msg_lvl()
988 return vdev->notify_copy.msglvl; in vnic_dev_msg_lvl()
991 u32 vnic_dev_mtu(struct vnic_dev *vdev) in vnic_dev_mtu() argument
993 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_mtu()
996 return vdev->notify_copy.mtu; in vnic_dev_mtu()
999 void vnic_dev_set_intr_mode(struct vnic_dev *vdev, in vnic_dev_set_intr_mode() argument
1002 vdev->intr_mode = intr_mode; in vnic_dev_set_intr_mode()
1006 struct vnic_dev *vdev) in vnic_dev_get_intr_mode() argument
1008 return vdev->intr_mode; in vnic_dev_get_intr_mode()
1011 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
1013 return (usec * vdev->intr_coal_timer_info.mul) / in vnic_dev_intr_coal_timer_usec_to_hw()
1014 vdev->intr_coal_timer_info.div; in vnic_dev_intr_coal_timer_usec_to_hw()
1017 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
1019 return (hw_cycles * vdev->intr_coal_timer_info.div) / in vnic_dev_intr_coal_timer_hw_to_usec()
1020 vdev->intr_coal_timer_info.mul; in vnic_dev_intr_coal_timer_hw_to_usec()
1023 u32 vnic_dev_get_intr_coal_timer_max(struct vnic_dev *vdev) in vnic_dev_get_intr_coal_timer_max() argument
1025 return vdev->intr_coal_timer_info.max_usec; in vnic_dev_get_intr_coal_timer_max()
1028 void vnic_dev_unregister(struct vnic_dev *vdev) in vnic_dev_unregister() argument
1030 if (vdev) { in vnic_dev_unregister()
1031 if (vdev->notify) in vnic_dev_unregister()
1032 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_unregister()
1034 vdev->notify, vdev->notify_pa); in vnic_dev_unregister()
1035 if (vdev->stats) in vnic_dev_unregister()
1036 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_unregister()
1038 vdev->stats, vdev->stats_pa); in vnic_dev_unregister()
1039 if (vdev->fw_info) in vnic_dev_unregister()
1040 dma_free_coherent(&vdev->pdev->dev, in vnic_dev_unregister()
1042 vdev->fw_info, vdev->fw_info_pa); in vnic_dev_unregister()
1043 if (vdev->devcmd2) in vnic_dev_unregister()
1044 vnic_dev_deinit_devcmd2(vdev); in vnic_dev_unregister()
1046 kfree(vdev); in vnic_dev_unregister()
1051 struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, in vnic_dev_register() argument
1055 if (!vdev) { in vnic_dev_register()
1056 vdev = kzalloc(sizeof(struct vnic_dev), GFP_KERNEL); in vnic_dev_register()
1057 if (!vdev) in vnic_dev_register()
1061 vdev->priv = priv; in vnic_dev_register()
1062 vdev->pdev = pdev; in vnic_dev_register()
1064 if (vnic_dev_discover_res(vdev, bar, num_bars)) in vnic_dev_register()
1067 return vdev; in vnic_dev_register()
1070 vnic_dev_unregister(vdev); in vnic_dev_register()
1075 struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev) in vnic_dev_get_pdev() argument
1077 return vdev->pdev; in vnic_dev_get_pdev()
1081 int vnic_devcmd_init(struct vnic_dev *vdev) in vnic_devcmd_init() argument
1086 res = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD2, 0); in vnic_devcmd_init()
1088 err = vnic_dev_init_devcmd2(vdev); in vnic_devcmd_init()
1090 vdev_warn(vdev, "DEVCMD2 init failed: %d, Using DEVCMD1\n", in vnic_devcmd_init()
1095 vdev_warn(vdev, "DEVCMD2 resource not found (old firmware?) Using DEVCMD1\n"); in vnic_devcmd_init()
1097 err = vnic_dev_init_devcmd1(vdev); in vnic_devcmd_init()
1099 vdev_err(vdev, "DEVCMD1 initialization failed: %d\n", err); in vnic_devcmd_init()
1104 int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len) in vnic_dev_init_prov2() argument
1112 prov_buf = dma_alloc_coherent(&vdev->pdev->dev, len, &prov_pa, GFP_ATOMIC); in vnic_dev_init_prov2()
1120 ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO2, &a0, &a1, wait); in vnic_dev_init_prov2()
1122 dma_free_coherent(&vdev->pdev->dev, len, prov_buf, prov_pa); in vnic_dev_init_prov2()
1127 int vnic_dev_enable2(struct vnic_dev *vdev, int active) in vnic_dev_enable2() argument
1134 return vnic_dev_cmd(vdev, CMD_ENABLE2, &a0, &a1, wait); in vnic_dev_enable2()
1137 static int vnic_dev_cmd_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in vnic_dev_cmd_status() argument
1144 ret = vnic_dev_cmd(vdev, CMD_STATUS, &a0, &a1, wait); in vnic_dev_cmd_status()
1151 int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status) in vnic_dev_enable2_done() argument
1153 return vnic_dev_cmd_status(vdev, CMD_ENABLE2, status); in vnic_dev_enable2_done()
1156 int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status) in vnic_dev_deinit_done() argument
1158 return vnic_dev_cmd_status(vdev, CMD_DEINIT, status); in vnic_dev_deinit_done()
1161 int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) in vnic_dev_set_mac_addr() argument
1170 return vnic_dev_cmd(vdev, CMD_SET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_set_mac_addr()
1174 * @vdev: vdev of the device
1187 int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry, in vnic_dev_classifier() argument
1202 tlv_va = dma_alloc_coherent(&vdev->pdev->dev, tlv_size, in vnic_dev_classifier()
1224 ret = vnic_dev_cmd(vdev, CMD_ADD_FILTER, &a0, &a1, wait); in vnic_dev_classifier()
1226 dma_free_coherent(&vdev->pdev->dev, tlv_size, tlv_va, tlv_pa); in vnic_dev_classifier()
1229 ret = vnic_dev_cmd(vdev, CMD_DEL_FILTER, &a0, &a1, wait); in vnic_dev_classifier()
1235 int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev, u8 overlay, u8 config) in vnic_dev_overlay_offload_ctrl() argument
1241 return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CTRL, &a0, &a1, wait); in vnic_dev_overlay_offload_ctrl()
1244 int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay, in vnic_dev_overlay_offload_cfg() argument
1251 return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CFG, &a0, &a1, wait); in vnic_dev_overlay_offload_cfg()
1254 int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature, in vnic_dev_get_supported_feature_ver() argument
1261 ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, a1, wait); in vnic_dev_get_supported_feature_ver()
1268 int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type) in vnic_dev_capable_rss_hash_type() argument
1274 err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait); in vnic_dev_capable_rss_hash_type()