Lines Matching full:adapter
267 int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_fw_version() argument
270 struct pci_dev *pdev = adapter->pdev; in qlcnic_83xx_get_fw_version()
272 fw_major = QLC_SHARED_REG_RD32(adapter, QLCNIC_FW_VERSION_MAJOR); in qlcnic_83xx_get_fw_version()
273 fw_minor = QLC_SHARED_REG_RD32(adapter, QLCNIC_FW_VERSION_MINOR); in qlcnic_83xx_get_fw_version()
274 fw_build = QLC_SHARED_REG_RD32(adapter, QLCNIC_FW_VERSION_SUB); in qlcnic_83xx_get_fw_version()
275 adapter->fw_version = QLCNIC_VERSION_CODE(fw_major, fw_minor, fw_build); in qlcnic_83xx_get_fw_version()
280 return adapter->fw_version; in qlcnic_83xx_get_fw_version()
283 static int __qlcnic_set_win_base(struct qlcnic_adapter *adapter, u32 addr) in __qlcnic_set_win_base() argument
288 base = adapter->ahw->pci_base0 + in __qlcnic_set_win_base()
289 QLC_83XX_CRB_WIN_FUNC(adapter->ahw->pci_func); in __qlcnic_set_win_base()
298 int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr, in qlcnic_83xx_rd_reg_indirect() argument
301 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_rd_reg_indirect()
303 *err = __qlcnic_set_win_base(adapter, (u32) addr); in qlcnic_83xx_rd_reg_indirect()
307 dev_err(&adapter->pdev->dev, in qlcnic_83xx_rd_reg_indirect()
313 int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *adapter, ulong addr, in qlcnic_83xx_wrt_reg_indirect() argument
317 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_wrt_reg_indirect()
319 err = __qlcnic_set_win_base(adapter, (u32) addr); in qlcnic_83xx_wrt_reg_indirect()
324 dev_err(&adapter->pdev->dev, in qlcnic_83xx_wrt_reg_indirect()
331 static void qlcnic_83xx_enable_legacy(struct qlcnic_adapter *adapter) in qlcnic_83xx_enable_legacy() argument
333 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_enable_legacy()
336 adapter->tgt_status_reg = ahw->pci_base0 + QLC_83XX_INTX_PTR; in qlcnic_83xx_enable_legacy()
337 adapter->tgt_mask_reg = ahw->pci_base0 + QLC_83XX_INTX_MASK; in qlcnic_83xx_enable_legacy()
338 adapter->isr_int_vec = ahw->pci_base0 + QLC_83XX_INTX_TRGR; in qlcnic_83xx_enable_legacy()
339 adapter->msix_entries[0].vector = adapter->pdev->irq; in qlcnic_83xx_enable_legacy()
340 dev_info(&adapter->pdev->dev, "using legacy interrupt\n"); in qlcnic_83xx_enable_legacy()
343 static int qlcnic_83xx_calculate_msix_vector(struct qlcnic_adapter *adapter) in qlcnic_83xx_calculate_msix_vector() argument
347 num_msix = adapter->drv_sds_rings; in qlcnic_83xx_calculate_msix_vector()
352 if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) in qlcnic_83xx_calculate_msix_vector()
353 num_msix += adapter->drv_tx_rings; in qlcnic_83xx_calculate_msix_vector()
358 int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter) in qlcnic_83xx_setup_intr() argument
360 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_setup_intr()
363 if (adapter->flags & QLCNIC_TSS_RSS) { in qlcnic_83xx_setup_intr()
364 err = qlcnic_setup_tss_rss_intr(adapter); in qlcnic_83xx_setup_intr()
369 num_msix = qlcnic_83xx_calculate_msix_vector(adapter); in qlcnic_83xx_setup_intr()
371 err = qlcnic_enable_msix(adapter, num_msix); in qlcnic_83xx_setup_intr()
375 if (adapter->flags & QLCNIC_MSIX_ENABLED) { in qlcnic_83xx_setup_intr()
378 if (qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_setup_intr()
381 adapter->drv_sds_rings = QLCNIC_SINGLE_RING; in qlcnic_83xx_setup_intr()
382 adapter->drv_tx_rings = QLCNIC_SINGLE_RING; in qlcnic_83xx_setup_intr()
393 if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) { in qlcnic_83xx_setup_intr()
394 if (adapter->ahw->pci_func >= QLC_MAX_LEGACY_FUNC_SUPP) { in qlcnic_83xx_setup_intr()
395 …dev_err(&adapter->pdev->dev, "PCI function number 8 and higher are not supported with legacy inter… in qlcnic_83xx_setup_intr()
400 qlcnic_83xx_enable_legacy(adapter); in qlcnic_83xx_setup_intr()
404 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_setup_intr()
415 static inline void qlcnic_83xx_clear_legacy_intr_mask(struct qlcnic_adapter *adapter) in qlcnic_83xx_clear_legacy_intr_mask() argument
417 writel(0, adapter->tgt_mask_reg); in qlcnic_83xx_clear_legacy_intr_mask()
420 static inline void qlcnic_83xx_set_legacy_intr_mask(struct qlcnic_adapter *adapter) in qlcnic_83xx_set_legacy_intr_mask() argument
422 if (adapter->tgt_mask_reg) in qlcnic_83xx_set_legacy_intr_mask()
423 writel(1, adapter->tgt_mask_reg); in qlcnic_83xx_set_legacy_intr_mask()
427 *adapter) in qlcnic_83xx_enable_legacy_msix_mbx_intr()
436 mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK); in qlcnic_83xx_enable_legacy_msix_mbx_intr()
437 writel(0, adapter->ahw->pci_base0 + mask); in qlcnic_83xx_enable_legacy_msix_mbx_intr()
440 void qlcnic_83xx_disable_mbx_intr(struct qlcnic_adapter *adapter) in qlcnic_83xx_disable_mbx_intr() argument
444 mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK); in qlcnic_83xx_disable_mbx_intr()
445 writel(1, adapter->ahw->pci_base0 + mask); in qlcnic_83xx_disable_mbx_intr()
446 QLCWRX(adapter->ahw, QLCNIC_MBX_INTR_ENBL, 0); in qlcnic_83xx_disable_mbx_intr()
449 static inline void qlcnic_83xx_get_mbx_data(struct qlcnic_adapter *adapter, in qlcnic_83xx_get_mbx_data() argument
458 cmd->rsp.arg[i] = readl(QLCNIC_MBX_FW(adapter->ahw, i)); in qlcnic_83xx_get_mbx_data()
461 irqreturn_t qlcnic_83xx_clear_legacy_intr(struct qlcnic_adapter *adapter) in qlcnic_83xx_clear_legacy_intr() argument
464 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_clear_legacy_intr()
467 intr_val = readl(adapter->tgt_status_reg); in qlcnic_83xx_clear_legacy_intr()
472 if (QLC_83XX_INTX_FUNC(intr_val) != adapter->ahw->pci_func) { in qlcnic_83xx_clear_legacy_intr()
473 adapter->stats.spurious_intr++; in qlcnic_83xx_clear_legacy_intr()
480 writel_relaxed(0, adapter->isr_int_vec); in qlcnic_83xx_clear_legacy_intr()
481 intr_val = readl(adapter->isr_int_vec); in qlcnic_83xx_clear_legacy_intr()
483 intr_val = readl(adapter->tgt_status_reg); in qlcnic_83xx_clear_legacy_intr()
499 static void qlcnic_83xx_poll_process_aen(struct qlcnic_adapter *adapter) in qlcnic_83xx_poll_process_aen() argument
502 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_poll_process_aen()
506 resp = QLCRDX(adapter->ahw, QLCNIC_FW_MBX_CTRL); in qlcnic_83xx_poll_process_aen()
510 event = readl(QLCNIC_MBX_FW(adapter->ahw, 0)); in qlcnic_83xx_poll_process_aen()
512 __qlcnic_83xx_process_aen(adapter); in qlcnic_83xx_poll_process_aen()
518 qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter); in qlcnic_83xx_poll_process_aen()
524 struct qlcnic_adapter *adapter = data; in qlcnic_83xx_intr() local
526 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_intr()
528 if (qlcnic_83xx_clear_legacy_intr(adapter) == IRQ_NONE) in qlcnic_83xx_intr()
531 qlcnic_83xx_poll_process_aen(adapter); in qlcnic_83xx_intr()
536 qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter); in qlcnic_83xx_intr()
540 if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) { in qlcnic_83xx_intr()
541 qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter); in qlcnic_83xx_intr()
543 sds_ring = &adapter->recv_ctx->sds_rings[0]; in qlcnic_83xx_intr()
553 struct qlcnic_adapter *adapter = sds_ring->adapter; in qlcnic_83xx_tmp_intr() local
555 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_tmp_intr()
558 if (adapter->nic_ops->clear_legacy_intr(adapter) == IRQ_NONE) in qlcnic_83xx_tmp_intr()
562 adapter->ahw->diag_cnt++; in qlcnic_83xx_tmp_intr()
563 qlcnic_enable_sds_intr(adapter, sds_ring); in qlcnic_83xx_tmp_intr()
568 void qlcnic_83xx_free_mbx_intr(struct qlcnic_adapter *adapter) in qlcnic_83xx_free_mbx_intr() argument
572 if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) in qlcnic_83xx_free_mbx_intr()
573 qlcnic_83xx_set_legacy_intr_mask(adapter); in qlcnic_83xx_free_mbx_intr()
575 qlcnic_83xx_disable_mbx_intr(adapter); in qlcnic_83xx_free_mbx_intr()
577 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_free_mbx_intr()
578 num_msix = adapter->ahw->num_msix - 1; in qlcnic_83xx_free_mbx_intr()
584 if (adapter->msix_entries) { in qlcnic_83xx_free_mbx_intr()
585 synchronize_irq(adapter->msix_entries[num_msix].vector); in qlcnic_83xx_free_mbx_intr()
586 free_irq(adapter->msix_entries[num_msix].vector, adapter); in qlcnic_83xx_free_mbx_intr()
590 int qlcnic_83xx_setup_mbx_intr(struct qlcnic_adapter *adapter) in qlcnic_83xx_setup_mbx_intr() argument
597 if (!(adapter->flags & QLCNIC_MSI_ENABLED) && in qlcnic_83xx_setup_mbx_intr()
598 !(adapter->flags & QLCNIC_MSIX_ENABLED)) in qlcnic_83xx_setup_mbx_intr()
601 if (adapter->flags & QLCNIC_MSIX_ENABLED) { in qlcnic_83xx_setup_mbx_intr()
603 val = adapter->msix_entries[adapter->ahw->num_msix - 1].vector; in qlcnic_83xx_setup_mbx_intr()
604 err = request_irq(val, handler, flags, "qlcnic-MB", adapter); in qlcnic_83xx_setup_mbx_intr()
606 dev_err(&adapter->pdev->dev, in qlcnic_83xx_setup_mbx_intr()
612 val = adapter->msix_entries[0].vector; in qlcnic_83xx_setup_mbx_intr()
613 err = request_irq(val, handler, flags, "qlcnic", adapter); in qlcnic_83xx_setup_mbx_intr()
615 dev_err(&adapter->pdev->dev, in qlcnic_83xx_setup_mbx_intr()
619 qlcnic_83xx_clear_legacy_intr_mask(adapter); in qlcnic_83xx_setup_mbx_intr()
623 qlcnic_83xx_enable_mbx_interrupt(adapter); in qlcnic_83xx_setup_mbx_intr()
628 void qlcnic_83xx_get_func_no(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_func_no() argument
630 u32 val = QLCRDX(adapter->ahw, QLCNIC_INFORMANT); in qlcnic_83xx_get_func_no()
631 adapter->ahw->pci_func = (val >> 24) & 0xff; in qlcnic_83xx_get_func_no()
634 int qlcnic_83xx_cam_lock(struct qlcnic_adapter *adapter) in qlcnic_83xx_cam_lock() argument
639 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_cam_lock()
646 QLC_SHARED_REG_WR32(adapter, QLCNIC_FLASH_LOCK_OWNER, in qlcnic_83xx_cam_lock()
656 void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *adapter) in qlcnic_83xx_cam_unlock() argument
659 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_cam_unlock()
665 void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, in qlcnic_83xx_read_crb() argument
671 if (qlcnic_api_lock(adapter)) { in qlcnic_83xx_read_crb()
672 dev_err(&adapter->pdev->dev, in qlcnic_83xx_read_crb()
678 data = QLCRD32(adapter, (u32) offset, &ret); in qlcnic_83xx_read_crb()
679 qlcnic_api_unlock(adapter); in qlcnic_83xx_read_crb()
682 dev_err(&adapter->pdev->dev, in qlcnic_83xx_read_crb()
690 void qlcnic_83xx_write_crb(struct qlcnic_adapter *adapter, char *buf, in qlcnic_83xx_write_crb() argument
696 qlcnic_83xx_wrt_reg_indirect(adapter, (u32) offset, data); in qlcnic_83xx_write_crb()
699 int qlcnic_83xx_get_port_info(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_port_info() argument
701 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_port_info()
704 status = qlcnic_83xx_get_port_config(adapter); in qlcnic_83xx_get_port_info()
706 dev_err(&adapter->pdev->dev, in qlcnic_83xx_get_port_info()
727 static void qlcnic_83xx_set_mac_filter_count(struct qlcnic_adapter *adapter) in qlcnic_83xx_set_mac_filter_count() argument
729 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_set_mac_filter_count()
743 void qlcnic_83xx_enable_mbx_interrupt(struct qlcnic_adapter *adapter) in qlcnic_83xx_enable_mbx_interrupt() argument
747 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_enable_mbx_interrupt()
748 val = BIT_2 | ((adapter->ahw->num_msix - 1) << 8); in qlcnic_83xx_enable_mbx_interrupt()
752 QLCWRX(adapter->ahw, QLCNIC_MBX_INTR_ENBL, val); in qlcnic_83xx_enable_mbx_interrupt()
753 qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter); in qlcnic_83xx_enable_mbx_interrupt()
756 void qlcnic_83xx_check_vf(struct qlcnic_adapter *adapter, in qlcnic_83xx_check_vf() argument
760 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_check_vf()
763 qlcnic_get_func_no(adapter); in qlcnic_83xx_check_vf()
765 if (qlcnic_sriov_vf_check(adapter)) { in qlcnic_83xx_check_vf()
766 qlcnic_sriov_vf_set_ops(adapter); in qlcnic_83xx_check_vf()
771 op_mode = QLCRDX(adapter->ahw, QLC_83XX_DRV_OP_MODE); in qlcnic_83xx_check_vf()
780 dev_info(&adapter->pdev->dev, in qlcnic_83xx_check_vf()
783 adapter->nic_ops = &qlcnic_vf_ops; in qlcnic_83xx_check_vf()
785 if (pci_find_ext_capability(adapter->pdev, in qlcnic_83xx_check_vf()
787 set_bit(__QLCNIC_SRIOV_CAPABLE, &adapter->state); in qlcnic_83xx_check_vf()
788 adapter->nic_ops = &qlcnic_83xx_ops; in qlcnic_83xx_check_vf()
792 static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter,
794 static void qlcnic_83xx_handle_idc_comp_aen(struct qlcnic_adapter *adapter,
797 void qlcnic_dump_mbx(struct qlcnic_adapter *adapter, in qlcnic_dump_mbx() argument
805 dev_info(&adapter->pdev->dev, in qlcnic_dump_mbx()
813 dev_info(&adapter->pdev->dev, in qlcnic_dump_mbx()
823 static void qlcnic_83xx_poll_for_mbx_completion(struct qlcnic_adapter *adapter, in qlcnic_83xx_poll_for_mbx_completion() argument
826 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_poll_for_mbx_completion()
840 dev_err(&adapter->pdev->dev, in qlcnic_83xx_poll_for_mbx_completion()
847 int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *adapter, in qlcnic_83xx_issue_cmd() argument
850 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_issue_cmd()
851 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_issue_cmd()
860 err = mbx->ops->enqueue_cmd(adapter, cmd, &timeout); in qlcnic_83xx_issue_cmd()
862 dev_err(&adapter->pdev->dev, in qlcnic_83xx_issue_cmd()
872 dev_err(&adapter->pdev->dev, in qlcnic_83xx_issue_cmd()
882 qlcnic_83xx_poll_for_mbx_completion(adapter, cmd); in qlcnic_83xx_issue_cmd()
885 dev_err(&adapter->pdev->dev, in qlcnic_83xx_issue_cmd()
889 qlcnic_83xx_detach_mailbox_work(adapter); in qlcnic_83xx_issue_cmd()
896 struct qlcnic_adapter *adapter, u32 type) in qlcnic_83xx_alloc_mbx_args() argument
921 temp = adapter->ahw->fw_hal_version << 29; in qlcnic_83xx_alloc_mbx_args()
928 dev_err(&adapter->pdev->dev, "%s: Invalid mailbox command opcode 0x%x\n", in qlcnic_83xx_alloc_mbx_args()
935 struct qlcnic_adapter *adapter; in qlcnic_83xx_idc_aen_work() local
939 adapter = container_of(work, struct qlcnic_adapter, idc_aen_work.work); in qlcnic_83xx_idc_aen_work()
940 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_IDC_ACK); in qlcnic_83xx_idc_aen_work()
945 cmd.req.arg[i] = adapter->ahw->mbox_aen[i]; in qlcnic_83xx_idc_aen_work()
947 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_idc_aen_work()
949 dev_info(&adapter->pdev->dev, in qlcnic_83xx_idc_aen_work()
954 static void qlcnic_83xx_handle_idc_comp_aen(struct qlcnic_adapter *adapter, in qlcnic_83xx_handle_idc_comp_aen() argument
957 dev_dbg(&adapter->pdev->dev, "Completion AEN:0x%x.\n", in qlcnic_83xx_handle_idc_comp_aen()
959 clear_bit(QLC_83XX_IDC_COMP_AEN, &adapter->ahw->idc.status); in qlcnic_83xx_handle_idc_comp_aen()
963 static void __qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter) in __qlcnic_83xx_process_aen() argument
965 struct qlcnic_hardware_context *ahw = adapter->ahw; in __qlcnic_83xx_process_aen()
975 qlcnic_83xx_handle_link_aen(adapter, event); in __qlcnic_83xx_process_aen()
978 qlcnic_83xx_handle_idc_comp_aen(adapter, event); in __qlcnic_83xx_process_aen()
982 adapter->ahw->mbox_aen[i] = QLCNIC_MBX_RSP(event[i]); in __qlcnic_83xx_process_aen()
983 queue_delayed_work(adapter->qlcnic_wq, in __qlcnic_83xx_process_aen()
984 &adapter->idc_aen_work, 0); in __qlcnic_83xx_process_aen()
990 qlcnic_sriov_handle_bc_event(adapter, event[1]); in __qlcnic_83xx_process_aen()
993 dev_info(&adapter->pdev->dev, "SFP+ Insert AEN:0x%x.\n", in __qlcnic_83xx_process_aen()
997 dev_info(&adapter->pdev->dev, "SFP Removed AEN:0x%x.\n", in __qlcnic_83xx_process_aen()
1001 qlcnic_dcb_aen_handler(adapter->dcb, (void *)&event[1]); in __qlcnic_83xx_process_aen()
1004 dev_dbg(&adapter->pdev->dev, "Unsupported AEN:0x%x.\n", in __qlcnic_83xx_process_aen()
1012 static void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter) in qlcnic_83xx_process_aen() argument
1015 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_process_aen()
1024 __qlcnic_83xx_process_aen(adapter); in qlcnic_83xx_process_aen()
1035 struct qlcnic_adapter *adapter; in qlcnic_83xx_mbx_poll_work() local
1037 adapter = container_of(work, struct qlcnic_adapter, mbx_poll_work.work); in qlcnic_83xx_mbx_poll_work()
1039 if (!test_bit(__QLCNIC_MBX_POLL_ENABLE, &adapter->state)) in qlcnic_83xx_mbx_poll_work()
1042 qlcnic_83xx_process_aen(adapter); in qlcnic_83xx_mbx_poll_work()
1043 queue_delayed_work(adapter->qlcnic_wq, &adapter->mbx_poll_work, in qlcnic_83xx_mbx_poll_work()
1047 void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *adapter) in qlcnic_83xx_enable_mbx_poll() argument
1049 if (test_and_set_bit(__QLCNIC_MBX_POLL_ENABLE, &adapter->state)) in qlcnic_83xx_enable_mbx_poll()
1052 INIT_DELAYED_WORK(&adapter->mbx_poll_work, qlcnic_83xx_mbx_poll_work); in qlcnic_83xx_enable_mbx_poll()
1053 queue_delayed_work(adapter->qlcnic_wq, &adapter->mbx_poll_work, 0); in qlcnic_83xx_enable_mbx_poll()
1056 void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *adapter) in qlcnic_83xx_disable_mbx_poll() argument
1058 if (!test_and_clear_bit(__QLCNIC_MBX_POLL_ENABLE, &adapter->state)) in qlcnic_83xx_disable_mbx_poll()
1060 cancel_delayed_work_sync(&adapter->mbx_poll_work); in qlcnic_83xx_disable_mbx_poll()
1063 static int qlcnic_83xx_add_rings(struct qlcnic_adapter *adapter) in qlcnic_83xx_add_rings() argument
1073 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_83xx_add_rings()
1074 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_add_rings()
1078 num_sds = adapter->drv_sds_rings - QLCNIC_MAX_SDS_RINGS; in qlcnic_83xx_add_rings()
1079 err = ahw->hw_ops->alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_add_rings()
1082 dev_err(&adapter->pdev->dev, in qlcnic_83xx_add_rings()
1091 for (i = 8; i < adapter->drv_sds_rings; i++) { in qlcnic_83xx_add_rings()
1100 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_add_rings()
1105 if (adapter->ahw->diag_test != QLCNIC_LOOPBACK_TEST) in qlcnic_83xx_add_rings()
1116 err = ahw->hw_ops->mbx_cmd(adapter, &cmd); in qlcnic_83xx_add_rings()
1118 dev_err(&adapter->pdev->dev, in qlcnic_83xx_add_rings()
1126 for (i = 8; i < adapter->drv_sds_rings; i++) { in qlcnic_83xx_add_rings()
1130 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_add_rings()
1143 void qlcnic_83xx_del_rx_ctx(struct qlcnic_adapter *adapter) in qlcnic_83xx_del_rx_ctx() argument
1148 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_83xx_del_rx_ctx()
1150 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_RX_CTX)) in qlcnic_83xx_del_rx_ctx()
1153 if (qlcnic_sriov_pf_check(adapter) || qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_del_rx_ctx()
1156 if (qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_del_rx_ctx()
1157 qlcnic_pf_set_interface_id_del_rx_ctx(adapter, &temp); in qlcnic_83xx_del_rx_ctx()
1160 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_del_rx_ctx()
1162 dev_err(&adapter->pdev->dev, in qlcnic_83xx_del_rx_ctx()
1169 int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *adapter) in qlcnic_83xx_create_rx_ctx() argument
1180 struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; in qlcnic_83xx_create_rx_ctx()
1181 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_create_rx_ctx()
1182 num_rds = adapter->max_rds_rings; in qlcnic_83xx_create_rx_ctx()
1184 if (adapter->drv_sds_rings <= QLCNIC_MAX_SDS_RINGS) in qlcnic_83xx_create_rx_ctx()
1185 num_sds = adapter->drv_sds_rings; in qlcnic_83xx_create_rx_ctx()
1193 if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) in qlcnic_83xx_create_rx_ctx()
1197 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_create_rx_ctx()
1202 if (qlcnic_sriov_pf_check(adapter) || qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_create_rx_ctx()
1209 if (qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_create_rx_ctx()
1210 qlcnic_pf_set_interface_id_create_rx_ctx(adapter, in qlcnic_83xx_create_rx_ctx()
1222 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_create_rx_ctx()
1226 if (adapter->ahw->diag_test != QLCNIC_LOOPBACK_TEST) in qlcnic_83xx_create_rx_ctx()
1255 err = ahw->hw_ops->mbx_cmd(adapter, &cmd); in qlcnic_83xx_create_rx_ctx()
1257 dev_err(&adapter->pdev->dev, in qlcnic_83xx_create_rx_ctx()
1265 dev_info(&adapter->pdev->dev, "Rx Context[%d] Created, state:0x%x\n", in qlcnic_83xx_create_rx_ctx()
1281 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_create_rx_ctx()
1288 if (adapter->drv_sds_rings > QLCNIC_MAX_SDS_RINGS) in qlcnic_83xx_create_rx_ctx()
1289 err = qlcnic_83xx_add_rings(adapter); in qlcnic_83xx_create_rx_ctx()
1295 void qlcnic_83xx_del_tx_ctx(struct qlcnic_adapter *adapter, in qlcnic_83xx_del_tx_ctx() argument
1301 if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DESTROY_TX_CTX)) in qlcnic_83xx_del_tx_ctx()
1304 if (qlcnic_sriov_pf_check(adapter) || qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_del_tx_ctx()
1307 if (qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_del_tx_ctx()
1308 qlcnic_pf_set_interface_id_del_tx_ctx(adapter, &temp); in qlcnic_83xx_del_tx_ctx()
1311 if (qlcnic_issue_cmd(adapter, &cmd)) in qlcnic_83xx_del_tx_ctx()
1312 dev_err(&adapter->pdev->dev, in qlcnic_83xx_del_tx_ctx()
1317 int qlcnic_83xx_create_tx_ctx(struct qlcnic_adapter *adapter, in qlcnic_83xx_create_tx_ctx() argument
1326 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_create_tx_ctx()
1342 if (adapter->flags & QLCNIC_MSIX_ENABLED) { in qlcnic_83xx_create_tx_ctx()
1343 if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) in qlcnic_83xx_create_tx_ctx()
1344 msix_vector = adapter->drv_sds_rings + ring; in qlcnic_83xx_create_tx_ctx()
1346 msix_vector = adapter->drv_sds_rings - 1; in qlcnic_83xx_create_tx_ctx()
1352 if (adapter->ahw->diag_test != QLCNIC_LOOPBACK_TEST) in qlcnic_83xx_create_tx_ctx()
1358 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CREATE_TX_CTX); in qlcnic_83xx_create_tx_ctx()
1362 if (qlcnic_sriov_pf_check(adapter) || qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_create_tx_ctx()
1365 if (qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_create_tx_ctx()
1366 qlcnic_pf_set_interface_id_create_tx_ctx(adapter, &temp); in qlcnic_83xx_create_tx_ctx()
1374 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_create_tx_ctx()
1376 netdev_err(adapter->netdev, in qlcnic_83xx_create_tx_ctx()
1383 if ((adapter->flags & QLCNIC_MSIX_ENABLED) && in qlcnic_83xx_create_tx_ctx()
1384 !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { in qlcnic_83xx_create_tx_ctx()
1385 intr_mask = ahw->intr_tbl[adapter->drv_sds_rings + ring].src; in qlcnic_83xx_create_tx_ctx()
1388 netdev_info(adapter->netdev, in qlcnic_83xx_create_tx_ctx()
1399 struct qlcnic_adapter *adapter = netdev_priv(netdev); in qlcnic_83xx_diag_alloc_res() local
1402 u16 adapter_state = adapter->is_up; in qlcnic_83xx_diag_alloc_res()
1409 __qlcnic_down(adapter, netdev); in qlcnic_83xx_diag_alloc_res()
1411 qlcnic_detach(adapter); in qlcnic_83xx_diag_alloc_res()
1413 adapter->drv_sds_rings = QLCNIC_SINGLE_RING; in qlcnic_83xx_diag_alloc_res()
1414 adapter->ahw->diag_test = test; in qlcnic_83xx_diag_alloc_res()
1415 adapter->ahw->linkup = 0; in qlcnic_83xx_diag_alloc_res()
1417 ret = qlcnic_attach(adapter); in qlcnic_83xx_diag_alloc_res()
1423 ret = qlcnic_fw_create_ctx(adapter); in qlcnic_83xx_diag_alloc_res()
1425 qlcnic_detach(adapter); in qlcnic_83xx_diag_alloc_res()
1427 adapter->drv_sds_rings = num_sds_ring; in qlcnic_83xx_diag_alloc_res()
1428 qlcnic_attach(adapter); in qlcnic_83xx_diag_alloc_res()
1434 for (ring = 0; ring < adapter->max_rds_rings; ring++) { in qlcnic_83xx_diag_alloc_res()
1435 rds_ring = &adapter->recv_ctx->rds_rings[ring]; in qlcnic_83xx_diag_alloc_res()
1436 qlcnic_post_rx_buffers(adapter, rds_ring, ring); in qlcnic_83xx_diag_alloc_res()
1439 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { in qlcnic_83xx_diag_alloc_res()
1440 for (ring = 0; ring < adapter->drv_sds_rings; ring++) { in qlcnic_83xx_diag_alloc_res()
1441 sds_ring = &adapter->recv_ctx->sds_rings[ring]; in qlcnic_83xx_diag_alloc_res()
1442 qlcnic_enable_sds_intr(adapter, sds_ring); in qlcnic_83xx_diag_alloc_res()
1446 if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) { in qlcnic_83xx_diag_alloc_res()
1447 adapter->ahw->loopback_state = 0; in qlcnic_83xx_diag_alloc_res()
1448 adapter->ahw->hw_ops->setup_link_event(adapter, 1); in qlcnic_83xx_diag_alloc_res()
1451 set_bit(__QLCNIC_DEV_UP, &adapter->state); in qlcnic_83xx_diag_alloc_res()
1458 struct qlcnic_adapter *adapter = netdev_priv(netdev); in qlcnic_83xx_diag_free_res() local
1462 clear_bit(__QLCNIC_DEV_UP, &adapter->state); in qlcnic_83xx_diag_free_res()
1463 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { in qlcnic_83xx_diag_free_res()
1464 for (ring = 0; ring < adapter->drv_sds_rings; ring++) { in qlcnic_83xx_diag_free_res()
1465 sds_ring = &adapter->recv_ctx->sds_rings[ring]; in qlcnic_83xx_diag_free_res()
1466 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_diag_free_res()
1467 qlcnic_disable_sds_intr(adapter, sds_ring); in qlcnic_83xx_diag_free_res()
1471 qlcnic_fw_destroy_ctx(adapter); in qlcnic_83xx_diag_free_res()
1472 qlcnic_detach(adapter); in qlcnic_83xx_diag_free_res()
1474 adapter->ahw->diag_test = 0; in qlcnic_83xx_diag_free_res()
1475 adapter->drv_sds_rings = drv_sds_rings; in qlcnic_83xx_diag_free_res()
1477 if (qlcnic_attach(adapter)) in qlcnic_83xx_diag_free_res()
1481 __qlcnic_up(adapter, netdev); in qlcnic_83xx_diag_free_res()
1487 static void qlcnic_83xx_get_beacon_state(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_beacon_state() argument
1489 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_beacon_state()
1494 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LED_CONFIG); in qlcnic_83xx_get_beacon_state()
1496 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_get_beacon_state()
1505 netdev_err(adapter->netdev, "Get beacon state failed, err=%d\n", in qlcnic_83xx_get_beacon_state()
1514 int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state, in qlcnic_83xx_config_led() argument
1523 status = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_config_led()
1528 status = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_led()
1530 dev_err(&adapter->pdev->dev, in qlcnic_83xx_config_led()
1535 adapter->ahw->mbox_reg[i] = cmd.rsp.arg[i+1]; in qlcnic_83xx_config_led()
1541 status = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_config_led()
1551 status = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_led()
1553 dev_err(&adapter->pdev->dev, in qlcnic_83xx_config_led()
1562 status = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_config_led()
1567 cmd.req.arg[1] = adapter->ahw->mbox_reg[0]; in qlcnic_83xx_config_led()
1568 cmd.req.arg[2] = adapter->ahw->mbox_reg[1]; in qlcnic_83xx_config_led()
1569 cmd.req.arg[3] = adapter->ahw->mbox_reg[2]; in qlcnic_83xx_config_led()
1571 cmd.req.arg[4] = adapter->ahw->mbox_reg[3]; in qlcnic_83xx_config_led()
1572 status = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_led()
1574 dev_err(&adapter->pdev->dev, in qlcnic_83xx_config_led()
1584 struct qlcnic_adapter *adapter = netdev_priv(netdev); in qlcnic_83xx_set_led() local
1587 if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) { in qlcnic_83xx_set_led()
1595 if (test_and_set_bit(__QLCNIC_LED_ENABLE, &adapter->state)) in qlcnic_83xx_set_led()
1598 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) in qlcnic_83xx_set_led()
1601 err = qlcnic_83xx_config_led(adapter, active, 0); in qlcnic_83xx_set_led()
1608 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) in qlcnic_83xx_set_led()
1611 err = qlcnic_83xx_config_led(adapter, active, 0); in qlcnic_83xx_set_led()
1621 clear_bit(__QLCNIC_LED_ENABLE, &adapter->state); in qlcnic_83xx_set_led()
1626 void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *adapter, int enable) in qlcnic_83xx_initialize_nic() argument
1631 if (qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_initialize_nic()
1635 status = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_initialize_nic()
1638 status = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_initialize_nic()
1646 if (adapter->dcb) in qlcnic_83xx_initialize_nic()
1649 status = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_initialize_nic()
1651 dev_err(&adapter->pdev->dev, in qlcnic_83xx_initialize_nic()
1658 static int qlcnic_83xx_set_port_config(struct qlcnic_adapter *adapter) in qlcnic_83xx_set_port_config() argument
1663 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_PORT_CONFIG); in qlcnic_83xx_set_port_config()
1667 cmd.req.arg[1] = adapter->ahw->port_config; in qlcnic_83xx_set_port_config()
1668 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_set_port_config()
1670 dev_info(&adapter->pdev->dev, "Set Port Config failed.\n"); in qlcnic_83xx_set_port_config()
1675 static int qlcnic_83xx_get_port_config(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_port_config() argument
1680 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PORT_CONFIG); in qlcnic_83xx_get_port_config()
1684 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_get_port_config()
1686 dev_info(&adapter->pdev->dev, "Get Port config failed\n"); in qlcnic_83xx_get_port_config()
1688 adapter->ahw->port_config = cmd.rsp.arg[1]; in qlcnic_83xx_get_port_config()
1693 int qlcnic_83xx_setup_link_event(struct qlcnic_adapter *adapter, int enable) in qlcnic_83xx_setup_link_event() argument
1699 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_EVENT); in qlcnic_83xx_setup_link_event()
1703 temp = adapter->recv_ctx->context_id << 16; in qlcnic_83xx_setup_link_event()
1705 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_setup_link_event()
1707 dev_info(&adapter->pdev->dev, in qlcnic_83xx_setup_link_event()
1713 static void qlcnic_83xx_set_interface_id_promisc(struct qlcnic_adapter *adapter, in qlcnic_83xx_set_interface_id_promisc() argument
1716 if (qlcnic_sriov_pf_check(adapter)) { in qlcnic_83xx_set_interface_id_promisc()
1717 qlcnic_alloc_lb_filters_mem(adapter); in qlcnic_83xx_set_interface_id_promisc()
1718 qlcnic_pf_set_interface_id_promisc(adapter, interface_id); in qlcnic_83xx_set_interface_id_promisc()
1719 adapter->rx_mac_learn = true; in qlcnic_83xx_set_interface_id_promisc()
1721 if (!qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_set_interface_id_promisc()
1722 *interface_id = adapter->recv_ctx->context_id << 16; in qlcnic_83xx_set_interface_id_promisc()
1726 int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode) in qlcnic_83xx_nic_set_promisc() argument
1732 if (adapter->recv_ctx->state == QLCNIC_HOST_CTX_STATE_FREED) in qlcnic_83xx_nic_set_promisc()
1739 err = qlcnic_alloc_mbx_args(cmd, adapter, in qlcnic_83xx_nic_set_promisc()
1745 qlcnic_83xx_set_interface_id_promisc(adapter, &temp); in qlcnic_83xx_nic_set_promisc()
1747 if (qlcnic_84xx_check(adapter) && qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_nic_set_promisc()
1751 err = qlcnic_issue_cmd(adapter, cmd); in qlcnic_83xx_nic_set_promisc()
1764 struct qlcnic_adapter *adapter = netdev_priv(netdev); in qlcnic_83xx_loopback_test() local
1765 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_loopback_test()
1766 u8 drv_sds_rings = adapter->drv_sds_rings; in qlcnic_83xx_loopback_test()
1767 u8 drv_tx_rings = adapter->drv_tx_rings; in qlcnic_83xx_loopback_test()
1776 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { in qlcnic_83xx_loopback_test()
1781 if (qlcnic_get_diag_lock(adapter)) { in qlcnic_83xx_loopback_test()
1794 ret = qlcnic_83xx_set_lb_mode(adapter, mode); in qlcnic_83xx_loopback_test()
1802 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { in qlcnic_83xx_loopback_test()
1812 qlcnic_83xx_clear_lb_mode(adapter, mode); in qlcnic_83xx_loopback_test()
1815 } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); in qlcnic_83xx_loopback_test()
1817 ret = qlcnic_do_lb_test(adapter, mode); in qlcnic_83xx_loopback_test()
1819 qlcnic_83xx_clear_lb_mode(adapter, mode); in qlcnic_83xx_loopback_test()
1825 adapter->drv_sds_rings = drv_sds_rings; in qlcnic_83xx_loopback_test()
1826 adapter->drv_tx_rings = drv_tx_rings; in qlcnic_83xx_loopback_test()
1827 qlcnic_release_diag_lock(adapter); in qlcnic_83xx_loopback_test()
1831 static void qlcnic_extend_lb_idc_cmpltn_wait(struct qlcnic_adapter *adapter, in qlcnic_extend_lb_idc_cmpltn_wait() argument
1834 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_extend_lb_idc_cmpltn_wait()
1837 netdev_info(adapter->netdev, "Received loopback IDC time extend event for 0x%x seconds\n", in qlcnic_extend_lb_idc_cmpltn_wait()
1844 static int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode) in qlcnic_83xx_set_lb_mode() argument
1846 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_set_lb_mode()
1847 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_set_lb_mode()
1853 status = qlcnic_83xx_get_port_config(adapter); in qlcnic_83xx_set_lb_mode()
1874 status = qlcnic_83xx_set_port_config(adapter); in qlcnic_83xx_set_lb_mode()
1888 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { in qlcnic_83xx_set_lb_mode()
1896 qlcnic_extend_lb_idc_cmpltn_wait(adapter, in qlcnic_83xx_set_lb_mode()
1903 qlcnic_83xx_clear_lb_mode(adapter, mode); in qlcnic_83xx_set_lb_mode()
1908 qlcnic_sre_macaddr_change(adapter, adapter->mac_addr, 0, in qlcnic_83xx_set_lb_mode()
1913 static int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode) in qlcnic_83xx_clear_lb_mode() argument
1915 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_clear_lb_mode()
1917 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_clear_lb_mode()
1928 status = qlcnic_83xx_set_port_config(adapter); in qlcnic_83xx_clear_lb_mode()
1942 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { in qlcnic_83xx_clear_lb_mode()
1950 qlcnic_extend_lb_idc_cmpltn_wait(adapter, in qlcnic_83xx_clear_lb_mode()
1961 qlcnic_sre_macaddr_change(adapter, adapter->mac_addr, 0, in qlcnic_83xx_clear_lb_mode()
1966 static void qlcnic_83xx_set_interface_id_ipaddr(struct qlcnic_adapter *adapter, in qlcnic_83xx_set_interface_id_ipaddr() argument
1969 if (qlcnic_sriov_pf_check(adapter)) { in qlcnic_83xx_set_interface_id_ipaddr()
1970 qlcnic_pf_set_interface_id_ipaddr(adapter, interface_id); in qlcnic_83xx_set_interface_id_ipaddr()
1972 if (!qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_set_interface_id_ipaddr()
1973 *interface_id = adapter->recv_ctx->context_id << 16; in qlcnic_83xx_set_interface_id_ipaddr()
1977 void qlcnic_83xx_config_ipaddr(struct qlcnic_adapter *adapter, __be32 ip, in qlcnic_83xx_config_ipaddr() argument
1984 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_config_ipaddr()
1989 qlcnic_83xx_set_interface_id_ipaddr(adapter, &temp); in qlcnic_83xx_config_ipaddr()
1997 * Adapter needs IP address in network byte order. in qlcnic_83xx_config_ipaddr()
2006 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_ipaddr()
2008 dev_err(&adapter->netdev->dev, in qlcnic_83xx_config_ipaddr()
2015 int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *adapter, int mode) in qlcnic_83xx_config_hw_lro() argument
2024 if (adapter->recv_ctx->state == QLCNIC_HOST_CTX_STATE_FREED) in qlcnic_83xx_config_hw_lro()
2027 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIGURE_HW_LRO); in qlcnic_83xx_config_hw_lro()
2031 temp = adapter->recv_ctx->context_id << 16; in qlcnic_83xx_config_hw_lro()
2035 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_hw_lro()
2037 dev_info(&adapter->pdev->dev, "LRO config failed\n"); in qlcnic_83xx_config_hw_lro()
2043 int qlcnic_83xx_config_rss(struct qlcnic_adapter *adapter, int enable) in qlcnic_83xx_config_rss() argument
2054 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIGURE_RSS); in qlcnic_83xx_config_rss()
2070 cmd.req.arg[1] = (adapter->recv_ctx->context_id); in qlcnic_83xx_config_rss()
2074 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_rss()
2077 dev_info(&adapter->pdev->dev, "RSS config failed\n"); in qlcnic_83xx_config_rss()
2084 static void qlcnic_83xx_set_interface_id_macaddr(struct qlcnic_adapter *adapter, in qlcnic_83xx_set_interface_id_macaddr() argument
2087 if (qlcnic_sriov_pf_check(adapter)) { in qlcnic_83xx_set_interface_id_macaddr()
2088 qlcnic_pf_set_interface_id_macaddr(adapter, interface_id); in qlcnic_83xx_set_interface_id_macaddr()
2090 if (!qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_set_interface_id_macaddr()
2091 *interface_id = adapter->recv_ctx->context_id << 16; in qlcnic_83xx_set_interface_id_macaddr()
2095 int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr, in qlcnic_83xx_sre_macaddr_change() argument
2103 if (adapter->recv_ctx->state == QLCNIC_HOST_CTX_STATE_FREED) in qlcnic_83xx_sre_macaddr_change()
2110 err = qlcnic_alloc_mbx_args(cmd, adapter, QLCNIC_CMD_CONFIG_MAC_VLAN); in qlcnic_83xx_sre_macaddr_change()
2121 qlcnic_83xx_set_interface_id_macaddr(adapter, &temp); in qlcnic_83xx_sre_macaddr_change()
2132 err = qlcnic_issue_cmd(adapter, cmd); in qlcnic_83xx_sre_macaddr_change()
2142 void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, in qlcnic_83xx_change_l2_filter() argument
2148 qlcnic_83xx_sre_macaddr_change(adapter, mac, vlan_id, QLCNIC_MAC_ADD); in qlcnic_83xx_change_l2_filter()
2151 static void qlcnic_83xx_configure_mac(struct qlcnic_adapter *adapter, u8 *mac, in qlcnic_83xx_configure_mac() argument
2164 int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac, in qlcnic_83xx_get_mac_address() argument
2171 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_MAC_ADDRESS); in qlcnic_83xx_get_mac_address()
2175 qlcnic_83xx_configure_mac(adapter, mac, QLCNIC_GET_CURRENT_MAC, &cmd); in qlcnic_83xx_get_mac_address()
2176 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_get_mac_address()
2187 dev_err(&adapter->pdev->dev, "Failed to get mac address%d\n", in qlcnic_83xx_get_mac_address()
2195 static int qlcnic_83xx_set_rx_intr_coal(struct qlcnic_adapter *adapter) in qlcnic_83xx_set_rx_intr_coal() argument
2197 struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal; in qlcnic_83xx_set_rx_intr_coal()
2202 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTR_COAL); in qlcnic_83xx_set_rx_intr_coal()
2206 temp = adapter->recv_ctx->context_id; in qlcnic_83xx_set_rx_intr_coal()
2212 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_set_rx_intr_coal()
2214 netdev_err(adapter->netdev, in qlcnic_83xx_set_rx_intr_coal()
2222 static int qlcnic_83xx_set_tx_intr_coal(struct qlcnic_adapter *adapter) in qlcnic_83xx_set_tx_intr_coal() argument
2224 struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal; in qlcnic_83xx_set_tx_intr_coal()
2229 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTR_COAL); in qlcnic_83xx_set_tx_intr_coal()
2233 temp = adapter->tx_ring->ctx_id; in qlcnic_83xx_set_tx_intr_coal()
2239 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_set_tx_intr_coal()
2241 netdev_err(adapter->netdev, in qlcnic_83xx_set_tx_intr_coal()
2249 int qlcnic_83xx_set_rx_tx_intr_coal(struct qlcnic_adapter *adapter) in qlcnic_83xx_set_rx_tx_intr_coal() argument
2253 err = qlcnic_83xx_set_rx_intr_coal(adapter); in qlcnic_83xx_set_rx_tx_intr_coal()
2255 netdev_err(adapter->netdev, in qlcnic_83xx_set_rx_tx_intr_coal()
2258 err = qlcnic_83xx_set_tx_intr_coal(adapter); in qlcnic_83xx_set_rx_tx_intr_coal()
2260 netdev_err(adapter->netdev, in qlcnic_83xx_set_rx_tx_intr_coal()
2266 int qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *adapter, in qlcnic_83xx_config_intr_coal() argument
2269 struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal; in qlcnic_83xx_config_intr_coal()
2274 if (adapter->recv_ctx->state == QLCNIC_HOST_CTX_STATE_FREED) in qlcnic_83xx_config_intr_coal()
2303 err = qlcnic_83xx_set_rx_intr_coal(adapter); in qlcnic_83xx_config_intr_coal()
2306 err = qlcnic_83xx_set_tx_intr_coal(adapter); in qlcnic_83xx_config_intr_coal()
2309 err = qlcnic_83xx_set_rx_tx_intr_coal(adapter); in qlcnic_83xx_config_intr_coal()
2313 netdev_err(adapter->netdev, in qlcnic_83xx_config_intr_coal()
2321 static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, in qlcnic_83xx_handle_link_aen() argument
2324 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_handle_link_aen()
2344 qlcnic_advert_link_change(adapter, link_status); in qlcnic_83xx_handle_link_aen()
2350 struct qlcnic_adapter *adapter = data; in qlcnic_83xx_handle_aen() local
2354 mbx = adapter->ahw->mailbox; in qlcnic_83xx_handle_aen()
2356 resp = QLCRDX(adapter->ahw, QLCNIC_FW_MBX_CTRL); in qlcnic_83xx_handle_aen()
2360 event = readl(QLCNIC_MBX_FW(adapter->ahw, 0)); in qlcnic_83xx_handle_aen()
2362 __qlcnic_83xx_process_aen(adapter); in qlcnic_83xx_handle_aen()
2367 adapter->stats.mbx_spurious_intr++; in qlcnic_83xx_handle_aen()
2371 mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK); in qlcnic_83xx_handle_aen()
2372 writel(0, adapter->ahw->pci_base0 + mask); in qlcnic_83xx_handle_aen()
2377 int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *adapter, in qlcnic_83xx_set_nic_info() argument
2383 if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) { in qlcnic_83xx_set_nic_info()
2384 dev_err(&adapter->pdev->dev, in qlcnic_83xx_set_nic_info()
2390 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO); in qlcnic_83xx_set_nic_info()
2404 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_set_nic_info()
2407 dev_err(&adapter->pdev->dev, "Failed to set nic info%d\n", in qlcnic_83xx_set_nic_info()
2417 int qlcnic_83xx_get_nic_info(struct qlcnic_adapter *adapter, in qlcnic_83xx_get_nic_info() argument
2424 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_nic_info()
2426 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_NIC_INFO); in qlcnic_83xx_get_nic_info()
2436 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_get_nic_info()
2438 dev_info(&adapter->pdev->dev, in qlcnic_83xx_get_nic_info()
2470 int qlcnic_get_pci_func_type(struct qlcnic_adapter *adapter, u16 type, in qlcnic_get_pci_func_type() argument
2473 struct device *dev = &adapter->pdev->dev; in qlcnic_get_pci_func_type()
2495 int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter, in qlcnic_83xx_get_pci_info() argument
2498 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_pci_info()
2499 struct device *dev = &adapter->pdev->dev; in qlcnic_83xx_get_pci_info()
2505 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_PCI_INFO); in qlcnic_83xx_get_pci_info()
2509 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_get_pci_info()
2523 err = qlcnic_get_pci_func_type(adapter, pci_info->type, in qlcnic_83xx_get_pci_info()
2554 int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type) in qlcnic_83xx_config_intrpt() argument
2561 max_ints = adapter->ahw->num_msix - 1; in qlcnic_83xx_config_intrpt()
2562 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTRPT); in qlcnic_83xx_config_intrpt()
2568 if (qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_config_intrpt()
2569 cmd.req.arg[1] |= (adapter->ahw->pci_func << 8) | BIT_16; in qlcnic_83xx_config_intrpt()
2573 val = type | (adapter->ahw->intr_tbl[i].type << 4); in qlcnic_83xx_config_intrpt()
2574 if (adapter->ahw->intr_tbl[i].type == QLCNIC_INTRPT_MSIX) in qlcnic_83xx_config_intrpt()
2575 val |= (adapter->ahw->intr_tbl[i].id << 16); in qlcnic_83xx_config_intrpt()
2578 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_config_intrpt()
2580 dev_err(&adapter->pdev->dev, in qlcnic_83xx_config_intrpt()
2589 dev_info(&adapter->pdev->dev, in qlcnic_83xx_config_intrpt()
2591 adapter->ahw->intr_tbl[i].id); in qlcnic_83xx_config_intrpt()
2595 adapter->ahw->intr_tbl[i].id = MSW(val); in qlcnic_83xx_config_intrpt()
2596 adapter->ahw->intr_tbl[i].enabled = 1; in qlcnic_83xx_config_intrpt()
2598 adapter->ahw->intr_tbl[i].src = temp; in qlcnic_83xx_config_intrpt()
2600 adapter->ahw->intr_tbl[i].id = i; in qlcnic_83xx_config_intrpt()
2601 adapter->ahw->intr_tbl[i].enabled = 0; in qlcnic_83xx_config_intrpt()
2602 adapter->ahw->intr_tbl[i].src = 0; in qlcnic_83xx_config_intrpt()
2610 int qlcnic_83xx_lock_flash(struct qlcnic_adapter *adapter) in qlcnic_83xx_lock_flash() argument
2616 status = QLC_SHARED_REG_RD32(adapter, QLCNIC_FLASH_LOCK); in qlcnic_83xx_lock_flash()
2621 id = QLC_SHARED_REG_RD32(adapter, in qlcnic_83xx_lock_flash()
2623 dev_err(&adapter->pdev->dev, in qlcnic_83xx_lock_flash()
2630 QLC_SHARED_REG_WR32(adapter, QLCNIC_FLASH_LOCK_OWNER, adapter->portnum); in qlcnic_83xx_lock_flash()
2634 void qlcnic_83xx_unlock_flash(struct qlcnic_adapter *adapter) in qlcnic_83xx_unlock_flash() argument
2636 QLC_SHARED_REG_RD32(adapter, QLCNIC_FLASH_UNLOCK); in qlcnic_83xx_unlock_flash()
2637 QLC_SHARED_REG_WR32(adapter, QLCNIC_FLASH_LOCK_OWNER, 0xFF); in qlcnic_83xx_unlock_flash()
2640 int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, in qlcnic_83xx_lockless_flash_read32() argument
2650 dev_err(&adapter->pdev->dev, "Illegal addr = 0x%x\n", addr); in qlcnic_83xx_lockless_flash_read32()
2654 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_DIRECT_WINDOW, in qlcnic_83xx_lockless_flash_read32()
2664 ret = QLCRD32(adapter, indirect_add, &err); in qlcnic_83xx_lockless_flash_read32()
2677 qlcnic_83xx_wrt_reg_indirect(adapter, in qlcnic_83xx_lockless_flash_read32()
2687 ret = QLCRD32(adapter, indirect_add, &err); in qlcnic_83xx_lockless_flash_read32()
2701 static int qlcnic_83xx_poll_flash_status_reg(struct qlcnic_adapter *adapter) in qlcnic_83xx_poll_flash_status_reg() argument
2708 status = QLCRD32(adapter, QLC_83XX_FLASH_STATUS, &err); in qlcnic_83xx_poll_flash_status_reg()
2725 int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *adapter) in qlcnic_83xx_enable_flash_write() argument
2729 cmd = adapter->ahw->fdt.write_statusreg_cmd; in qlcnic_83xx_enable_flash_write()
2730 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_enable_flash_write()
2732 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, in qlcnic_83xx_enable_flash_write()
2733 adapter->ahw->fdt.write_enable_bits); in qlcnic_83xx_enable_flash_write()
2734 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_enable_flash_write()
2736 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_enable_flash_write()
2743 int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *adapter) in qlcnic_83xx_disable_flash_write() argument
2747 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_disable_flash_write()
2749 adapter->ahw->fdt.write_statusreg_cmd)); in qlcnic_83xx_disable_flash_write()
2750 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, in qlcnic_83xx_disable_flash_write()
2751 adapter->ahw->fdt.write_disable_bits); in qlcnic_83xx_disable_flash_write()
2752 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_disable_flash_write()
2754 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_disable_flash_write()
2761 int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) in qlcnic_83xx_read_flash_mfg_id() argument
2766 if (qlcnic_83xx_lock_flash(adapter)) in qlcnic_83xx_read_flash_mfg_id()
2769 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_read_flash_mfg_id()
2771 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_read_flash_mfg_id()
2773 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_read_flash_mfg_id()
2775 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_read_flash_mfg_id()
2779 mfg_id = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); in qlcnic_83xx_read_flash_mfg_id()
2781 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_read_flash_mfg_id()
2785 adapter->flash_mfg_id = (mfg_id & 0xFF); in qlcnic_83xx_read_flash_mfg_id()
2786 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_read_flash_mfg_id()
2791 int qlcnic_83xx_read_flash_descriptor_table(struct qlcnic_adapter *adapter) in qlcnic_83xx_read_flash_descriptor_table() argument
2798 if (qlcnic_83xx_lock_flash(adapter)) in qlcnic_83xx_read_flash_descriptor_table()
2801 memset(&adapter->ahw->fdt, 0, fdt_size); in qlcnic_83xx_read_flash_descriptor_table()
2802 ret = qlcnic_83xx_lockless_flash_read32(adapter, QLCNIC_FDT_LOCATION, in qlcnic_83xx_read_flash_descriptor_table()
2803 (u8 *)&adapter->ahw->fdt, in qlcnic_83xx_read_flash_descriptor_table()
2805 qlcnic_swap32_buffer((u32 *)&adapter->ahw->fdt, count); in qlcnic_83xx_read_flash_descriptor_table()
2806 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_read_flash_descriptor_table()
2810 int qlcnic_83xx_erase_flash_sector(struct qlcnic_adapter *adapter, in qlcnic_83xx_erase_flash_sector() argument
2816 if (qlcnic_83xx_lock_flash(adapter) != 0) in qlcnic_83xx_erase_flash_sector()
2819 if (adapter->ahw->fdt.mfg_id == adapter->flash_mfg_id) { in qlcnic_83xx_erase_flash_sector()
2820 ret = qlcnic_83xx_enable_flash_write(adapter); in qlcnic_83xx_erase_flash_sector()
2822 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_erase_flash_sector()
2823 dev_err(&adapter->pdev->dev, in qlcnic_83xx_erase_flash_sector()
2830 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_erase_flash_sector()
2832 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_erase_flash_sector()
2833 dev_err(&adapter->pdev->dev, in qlcnic_83xx_erase_flash_sector()
2842 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, in qlcnic_83xx_erase_flash_sector()
2844 cmd = QLC_83XX_FLASH_FDT_ERASE_DEF_SIG | adapter->ahw->fdt.erase_cmd; in qlcnic_83xx_erase_flash_sector()
2845 if (adapter->ahw->fdt.mfg_id == adapter->flash_mfg_id) in qlcnic_83xx_erase_flash_sector()
2846 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, cmd); in qlcnic_83xx_erase_flash_sector()
2848 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_erase_flash_sector()
2850 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_erase_flash_sector()
2853 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_erase_flash_sector()
2855 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_erase_flash_sector()
2856 dev_err(&adapter->pdev->dev, in qlcnic_83xx_erase_flash_sector()
2861 if (adapter->ahw->fdt.mfg_id == adapter->flash_mfg_id) { in qlcnic_83xx_erase_flash_sector()
2862 ret = qlcnic_83xx_disable_flash_write(adapter); in qlcnic_83xx_erase_flash_sector()
2864 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_erase_flash_sector()
2865 dev_err(&adapter->pdev->dev, in qlcnic_83xx_erase_flash_sector()
2871 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_erase_flash_sector()
2876 int qlcnic_83xx_flash_write32(struct qlcnic_adapter *adapter, u32 addr, in qlcnic_83xx_flash_write32() argument
2882 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, addr1); in qlcnic_83xx_flash_write32()
2883 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, *p_data); in qlcnic_83xx_flash_write32()
2884 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_flash_write32()
2886 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_flash_write32()
2888 dev_err(&adapter->pdev->dev, in qlcnic_83xx_flash_write32()
2896 int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, in qlcnic_83xx_flash_bulk_write() argument
2904 dev_err(&adapter->pdev->dev, in qlcnic_83xx_flash_bulk_write()
2909 temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); in qlcnic_83xx_flash_bulk_write()
2913 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, in qlcnic_83xx_flash_bulk_write()
2915 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_flash_bulk_write()
2919 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, *p_data++); in qlcnic_83xx_flash_bulk_write()
2920 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_flash_bulk_write()
2922 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_flash_bulk_write()
2924 dev_err(&adapter->pdev->dev, in qlcnic_83xx_flash_bulk_write()
2930 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_flash_bulk_write()
2934 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, in qlcnic_83xx_flash_bulk_write()
2936 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_flash_bulk_write()
2938 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_flash_bulk_write()
2940 dev_err(&adapter->pdev->dev, in qlcnic_83xx_flash_bulk_write()
2947 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_flash_bulk_write()
2951 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_WRDATA, *p_data++); in qlcnic_83xx_flash_bulk_write()
2952 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_flash_bulk_write()
2954 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_flash_bulk_write()
2956 dev_err(&adapter->pdev->dev, in qlcnic_83xx_flash_bulk_write()
2961 ret = QLCRD32(adapter, QLC_83XX_FLASH_SPI_STATUS, &err); in qlcnic_83xx_flash_bulk_write()
2966 dev_err(&adapter->pdev->dev, "%s: failed at %d\n", in qlcnic_83xx_flash_bulk_write()
2969 temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); in qlcnic_83xx_flash_bulk_write()
2973 qlcnic_83xx_wrt_reg_indirect(adapter, in qlcnic_83xx_flash_bulk_write()
2981 static void qlcnic_83xx_recover_driver_lock(struct qlcnic_adapter *adapter) in qlcnic_83xx_recover_driver_lock() argument
2985 val = QLCRDX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK); in qlcnic_83xx_recover_driver_lock()
2990 val = val | ((adapter->portnum << 2) | in qlcnic_83xx_recover_driver_lock()
2992 QLCWRX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK, val); in qlcnic_83xx_recover_driver_lock()
2993 dev_info(&adapter->pdev->dev, in qlcnic_83xx_recover_driver_lock()
2996 val = QLCRDX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK); in qlcnic_83xx_recover_driver_lock()
2998 if (id == adapter->portnum) { in qlcnic_83xx_recover_driver_lock()
3001 QLCWRX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK, val); in qlcnic_83xx_recover_driver_lock()
3003 QLCRDX(adapter->ahw, QLC_83XX_DRV_UNLOCK); in qlcnic_83xx_recover_driver_lock()
3006 QLCWRX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK, val); in qlcnic_83xx_recover_driver_lock()
3007 dev_info(&adapter->pdev->dev, in qlcnic_83xx_recover_driver_lock()
3010 dev_info(&adapter->pdev->dev, in qlcnic_83xx_recover_driver_lock()
3015 dev_info(&adapter->pdev->dev, in qlcnic_83xx_recover_driver_lock()
3021 int qlcnic_83xx_lock_driver(struct qlcnic_adapter *adapter) in qlcnic_83xx_lock_driver() argument
3027 status = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK); in qlcnic_83xx_lock_driver()
3035 temp = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK_ID); in qlcnic_83xx_lock_driver()
3038 val = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK_ID); in qlcnic_83xx_lock_driver()
3041 dev_info(&adapter->pdev->dev, in qlcnic_83xx_lock_driver()
3044 qlcnic_83xx_recover_driver_lock(adapter); in qlcnic_83xx_lock_driver()
3048 dev_err(&adapter->pdev->dev, in qlcnic_83xx_lock_driver()
3056 dev_err(&adapter->pdev->dev, in qlcnic_83xx_lock_driver()
3062 val = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK_ID); in qlcnic_83xx_lock_driver()
3065 val = lock_alive_counter << 8 | adapter->portnum; in qlcnic_83xx_lock_driver()
3066 QLCWRX(adapter->ahw, QLC_83XX_DRV_LOCK_ID, val); in qlcnic_83xx_lock_driver()
3071 void qlcnic_83xx_unlock_driver(struct qlcnic_adapter *adapter) in qlcnic_83xx_unlock_driver() argument
3075 val = QLCRDX(adapter->ahw, QLC_83XX_DRV_LOCK_ID); in qlcnic_83xx_unlock_driver()
3079 if (id != adapter->portnum) in qlcnic_83xx_unlock_driver()
3080 dev_err(&adapter->pdev->dev, in qlcnic_83xx_unlock_driver()
3082 __func__, adapter->portnum, id); in qlcnic_83xx_unlock_driver()
3085 QLCWRX(adapter->ahw, QLC_83XX_DRV_LOCK_ID, val); in qlcnic_83xx_unlock_driver()
3086 QLCRDX(adapter->ahw, QLC_83XX_DRV_UNLOCK); in qlcnic_83xx_unlock_driver()
3089 int qlcnic_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, in qlcnic_ms_mem_write128() argument
3099 mutex_lock(&adapter->ahw->mem_lock); in qlcnic_ms_mem_write128()
3100 qlcnic_ind_wr(adapter, QLCNIC_MS_ADDR_HI, 0); in qlcnic_ms_mem_write128()
3107 mutex_unlock(&adapter->ahw->mem_lock); in qlcnic_ms_mem_write128()
3111 qlcnic_ind_wr(adapter, QLCNIC_MS_ADDR_LO, addr); in qlcnic_ms_mem_write128()
3112 qlcnic_ind_wr(adapter, QLCNIC_MS_WRTDATA_LO, *data++); in qlcnic_ms_mem_write128()
3113 qlcnic_ind_wr(adapter, QLCNIC_MS_WRTDATA_HI, *data++); in qlcnic_ms_mem_write128()
3114 qlcnic_ind_wr(adapter, QLCNIC_MS_WRTDATA_ULO, *data++); in qlcnic_ms_mem_write128()
3115 qlcnic_ind_wr(adapter, QLCNIC_MS_WRTDATA_UHI, *data++); in qlcnic_ms_mem_write128()
3116 qlcnic_ind_wr(adapter, QLCNIC_MS_CTRL, QLCNIC_TA_WRITE_ENABLE); in qlcnic_ms_mem_write128()
3117 qlcnic_ind_wr(adapter, QLCNIC_MS_CTRL, QLCNIC_TA_WRITE_START); in qlcnic_ms_mem_write128()
3120 temp = qlcnic_ind_rd(adapter, QLCNIC_MS_CTRL); in qlcnic_ms_mem_write128()
3130 mutex_unlock(&adapter->ahw->mem_lock); in qlcnic_ms_mem_write128()
3135 mutex_unlock(&adapter->ahw->mem_lock); in qlcnic_ms_mem_write128()
3140 int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, in qlcnic_83xx_flash_read32() argument
3147 if (qlcnic_83xx_lock_flash(adapter) != 0) in qlcnic_83xx_flash_read32()
3151 dev_err(&adapter->pdev->dev, "Illegal addr = 0x%x\n", addr); in qlcnic_83xx_flash_read32()
3152 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_flash_read32()
3157 if (qlcnic_83xx_wrt_reg_indirect(adapter, in qlcnic_83xx_flash_read32()
3160 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_flash_read32()
3165 ret = QLCRD32(adapter, indirect_addr, &err); in qlcnic_83xx_flash_read32()
3167 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_flash_read32()
3177 qlcnic_83xx_unlock_flash(adapter); in qlcnic_83xx_flash_read32()
3182 void qlcnic_83xx_get_port_type(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_port_type() argument
3184 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_port_type()
3189 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_STATUS); in qlcnic_83xx_get_port_type()
3193 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_get_port_type()
3195 dev_info(&adapter->pdev->dev, in qlcnic_83xx_get_port_type()
3216 int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter) in qlcnic_83xx_test_link() argument
3222 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_test_link()
3224 if (qlcnic_sriov_vf_check(adapter)) in qlcnic_83xx_test_link()
3225 pci_func = adapter->portnum; in qlcnic_83xx_test_link()
3231 dev_info(&adapter->pdev->dev, "link state down\n"); in qlcnic_83xx_test_link()
3235 err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_STATUS); in qlcnic_83xx_test_link()
3239 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_test_link()
3241 dev_info(&adapter->pdev->dev, in qlcnic_83xx_test_link()
3300 int qlcnic_83xx_get_link_ksettings(struct qlcnic_adapter *adapter, in qlcnic_83xx_get_link_ksettings() argument
3303 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_link_ksettings()
3308 if (!test_bit(__QLCNIC_MAINTENANCE_MODE, &adapter->state)) { in qlcnic_83xx_get_link_ksettings()
3310 status = qlcnic_83xx_get_port_info(adapter); in qlcnic_83xx_get_link_ksettings()
3312 config = qlcnic_83xx_test_link(adapter); in qlcnic_83xx_get_link_ksettings()
3319 if (netif_running(adapter->netdev) && ahw->has_link_events) { in qlcnic_83xx_get_link_ksettings()
3401 int qlcnic_83xx_set_link_ksettings(struct qlcnic_adapter *adapter, in qlcnic_83xx_set_link_ksettings() argument
3404 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_set_link_ksettings()
3405 u32 config = adapter->ahw->port_config; in qlcnic_83xx_set_link_ksettings()
3410 netdev_info(adapter->netdev, in qlcnic_83xx_set_link_ksettings()
3451 status = qlcnic_83xx_set_port_config(adapter); in qlcnic_83xx_set_link_ksettings()
3453 netdev_info(adapter->netdev, in qlcnic_83xx_set_link_ksettings()
3474 static u64 *qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter, in qlcnic_83xx_fill_stats() argument
3481 err = qlcnic_issue_cmd(adapter, cmd); in qlcnic_83xx_fill_stats()
3483 dev_info(&adapter->pdev->dev, in qlcnic_83xx_fill_stats()
3524 dev_warn(&adapter->pdev->dev, "Unknown get statistics mode\n"); in qlcnic_83xx_fill_stats()
3530 void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) in qlcnic_83xx_get_stats() argument
3533 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_get_stats()
3536 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); in qlcnic_83xx_get_stats()
3540 cmd.req.arg[1] = BIT_1 | (adapter->tx_ring->ctx_id << 16); in qlcnic_83xx_get_stats()
3542 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, in qlcnic_83xx_get_stats()
3549 cmd.req.arg[1] = BIT_2 | (adapter->portnum << 16); in qlcnic_83xx_get_stats()
3552 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, in qlcnic_83xx_get_stats()
3559 cmd.req.arg[1] = adapter->recv_ctx->context_id << 16; in qlcnic_83xx_get_stats()
3562 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, in qlcnic_83xx_get_stats()
3573 int qlcnic_83xx_extend_md_capab(struct qlcnic_adapter *adapter) in qlcnic_83xx_extend_md_capab() argument
3578 err = qlcnic_alloc_mbx_args(&cmd, adapter, in qlcnic_83xx_extend_md_capab()
3587 err = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_extend_md_capab()
3589 dev_err(&adapter->pdev->dev, in qlcnic_83xx_extend_md_capab()
3595 int qlcnic_83xx_reg_test(struct qlcnic_adapter *adapter) in qlcnic_83xx_reg_test() argument
3599 major = QLC_SHARED_REG_RD32(adapter, QLCNIC_FW_VERSION_MAJOR); in qlcnic_83xx_reg_test()
3600 minor = QLC_SHARED_REG_RD32(adapter, QLCNIC_FW_VERSION_MINOR); in qlcnic_83xx_reg_test()
3601 sub = QLC_SHARED_REG_RD32(adapter, QLCNIC_FW_VERSION_SUB); in qlcnic_83xx_reg_test()
3603 if (adapter->fw_version != QLCNIC_VERSION_CODE(major, minor, sub)) { in qlcnic_83xx_reg_test()
3604 dev_info(&adapter->pdev->dev, "%s: Reg test failed\n", in qlcnic_83xx_reg_test()
3611 inline int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter) in qlcnic_83xx_get_regs_len() argument
3614 sizeof(*adapter->ahw->ext_reg_tbl)) + in qlcnic_83xx_get_regs_len()
3616 sizeof(*adapter->ahw->reg_tbl)); in qlcnic_83xx_get_regs_len()
3619 int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff) in qlcnic_83xx_get_registers() argument
3625 regs_buff[i] = QLC_SHARED_REG_RD32(adapter, j); in qlcnic_83xx_get_registers()
3628 regs_buff[i++] = QLCRDX(adapter->ahw, j); in qlcnic_83xx_get_registers()
3634 struct qlcnic_adapter *adapter = netdev_priv(netdev); in qlcnic_83xx_interrupt_test() local
3635 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_interrupt_test()
3637 u8 val, drv_sds_rings = adapter->drv_sds_rings; in qlcnic_83xx_interrupt_test()
3638 u8 drv_tx_rings = adapter->drv_tx_rings; in qlcnic_83xx_interrupt_test()
3643 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { in qlcnic_83xx_interrupt_test()
3648 if (qlcnic_get_diag_lock(adapter)) { in qlcnic_83xx_interrupt_test()
3659 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_INTRPT_TEST); in qlcnic_83xx_interrupt_test()
3663 if (adapter->flags & QLCNIC_MSIX_ENABLED) in qlcnic_83xx_interrupt_test()
3672 ret = qlcnic_issue_cmd(adapter, &cmd); in qlcnic_83xx_interrupt_test()
3677 dev_info(&adapter->pdev->dev, in qlcnic_83xx_interrupt_test()
3681 dev_err(&adapter->pdev->dev, in qlcnic_83xx_interrupt_test()
3696 adapter->drv_sds_rings = drv_sds_rings; in qlcnic_83xx_interrupt_test()
3697 adapter->drv_tx_rings = drv_tx_rings; in qlcnic_83xx_interrupt_test()
3698 qlcnic_release_diag_lock(adapter); in qlcnic_83xx_interrupt_test()
3702 void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *adapter, in qlcnic_83xx_get_pauseparam() argument
3705 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_get_pauseparam()
3709 status = qlcnic_83xx_get_port_config(adapter); in qlcnic_83xx_get_pauseparam()
3711 dev_err(&adapter->pdev->dev, in qlcnic_83xx_get_pauseparam()
3738 int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter, in qlcnic_83xx_set_pauseparam() argument
3741 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_set_pauseparam()
3745 status = qlcnic_83xx_get_port_config(adapter); in qlcnic_83xx_set_pauseparam()
3747 dev_err(&adapter->pdev->dev, in qlcnic_83xx_set_pauseparam()
3777 status = qlcnic_83xx_set_port_config(adapter); in qlcnic_83xx_set_pauseparam()
3779 dev_err(&adapter->pdev->dev, in qlcnic_83xx_set_pauseparam()
3786 static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) in qlcnic_83xx_read_flash_status_reg() argument
3791 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, in qlcnic_83xx_read_flash_status_reg()
3793 qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_CONTROL, in qlcnic_83xx_read_flash_status_reg()
3795 ret = qlcnic_83xx_poll_flash_status_reg(adapter); in qlcnic_83xx_read_flash_status_reg()
3799 temp = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); in qlcnic_83xx_read_flash_status_reg()
3806 int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter) in qlcnic_83xx_flash_test() argument
3810 status = qlcnic_83xx_read_flash_status_reg(adapter); in qlcnic_83xx_flash_test()
3812 dev_info(&adapter->pdev->dev, "%s: EEPROM test failed.\n", in qlcnic_83xx_flash_test()
3821 struct qlcnic_adapter *adapter = pci_get_drvdata(pdev); in qlcnic_83xx_shutdown() local
3822 struct net_device *netdev = adapter->netdev; in qlcnic_83xx_shutdown()
3825 qlcnic_cancel_idc_work(adapter); in qlcnic_83xx_shutdown()
3828 qlcnic_down(adapter, netdev); in qlcnic_83xx_shutdown()
3830 qlcnic_83xx_disable_mbx_intr(adapter); in qlcnic_83xx_shutdown()
3831 cancel_delayed_work_sync(&adapter->idc_aen_work); in qlcnic_83xx_shutdown()
3836 static int qlcnic_83xx_resume(struct qlcnic_adapter *adapter) in qlcnic_83xx_resume() argument
3838 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_resume()
3842 err = qlcnic_83xx_idc_init(adapter); in qlcnic_83xx_resume()
3848 qlcnic_83xx_set_vnic_opmode(adapter); in qlcnic_83xx_resume()
3850 err = qlcnic_83xx_check_vnic_state(adapter); in qlcnic_83xx_resume()
3856 err = qlcnic_83xx_idc_reattach_driver(adapter); in qlcnic_83xx_resume()
3860 qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state, in qlcnic_83xx_resume()
3881 qlcnic_83xx_notify_cmd_completion(struct qlcnic_adapter *adapter, in qlcnic_83xx_notify_cmd_completion() argument
3894 static void qlcnic_83xx_flush_mbx_queue(struct qlcnic_adapter *adapter) in qlcnic_83xx_flush_mbx_queue() argument
3896 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_flush_mbx_queue()
3904 dev_info(&adapter->pdev->dev, "%s: Mailbox command 0x%x\n", in qlcnic_83xx_flush_mbx_queue()
3908 qlcnic_83xx_notify_cmd_completion(adapter, cmd); in qlcnic_83xx_flush_mbx_queue()
3914 static int qlcnic_83xx_check_mbx_status(struct qlcnic_adapter *adapter) in qlcnic_83xx_check_mbx_status() argument
3916 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_check_mbx_status()
3933 static inline void qlcnic_83xx_signal_mbx_cmd(struct qlcnic_adapter *adapter, in qlcnic_83xx_signal_mbx_cmd() argument
3937 QLCWRX(adapter->ahw, QLCNIC_HOST_MBX_CTRL, QLCNIC_SET_OWNER); in qlcnic_83xx_signal_mbx_cmd()
3939 QLCWRX(adapter->ahw, QLCNIC_FW_MBX_CTRL, QLCNIC_CLR_OWNER); in qlcnic_83xx_signal_mbx_cmd()
3942 static void qlcnic_83xx_dequeue_mbx_cmd(struct qlcnic_adapter *adapter, in qlcnic_83xx_dequeue_mbx_cmd() argument
3945 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_dequeue_mbx_cmd()
3954 qlcnic_83xx_notify_cmd_completion(adapter, cmd); in qlcnic_83xx_dequeue_mbx_cmd()
3957 static void qlcnic_83xx_encode_mbx_cmd(struct qlcnic_adapter *adapter, in qlcnic_83xx_encode_mbx_cmd() argument
3961 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_encode_mbx_cmd()
3980 if (qlcnic_sriov_pf_check(adapter)) in qlcnic_83xx_encode_mbx_cmd()
3992 void qlcnic_83xx_detach_mailbox_work(struct qlcnic_adapter *adapter) in qlcnic_83xx_detach_mailbox_work() argument
3994 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_detach_mailbox_work()
4003 qlcnic_83xx_flush_mbx_queue(adapter); in qlcnic_83xx_detach_mailbox_work()
4006 static int qlcnic_83xx_enqueue_mbx_cmd(struct qlcnic_adapter *adapter, in qlcnic_83xx_enqueue_mbx_cmd() argument
4010 struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; in qlcnic_83xx_enqueue_mbx_cmd()
4033 static int qlcnic_83xx_check_mac_rcode(struct qlcnic_adapter *adapter, in qlcnic_83xx_check_mac_rcode() argument
4040 fw_data = readl(QLCNIC_MBX_FW(adapter->ahw, 2)); in qlcnic_83xx_check_mac_rcode()
4053 static void qlcnic_83xx_decode_mbx_rsp(struct qlcnic_adapter *adapter, in qlcnic_83xx_decode_mbx_rsp() argument
4056 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_decode_mbx_rsp()
4057 struct device *dev = &adapter->pdev->dev; in qlcnic_83xx_decode_mbx_rsp()
4063 qlcnic_83xx_get_mbx_data(adapter, cmd); in qlcnic_83xx_decode_mbx_rsp()
4071 if (!qlcnic_83xx_check_mac_rcode(adapter, cmd)) in qlcnic_83xx_decode_mbx_rsp()
4078 qlcnic_dump_mbx(adapter, cmd); in qlcnic_83xx_decode_mbx_rsp()
4084 static inline void qlcnic_dump_mailbox_registers(struct qlcnic_adapter *adapter) in qlcnic_dump_mailbox_registers() argument
4086 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_dump_mailbox_registers()
4090 …dev_info(&adapter->pdev->dev, "Mbx interrupt mask=0x%x, Mbx interrupt enable=0x%x, Host mbx contro… in qlcnic_dump_mailbox_registers()
4101 struct qlcnic_adapter *adapter = mbx->adapter; in qlcnic_83xx_mailbox_worker() local
4103 struct device *dev = &adapter->pdev->dev; in qlcnic_83xx_mailbox_worker()
4109 ahw = adapter->ahw; in qlcnic_83xx_mailbox_worker()
4112 if (qlcnic_83xx_check_mbx_status(adapter)) { in qlcnic_83xx_mailbox_worker()
4113 qlcnic_83xx_flush_mbx_queue(adapter); in qlcnic_83xx_mailbox_worker()
4131 mbx_ops->encode_cmd(adapter, cmd); in qlcnic_83xx_mailbox_worker()
4132 mbx_ops->nofity_fw(adapter, QLC_83XX_MBX_REQUEST); in qlcnic_83xx_mailbox_worker()
4136 mbx_ops->decode_resp(adapter, cmd); in qlcnic_83xx_mailbox_worker()
4137 mbx_ops->nofity_fw(adapter, QLC_83XX_MBX_COMPLETION); in qlcnic_83xx_mailbox_worker()
4143 qlcnic_dump_mailbox_registers(adapter); in qlcnic_83xx_mailbox_worker()
4144 qlcnic_83xx_get_mbx_data(adapter, cmd); in qlcnic_83xx_mailbox_worker()
4145 qlcnic_dump_mbx(adapter, cmd); in qlcnic_83xx_mailbox_worker()
4146 qlcnic_83xx_idc_request_reset(adapter, in qlcnic_83xx_mailbox_worker()
4150 mbx_ops->dequeue_cmd(adapter, cmd); in qlcnic_83xx_mailbox_worker()
4162 int qlcnic_83xx_init_mailbox_work(struct qlcnic_adapter *adapter) in qlcnic_83xx_init_mailbox_work() argument
4164 struct qlcnic_hardware_context *ahw = adapter->ahw; in qlcnic_83xx_init_mailbox_work()
4173 mbx->adapter = adapter; in qlcnic_83xx_init_mailbox_work()
4194 struct qlcnic_adapter *adapter = pci_get_drvdata(pdev); in qlcnic_83xx_io_error_detected() local
4202 set_bit(__QLCNIC_AER, &adapter->state); in qlcnic_83xx_io_error_detected()
4203 set_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_io_error_detected()
4205 qlcnic_83xx_aer_stop_poll_work(adapter); in qlcnic_83xx_io_error_detected()
4215 struct qlcnic_adapter *adapter = pci_get_drvdata(pdev); in qlcnic_83xx_io_slot_reset() local
4227 err = qlcnic_83xx_aer_reset(adapter); in qlcnic_83xx_io_slot_reset()
4231 clear_bit(__QLCNIC_AER, &adapter->state); in qlcnic_83xx_io_slot_reset()
4232 clear_bit(__QLCNIC_RESETTING, &adapter->state); in qlcnic_83xx_io_slot_reset()
4238 struct qlcnic_adapter *adapter = pci_get_drvdata(pdev); in qlcnic_83xx_io_resume() local
4240 if (test_and_clear_bit(__QLCNIC_AER, &adapter->state)) in qlcnic_83xx_io_resume()
4241 qlcnic_83xx_aer_start_poll_work(adapter); in qlcnic_83xx_io_resume()