Lines Matching refs:vdev
39 void *vnic_dev_priv(struct vnic_dev *vdev) in vnic_dev_priv() argument
41 return vdev->priv; in vnic_dev_priv()
44 static int vnic_dev_discover_res(struct vnic_dev *vdev, in vnic_dev_discover_res() argument
56 vdev_err(vdev, "vNIC BAR0 res hdr length error\n"); in vnic_dev_discover_res()
63 vdev_err(vdev, "vNIC BAR0 res hdr not mem-mapped\n"); in vnic_dev_discover_res()
72 vdev_err(vdev, "vNIC BAR0 res magic/version error exp (%lx/%lx) or (%lx/%lx), curr (%x/%x)\n", in vnic_dev_discover_res()
109 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()
124 vdev->res[type].count = count; in vnic_dev_discover_res()
125 vdev->res[type].vaddr = (char __iomem *)bar[bar_num].vaddr + in vnic_dev_discover_res()
127 vdev->res[type].bus_addr = bar[bar_num].bus_addr + bar_offset; in vnic_dev_discover_res()
133 unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev, in vnic_dev_get_res_count() argument
136 return vdev->res[type].count; in vnic_dev_get_res_count()
140 void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type, in vnic_dev_get_res() argument
143 if (!vdev->res[type].vaddr) in vnic_dev_get_res()
151 return (char __iomem *)vdev->res[type].vaddr + in vnic_dev_get_res()
154 return (char __iomem *)vdev->res[type].vaddr; in vnic_dev_get_res()
191 int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, in vnic_dev_alloc_desc_ring() argument
196 ring->descs_unaligned = pci_alloc_consistent(vdev->pdev, in vnic_dev_alloc_desc_ring()
201 vdev_err(vdev, "Failed to allocate ring (size=%d), aborting\n", in vnic_dev_alloc_desc_ring()
218 void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring) in vnic_dev_free_desc_ring() argument
221 pci_free_consistent(vdev->pdev, in vnic_dev_free_desc_ring()
229 static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in _vnic_dev_cmd() argument
232 struct vnic_devcmd __iomem *devcmd = vdev->devcmd; in _vnic_dev_cmd()
244 vdev_neterr(vdev, "Busy devcmd %d\n", _CMD_N(cmd)); in _vnic_dev_cmd()
250 writeq(vdev->args[i], &devcmd->args[i]); in _vnic_dev_cmd()
278 vdev_neterr(vdev, "Error %d devcmd %d\n", in _vnic_dev_cmd()
286 vdev->args[i] = readq(&devcmd->args[i]); in _vnic_dev_cmd()
293 vdev_neterr(vdev, "Timedout devcmd %d\n", _CMD_N(cmd)); in _vnic_dev_cmd()
297 static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in _vnic_dev_cmd2() argument
300 struct devcmd2_controller *dc2c = vdev->devcmd2; in _vnic_dev_cmd2()
316 vdev_neterr(vdev, "devcmd2 %d: wq is full. fetch index: %u, posted index: %u\n", in _vnic_dev_cmd2()
327 dc2c->cmd_ring[posted].args[i] = vdev->args[i]; in _vnic_dev_cmd2()
355 vdev_neterr(vdev, "Error %d devcmd %d\n", in _vnic_dev_cmd2()
361 vdev->args[i] = result->results[i]; in _vnic_dev_cmd2()
368 vdev_neterr(vdev, "devcmd %d timed out\n", _CMD_N(cmd)); in _vnic_dev_cmd2()
373 static int vnic_dev_init_devcmd1(struct vnic_dev *vdev) in vnic_dev_init_devcmd1() argument
375 vdev->devcmd = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD, 0); in vnic_dev_init_devcmd1()
376 if (!vdev->devcmd) in vnic_dev_init_devcmd1()
378 vdev->devcmd_rtn = _vnic_dev_cmd; in vnic_dev_init_devcmd1()
383 static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) in vnic_dev_init_devcmd2() argument
388 if (vdev->devcmd2) in vnic_dev_init_devcmd2()
391 vdev->devcmd2 = kzalloc(sizeof(*vdev->devcmd2), GFP_KERNEL); in vnic_dev_init_devcmd2()
392 if (!vdev->devcmd2) in vnic_dev_init_devcmd2()
395 vdev->devcmd2->color = 1; in vnic_dev_init_devcmd2()
396 vdev->devcmd2->result_size = DEVCMD2_RING_SIZE; in vnic_dev_init_devcmd2()
397 err = enic_wq_devcmd2_alloc(vdev, &vdev->devcmd2->wq, DEVCMD2_RING_SIZE, in vnic_dev_init_devcmd2()
402 fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index); in vnic_dev_init_devcmd2()
404 vdev_err(vdev, "Fatal error in devcmd2 init - hardware surprise removal\n"); in vnic_dev_init_devcmd2()
409 enic_wq_init_start(&vdev->devcmd2->wq, 0, fetch_index, fetch_index, 0, in vnic_dev_init_devcmd2()
411 vdev->devcmd2->posted = fetch_index; in vnic_dev_init_devcmd2()
412 vnic_wq_enable(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
414 err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, in vnic_dev_init_devcmd2()
419 vdev->devcmd2->result = vdev->devcmd2->results_ring.descs; in vnic_dev_init_devcmd2()
420 vdev->devcmd2->cmd_ring = vdev->devcmd2->wq.ring.descs; in vnic_dev_init_devcmd2()
421 vdev->devcmd2->wq_ctrl = vdev->devcmd2->wq.ctrl; in vnic_dev_init_devcmd2()
422 vdev->args[0] = (u64)vdev->devcmd2->results_ring.base_addr | in vnic_dev_init_devcmd2()
424 vdev->args[1] = DEVCMD2_RING_SIZE; in vnic_dev_init_devcmd2()
426 err = _vnic_dev_cmd2(vdev, CMD_INITIALIZE_DEVCMD2, 1000); in vnic_dev_init_devcmd2()
430 vdev->devcmd_rtn = _vnic_dev_cmd2; in vnic_dev_init_devcmd2()
435 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); in vnic_dev_init_devcmd2()
437 vnic_wq_disable(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
439 vnic_wq_free(&vdev->devcmd2->wq); in vnic_dev_init_devcmd2()
441 kfree(vdev->devcmd2); in vnic_dev_init_devcmd2()
442 vdev->devcmd2 = NULL; in vnic_dev_init_devcmd2()
447 static void vnic_dev_deinit_devcmd2(struct vnic_dev *vdev) in vnic_dev_deinit_devcmd2() argument
449 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); in vnic_dev_deinit_devcmd2()
450 vnic_wq_disable(&vdev->devcmd2->wq); in vnic_dev_deinit_devcmd2()
451 vnic_wq_free(&vdev->devcmd2->wq); in vnic_dev_deinit_devcmd2()
452 kfree(vdev->devcmd2); in vnic_dev_deinit_devcmd2()
455 static int vnic_dev_cmd_proxy(struct vnic_dev *vdev, in vnic_dev_cmd_proxy() argument
462 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_cmd_proxy()
464 vdev->args[0] = vdev->proxy_index; in vnic_dev_cmd_proxy()
465 vdev->args[1] = cmd; in vnic_dev_cmd_proxy()
466 vdev->args[2] = *a0; in vnic_dev_cmd_proxy()
467 vdev->args[3] = *a1; in vnic_dev_cmd_proxy()
469 err = vdev->devcmd_rtn(vdev, proxy_cmd, wait); in vnic_dev_cmd_proxy()
473 status = (u32)vdev->args[0]; in vnic_dev_cmd_proxy()
475 err = (int)vdev->args[1]; in vnic_dev_cmd_proxy()
478 vdev_neterr(vdev, "Error %d proxy devcmd %d\n", in vnic_dev_cmd_proxy()
483 *a0 = vdev->args[1]; in vnic_dev_cmd_proxy()
484 *a1 = vdev->args[2]; in vnic_dev_cmd_proxy()
489 static int vnic_dev_cmd_no_proxy(struct vnic_dev *vdev, in vnic_dev_cmd_no_proxy() argument
494 vdev->args[0] = *a0; in vnic_dev_cmd_no_proxy()
495 vdev->args[1] = *a1; in vnic_dev_cmd_no_proxy()
497 err = vdev->devcmd_rtn(vdev, cmd, wait); in vnic_dev_cmd_no_proxy()
499 *a0 = vdev->args[0]; in vnic_dev_cmd_no_proxy()
500 *a1 = vdev->args[1]; in vnic_dev_cmd_no_proxy()
505 void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index) in vnic_dev_cmd_proxy_by_index_start() argument
507 vdev->proxy = PROXY_BY_INDEX; in vnic_dev_cmd_proxy_by_index_start()
508 vdev->proxy_index = index; in vnic_dev_cmd_proxy_by_index_start()
511 void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev) in vnic_dev_cmd_proxy_end() argument
513 vdev->proxy = PROXY_NONE; in vnic_dev_cmd_proxy_end()
514 vdev->proxy_index = 0; in vnic_dev_cmd_proxy_end()
517 int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in vnic_dev_cmd() argument
520 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_cmd()
522 switch (vdev->proxy) { in vnic_dev_cmd()
524 return vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_INDEX, cmd, in vnic_dev_cmd()
527 return vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_BDF, cmd, in vnic_dev_cmd()
531 return vnic_dev_cmd_no_proxy(vdev, cmd, a0, a1, wait); in vnic_dev_cmd()
535 static int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd) in vnic_dev_capable() argument
541 err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait); in vnic_dev_capable()
546 int vnic_dev_fw_info(struct vnic_dev *vdev, in vnic_dev_fw_info() argument
553 if (!vdev->fw_info) { in vnic_dev_fw_info()
554 vdev->fw_info = pci_zalloc_consistent(vdev->pdev, in vnic_dev_fw_info()
556 &vdev->fw_info_pa); in vnic_dev_fw_info()
557 if (!vdev->fw_info) in vnic_dev_fw_info()
560 a0 = vdev->fw_info_pa; in vnic_dev_fw_info()
564 if (vnic_dev_capable(vdev, CMD_MCPU_FW_INFO)) in vnic_dev_fw_info()
565 err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO, in vnic_dev_fw_info()
568 err = vnic_dev_cmd(vdev, CMD_MCPU_FW_INFO_OLD, in vnic_dev_fw_info()
572 *fw_info = vdev->fw_info; in vnic_dev_fw_info()
577 int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, in vnic_dev_spec() argument
587 err = vnic_dev_cmd(vdev, CMD_DEV_SPEC, &a0, &a1, wait); in vnic_dev_spec()
600 int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) in vnic_dev_stats_dump() argument
605 if (!vdev->stats) { in vnic_dev_stats_dump()
606 vdev->stats = pci_alloc_consistent(vdev->pdev, in vnic_dev_stats_dump()
607 sizeof(struct vnic_stats), &vdev->stats_pa); in vnic_dev_stats_dump()
608 if (!vdev->stats) in vnic_dev_stats_dump()
612 *stats = vdev->stats; in vnic_dev_stats_dump()
613 a0 = vdev->stats_pa; in vnic_dev_stats_dump()
616 return vnic_dev_cmd(vdev, CMD_STATS_DUMP, &a0, &a1, wait); in vnic_dev_stats_dump()
619 int vnic_dev_close(struct vnic_dev *vdev) in vnic_dev_close() argument
623 return vnic_dev_cmd(vdev, CMD_CLOSE, &a0, &a1, wait); in vnic_dev_close()
626 int vnic_dev_enable_wait(struct vnic_dev *vdev) in vnic_dev_enable_wait() argument
631 if (vnic_dev_capable(vdev, CMD_ENABLE_WAIT)) in vnic_dev_enable_wait()
632 return vnic_dev_cmd(vdev, CMD_ENABLE_WAIT, &a0, &a1, wait); in vnic_dev_enable_wait()
634 return vnic_dev_cmd(vdev, CMD_ENABLE, &a0, &a1, wait); in vnic_dev_enable_wait()
637 int vnic_dev_disable(struct vnic_dev *vdev) in vnic_dev_disable() argument
641 return vnic_dev_cmd(vdev, CMD_DISABLE, &a0, &a1, wait); in vnic_dev_disable()
644 int vnic_dev_open(struct vnic_dev *vdev, int arg) in vnic_dev_open() argument
648 return vnic_dev_cmd(vdev, CMD_OPEN, &a0, &a1, wait); in vnic_dev_open()
651 int vnic_dev_open_done(struct vnic_dev *vdev, int *done) in vnic_dev_open_done() argument
659 err = vnic_dev_cmd(vdev, CMD_OPEN_STATUS, &a0, &a1, wait); in vnic_dev_open_done()
668 int vnic_dev_soft_reset(struct vnic_dev *vdev, int arg) in vnic_dev_soft_reset() argument
672 return vnic_dev_cmd(vdev, CMD_SOFT_RESET, &a0, &a1, wait); in vnic_dev_soft_reset()
675 int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) in vnic_dev_soft_reset_done() argument
683 err = vnic_dev_cmd(vdev, CMD_SOFT_RESET_STATUS, &a0, &a1, wait); in vnic_dev_soft_reset_done()
692 int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg) in vnic_dev_hang_reset() argument
698 if (vnic_dev_capable(vdev, CMD_HANG_RESET)) { in vnic_dev_hang_reset()
699 return vnic_dev_cmd(vdev, CMD_HANG_RESET, in vnic_dev_hang_reset()
702 err = vnic_dev_soft_reset(vdev, arg); in vnic_dev_hang_reset()
705 return vnic_dev_init(vdev, 0); in vnic_dev_hang_reset()
709 int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done) in vnic_dev_hang_reset_done() argument
717 if (vnic_dev_capable(vdev, CMD_HANG_RESET_STATUS)) { in vnic_dev_hang_reset_done()
718 err = vnic_dev_cmd(vdev, CMD_HANG_RESET_STATUS, in vnic_dev_hang_reset_done()
723 return vnic_dev_soft_reset_done(vdev, done); in vnic_dev_hang_reset_done()
731 int vnic_dev_hang_notify(struct vnic_dev *vdev) in vnic_dev_hang_notify() argument
735 return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); in vnic_dev_hang_notify()
738 int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) in vnic_dev_get_mac_addr() argument
747 err = vnic_dev_cmd(vdev, CMD_GET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_get_mac_addr()
757 int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, in vnic_dev_packet_filter() argument
770 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); in vnic_dev_packet_filter()
772 vdev_neterr(vdev, "Can't set packet filter\n"); in vnic_dev_packet_filter()
777 int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr) in vnic_dev_add_addr() argument
787 err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); in vnic_dev_add_addr()
789 vdev_neterr(vdev, "Can't add addr [%pM], %d\n", addr, err); in vnic_dev_add_addr()
794 int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr) in vnic_dev_del_addr() argument
804 err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); in vnic_dev_del_addr()
806 vdev_neterr(vdev, "Can't del addr [%pM], %d\n", addr, err); in vnic_dev_del_addr()
811 int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev, in vnic_dev_set_ig_vlan_rewrite_mode() argument
817 if (vnic_dev_capable(vdev, CMD_IG_VLAN_REWRITE_MODE)) in vnic_dev_set_ig_vlan_rewrite_mode()
818 return vnic_dev_cmd(vdev, CMD_IG_VLAN_REWRITE_MODE, in vnic_dev_set_ig_vlan_rewrite_mode()
824 static int vnic_dev_notify_setcmd(struct vnic_dev *vdev, in vnic_dev_notify_setcmd() argument
832 vdev->notify = notify_addr; in vnic_dev_notify_setcmd()
833 vdev->notify_pa = notify_pa; in vnic_dev_notify_setcmd()
839 r = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); in vnic_dev_notify_setcmd()
840 vdev->notify_sz = (r == 0) ? (u32)a1 : 0; in vnic_dev_notify_setcmd()
844 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) in vnic_dev_notify_set() argument
849 if (vdev->notify || vdev->notify_pa) { in vnic_dev_notify_set()
850 vdev_neterr(vdev, "notify block %p still allocated\n", in vnic_dev_notify_set()
851 vdev->notify); in vnic_dev_notify_set()
855 notify_addr = pci_alloc_consistent(vdev->pdev, in vnic_dev_notify_set()
861 return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr); in vnic_dev_notify_set()
864 static int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev) in vnic_dev_notify_unsetcmd() argument
874 err = vnic_dev_cmd(vdev, CMD_NOTIFY, &a0, &a1, wait); in vnic_dev_notify_unsetcmd()
875 vdev->notify = NULL; in vnic_dev_notify_unsetcmd()
876 vdev->notify_pa = 0; in vnic_dev_notify_unsetcmd()
877 vdev->notify_sz = 0; in vnic_dev_notify_unsetcmd()
882 int vnic_dev_notify_unset(struct vnic_dev *vdev) in vnic_dev_notify_unset() argument
884 if (vdev->notify) { in vnic_dev_notify_unset()
885 pci_free_consistent(vdev->pdev, in vnic_dev_notify_unset()
887 vdev->notify, in vnic_dev_notify_unset()
888 vdev->notify_pa); in vnic_dev_notify_unset()
891 return vnic_dev_notify_unsetcmd(vdev); in vnic_dev_notify_unset()
894 static int vnic_dev_notify_ready(struct vnic_dev *vdev) in vnic_dev_notify_ready() argument
897 unsigned int nwords = vdev->notify_sz / 4; in vnic_dev_notify_ready()
901 if (!vdev->notify || !vdev->notify_sz) in vnic_dev_notify_ready()
906 memcpy(&vdev->notify_copy, vdev->notify, vdev->notify_sz); in vnic_dev_notify_ready()
907 words = (u32 *)&vdev->notify_copy; in vnic_dev_notify_ready()
915 int vnic_dev_init(struct vnic_dev *vdev, int arg) in vnic_dev_init() argument
921 if (vnic_dev_capable(vdev, CMD_INIT)) in vnic_dev_init()
922 r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait); in vnic_dev_init()
924 vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait); in vnic_dev_init()
929 vnic_dev_cmd(vdev, CMD_GET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_init()
930 vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); in vnic_dev_init()
936 int vnic_dev_deinit(struct vnic_dev *vdev) in vnic_dev_deinit() argument
941 return vnic_dev_cmd(vdev, CMD_DEINIT, &a0, &a1, wait); in vnic_dev_deinit()
944 void vnic_dev_intr_coal_timer_info_default(struct vnic_dev *vdev) in vnic_dev_intr_coal_timer_info_default() argument
947 vdev->intr_coal_timer_info.mul = 2; in vnic_dev_intr_coal_timer_info_default()
948 vdev->intr_coal_timer_info.div = 3; in vnic_dev_intr_coal_timer_info_default()
949 vdev->intr_coal_timer_info.max_usec = in vnic_dev_intr_coal_timer_info_default()
950 vnic_dev_intr_coal_timer_hw_to_usec(vdev, 0xffff); in vnic_dev_intr_coal_timer_info_default()
953 int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev) in vnic_dev_intr_coal_timer_info() argument
958 memset(vdev->args, 0, sizeof(vdev->args)); in vnic_dev_intr_coal_timer_info()
960 if (vnic_dev_capable(vdev, CMD_INTR_COAL_CONVERT)) in vnic_dev_intr_coal_timer_info()
961 err = vdev->devcmd_rtn(vdev, CMD_INTR_COAL_CONVERT, wait); in vnic_dev_intr_coal_timer_info()
969 (!err && !(vdev->args[0] && vdev->args[1] && vdev->args[2]))) { in vnic_dev_intr_coal_timer_info()
970 vdev_netwarn(vdev, "Using default conversion factor for interrupt coalesce timer\n"); in vnic_dev_intr_coal_timer_info()
971 vnic_dev_intr_coal_timer_info_default(vdev); in vnic_dev_intr_coal_timer_info()
976 vdev->intr_coal_timer_info.mul = (u32) vdev->args[0]; in vnic_dev_intr_coal_timer_info()
977 vdev->intr_coal_timer_info.div = (u32) vdev->args[1]; in vnic_dev_intr_coal_timer_info()
978 vdev->intr_coal_timer_info.max_usec = (u32) vdev->args[2]; in vnic_dev_intr_coal_timer_info()
984 int vnic_dev_link_status(struct vnic_dev *vdev) in vnic_dev_link_status() argument
986 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_link_status()
989 return vdev->notify_copy.link_state; in vnic_dev_link_status()
992 u32 vnic_dev_port_speed(struct vnic_dev *vdev) in vnic_dev_port_speed() argument
994 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_port_speed()
997 return vdev->notify_copy.port_speed; in vnic_dev_port_speed()
1000 u32 vnic_dev_msg_lvl(struct vnic_dev *vdev) in vnic_dev_msg_lvl() argument
1002 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_msg_lvl()
1005 return vdev->notify_copy.msglvl; in vnic_dev_msg_lvl()
1008 u32 vnic_dev_mtu(struct vnic_dev *vdev) in vnic_dev_mtu() argument
1010 if (!vnic_dev_notify_ready(vdev)) in vnic_dev_mtu()
1013 return vdev->notify_copy.mtu; in vnic_dev_mtu()
1016 void vnic_dev_set_intr_mode(struct vnic_dev *vdev, in vnic_dev_set_intr_mode() argument
1019 vdev->intr_mode = intr_mode; in vnic_dev_set_intr_mode()
1023 struct vnic_dev *vdev) in vnic_dev_get_intr_mode() argument
1025 return vdev->intr_mode; in vnic_dev_get_intr_mode()
1028 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
1030 return (usec * vdev->intr_coal_timer_info.mul) / in vnic_dev_intr_coal_timer_usec_to_hw()
1031 vdev->intr_coal_timer_info.div; in vnic_dev_intr_coal_timer_usec_to_hw()
1034 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
1036 return (hw_cycles * vdev->intr_coal_timer_info.div) / in vnic_dev_intr_coal_timer_hw_to_usec()
1037 vdev->intr_coal_timer_info.mul; in vnic_dev_intr_coal_timer_hw_to_usec()
1040 u32 vnic_dev_get_intr_coal_timer_max(struct vnic_dev *vdev) in vnic_dev_get_intr_coal_timer_max() argument
1042 return vdev->intr_coal_timer_info.max_usec; in vnic_dev_get_intr_coal_timer_max()
1045 void vnic_dev_unregister(struct vnic_dev *vdev) in vnic_dev_unregister() argument
1047 if (vdev) { in vnic_dev_unregister()
1048 if (vdev->notify) in vnic_dev_unregister()
1049 pci_free_consistent(vdev->pdev, in vnic_dev_unregister()
1051 vdev->notify, in vnic_dev_unregister()
1052 vdev->notify_pa); in vnic_dev_unregister()
1053 if (vdev->stats) in vnic_dev_unregister()
1054 pci_free_consistent(vdev->pdev, in vnic_dev_unregister()
1056 vdev->stats, vdev->stats_pa); in vnic_dev_unregister()
1057 if (vdev->fw_info) in vnic_dev_unregister()
1058 pci_free_consistent(vdev->pdev, in vnic_dev_unregister()
1060 vdev->fw_info, vdev->fw_info_pa); in vnic_dev_unregister()
1061 if (vdev->devcmd2) in vnic_dev_unregister()
1062 vnic_dev_deinit_devcmd2(vdev); in vnic_dev_unregister()
1064 kfree(vdev); in vnic_dev_unregister()
1069 struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, in vnic_dev_register() argument
1073 if (!vdev) { in vnic_dev_register()
1074 vdev = kzalloc(sizeof(struct vnic_dev), GFP_KERNEL); in vnic_dev_register()
1075 if (!vdev) in vnic_dev_register()
1079 vdev->priv = priv; in vnic_dev_register()
1080 vdev->pdev = pdev; in vnic_dev_register()
1082 if (vnic_dev_discover_res(vdev, bar, num_bars)) in vnic_dev_register()
1085 return vdev; in vnic_dev_register()
1088 vnic_dev_unregister(vdev); in vnic_dev_register()
1093 struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev) in vnic_dev_get_pdev() argument
1095 return vdev->pdev; in vnic_dev_get_pdev()
1099 int vnic_devcmd_init(struct vnic_dev *vdev) in vnic_devcmd_init() argument
1104 res = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD2, 0); in vnic_devcmd_init()
1106 err = vnic_dev_init_devcmd2(vdev); in vnic_devcmd_init()
1108 vdev_warn(vdev, "DEVCMD2 init failed: %d, Using DEVCMD1\n", in vnic_devcmd_init()
1113 vdev_warn(vdev, "DEVCMD2 resource not found (old firmware?) Using DEVCMD1\n"); in vnic_devcmd_init()
1115 err = vnic_dev_init_devcmd1(vdev); in vnic_devcmd_init()
1117 vdev_err(vdev, "DEVCMD1 initialization failed: %d\n", err); in vnic_devcmd_init()
1122 int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len) in vnic_dev_init_prov2() argument
1130 prov_buf = pci_alloc_consistent(vdev->pdev, len, &prov_pa); in vnic_dev_init_prov2()
1138 ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO2, &a0, &a1, wait); in vnic_dev_init_prov2()
1140 pci_free_consistent(vdev->pdev, len, prov_buf, prov_pa); in vnic_dev_init_prov2()
1145 int vnic_dev_enable2(struct vnic_dev *vdev, int active) in vnic_dev_enable2() argument
1152 return vnic_dev_cmd(vdev, CMD_ENABLE2, &a0, &a1, wait); in vnic_dev_enable2()
1155 static int vnic_dev_cmd_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, in vnic_dev_cmd_status() argument
1162 ret = vnic_dev_cmd(vdev, CMD_STATUS, &a0, &a1, wait); in vnic_dev_cmd_status()
1169 int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status) in vnic_dev_enable2_done() argument
1171 return vnic_dev_cmd_status(vdev, CMD_ENABLE2, status); in vnic_dev_enable2_done()
1174 int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status) in vnic_dev_deinit_done() argument
1176 return vnic_dev_cmd_status(vdev, CMD_DEINIT, status); in vnic_dev_deinit_done()
1179 int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) in vnic_dev_set_mac_addr() argument
1188 return vnic_dev_cmd(vdev, CMD_SET_MAC_ADDR, &a0, &a1, wait); in vnic_dev_set_mac_addr()
1205 int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry, in vnic_dev_classifier() argument
1220 tlv_va = pci_alloc_consistent(vdev->pdev, tlv_size, &tlv_pa); in vnic_dev_classifier()
1241 ret = vnic_dev_cmd(vdev, CMD_ADD_FILTER, &a0, &a1, wait); in vnic_dev_classifier()
1243 pci_free_consistent(vdev->pdev, tlv_size, tlv_va, tlv_pa); in vnic_dev_classifier()
1246 ret = vnic_dev_cmd(vdev, CMD_DEL_FILTER, &a0, &a1, wait); in vnic_dev_classifier()
1252 int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev, u8 overlay, u8 config) in vnic_dev_overlay_offload_ctrl() argument
1258 return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CTRL, &a0, &a1, wait); in vnic_dev_overlay_offload_ctrl()
1261 int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay, in vnic_dev_overlay_offload_cfg() argument
1268 return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CFG, &a0, &a1, wait); in vnic_dev_overlay_offload_cfg()
1271 int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature, in vnic_dev_get_supported_feature_ver() argument
1278 ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, a1, wait); in vnic_dev_get_supported_feature_ver()
1285 int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type) in vnic_dev_capable_rss_hash_type() argument
1291 err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait); in vnic_dev_capable_rss_hash_type()