• Home
  • Raw
  • Download

Lines Matching refs:oct

151 static int octeon_dbg_console_print(struct octeon_device *oct, u32 console_num,
169 struct octeon_device *oct = (struct octeon_device *)pdev; in octeon_droq_bh() local
171 (struct octeon_device_priv *)oct->priv; in octeon_droq_bh()
173 for (q_no = 0; q_no < MAX_OCTEON_OUTPUT_QUEUES(oct); q_no++) { in octeon_droq_bh()
174 if (!(oct->io_qmask.oq & BIT_ULL(q_no))) in octeon_droq_bh()
176 reschedule |= octeon_droq_process_packets(oct, oct->droq[q_no], in octeon_droq_bh()
178 lio_enable_irq(oct->droq[q_no], NULL); in octeon_droq_bh()
180 if (OCTEON_CN23XX_PF(oct) && oct->msix_on) { in octeon_droq_bh()
184 int adjusted_q_no = q_no + oct->sriov_info.pf_srn; in octeon_droq_bh()
187 oct, CN23XX_SLI_OQ_PKT_INT_LEVELS(adjusted_q_no), in octeon_droq_bh()
190 oct, CN23XX_SLI_OQ_PKTS_SENT(adjusted_q_no), 0); in octeon_droq_bh()
198 static int lio_wait_for_oq_pkts(struct octeon_device *oct) in lio_wait_for_oq_pkts() argument
201 (struct octeon_device_priv *)oct->priv; in lio_wait_for_oq_pkts()
208 for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES(oct); i++) { in lio_wait_for_oq_pkts()
209 if (!(oct->io_qmask.oq & BIT_ULL(i))) in lio_wait_for_oq_pkts()
211 pkt_cnt += octeon_droq_check_hw_for_pkts(oct->droq[i]); in lio_wait_for_oq_pkts()
229 static void force_io_queues_off(struct octeon_device *oct) in force_io_queues_off() argument
231 if ((oct->chip_id == OCTEON_CN66XX) || in force_io_queues_off()
232 (oct->chip_id == OCTEON_CN68XX)) { in force_io_queues_off()
234 octeon_write_csr(oct, CN6XXX_SLI_PKT_INSTR_ENB, 0); in force_io_queues_off()
237 octeon_write_csr(oct, CN6XXX_SLI_PKT_OUT_ENB, 0); in force_io_queues_off()
245 static inline void pcierror_quiesce_device(struct octeon_device *oct) in pcierror_quiesce_device() argument
253 force_io_queues_off(oct); in pcierror_quiesce_device()
258 if (wait_for_pending_requests(oct)) in pcierror_quiesce_device()
259 dev_err(&oct->pci_dev->dev, "There were pending requests\n"); in pcierror_quiesce_device()
262 for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) { in pcierror_quiesce_device()
265 if (!(oct->io_qmask.iq & BIT_ULL(i))) in pcierror_quiesce_device()
267 iq = oct->instr_queue[i]; in pcierror_quiesce_device()
275 lio_process_iq_request_list(oct, iq, 0); in pcierror_quiesce_device()
281 lio_process_ordered_list(oct, 1); in pcierror_quiesce_device()
310 static void stop_pci_io(struct octeon_device *oct) in stop_pci_io() argument
313 atomic_set(&oct->status, OCT_DEV_IN_RESET); in stop_pci_io()
315 pci_disable_device(oct->pci_dev); in stop_pci_io()
318 oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); in stop_pci_io()
320 pcierror_quiesce_device(oct); in stop_pci_io()
323 free_irq(oct->pci_dev->irq, oct); in stop_pci_io()
325 if (oct->flags & LIO_FLAG_MSI_ENABLED) in stop_pci_io()
326 pci_disable_msi(oct->pci_dev); in stop_pci_io()
328 dev_dbg(&oct->pci_dev->dev, "Device state is now %s\n", in stop_pci_io()
329 lio_get_state_string(&oct->status)); in stop_pci_io()
332 cleanup_aer_uncorrect_error_status(oct->pci_dev); in stop_pci_io()
346 struct octeon_device *oct = pci_get_drvdata(pdev); in liquidio_pcie_error_detected() local
350 dev_err(&oct->pci_dev->dev, "Non-correctable non-fatal error reported:\n"); in liquidio_pcie_error_detected()
351 cleanup_aer_uncorrect_error_status(oct->pci_dev); in liquidio_pcie_error_detected()
356 dev_err(&oct->pci_dev->dev, "Non-correctable FATAL reported by PCI AER driver\n"); in liquidio_pcie_error_detected()
357 stop_pci_io(oct); in liquidio_pcie_error_detected()
562 struct octeon_device *oct = lio->oct_dev; in setup_link_status_change_wq() local
567 dev_err(&oct->pci_dev->dev, "unable to create cavium link status wq\n"); in setup_link_status_change_wq()
601 struct octeon_device *oct = lio->oct_dev; in update_link_status() local
603 dev_dbg(&oct->pci_dev->dev, "%s: lio->linfo.link.u64=%llx, ls->u64=%llx\n", in update_link_status()
612 dev_dbg(&oct->pci_dev->dev, "%s: link_up", __func__); in update_link_status()
616 dev_dbg(&oct->pci_dev->dev, "%s: link_off", __func__); in update_link_status()
626 dev_warn(&oct->pci_dev->dev, in update_link_status()
645 struct octeon_device *oct = lio->oct_dev; in lio_sync_octeon_time() local
651 sc = octeon_alloc_soft_command(oct, sizeof(struct lio_time), 16, 0); in lio_sync_octeon_time()
653 dev_err(&oct->pci_dev->dev, in lio_sync_octeon_time()
667 octeon_prepare_soft_command(oct, sc, OPCODE_NIC, in lio_sync_octeon_time()
673 ret = octeon_send_soft_command(oct, sc); in lio_sync_octeon_time()
675 dev_err(&oct->pci_dev->dev, in lio_sync_octeon_time()
677 octeon_free_soft_command(oct, sc); in lio_sync_octeon_time()
696 struct octeon_device *oct = lio->oct_dev; in setup_sync_octeon_time_wq() local
701 dev_err(&oct->pci_dev->dev, "Unable to create wq to update octeon time\n"); in setup_sync_octeon_time_wq()
731 static struct octeon_device *get_other_octeon_device(struct octeon_device *oct) in get_other_octeon_device() argument
735 other_oct = lio_get_device(oct->octeon_id + 1); in get_other_octeon_device()
740 oct_busnum = oct->pci_dev->bus->number; in get_other_octeon_device()
746 oct_slot = PCI_SLOT(oct->pci_dev->devfn); in get_other_octeon_device()
757 static void disable_all_vf_links(struct octeon_device *oct) in disable_all_vf_links() argument
762 if (!oct) in disable_all_vf_links()
765 max_vfs = oct->sriov_info.max_vfs; in disable_all_vf_links()
767 for (i = 0; i < oct->ifcount; i++) { in disable_all_vf_links()
768 netdev = oct->props[i].netdev; in disable_all_vf_links()
783 struct octeon_device *oct = param; in liquidio_watchdog() local
799 (u16)octeon_read_csr64(oct, CN23XX_SLI_SCRATCH2); in liquidio_watchdog()
804 WRITE_ONCE(oct->cores_crashed, true); in liquidio_watchdog()
805 other_oct = get_other_octeon_device(oct); in liquidio_watchdog()
818 dev_err(&oct->pci_dev->dev, in liquidio_watchdog()
828 disable_all_vf_links(oct); in liquidio_watchdog()
833 vfs_mask1 = READ_ONCE(oct->sriov_info.vf_drv_loaded_mask); in liquidio_watchdog()
952 static void octeon_pci_flr(struct octeon_device *oct) in octeon_pci_flr() argument
956 pci_save_state(oct->pci_dev); in octeon_pci_flr()
958 pci_cfg_access_lock(oct->pci_dev); in octeon_pci_flr()
961 pci_write_config_word(oct->pci_dev, PCI_COMMAND, in octeon_pci_flr()
964 rc = __pci_reset_function_locked(oct->pci_dev); in octeon_pci_flr()
967 dev_err(&oct->pci_dev->dev, "Error %d resetting PCI function %d\n", in octeon_pci_flr()
968 rc, oct->pf_num); in octeon_pci_flr()
970 pci_cfg_access_unlock(oct->pci_dev); in octeon_pci_flr()
972 pci_restore_state(oct->pci_dev); in octeon_pci_flr()
980 static void octeon_destroy_resources(struct octeon_device *oct) in octeon_destroy_resources() argument
985 (struct octeon_device_priv *)oct->priv; in octeon_destroy_resources()
989 switch (atomic_read(&oct->status)) { in octeon_destroy_resources()
994 atomic_set(&oct->status, OCT_DEV_IN_RESET); in octeon_destroy_resources()
996 oct->app_mode = CVM_DRV_INVALID_APP; in octeon_destroy_resources()
997 dev_dbg(&oct->pci_dev->dev, "Device state is now %s\n", in octeon_destroy_resources()
998 lio_get_state_string(&oct->status)); in octeon_destroy_resources()
1008 octeon_remove_consoles(oct); in octeon_destroy_resources()
1012 if (lio_wait_for_instr_fetch(oct)) in octeon_destroy_resources()
1013 dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n"); in octeon_destroy_resources()
1015 if (wait_for_pending_requests(oct)) in octeon_destroy_resources()
1016 dev_err(&oct->pci_dev->dev, "There were pending requests\n"); in octeon_destroy_resources()
1022 oct->fn_list.disable_io_queues(oct); in octeon_destroy_resources()
1024 if (lio_wait_for_oq_pkts(oct)) in octeon_destroy_resources()
1025 dev_err(&oct->pci_dev->dev, "OQ had pending packets\n"); in octeon_destroy_resources()
1030 for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) { in octeon_destroy_resources()
1033 if (!(oct->io_qmask.iq & BIT_ULL(i))) in octeon_destroy_resources()
1035 iq = oct->instr_queue[i]; in octeon_destroy_resources()
1043 lio_process_iq_request_list(oct, iq, 0); in octeon_destroy_resources()
1048 lio_process_ordered_list(oct, 1); in octeon_destroy_resources()
1049 octeon_free_sc_done_list(oct); in octeon_destroy_resources()
1050 octeon_free_sc_zombie_list(oct); in octeon_destroy_resources()
1055 oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); in octeon_destroy_resources()
1057 if (oct->msix_on) { in octeon_destroy_resources()
1058 msix_entries = (struct msix_entry *)oct->msix_entries; in octeon_destroy_resources()
1059 for (i = 0; i < oct->num_msix_irqs - 1; i++) { in octeon_destroy_resources()
1060 if (oct->ioq_vector[i].vector) { in octeon_destroy_resources()
1066 &oct->ioq_vector[i]); in octeon_destroy_resources()
1067 oct->ioq_vector[i].vector = 0; in octeon_destroy_resources()
1071 free_irq(msix_entries[i].vector, oct); in octeon_destroy_resources()
1073 pci_disable_msix(oct->pci_dev); in octeon_destroy_resources()
1074 kfree(oct->msix_entries); in octeon_destroy_resources()
1075 oct->msix_entries = NULL; in octeon_destroy_resources()
1078 free_irq(oct->pci_dev->irq, oct); in octeon_destroy_resources()
1080 if (oct->flags & LIO_FLAG_MSI_ENABLED) in octeon_destroy_resources()
1081 pci_disable_msi(oct->pci_dev); in octeon_destroy_resources()
1084 kfree(oct->irq_name_storage); in octeon_destroy_resources()
1085 oct->irq_name_storage = NULL; in octeon_destroy_resources()
1089 if (OCTEON_CN23XX_PF(oct)) in octeon_destroy_resources()
1090 octeon_free_ioq_vector(oct); in octeon_destroy_resources()
1094 if (OCTEON_CN23XX_PF(oct)) in octeon_destroy_resources()
1095 oct->fn_list.free_mbox(oct); in octeon_destroy_resources()
1102 for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES(oct); i++) { in octeon_destroy_resources()
1103 if (!(oct->io_qmask.oq & BIT_ULL(i))) in octeon_destroy_resources()
1105 octeon_delete_droq(oct, i); in octeon_destroy_resources()
1113 handshake[oct->octeon_id].init_ok = 0; in octeon_destroy_resources()
1114 complete(&handshake[oct->octeon_id].init); in octeon_destroy_resources()
1115 handshake[oct->octeon_id].started_ok = 0; in octeon_destroy_resources()
1116 complete(&handshake[oct->octeon_id].started); in octeon_destroy_resources()
1122 octeon_delete_response_list(oct); in octeon_destroy_resources()
1126 for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) { in octeon_destroy_resources()
1127 if (!(oct->io_qmask.iq & BIT_ULL(i))) in octeon_destroy_resources()
1129 octeon_delete_instr_queue(oct, i); in octeon_destroy_resources()
1132 if (oct->sriov_info.sriov_enabled) in octeon_destroy_resources()
1133 pci_disable_sriov(oct->pci_dev); in octeon_destroy_resources()
1137 octeon_free_sc_buffer_pool(oct); in octeon_destroy_resources()
1141 octeon_delete_dispatch_list(oct); in octeon_destroy_resources()
1142 cancel_delayed_work_sync(&oct->nic_poll_work.work); in octeon_destroy_resources()
1146 refcount = octeon_deregister_device(oct); in octeon_destroy_resources()
1154 if (atomic_read(oct->adapter_fw_state) == FW_IS_PRELOADED) in octeon_destroy_resources()
1155 octeon_pci_flr(oct); in octeon_destroy_resources()
1156 else if (OCTEON_CN6XXX(oct) || !refcount) in octeon_destroy_resources()
1157 oct->fn_list.soft_reset(oct); in octeon_destroy_resources()
1159 octeon_unmap_pci_barx(oct, 0); in octeon_destroy_resources()
1160 octeon_unmap_pci_barx(oct, 1); in octeon_destroy_resources()
1164 pci_clear_master(oct->pci_dev); in octeon_destroy_resources()
1166 pci_disable_device(oct->pci_dev); in octeon_destroy_resources()
1186 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in send_rx_ctrl_cmd() local
1189 if (oct->props[lio->ifidx].rx_on == start_stop) in send_rx_ctrl_cmd()
1193 octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, in send_rx_ctrl_cmd()
1211 octeon_prepare_soft_command(oct, sc, OPCODE_NIC, in send_rx_ctrl_cmd()
1217 retval = octeon_send_soft_command(oct, sc); in send_rx_ctrl_cmd()
1220 octeon_free_soft_command(oct, sc); in send_rx_ctrl_cmd()
1226 retval = wait_for_sc_completion_timeout(oct, sc, 0); in send_rx_ctrl_cmd()
1230 oct->props[lio->ifidx].rx_on = start_stop; in send_rx_ctrl_cmd()
1243 static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx) in liquidio_destroy_nic_device() argument
1245 struct net_device *netdev = oct->props[ifidx].netdev; in liquidio_destroy_nic_device()
1247 (struct octeon_device_priv *)oct->priv; in liquidio_destroy_nic_device()
1252 dev_err(&oct->pci_dev->dev, "%s No netdevice ptr for index %d\n", in liquidio_destroy_nic_device()
1259 dev_dbg(&oct->pci_dev->dev, "NIC device cleanup\n"); in liquidio_destroy_nic_device()
1264 if (oct->props[lio->ifidx].napi_enabled == 1) { in liquidio_destroy_nic_device()
1268 oct->props[lio->ifidx].napi_enabled = 0; in liquidio_destroy_nic_device()
1270 if (OCTEON_CN23XX_PF(oct)) in liquidio_destroy_nic_device()
1271 oct->droq[0]->ops.poll_mode = 0; in liquidio_destroy_nic_device()
1292 oct->props[ifidx].gmxport = -1; in liquidio_destroy_nic_device()
1294 oct->props[ifidx].netdev = NULL; in liquidio_destroy_nic_device()
1301 static int liquidio_stop_nic_module(struct octeon_device *oct) in liquidio_stop_nic_module() argument
1306 dev_dbg(&oct->pci_dev->dev, "Stopping network interfaces\n"); in liquidio_stop_nic_module()
1307 if (!oct->ifcount) { in liquidio_stop_nic_module()
1308 dev_err(&oct->pci_dev->dev, "Init for Octeon was not completed\n"); in liquidio_stop_nic_module()
1312 spin_lock_bh(&oct->cmd_resp_wqlock); in liquidio_stop_nic_module()
1313 oct->cmd_resp_state = OCT_DRV_OFFLINE; in liquidio_stop_nic_module()
1314 spin_unlock_bh(&oct->cmd_resp_wqlock); in liquidio_stop_nic_module()
1316 lio_vf_rep_destroy(oct); in liquidio_stop_nic_module()
1318 for (i = 0; i < oct->ifcount; i++) { in liquidio_stop_nic_module()
1319 lio = GET_LIO(oct->props[i].netdev); in liquidio_stop_nic_module()
1320 for (j = 0; j < oct->num_oqs; j++) in liquidio_stop_nic_module()
1321 octeon_unregister_droq_ops(oct, in liquidio_stop_nic_module()
1325 for (i = 0; i < oct->ifcount; i++) in liquidio_stop_nic_module()
1326 liquidio_destroy_nic_device(oct, i); in liquidio_stop_nic_module()
1328 if (oct->devlink) { in liquidio_stop_nic_module()
1329 devlink_unregister(oct->devlink); in liquidio_stop_nic_module()
1330 devlink_free(oct->devlink); in liquidio_stop_nic_module()
1331 oct->devlink = NULL; in liquidio_stop_nic_module()
1334 dev_dbg(&oct->pci_dev->dev, "Network interfaces stopped\n"); in liquidio_stop_nic_module()
1375 static int octeon_chip_specific_setup(struct octeon_device *oct) in octeon_chip_specific_setup() argument
1381 pci_read_config_dword(oct->pci_dev, 0, &dev_id); in octeon_chip_specific_setup()
1382 pci_read_config_dword(oct->pci_dev, 8, &rev_id); in octeon_chip_specific_setup()
1383 oct->rev_id = rev_id & 0xff; in octeon_chip_specific_setup()
1387 oct->chip_id = OCTEON_CN68XX; in octeon_chip_specific_setup()
1388 ret = lio_setup_cn68xx_octeon_device(oct); in octeon_chip_specific_setup()
1393 oct->chip_id = OCTEON_CN66XX; in octeon_chip_specific_setup()
1394 ret = lio_setup_cn66xx_octeon_device(oct); in octeon_chip_specific_setup()
1399 oct->chip_id = OCTEON_CN23XX_PF_VID; in octeon_chip_specific_setup()
1400 ret = setup_cn23xx_octeon_pf_device(oct); in octeon_chip_specific_setup()
1405 pci_sriov_set_totalvfs(oct->pci_dev, in octeon_chip_specific_setup()
1406 oct->sriov_info.max_vfs); in octeon_chip_specific_setup()
1413 dev_err(&oct->pci_dev->dev, "Unknown device found (dev_id: %x)\n", in octeon_chip_specific_setup()
1418 dev_info(&oct->pci_dev->dev, "%s PASS%d.%d %s Version: %s\n", s, in octeon_chip_specific_setup()
1419 OCTEON_MAJOR_REV(oct), in octeon_chip_specific_setup()
1420 OCTEON_MINOR_REV(oct), in octeon_chip_specific_setup()
1421 octeon_get_conf(oct)->card_name, in octeon_chip_specific_setup()
1431 static int octeon_pci_os_setup(struct octeon_device *oct) in octeon_pci_os_setup() argument
1434 if (pci_enable_device(oct->pci_dev)) { in octeon_pci_os_setup()
1435 dev_err(&oct->pci_dev->dev, "pci_enable_device failed\n"); in octeon_pci_os_setup()
1439 if (dma_set_mask_and_coherent(&oct->pci_dev->dev, DMA_BIT_MASK(64))) { in octeon_pci_os_setup()
1440 dev_err(&oct->pci_dev->dev, "Unexpected DMA device capability\n"); in octeon_pci_os_setup()
1441 pci_disable_device(oct->pci_dev); in octeon_pci_os_setup()
1446 pci_set_master(oct->pci_dev); in octeon_pci_os_setup()
1563 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in liquidio_ptp_adjfreq() local
1578 do_div(delta, oct->coproc_clock_rate); in liquidio_ptp_adjfreq()
1581 comp = lio_pci_readq(oct, CN6XXX_MIO_PTP_CLOCK_COMP); in liquidio_ptp_adjfreq()
1586 lio_pci_writeq(oct, comp, CN6XXX_MIO_PTP_CLOCK_COMP); in liquidio_ptp_adjfreq()
1620 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in liquidio_ptp_gettime() local
1623 ns = lio_pci_readq(oct, CN6XXX_MIO_PTP_CLOCK_HI); in liquidio_ptp_gettime()
1643 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in liquidio_ptp_settime() local
1648 lio_pci_writeq(oct, ns, CN6XXX_MIO_PTP_CLOCK_HI); in liquidio_ptp_settime()
1676 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in oct_ptp_open() local
1696 &oct->pci_dev->dev); in oct_ptp_open()
1706 static void liquidio_ptp_init(struct octeon_device *oct) in liquidio_ptp_init() argument
1711 do_div(clock_comp, oct->coproc_clock_rate); in liquidio_ptp_init()
1712 lio_pci_writeq(oct, clock_comp, CN6XXX_MIO_PTP_CLOCK_COMP); in liquidio_ptp_init()
1715 cfg = lio_pci_readq(oct, CN6XXX_MIO_PTP_CLOCK_CFG); in liquidio_ptp_init()
1716 lio_pci_writeq(oct, cfg | 0x01, CN6XXX_MIO_PTP_CLOCK_CFG); in liquidio_ptp_init()
1725 static int load_firmware(struct octeon_device *oct) in load_firmware() argument
1740 octeon_get_conf(oct)->card_name, tmp_fw_type, in load_firmware()
1743 ret = request_firmware(&fw, fw_name, &oct->pci_dev->dev); in load_firmware()
1745 dev_err(&oct->pci_dev->dev, "Request firmware failed. Could not find file %s.\n", in load_firmware()
1751 ret = octeon_download_firmware(oct, fw->data, fw->size); in load_firmware()
1782 struct octeon_device *oct = lio->oct_dev; in setup_tx_poll_fn() local
1787 dev_err(&oct->pci_dev->dev, "unable to create cavium txq status wq\n"); in setup_tx_poll_fn()
1815 struct octeon_device *oct = lio->oct_dev; in liquidio_open() local
1817 (struct octeon_device_priv *)oct->priv; in liquidio_open()
1820 if (oct->props[lio->ifidx].napi_enabled == 0) { in liquidio_open()
1826 oct->props[lio->ifidx].napi_enabled = 1; in liquidio_open()
1828 if (OCTEON_CN23XX_PF(oct)) in liquidio_open()
1829 oct->droq[0]->ops.poll_mode = 1; in liquidio_open()
1832 if (oct->ptp_enable) in liquidio_open()
1837 if (OCTEON_CN23XX_PF(oct)) { in liquidio_open()
1838 if (!oct->msix_on) in liquidio_open()
1862 dev_info(&oct->pci_dev->dev, "%s interface is opened\n", in liquidio_open()
1875 struct octeon_device *oct = lio->oct_dev; in liquidio_stop() local
1877 (struct octeon_device_priv *)oct->priv; in liquidio_stop()
1897 if (OCTEON_CN23XX_PF(oct)) { in liquidio_stop()
1898 if (!oct->msix_on) in liquidio_stop()
1912 if (lio_wait_for_clean_oq(oct)) in liquidio_stop()
1916 if (oct->props[lio->ifidx].napi_enabled == 1) { in liquidio_stop()
1920 oct->props[lio->ifidx].napi_enabled = 0; in liquidio_stop()
1922 if (OCTEON_CN23XX_PF(oct)) in liquidio_stop()
1923 oct->droq[0]->ops.poll_mode = 0; in liquidio_stop()
1928 dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); in liquidio_stop()
1973 struct octeon_device *oct = lio->oct_dev; in liquidio_set_mcast_list() local
2009 dev_err(&oct->pci_dev->dev, "DEVFLAGS change failed in core (ret: 0x%x)\n", in liquidio_set_mcast_list()
2022 struct octeon_device *oct = lio->oct_dev; in liquidio_set_mac() local
2044 dev_err(&oct->pci_dev->dev, "MAC Address change failed\n"); in liquidio_set_mac()
2049 dev_err(&oct->pci_dev->dev, in liquidio_set_mac()
2066 struct octeon_device *oct; in liquidio_get_stats64() local
2072 oct = lio->oct_dev; in liquidio_get_stats64()
2077 for (i = 0; i < oct->num_iqs; i++) { in liquidio_get_stats64()
2079 iq_stats = &oct->instr_queue[iq_no]->stats; in liquidio_get_stats64()
2093 for (i = 0; i < oct->num_oqs; i++) { in liquidio_get_stats64()
2095 oq_stats = &oct->droq[oq_no]->stats; in liquidio_get_stats64()
2108 lstats->multicast = oct->link_stats.fromwire.fw_total_mcast; in liquidio_get_stats64()
2109 lstats->collisions = oct->link_stats.fromhost.total_collisions; in liquidio_get_stats64()
2112 lstats->rx_length_errors = oct->link_stats.fromwire.l2_err; in liquidio_get_stats64()
2114 lstats->rx_crc_errors = oct->link_stats.fromwire.fcs_err; in liquidio_get_stats64()
2116 lstats->rx_frame_errors = oct->link_stats.fromwire.frame_err; in liquidio_get_stats64()
2118 lstats->rx_fifo_errors = oct->link_stats.fromwire.fifo_err; in liquidio_get_stats64()
2124 lstats->tx_aborted_errors = oct->link_stats.fromhost.fw_err_pko; in liquidio_get_stats64()
2125 lstats->tx_carrier_errors = oct->link_stats.fromhost.fw_err_link; in liquidio_get_stats64()
2126 lstats->tx_fifo_errors = oct->link_stats.fromhost.fifo_err; in liquidio_get_stats64()
2216 static void handle_timestamp(struct octeon_device *oct, in handle_timestamp() argument
2229 oct = lio->oct_dev; in handle_timestamp()
2233 dev_err(&oct->pci_dev->dev, "Tx timestamp instruction failed. Status: %llx\n", in handle_timestamp()
2251 octeon_free_soft_command(oct, sc); in handle_timestamp()
2260 static inline int send_nic_timestamp_pkt(struct octeon_device *oct, in send_nic_timestamp_pkt() argument
2273 sc = octeon_alloc_soft_command_resp(oct, &ndata->cmd, in send_nic_timestamp_pkt()
2278 dev_err(&oct->pci_dev->dev, "No memory for timestamped data packet\n"); in send_nic_timestamp_pkt()
2291 if (OCTEON_CN23XX_PF(oct)) in send_nic_timestamp_pkt()
2300 retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd, in send_nic_timestamp_pkt()
2304 dev_err(&oct->pci_dev->dev, "timestamp data packet failed status: %x\n", in send_nic_timestamp_pkt()
2306 octeon_free_soft_command(oct, sc); in send_nic_timestamp_pkt()
2326 struct octeon_device *oct; in liquidio_xmit() local
2337 oct = lio->oct_dev; in liquidio_xmit()
2339 q_idx = skb_iq(oct, skb); in liquidio_xmit()
2343 stats = &oct->instr_queue[iq_no]->stats; in liquidio_xmit()
2372 if (octnet_iq_is_full(oct, ndata.q_no)) { in liquidio_xmit()
2404 octnet_prepare_pci_cmd(oct, &ndata.cmd, &cmdsetup, tag); in liquidio_xmit()
2407 dptr = dma_map_single(&oct->pci_dev->dev, in liquidio_xmit()
2411 if (dma_mapping_error(&oct->pci_dev->dev, dptr)) { in liquidio_xmit()
2412 dev_err(&oct->pci_dev->dev, "%s DMA mapping error 1\n", in liquidio_xmit()
2418 if (OCTEON_CN23XX_PF(oct)) in liquidio_xmit()
2443 octnet_prepare_pci_cmd(oct, &ndata.cmd, &cmdsetup, tag); in liquidio_xmit()
2447 g->sg[0].ptr[0] = dma_map_single(&oct->pci_dev->dev, in liquidio_xmit()
2451 if (dma_mapping_error(&oct->pci_dev->dev, g->sg[0].ptr[0])) { in liquidio_xmit()
2452 dev_err(&oct->pci_dev->dev, "%s DMA mapping error 2\n", in liquidio_xmit()
2465 skb_frag_dma_map(&oct->pci_dev->dev, in liquidio_xmit()
2469 if (dma_mapping_error(&oct->pci_dev->dev, in liquidio_xmit()
2471 dma_unmap_single(&oct->pci_dev->dev, in liquidio_xmit()
2477 dma_unmap_page(&oct->pci_dev->dev, in liquidio_xmit()
2482 dev_err(&oct->pci_dev->dev, "%s DMA mapping error 3\n", in liquidio_xmit()
2494 if (OCTEON_CN23XX_PF(oct)) in liquidio_xmit()
2504 if (OCTEON_CN23XX_PF(oct)) { in liquidio_xmit()
2527 status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more); in liquidio_xmit()
2529 status = octnet_send_nic_data_pkt(oct, &ndata, xmit_more); in liquidio_xmit()
2553 dma_unmap_single(&oct->pci_dev->dev, dptr, in liquidio_xmit()
2556 octeon_ring_doorbell_locked(oct, iq_no); in liquidio_xmit()
2583 struct octeon_device *oct = lio->oct_dev; in liquidio_vlan_rx_add_vid() local
2598 dev_err(&oct->pci_dev->dev, "Add VLAN filter failed in core (ret: 0x%x)\n", in liquidio_vlan_rx_add_vid()
2612 struct octeon_device *oct = lio->oct_dev; in liquidio_vlan_rx_kill_vid() local
2627 dev_err(&oct->pci_dev->dev, "Del VLAN filter failed in core (ret: 0x%x)\n", in liquidio_vlan_rx_kill_vid()
2646 struct octeon_device *oct = lio->oct_dev; in liquidio_set_rxcsum_command() local
2661 dev_err(&oct->pci_dev->dev, in liquidio_set_rxcsum_command()
2682 struct octeon_device *oct = lio->oct_dev; in liquidio_vxlan_port_command() local
2698 dev_err(&oct->pci_dev->dev, in liquidio_vxlan_port_command()
2823 struct octeon_device *oct = lio->oct_dev; in __liquidio_set_vf_mac() local
2830 if (vfidx < 0 || vfidx >= oct->sriov_info.max_vfs) in __liquidio_set_vf_mac()
2851 oct->sriov_info.vf_macaddr[vfidx] = nctrl.udd[0]; in __liquidio_set_vf_mac()
2853 ret = octnet_send_nic_ctrl_pkt(oct, &nctrl); in __liquidio_set_vf_mac()
2863 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_mac() local
2866 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_set_vf_mac()
2871 cn23xx_tell_vf_its_macaddr_changed(oct, vfidx, mac); in liquidio_set_vf_mac()
2880 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_spoofchk() local
2884 if (!(oct->fw_info.app_cap_flags & LIQUIDIO_SPOOFCHK_CAP)) { in liquidio_set_vf_spoofchk()
2890 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) { in liquidio_set_vf_spoofchk()
2896 if (oct->sriov_info.vf_spoofchk[vfidx]) in liquidio_set_vf_spoofchk()
2900 if (!oct->sriov_info.vf_spoofchk[vfidx]) in liquidio_set_vf_spoofchk()
2916 retval = octnet_send_nic_ctrl_pkt(oct, &nctrl); in liquidio_set_vf_spoofchk()
2925 oct->sriov_info.vf_spoofchk[vfidx] = enable; in liquidio_set_vf_spoofchk()
2936 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_vlan() local
2941 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_set_vf_vlan()
2955 if (oct->sriov_info.vf_vlantci[vfidx] == vlantci) in liquidio_set_vf_vlan()
2972 ret = octnet_send_nic_ctrl_pkt(oct, &nctrl); in liquidio_set_vf_vlan()
2979 oct->sriov_info.vf_vlantci[vfidx] = vlantci; in liquidio_set_vf_vlan()
2988 struct octeon_device *oct = lio->oct_dev; in liquidio_get_vf_config() local
2991 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_get_vf_config()
2997 macaddr = 2 + (u8 *)&oct->sriov_info.vf_macaddr[vfidx]; in liquidio_get_vf_config()
2999 ivi->vlan = oct->sriov_info.vf_vlantci[vfidx] & VLAN_VID_MASK; in liquidio_get_vf_config()
3000 ivi->qos = oct->sriov_info.vf_vlantci[vfidx] >> VLAN_PRIO_SHIFT; in liquidio_get_vf_config()
3001 if (oct->sriov_info.trusted_vf.active && in liquidio_get_vf_config()
3002 oct->sriov_info.trusted_vf.id == vfidx) in liquidio_get_vf_config()
3006 ivi->linkstate = oct->sriov_info.vf_linkstate[vfidx]; in liquidio_get_vf_config()
3007 ivi->spoofchk = oct->sriov_info.vf_spoofchk[vfidx]; in liquidio_get_vf_config()
3016 struct octeon_device *oct = lio->oct_dev; in liquidio_send_vf_trust_cmd() local
3020 sc = octeon_alloc_soft_command(oct, 0, 16, 0); in liquidio_send_vf_trust_cmd()
3027 octeon_prepare_soft_command(oct, sc, OPCODE_NIC, in liquidio_send_vf_trust_cmd()
3034 retval = octeon_send_soft_command(oct, sc); in liquidio_send_vf_trust_cmd()
3036 octeon_free_soft_command(oct, sc); in liquidio_send_vf_trust_cmd()
3040 retval = wait_for_sc_completion_timeout(oct, sc, 0); in liquidio_send_vf_trust_cmd()
3054 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_trust() local
3056 if (strcmp(oct->fw_info.liquidio_firmware_version, "1.7.1") < 0) { in liquidio_set_vf_trust()
3061 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) { in liquidio_set_vf_trust()
3069 if (oct->sriov_info.trusted_vf.active && in liquidio_set_vf_trust()
3070 oct->sriov_info.trusted_vf.id == vfidx) in liquidio_set_vf_trust()
3073 if (oct->sriov_info.trusted_vf.active) { in liquidio_set_vf_trust()
3080 if (!oct->sriov_info.trusted_vf.active) in liquidio_set_vf_trust()
3086 oct->sriov_info.trusted_vf.id = vfidx; in liquidio_set_vf_trust()
3087 oct->sriov_info.trusted_vf.active = true; in liquidio_set_vf_trust()
3089 oct->sriov_info.trusted_vf.active = false; in liquidio_set_vf_trust()
3106 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_link_state() local
3110 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_set_vf_link_state()
3113 if (oct->sriov_info.vf_linkstate[vfidx] == linkstate) in liquidio_set_vf_link_state()
3125 ret = octnet_send_nic_ctrl_pkt(oct, &nctrl); in liquidio_set_vf_link_state()
3128 oct->sriov_info.vf_linkstate[vfidx] = linkstate; in liquidio_set_vf_link_state()
3139 struct octeon_device *oct; in liquidio_eswitch_mode_get() local
3142 oct = priv->oct; in liquidio_eswitch_mode_get()
3144 *mode = oct->eswitch_mode; in liquidio_eswitch_mode_get()
3154 struct octeon_device *oct; in liquidio_eswitch_mode_set() local
3158 oct = priv->oct; in liquidio_eswitch_mode_set()
3160 if (!(oct->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP)) in liquidio_eswitch_mode_set()
3163 if (oct->eswitch_mode == mode) in liquidio_eswitch_mode_set()
3168 oct->eswitch_mode = mode; in liquidio_eswitch_mode_set()
3169 ret = lio_vf_rep_create(oct); in liquidio_eswitch_mode_set()
3173 lio_vf_rep_destroy(oct); in liquidio_eswitch_mode_set()
3174 oct->eswitch_mode = mode; in liquidio_eswitch_mode_set()
3194 struct octeon_device *oct = lio->oct_dev; in liquidio_get_port_parent_id() local
3196 if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV) in liquidio_get_port_parent_id()
3209 struct octeon_device *oct = lio->oct_dev; in liquidio_get_vf_stats() local
3213 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_get_vf_stats()
3217 ret = cn23xx_get_vf_stats(oct, vfidx, &stats); in liquidio_get_vf_stats()
3307 struct octeon_device *oct = (struct octeon_device *)buf; in lio_nic_info() local
3314 dev_err(&oct->pci_dev->dev, "Malformed NIC_INFO, len=%d, ifidx=%d\n", in lio_nic_info()
3325 for (i = 0; i < oct->ifcount; i++) { in lio_nic_info()
3326 if (oct->props[i].gmxport == gmxport) { in lio_nic_info()
3327 update_link_status(oct->props[i].netdev, ls); in lio_nic_info()
3775 lio_devlink->oct = octeon_dev; in setup_nic_devices()
3803 static int octeon_enable_sriov(struct octeon_device *oct) in octeon_enable_sriov() argument
3805 unsigned int num_vfs_alloced = oct->sriov_info.num_vfs_alloced; in octeon_enable_sriov()
3810 if (OCTEON_CN23XX_PF(oct) && num_vfs_alloced) { in octeon_enable_sriov()
3811 err = pci_enable_sriov(oct->pci_dev, in octeon_enable_sriov()
3812 oct->sriov_info.num_vfs_alloced); in octeon_enable_sriov()
3814 dev_err(&oct->pci_dev->dev, in octeon_enable_sriov()
3817 oct->sriov_info.num_vfs_alloced = 0; in octeon_enable_sriov()
3820 oct->sriov_info.sriov_enabled = 1; in octeon_enable_sriov()
3830 (vfdev->physfn == oct->pci_dev)) { in octeon_enable_sriov()
3831 oct->sriov_info.dpiring_to_vfpcidev_lut[u] = in octeon_enable_sriov()
3833 u += oct->sriov_info.rings_per_vf; in octeon_enable_sriov()
3843 static int lio_pci_sriov_disable(struct octeon_device *oct) in lio_pci_sriov_disable() argument
3847 if (pci_vfs_assigned(oct->pci_dev)) { in lio_pci_sriov_disable()
3848 dev_err(&oct->pci_dev->dev, "VFs are still assigned to VMs.\n"); in lio_pci_sriov_disable()
3852 pci_disable_sriov(oct->pci_dev); in lio_pci_sriov_disable()
3856 oct->sriov_info.dpiring_to_vfpcidev_lut[u] = NULL; in lio_pci_sriov_disable()
3857 u += oct->sriov_info.rings_per_vf; in lio_pci_sriov_disable()
3860 oct->sriov_info.num_vfs_alloced = 0; in lio_pci_sriov_disable()
3861 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d disabled VFs\n", in lio_pci_sriov_disable()
3862 oct->pf_num); in lio_pci_sriov_disable()
3869 struct octeon_device *oct = pci_get_drvdata(dev); in liquidio_enable_sriov() local
3872 if ((num_vfs == oct->sriov_info.num_vfs_alloced) && in liquidio_enable_sriov()
3873 (oct->sriov_info.sriov_enabled)) { in liquidio_enable_sriov()
3874 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d already enabled num_vfs:%d\n", in liquidio_enable_sriov()
3875 oct->pf_num, num_vfs); in liquidio_enable_sriov()
3880 lio_vf_rep_destroy(oct); in liquidio_enable_sriov()
3881 ret = lio_pci_sriov_disable(oct); in liquidio_enable_sriov()
3882 } else if (num_vfs > oct->sriov_info.max_vfs) { in liquidio_enable_sriov()
3883 dev_err(&oct->pci_dev->dev, in liquidio_enable_sriov()
3885 oct->sriov_info.max_vfs, num_vfs); in liquidio_enable_sriov()
3888 oct->sriov_info.num_vfs_alloced = num_vfs; in liquidio_enable_sriov()
3889 ret = octeon_enable_sriov(oct); in liquidio_enable_sriov()
3890 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d num_vfs:%d\n", in liquidio_enable_sriov()
3891 oct->pf_num, num_vfs); in liquidio_enable_sriov()
3892 ret = lio_vf_rep_create(oct); in liquidio_enable_sriov()
3894 dev_info(&oct->pci_dev->dev, in liquidio_enable_sriov()
3909 static int liquidio_init_nic_module(struct octeon_device *oct) in liquidio_init_nic_module() argument
3912 int num_nic_ports = CFG_GET_NUM_NIC_PORTS(octeon_get_conf(oct)); in liquidio_init_nic_module()
3914 dev_dbg(&oct->pci_dev->dev, "Initializing network interfaces\n"); in liquidio_init_nic_module()
3920 oct->ifcount = num_nic_ports; in liquidio_init_nic_module()
3922 memset(oct->props, 0, sizeof(struct octdev_props) * num_nic_ports); in liquidio_init_nic_module()
3925 oct->props[i].gmxport = -1; in liquidio_init_nic_module()
3927 retval = setup_nic_devices(oct); in liquidio_init_nic_module()
3929 dev_err(&oct->pci_dev->dev, "Setup NIC devices failed\n"); in liquidio_init_nic_module()
3936 if (!oct->octeon_id && in liquidio_init_nic_module()
3937 oct->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP) { in liquidio_init_nic_module()
3940 liquidio_stop_nic_module(oct); in liquidio_init_nic_module()
3945 liquidio_ptp_init(oct); in liquidio_init_nic_module()
3947 dev_dbg(&oct->pci_dev->dev, "Network interfaces ready\n"); in liquidio_init_nic_module()
3953 oct->ifcount = 0; in liquidio_init_nic_module()
3965 struct octeon_device *oct; in nic_starter() local
3968 oct = (struct octeon_device *)wk->ctxptr; in nic_starter()
3970 if (atomic_read(&oct->status) == OCT_DEV_RUNNING) in nic_starter()
3978 if (atomic_read(&oct->status) != OCT_DEV_CORE_OK) { in nic_starter()
3979 schedule_delayed_work(&oct->nic_poll_work.work, in nic_starter()
3984 atomic_set(&oct->status, OCT_DEV_RUNNING); in nic_starter()
3986 if (oct->app_mode && oct->app_mode == CVM_DRV_NIC_APP) { in nic_starter()
3987 dev_dbg(&oct->pci_dev->dev, "Starting NIC module\n"); in nic_starter()
3989 if (liquidio_init_nic_module(oct)) in nic_starter()
3990 dev_err(&oct->pci_dev->dev, "NIC initialization failed\n"); in nic_starter()
3992 handshake[oct->octeon_id].started_ok = 1; in nic_starter()
3994 dev_err(&oct->pci_dev->dev, in nic_starter()
3996 oct->app_mode); in nic_starter()
3999 complete(&handshake[oct->octeon_id].started); in nic_starter()
4005 struct octeon_device *oct = (struct octeon_device *)buf; in octeon_recv_vf_drv_notice() local
4019 cores_crashed = READ_ONCE(oct->cores_crashed); in octeon_recv_vf_drv_notice()
4022 if (!(oct->sriov_info.vf_drv_loaded_mask & BIT_ULL(vf_idx))) { in octeon_recv_vf_drv_notice()
4023 oct->sriov_info.vf_drv_loaded_mask |= BIT_ULL(vf_idx); in octeon_recv_vf_drv_notice()
4024 dev_info(&oct->pci_dev->dev, in octeon_recv_vf_drv_notice()
4030 if (oct->sriov_info.vf_drv_loaded_mask & BIT_ULL(vf_idx)) { in octeon_recv_vf_drv_notice()
4031 oct->sriov_info.vf_drv_loaded_mask &= ~BIT_ULL(vf_idx); in octeon_recv_vf_drv_notice()
4032 dev_info(&oct->pci_dev->dev, in octeon_recv_vf_drv_notice()
4040 oct->sriov_info.vf_macaddr[vf_idx] = data[1]; in octeon_recv_vf_drv_notice()
4041 dev_info(&oct->pci_dev->dev, in octeon_recv_vf_drv_notice()
4346 static int octeon_dbg_console_print(struct octeon_device *oct, u32 console_num, in octeon_dbg_console_print() argument
4350 dev_info(&oct->pci_dev->dev, "%u: %s%s\n", console_num, prefix, in octeon_dbg_console_print()
4353 dev_info(&oct->pci_dev->dev, "%u: %s\n", console_num, prefix); in octeon_dbg_console_print()
4355 dev_info(&oct->pci_dev->dev, "%u: %s\n", console_num, suffix); in octeon_dbg_console_print()