Lines Matching +full:sg +full:- +full:micro
7 * Copyright (c) 2003-2016 Cavium, Inc.
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
54 …nds to wait for DDR initialization. 0 waits for ddr_timeout to be set to non-zero value before sta…
58 static int debug = -1;
72 * octeon_console_debug_enabled - determines if a given console has debug enabled.
92 /* time to wait for possible in-flight requests in milliseconds */
136 (CN23XX_DEFAULT_INPUT_JABBER - OCTNIC_GSO_MAX_HEADER_SIZE)
170 struct octeon_device *oct = oct_priv->dev; in octeon_droq_bh()
173 if (!(oct->io_qmask.oq & BIT_ULL(q_no))) in octeon_droq_bh()
175 reschedule |= octeon_droq_process_packets(oct, oct->droq[q_no], in octeon_droq_bh()
177 lio_enable_irq(oct->droq[q_no], NULL); in octeon_droq_bh()
179 if (OCTEON_CN23XX_PF(oct) && oct->msix_on) { in octeon_droq_bh()
183 int adjusted_q_no = q_no + oct->sriov_info.pf_srn; in octeon_droq_bh()
194 tasklet_schedule(&oct_priv->droq_tasklet); in octeon_droq_bh()
200 (struct octeon_device_priv *)oct->priv; in lio_wait_for_oq_pkts()
208 if (!(oct->io_qmask.oq & BIT_ULL(i))) in lio_wait_for_oq_pkts()
210 pkt_cnt += octeon_droq_check_hw_for_pkts(oct->droq[i]); in lio_wait_for_oq_pkts()
214 tasklet_schedule(&oct_priv->droq_tasklet); in lio_wait_for_oq_pkts()
219 } while (retry-- && pending_pkts); in lio_wait_for_oq_pkts()
225 * force_io_queues_off - Forces all IO queues off on a given device
230 if ((oct->chip_id == OCTEON_CN66XX) || in force_io_queues_off()
231 (oct->chip_id == OCTEON_CN68XX)) { in force_io_queues_off()
241 * pcierror_quiesce_device - Cause device to go quiet so it can be safely removed/reset/etc
254 /* To allow for in-flight requests */ in pcierror_quiesce_device()
258 dev_err(&oct->pci_dev->dev, "There were pending requests\n"); in pcierror_quiesce_device()
264 if (!(oct->io_qmask.iq & BIT_ULL(i))) in pcierror_quiesce_device()
266 iq = oct->instr_queue[i]; in pcierror_quiesce_device()
268 if (atomic_read(&iq->instr_pending)) { in pcierror_quiesce_device()
269 spin_lock_bh(&iq->lock); in pcierror_quiesce_device()
270 iq->fill_cnt = 0; in pcierror_quiesce_device()
271 iq->octeon_read_index = iq->host_write_index; in pcierror_quiesce_device()
272 iq->stats.instr_processed += in pcierror_quiesce_device()
273 atomic_read(&iq->instr_pending); in pcierror_quiesce_device()
275 spin_unlock_bh(&iq->lock); in pcierror_quiesce_device()
286 * cleanup_aer_uncorrect_error_status - Cleanup PCI AER uncorrectable error status
298 if (dev->error_state == pci_channel_io_normal) in cleanup_aer_uncorrect_error_status()
306 * stop_pci_io - Stop all PCI IO to a given device
312 atomic_set(&oct->status, OCT_DEV_IN_RESET); in stop_pci_io()
314 pci_disable_device(oct->pci_dev); in stop_pci_io()
317 oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); in stop_pci_io()
322 free_irq(oct->pci_dev->irq, oct); in stop_pci_io()
324 if (oct->flags & LIO_FLAG_MSI_ENABLED) in stop_pci_io()
325 pci_disable_msi(oct->pci_dev); in stop_pci_io()
327 dev_dbg(&oct->pci_dev->dev, "Device state is now %s\n", in stop_pci_io()
328 lio_get_state_string(&oct->status)); in stop_pci_io()
331 cleanup_aer_uncorrect_error_status(oct->pci_dev); in stop_pci_io()
335 * liquidio_pcie_error_detected - called when PCI error is detected
347 /* Non-correctable Non-fatal errors */ in liquidio_pcie_error_detected()
349 dev_err(&oct->pci_dev->dev, "Non-correctable non-fatal error reported:\n"); in liquidio_pcie_error_detected()
350 cleanup_aer_uncorrect_error_status(oct->pci_dev); in liquidio_pcie_error_detected()
354 /* Non-correctable Fatal errors */ in liquidio_pcie_error_detected()
355 dev_err(&oct->pci_dev->dev, "Non-correctable FATAL reported by PCI AER driver\n"); in liquidio_pcie_error_detected()
365 * liquidio_pcie_mmio_enabled - mmio handler
378 * liquidio_pcie_slot_reset - called after the pci bus has been reset.
381 * Restart the card from scratch, as if from a cold-boot. Implementation
382 * resembles the first-half of the octeon_resume routine.
394 * liquidio_pcie_resume - called when traffic can start flowing again.
399 * second-half of the octeon_resume routine.
409 /* For PCI-E Advanced Error Recovery (AER) Interface */
448 * liquidio_init_pci - register PCI driver
456 * liquidio_deinit_pci - unregister PCI driver
464 * check_txq_status - Check Tx queue status, and take appropriate action
465 * @lio: per-network private data
470 int numqs = lio->netdev->real_num_tx_queues; in check_txq_status()
474 /* check each sub-queue state */ in check_txq_status()
476 iq = lio->linfo.txpciq[q % in check_txq_status()
477 lio->oct_dev->num_iqs].s.q_no; in check_txq_status()
478 if (octnet_iq_is_full(lio->oct_dev, iq)) in check_txq_status()
480 if (__netif_subqueue_stopped(lio->netdev, q)) { in check_txq_status()
481 netif_wake_subqueue(lio->netdev, q); in check_txq_status()
482 INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, iq, in check_txq_status()
492 * print_link_info - Print link information
501 struct oct_link_info *linfo = &lio->linfo; in print_link_info()
503 if (linfo->link.s.link_up) { in print_link_info()
504 netif_info(lio, link, lio->netdev, "%d Mbps %s Duplex UP\n", in print_link_info()
505 linfo->link.s.speed, in print_link_info()
506 (linfo->link.s.duplex) ? "Full" : "Half"); in print_link_info()
508 netif_info(lio, link, lio->netdev, "Link Down\n"); in print_link_info()
514 * octnet_link_status_change - Routine to notify MTU change
520 struct lio *lio = (struct lio *)wk->ctxptr; in octnet_link_status_change()
522 /* lio->linfo.link.s.mtu always contains max MTU of the lio interface. in octnet_link_status_change()
523 * this API is invoked only when new max-MTU of the interface is in octnet_link_status_change()
527 dev_set_mtu(lio->netdev, lio->linfo.link.s.mtu); in octnet_link_status_change()
532 * setup_link_status_change_wq - Sets up the mtu status change work
538 struct octeon_device *oct = lio->oct_dev; in setup_link_status_change_wq()
540 lio->link_status_wq.wq = alloc_workqueue("link-status", in setup_link_status_change_wq()
542 if (!lio->link_status_wq.wq) { in setup_link_status_change_wq()
543 dev_err(&oct->pci_dev->dev, "unable to create cavium link status wq\n"); in setup_link_status_change_wq()
544 return -1; in setup_link_status_change_wq()
546 INIT_DELAYED_WORK(&lio->link_status_wq.wk.work, in setup_link_status_change_wq()
548 lio->link_status_wq.wk.ctxptr = lio; in setup_link_status_change_wq()
557 if (lio->link_status_wq.wq) { in cleanup_link_status_change_wq()
558 cancel_delayed_work_sync(&lio->link_status_wq.wk.work); in cleanup_link_status_change_wq()
559 destroy_workqueue(lio->link_status_wq.wq); in cleanup_link_status_change_wq()
564 * update_link_status - Update link status
575 int changed = (lio->linfo.link.u64 != ls->u64); in update_link_status()
576 int current_max_mtu = lio->linfo.link.s.mtu; in update_link_status()
577 struct octeon_device *oct = lio->oct_dev; in update_link_status()
579 dev_dbg(&oct->pci_dev->dev, "%s: lio->linfo.link.u64=%llx, ls->u64=%llx\n", in update_link_status()
580 __func__, lio->linfo.link.u64, ls->u64); in update_link_status()
581 lio->linfo.link.u64 = ls->u64; in update_link_status()
583 if ((lio->intf_open) && (changed)) { in update_link_status()
585 lio->link_changes++; in update_link_status()
587 if (lio->linfo.link.s.link_up) { in update_link_status()
588 dev_dbg(&oct->pci_dev->dev, "%s: link_up", __func__); in update_link_status()
592 dev_dbg(&oct->pci_dev->dev, "%s: link_off", __func__); in update_link_status()
596 if (lio->linfo.link.s.mtu != current_max_mtu) { in update_link_status()
597 netif_info(lio, probe, lio->netdev, "Max MTU changed from %d to %d\n", in update_link_status()
598 current_max_mtu, lio->linfo.link.s.mtu); in update_link_status()
599 netdev->max_mtu = lio->linfo.link.s.mtu; in update_link_status()
601 if (lio->linfo.link.s.mtu < netdev->mtu) { in update_link_status()
602 dev_warn(&oct->pci_dev->dev, in update_link_status()
604 netdev->mtu, lio->linfo.link.s.mtu); in update_link_status()
605 queue_delayed_work(lio->link_status_wq.wq, in update_link_status()
606 &lio->link_status_wq.wk.work, 0); in update_link_status()
612 * lio_sync_octeon_time - send latest localtime to octeon firmware so that
620 struct lio *lio = (struct lio *)wk->ctxptr; in lio_sync_octeon_time()
621 struct octeon_device *oct = lio->oct_dev; in lio_sync_octeon_time()
629 dev_err(&oct->pci_dev->dev, in lio_sync_octeon_time()
634 lt = (struct lio_time *)sc->virtdptr; in lio_sync_octeon_time()
638 lt->sec = ts.tv_sec; in lio_sync_octeon_time()
639 lt->nsec = ts.tv_nsec; in lio_sync_octeon_time()
642 sc->iq_no = lio->linfo.txpciq[0].s.q_no; in lio_sync_octeon_time()
646 init_completion(&sc->complete); in lio_sync_octeon_time()
647 sc->sc_status = OCTEON_REQUEST_PENDING; in lio_sync_octeon_time()
651 dev_err(&oct->pci_dev->dev, in lio_sync_octeon_time()
655 WRITE_ONCE(sc->caller_is_done, true); in lio_sync_octeon_time()
658 queue_delayed_work(lio->sync_octeon_time_wq.wq, in lio_sync_octeon_time()
659 &lio->sync_octeon_time_wq.wk.work, in lio_sync_octeon_time()
664 * setup_sync_octeon_time_wq - prepare work to periodically update local time to octeon firmware
671 struct octeon_device *oct = lio->oct_dev; in setup_sync_octeon_time_wq()
673 lio->sync_octeon_time_wq.wq = in setup_sync_octeon_time_wq()
674 alloc_workqueue("update-octeon-time", WQ_MEM_RECLAIM, 0); in setup_sync_octeon_time_wq()
675 if (!lio->sync_octeon_time_wq.wq) { in setup_sync_octeon_time_wq()
676 dev_err(&oct->pci_dev->dev, "Unable to create wq to update octeon time\n"); in setup_sync_octeon_time_wq()
677 return -1; in setup_sync_octeon_time_wq()
679 INIT_DELAYED_WORK(&lio->sync_octeon_time_wq.wk.work, in setup_sync_octeon_time_wq()
681 lio->sync_octeon_time_wq.wk.ctxptr = lio; in setup_sync_octeon_time_wq()
682 queue_delayed_work(lio->sync_octeon_time_wq.wq, in setup_sync_octeon_time_wq()
683 &lio->sync_octeon_time_wq.wk.work, in setup_sync_octeon_time_wq()
690 * cleanup_sync_octeon_time_wq - destroy wq
700 struct cavium_wq *time_wq = &lio->sync_octeon_time_wq; in cleanup_sync_octeon_time_wq()
702 if (time_wq->wq) { in cleanup_sync_octeon_time_wq()
703 cancel_delayed_work_sync(&time_wq->wk.work); in cleanup_sync_octeon_time_wq()
704 destroy_workqueue(time_wq->wq); in cleanup_sync_octeon_time_wq()
712 other_oct = lio_get_device(oct->octeon_id + 1); in get_other_octeon_device()
714 if (other_oct && other_oct->pci_dev) { in get_other_octeon_device()
717 oct_busnum = oct->pci_dev->bus->number; in get_other_octeon_device()
718 other_oct_busnum = other_oct->pci_dev->bus->number; in get_other_octeon_device()
723 oct_slot = PCI_SLOT(oct->pci_dev->devfn); in get_other_octeon_device()
724 other_oct_slot = PCI_SLOT(other_oct->pci_dev->devfn); in get_other_octeon_device()
742 max_vfs = oct->sriov_info.max_vfs; in disable_all_vf_links()
744 for (i = 0; i < oct->ifcount; i++) { in disable_all_vf_links()
745 netdev = oct->props[i].netdev; in disable_all_vf_links()
781 WRITE_ONCE(oct->cores_crashed, true); in liquidio_watchdog()
784 WRITE_ONCE(other_oct->cores_crashed, true); in liquidio_watchdog()
795 dev_err(&oct->pci_dev->dev, in liquidio_watchdog()
796 "ERROR: Octeon core %d crashed or got stuck! See oct-fwdump for details.\n", in liquidio_watchdog()
810 vfs_mask1 = READ_ONCE(oct->sriov_info.vf_drv_loaded_mask); in liquidio_watchdog()
811 vfs_mask2 = READ_ONCE(other_oct->sriov_info.vf_drv_loaded_mask); in liquidio_watchdog()
820 vfs_referencing_pf--; in liquidio_watchdog()
830 * liquidio_probe - PCI probe handler
840 oct_dev = octeon_allocate_device(pdev->device, in liquidio_probe()
843 dev_err(&pdev->dev, "Unable to allocate device\n"); in liquidio_probe()
844 return -ENOMEM; in liquidio_probe()
847 if (pdev->device == OCTEON_CN23XX_PF_VID) in liquidio_probe()
848 oct_dev->msix_on = LIO_FLAG_MSIX_ENABLED; in liquidio_probe()
851 if (((pdev->device == OCTEON_CN66XX) || in liquidio_probe()
852 (pdev->device == OCTEON_CN68XX))) in liquidio_probe()
853 oct_dev->ptp_enable = true; in liquidio_probe()
855 oct_dev->ptp_enable = false; in liquidio_probe()
857 dev_info(&pdev->dev, "Initializing device %x:%x.\n", in liquidio_probe()
858 (u32)pdev->vendor, (u32)pdev->device); in liquidio_probe()
864 oct_dev->pci_dev = (void *)pdev; in liquidio_probe()
866 oct_dev->subsystem_id = pdev->subsystem_vendor | in liquidio_probe()
867 (pdev->subsystem_device << 16); in liquidio_probe()
869 hs = &handshake[oct_dev->octeon_id]; in liquidio_probe()
870 init_completion(&hs->init); in liquidio_probe()
871 init_completion(&hs->started); in liquidio_probe()
872 hs->pci_dev = pdev; in liquidio_probe()
874 if (oct_dev->octeon_id == 0) in liquidio_probe()
879 complete(&hs->init); in liquidio_probe()
881 return -ENOMEM; in liquidio_probe()
887 if (atomic_read(oct_dev->adapter_refcount) == 1) { in liquidio_probe()
889 * PF (of each NIC) that gets pci_driver->probe()'d in liquidio_probe()
892 bus = pdev->bus->number; in liquidio_probe()
893 device = PCI_SLOT(pdev->devfn); in liquidio_probe()
894 function = PCI_FUNC(pdev->devfn); in liquidio_probe()
895 oct_dev->watchdog_task = kthread_create( in liquidio_probe()
898 if (!IS_ERR(oct_dev->watchdog_task)) { in liquidio_probe()
899 wake_up_process(oct_dev->watchdog_task); in liquidio_probe()
901 oct_dev->watchdog_task = NULL; in liquidio_probe()
902 dev_err(&oct_dev->pci_dev->dev, in liquidio_probe()
905 return -1; in liquidio_probe()
910 oct_dev->rx_pause = 1; in liquidio_probe()
911 oct_dev->tx_pause = 1; in liquidio_probe()
913 dev_dbg(&oct_dev->pci_dev->dev, "Device is ready\n"); in liquidio_probe()
925 * octeon_pci_flr - PCI FLR for each Octeon device.
932 pci_save_state(oct->pci_dev); in octeon_pci_flr()
934 pci_cfg_access_lock(oct->pci_dev); in octeon_pci_flr()
937 pci_write_config_word(oct->pci_dev, PCI_COMMAND, in octeon_pci_flr()
940 rc = __pci_reset_function_locked(oct->pci_dev); in octeon_pci_flr()
943 dev_err(&oct->pci_dev->dev, "Error %d resetting PCI function %d\n", in octeon_pci_flr()
944 rc, oct->pf_num); in octeon_pci_flr()
946 pci_cfg_access_unlock(oct->pci_dev); in octeon_pci_flr()
948 pci_restore_state(oct->pci_dev); in octeon_pci_flr()
952 * octeon_destroy_resources - Destroy resources associated with octeon device
960 (struct octeon_device_priv *)oct->priv; in octeon_destroy_resources()
964 switch (atomic_read(&oct->status)) { in octeon_destroy_resources()
969 atomic_set(&oct->status, OCT_DEV_IN_RESET); in octeon_destroy_resources()
971 oct->app_mode = CVM_DRV_INVALID_APP; in octeon_destroy_resources()
972 dev_dbg(&oct->pci_dev->dev, "Device state is now %s\n", in octeon_destroy_resources()
973 lio_get_state_string(&oct->status)); in octeon_destroy_resources()
987 dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n"); in octeon_destroy_resources()
990 dev_err(&oct->pci_dev->dev, "There were pending requests\n"); in octeon_destroy_resources()
996 oct->fn_list.disable_io_queues(oct); in octeon_destroy_resources()
999 dev_err(&oct->pci_dev->dev, "OQ had pending packets\n"); in octeon_destroy_resources()
1007 if (!(oct->io_qmask.iq & BIT_ULL(i))) in octeon_destroy_resources()
1009 iq = oct->instr_queue[i]; in octeon_destroy_resources()
1011 if (atomic_read(&iq->instr_pending)) { in octeon_destroy_resources()
1012 spin_lock_bh(&iq->lock); in octeon_destroy_resources()
1013 iq->fill_cnt = 0; in octeon_destroy_resources()
1014 iq->octeon_read_index = iq->host_write_index; in octeon_destroy_resources()
1015 iq->stats.instr_processed += in octeon_destroy_resources()
1016 atomic_read(&iq->instr_pending); in octeon_destroy_resources()
1018 spin_unlock_bh(&iq->lock); in octeon_destroy_resources()
1029 oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); in octeon_destroy_resources()
1031 if (oct->msix_on) { in octeon_destroy_resources()
1032 msix_entries = (struct msix_entry *)oct->msix_entries; in octeon_destroy_resources()
1033 for (i = 0; i < oct->num_msix_irqs - 1; i++) { in octeon_destroy_resources()
1034 if (oct->ioq_vector[i].vector) { in octeon_destroy_resources()
1040 &oct->ioq_vector[i]); in octeon_destroy_resources()
1041 oct->ioq_vector[i].vector = 0; in octeon_destroy_resources()
1044 /* non-iov vector's argument is oct struct */ in octeon_destroy_resources()
1047 pci_disable_msix(oct->pci_dev); in octeon_destroy_resources()
1048 kfree(oct->msix_entries); in octeon_destroy_resources()
1049 oct->msix_entries = NULL; in octeon_destroy_resources()
1052 free_irq(oct->pci_dev->irq, oct); in octeon_destroy_resources()
1054 if (oct->flags & LIO_FLAG_MSI_ENABLED) in octeon_destroy_resources()
1055 pci_disable_msi(oct->pci_dev); in octeon_destroy_resources()
1058 kfree(oct->irq_name_storage); in octeon_destroy_resources()
1059 oct->irq_name_storage = NULL; in octeon_destroy_resources()
1069 oct->fn_list.free_mbox(oct); in octeon_destroy_resources()
1077 if (!(oct->io_qmask.oq & BIT_ULL(i))) in octeon_destroy_resources()
1086 if (hs->pci_dev) { in octeon_destroy_resources()
1087 handshake[oct->octeon_id].init_ok = 0; in octeon_destroy_resources()
1088 complete(&handshake[oct->octeon_id].init); in octeon_destroy_resources()
1089 handshake[oct->octeon_id].started_ok = 0; in octeon_destroy_resources()
1090 complete(&handshake[oct->octeon_id].started); in octeon_destroy_resources()
1101 if (!(oct->io_qmask.iq & BIT_ULL(i))) in octeon_destroy_resources()
1106 if (oct->sriov_info.sriov_enabled) in octeon_destroy_resources()
1107 pci_disable_sriov(oct->pci_dev); in octeon_destroy_resources()
1116 cancel_delayed_work_sync(&oct->nic_poll_work.work); in octeon_destroy_resources()
1125 * Implementation note: only soft-reset the device in octeon_destroy_resources()
1128 if (atomic_read(oct->adapter_fw_state) == FW_IS_PRELOADED) in octeon_destroy_resources()
1131 oct->fn_list.soft_reset(oct); in octeon_destroy_resources()
1138 pci_clear_master(oct->pci_dev); in octeon_destroy_resources()
1140 pci_disable_device(oct->pci_dev); in octeon_destroy_resources()
1146 } /* end switch (oct->status) */ in octeon_destroy_resources()
1148 tasklet_kill(&oct_priv->droq_tasklet); in octeon_destroy_resources()
1152 * send_rx_ctrl_cmd - Send Rx control command
1153 * @lio: per-network private data
1160 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in send_rx_ctrl_cmd()
1163 if (oct->props[lio->ifidx].rx_on == start_stop) in send_rx_ctrl_cmd()
1170 netif_info(lio, rx_err, lio->netdev, in send_rx_ctrl_cmd()
1175 ncmd = (union octnet_cmd *)sc->virtdptr; in send_rx_ctrl_cmd()
1177 ncmd->u64 = 0; in send_rx_ctrl_cmd()
1178 ncmd->s.cmd = OCTNET_CMD_RX_CTL; in send_rx_ctrl_cmd()
1179 ncmd->s.param1 = start_stop; in send_rx_ctrl_cmd()
1183 sc->iq_no = lio->linfo.txpciq[0].s.q_no; in send_rx_ctrl_cmd()
1188 init_completion(&sc->complete); in send_rx_ctrl_cmd()
1189 sc->sc_status = OCTEON_REQUEST_PENDING; in send_rx_ctrl_cmd()
1193 netif_info(lio, rx_err, lio->netdev, "Failed to send RX Control message\n"); in send_rx_ctrl_cmd()
1198 * response arrived or timed-out. in send_rx_ctrl_cmd()
1204 oct->props[lio->ifidx].rx_on = start_stop; in send_rx_ctrl_cmd()
1205 WRITE_ONCE(sc->caller_is_done, true); in send_rx_ctrl_cmd()
1210 * liquidio_destroy_nic_device - Destroy NIC device interface
1219 struct net_device *netdev = oct->props[ifidx].netdev; in liquidio_destroy_nic_device()
1221 (struct octeon_device_priv *)oct->priv; in liquidio_destroy_nic_device()
1226 dev_err(&oct->pci_dev->dev, "%s No netdevice ptr for index %d\n", in liquidio_destroy_nic_device()
1233 dev_dbg(&oct->pci_dev->dev, "NIC device cleanup\n"); in liquidio_destroy_nic_device()
1235 if (atomic_read(&lio->ifstate) & LIO_IFSTATE_RUNNING) in liquidio_destroy_nic_device()
1238 if (oct->props[lio->ifidx].napi_enabled == 1) { in liquidio_destroy_nic_device()
1239 list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) in liquidio_destroy_nic_device()
1242 oct->props[lio->ifidx].napi_enabled = 0; in liquidio_destroy_nic_device()
1245 oct->droq[0]->ops.poll_mode = 0; in liquidio_destroy_nic_device()
1249 list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) in liquidio_destroy_nic_device()
1252 tasklet_enable(&oct_priv->droq_tasklet); in liquidio_destroy_nic_device()
1254 if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED) in liquidio_destroy_nic_device()
1266 oct->props[ifidx].gmxport = -1; in liquidio_destroy_nic_device()
1268 oct->props[ifidx].netdev = NULL; in liquidio_destroy_nic_device()
1272 * liquidio_stop_nic_module - Stop complete NIC functionality
1280 dev_dbg(&oct->pci_dev->dev, "Stopping network interfaces\n"); in liquidio_stop_nic_module()
1281 if (!oct->ifcount) { in liquidio_stop_nic_module()
1282 dev_err(&oct->pci_dev->dev, "Init for Octeon was not completed\n"); in liquidio_stop_nic_module()
1286 spin_lock_bh(&oct->cmd_resp_wqlock); in liquidio_stop_nic_module()
1287 oct->cmd_resp_state = OCT_DRV_OFFLINE; in liquidio_stop_nic_module()
1288 spin_unlock_bh(&oct->cmd_resp_wqlock); in liquidio_stop_nic_module()
1292 for (i = 0; i < oct->ifcount; i++) { in liquidio_stop_nic_module()
1293 lio = GET_LIO(oct->props[i].netdev); in liquidio_stop_nic_module()
1294 for (j = 0; j < oct->num_oqs; j++) in liquidio_stop_nic_module()
1296 lio->linfo.rxpciq[j].s.q_no); in liquidio_stop_nic_module()
1299 for (i = 0; i < oct->ifcount; i++) in liquidio_stop_nic_module()
1302 if (oct->devlink) { in liquidio_stop_nic_module()
1303 devlink_unregister(oct->devlink); in liquidio_stop_nic_module()
1304 devlink_free(oct->devlink); in liquidio_stop_nic_module()
1305 oct->devlink = NULL; in liquidio_stop_nic_module()
1308 dev_dbg(&oct->pci_dev->dev, "Network interfaces stopped\n"); in liquidio_stop_nic_module()
1313 * liquidio_remove - Cleans up resources at unload time
1320 dev_dbg(&oct_dev->pci_dev->dev, "Stopping device\n"); in liquidio_remove()
1322 if (oct_dev->watchdog_task) in liquidio_remove()
1323 kthread_stop(oct_dev->watchdog_task); in liquidio_remove()
1325 if (!oct_dev->octeon_id && in liquidio_remove()
1326 oct_dev->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP) in liquidio_remove()
1329 if (oct_dev->app_mode && (oct_dev->app_mode == CVM_DRV_NIC_APP)) in liquidio_remove()
1337 dev_info(&oct_dev->pci_dev->dev, "Device removed\n"); in liquidio_remove()
1346 * octeon_chip_specific_setup - Identify the Octeon device and to map the BAR address space
1354 pci_read_config_dword(oct->pci_dev, 0, &dev_id); in octeon_chip_specific_setup()
1355 pci_read_config_dword(oct->pci_dev, 8, &rev_id); in octeon_chip_specific_setup()
1356 oct->rev_id = rev_id & 0xff; in octeon_chip_specific_setup()
1360 oct->chip_id = OCTEON_CN68XX; in octeon_chip_specific_setup()
1365 oct->chip_id = OCTEON_CN66XX; in octeon_chip_specific_setup()
1370 oct->chip_id = OCTEON_CN23XX_PF_VID; in octeon_chip_specific_setup()
1376 pci_sriov_set_totalvfs(oct->pci_dev, in octeon_chip_specific_setup()
1377 oct->sriov_info.max_vfs); in octeon_chip_specific_setup()
1382 dev_err(&oct->pci_dev->dev, "Unknown device found (dev_id: %x)\n", in octeon_chip_specific_setup()
1390 * octeon_pci_os_setup - PCI initialization for each Octeon device.
1396 if (pci_enable_device(oct->pci_dev)) { in octeon_pci_os_setup()
1397 dev_err(&oct->pci_dev->dev, "pci_enable_device failed\n"); in octeon_pci_os_setup()
1401 if (dma_set_mask_and_coherent(&oct->pci_dev->dev, DMA_BIT_MASK(64))) { in octeon_pci_os_setup()
1402 dev_err(&oct->pci_dev->dev, "Unexpected DMA device capability\n"); in octeon_pci_os_setup()
1403 pci_disable_device(oct->pci_dev); in octeon_pci_os_setup()
1408 pci_set_master(oct->pci_dev); in octeon_pci_os_setup()
1414 * free_netbuf - Unmap and free network buffer
1424 skb = finfo->skb; in free_netbuf()
1425 lio = finfo->lio; in free_netbuf()
1427 dma_unmap_single(&lio->oct_dev->pci_dev->dev, finfo->dptr, skb->len, in free_netbuf()
1434 * free_netsgbuf - Unmap and free gather buffer
1446 skb = finfo->skb; in free_netsgbuf()
1447 lio = finfo->lio; in free_netsgbuf()
1448 g = finfo->g; in free_netsgbuf()
1449 frags = skb_shinfo(skb)->nr_frags; in free_netsgbuf()
1451 dma_unmap_single(&lio->oct_dev->pci_dev->dev, in free_netsgbuf()
1452 g->sg[0].ptr[0], (skb->len - skb->data_len), in free_netsgbuf()
1456 while (frags--) { in free_netsgbuf()
1457 skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; in free_netsgbuf()
1459 pci_unmap_page((lio->oct_dev)->pci_dev, in free_netsgbuf()
1460 g->sg[(i >> 2)].ptr[(i & 3)], in free_netsgbuf()
1465 iq = skb_iq(lio->oct_dev, skb); in free_netsgbuf()
1466 spin_lock(&lio->glist_lock[iq]); in free_netsgbuf()
1467 list_add_tail(&g->list, &lio->glist[iq]); in free_netsgbuf()
1468 spin_unlock(&lio->glist_lock[iq]); in free_netsgbuf()
1474 * free_netsgbuf_with_resp - Unmap and free gather buffer with response
1487 skb = (struct sk_buff *)sc->callback_arg; in free_netsgbuf_with_resp()
1488 finfo = (struct octnet_buf_free_info *)&skb->cb; in free_netsgbuf_with_resp()
1490 lio = finfo->lio; in free_netsgbuf_with_resp()
1491 g = finfo->g; in free_netsgbuf_with_resp()
1492 frags = skb_shinfo(skb)->nr_frags; in free_netsgbuf_with_resp()
1494 dma_unmap_single(&lio->oct_dev->pci_dev->dev, in free_netsgbuf_with_resp()
1495 g->sg[0].ptr[0], (skb->len - skb->data_len), in free_netsgbuf_with_resp()
1499 while (frags--) { in free_netsgbuf_with_resp()
1500 skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; in free_netsgbuf_with_resp()
1502 pci_unmap_page((lio->oct_dev)->pci_dev, in free_netsgbuf_with_resp()
1503 g->sg[(i >> 2)].ptr[(i & 3)], in free_netsgbuf_with_resp()
1508 iq = skb_iq(lio->oct_dev, skb); in free_netsgbuf_with_resp()
1510 spin_lock(&lio->glist_lock[iq]); in free_netsgbuf_with_resp()
1511 list_add_tail(&g->list, &lio->glist[iq]); in free_netsgbuf_with_resp()
1512 spin_unlock(&lio->glist_lock[iq]); in free_netsgbuf_with_resp()
1518 * liquidio_ptp_adjfreq - Adjust ptp frequency
1520 * @ppb: how much to adjust by, in parts-per-billion
1525 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in liquidio_ptp_adjfreq()
1532 ppb = -ppb; in liquidio_ptp_adjfreq()
1540 do_div(delta, oct->coproc_clock_rate); in liquidio_ptp_adjfreq()
1542 spin_lock_irqsave(&lio->ptp_lock, flags); in liquidio_ptp_adjfreq()
1545 comp -= delta; in liquidio_ptp_adjfreq()
1549 spin_unlock_irqrestore(&lio->ptp_lock, flags); in liquidio_ptp_adjfreq()
1555 * liquidio_ptp_adjtime - Adjust ptp time
1564 spin_lock_irqsave(&lio->ptp_lock, flags); in liquidio_ptp_adjtime()
1565 lio->ptp_adjust += delta; in liquidio_ptp_adjtime()
1566 spin_unlock_irqrestore(&lio->ptp_lock, flags); in liquidio_ptp_adjtime()
1572 * liquidio_ptp_gettime - Get hardware clock time, including any adjustment
1582 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in liquidio_ptp_gettime()
1584 spin_lock_irqsave(&lio->ptp_lock, flags); in liquidio_ptp_gettime()
1586 ns += lio->ptp_adjust; in liquidio_ptp_gettime()
1587 spin_unlock_irqrestore(&lio->ptp_lock, flags); in liquidio_ptp_gettime()
1595 * liquidio_ptp_settime - Set hardware clock time. Reset adjustment
1605 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in liquidio_ptp_settime()
1609 spin_lock_irqsave(&lio->ptp_lock, flags); in liquidio_ptp_settime()
1611 lio->ptp_adjust = 0; in liquidio_ptp_settime()
1612 spin_unlock_irqrestore(&lio->ptp_lock, flags); in liquidio_ptp_settime()
1618 * liquidio_ptp_enable - Check if PTP is enabled
1628 return -EOPNOTSUPP; in liquidio_ptp_enable()
1632 * oct_ptp_open - Open PTP clock source
1638 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; in oct_ptp_open()
1640 spin_lock_init(&lio->ptp_lock); in oct_ptp_open()
1642 snprintf(lio->ptp_info.name, 16, "%s", netdev->name); in oct_ptp_open()
1643 lio->ptp_info.owner = THIS_MODULE; in oct_ptp_open()
1644 lio->ptp_info.max_adj = 250000000; in oct_ptp_open()
1645 lio->ptp_info.n_alarm = 0; in oct_ptp_open()
1646 lio->ptp_info.n_ext_ts = 0; in oct_ptp_open()
1647 lio->ptp_info.n_per_out = 0; in oct_ptp_open()
1648 lio->ptp_info.pps = 0; in oct_ptp_open()
1649 lio->ptp_info.adjfreq = liquidio_ptp_adjfreq; in oct_ptp_open()
1650 lio->ptp_info.adjtime = liquidio_ptp_adjtime; in oct_ptp_open()
1651 lio->ptp_info.gettime64 = liquidio_ptp_gettime; in oct_ptp_open()
1652 lio->ptp_info.settime64 = liquidio_ptp_settime; in oct_ptp_open()
1653 lio->ptp_info.enable = liquidio_ptp_enable; in oct_ptp_open()
1655 lio->ptp_adjust = 0; in oct_ptp_open()
1657 lio->ptp_clock = ptp_clock_register(&lio->ptp_info, in oct_ptp_open()
1658 &oct->pci_dev->dev); in oct_ptp_open()
1660 if (IS_ERR(lio->ptp_clock)) in oct_ptp_open()
1661 lio->ptp_clock = NULL; in oct_ptp_open()
1665 * liquidio_ptp_init - Init PTP clock
1673 do_div(clock_comp, oct->coproc_clock_rate); in liquidio_ptp_init()
1682 * load_firmware - Load firmware to device
1702 octeon_get_conf(oct)->card_name, tmp_fw_type, in load_firmware()
1705 ret = request_firmware(&fw, fw_name, &oct->pci_dev->dev); in load_firmware()
1707 dev_err(&oct->pci_dev->dev, "Request firmware failed. Could not find file %s.\n", in load_firmware()
1713 ret = octeon_download_firmware(oct, fw->data, fw->size); in load_firmware()
1721 * octnet_poll_check_txq_status - Poll routine for checking transmit queue status
1727 struct lio *lio = (struct lio *)wk->ctxptr; in octnet_poll_check_txq_status()
1733 queue_delayed_work(lio->txq_status_wq.wq, in octnet_poll_check_txq_status()
1734 &lio->txq_status_wq.wk.work, msecs_to_jiffies(1)); in octnet_poll_check_txq_status()
1738 * setup_tx_poll_fn - Sets up the txq poll check
1744 struct octeon_device *oct = lio->oct_dev; in setup_tx_poll_fn()
1746 lio->txq_status_wq.wq = alloc_workqueue("txq-status", in setup_tx_poll_fn()
1748 if (!lio->txq_status_wq.wq) { in setup_tx_poll_fn()
1749 dev_err(&oct->pci_dev->dev, "unable to create cavium txq status wq\n"); in setup_tx_poll_fn()
1750 return -1; in setup_tx_poll_fn()
1752 INIT_DELAYED_WORK(&lio->txq_status_wq.wk.work, in setup_tx_poll_fn()
1754 lio->txq_status_wq.wk.ctxptr = lio; in setup_tx_poll_fn()
1755 queue_delayed_work(lio->txq_status_wq.wq, in setup_tx_poll_fn()
1756 &lio->txq_status_wq.wk.work, msecs_to_jiffies(1)); in setup_tx_poll_fn()
1764 if (lio->txq_status_wq.wq) { in cleanup_tx_poll_fn()
1765 cancel_delayed_work_sync(&lio->txq_status_wq.wk.work); in cleanup_tx_poll_fn()
1766 destroy_workqueue(lio->txq_status_wq.wq); in cleanup_tx_poll_fn()
1771 * liquidio_open - Net device open for LiquidIO
1777 struct octeon_device *oct = lio->oct_dev; in liquidio_open()
1779 (struct octeon_device_priv *)oct->priv; in liquidio_open()
1782 if (oct->props[lio->ifidx].napi_enabled == 0) { in liquidio_open()
1783 tasklet_disable(&oct_priv->droq_tasklet); in liquidio_open()
1785 list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) in liquidio_open()
1788 oct->props[lio->ifidx].napi_enabled = 1; in liquidio_open()
1791 oct->droq[0]->ops.poll_mode = 1; in liquidio_open()
1794 if (oct->ptp_enable) in liquidio_open()
1800 if (!oct->msix_on) in liquidio_open()
1802 return -1; in liquidio_open()
1805 return -1; in liquidio_open()
1811 lio->intf_open = 1; in liquidio_open()
1813 netif_info(lio, ifup, lio->netdev, "Interface Open, ready for traffic\n"); in liquidio_open()
1819 INIT_DELAYED_WORK(&lio->stats_wk.work, lio_fetch_stats); in liquidio_open()
1820 lio->stats_wk.ctxptr = lio; in liquidio_open()
1821 schedule_delayed_work(&lio->stats_wk.work, msecs_to_jiffies in liquidio_open()
1824 dev_info(&oct->pci_dev->dev, "%s interface is opened\n", in liquidio_open()
1825 netdev->name); in liquidio_open()
1831 * liquidio_stop - Net device stop for LiquidIO
1837 struct octeon_device *oct = lio->oct_dev; in liquidio_stop()
1839 (struct octeon_device_priv *)oct->priv; in liquidio_stop()
1845 lio->intf_open = 0; in liquidio_stop()
1853 lio->linfo.link.s.link_up = 0; in liquidio_stop()
1854 lio->link_changes++; in liquidio_stop()
1860 if (!oct->msix_on) in liquidio_stop()
1866 cancel_delayed_work_sync(&lio->stats_wk.work); in liquidio_stop()
1868 if (lio->ptp_clock) { in liquidio_stop()
1869 ptp_clock_unregister(lio->ptp_clock); in liquidio_stop()
1870 lio->ptp_clock = NULL; in liquidio_stop()
1875 netif_info(lio, rx_err, lio->netdev, in liquidio_stop()
1878 if (oct->props[lio->ifidx].napi_enabled == 1) { in liquidio_stop()
1879 list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) in liquidio_stop()
1882 oct->props[lio->ifidx].napi_enabled = 0; in liquidio_stop()
1885 oct->droq[0]->ops.poll_mode = 0; in liquidio_stop()
1887 tasklet_enable(&oct_priv->droq_tasklet); in liquidio_stop()
1890 dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); in liquidio_stop()
1896 * get_new_flags - Converts a mask based on net device flags
1906 if (netdev->flags & IFF_PROMISC) in get_new_flags()
1909 if (netdev->flags & IFF_ALLMULTI) in get_new_flags()
1912 if (netdev->flags & IFF_MULTICAST) { in get_new_flags()
1922 if (netdev->flags & IFF_BROADCAST) in get_new_flags()
1929 * liquidio_set_mcast_list - Net device set_multicast_list
1935 struct octeon_device *oct = lio->oct_dev; in liquidio_set_mcast_list()
1950 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_set_mcast_list()
1958 memcpy(((u8 *)mc) + 2, ha->addr, ETH_ALEN); in liquidio_set_mcast_list()
1969 ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); in liquidio_set_mcast_list()
1971 dev_err(&oct->pci_dev->dev, "DEVFLAGS change failed in core (ret: 0x%x)\n", in liquidio_set_mcast_list()
1977 * liquidio_set_mac - Net device set_mac_address
1985 struct octeon_device *oct = lio->oct_dev; in liquidio_set_mac()
1989 if (!is_valid_ether_addr(addr->sa_data)) in liquidio_set_mac()
1990 return -EADDRNOTAVAIL; in liquidio_set_mac()
1998 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_set_mac()
2003 memcpy((u8 *)&nctrl.udd[0] + 2, addr->sa_data, ETH_ALEN); in liquidio_set_mac()
2005 ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); in liquidio_set_mac()
2007 dev_err(&oct->pci_dev->dev, "MAC Address change failed\n"); in liquidio_set_mac()
2008 return -ENOMEM; in liquidio_set_mac()
2012 dev_err(&oct->pci_dev->dev, in liquidio_set_mac()
2015 return -EIO; in liquidio_set_mac()
2018 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); in liquidio_set_mac()
2019 memcpy(((u8 *)&lio->linfo.hw_addr) + 2, addr->sa_data, ETH_ALEN); in liquidio_set_mac()
2035 oct = lio->oct_dev; in liquidio_get_stats64()
2040 for (i = 0; i < oct->num_iqs; i++) { in liquidio_get_stats64()
2041 iq_no = lio->linfo.txpciq[i].s.q_no; in liquidio_get_stats64()
2042 iq_stats = &oct->instr_queue[iq_no]->stats; in liquidio_get_stats64()
2043 pkts += iq_stats->tx_done; in liquidio_get_stats64()
2044 drop += iq_stats->tx_dropped; in liquidio_get_stats64()
2045 bytes += iq_stats->tx_tot_bytes; in liquidio_get_stats64()
2048 lstats->tx_packets = pkts; in liquidio_get_stats64()
2049 lstats->tx_bytes = bytes; in liquidio_get_stats64()
2050 lstats->tx_dropped = drop; in liquidio_get_stats64()
2056 for (i = 0; i < oct->num_oqs; i++) { in liquidio_get_stats64()
2057 oq_no = lio->linfo.rxpciq[i].s.q_no; in liquidio_get_stats64()
2058 oq_stats = &oct->droq[oq_no]->stats; in liquidio_get_stats64()
2059 pkts += oq_stats->rx_pkts_received; in liquidio_get_stats64()
2060 drop += (oq_stats->rx_dropped + in liquidio_get_stats64()
2061 oq_stats->dropped_nodispatch + in liquidio_get_stats64()
2062 oq_stats->dropped_toomany + in liquidio_get_stats64()
2063 oq_stats->dropped_nomem); in liquidio_get_stats64()
2064 bytes += oq_stats->rx_bytes_received; in liquidio_get_stats64()
2067 lstats->rx_bytes = bytes; in liquidio_get_stats64()
2068 lstats->rx_packets = pkts; in liquidio_get_stats64()
2069 lstats->rx_dropped = drop; in liquidio_get_stats64()
2071 lstats->multicast = oct->link_stats.fromwire.fw_total_mcast; in liquidio_get_stats64()
2072 lstats->collisions = oct->link_stats.fromhost.total_collisions; in liquidio_get_stats64()
2075 lstats->rx_length_errors = oct->link_stats.fromwire.l2_err; in liquidio_get_stats64()
2077 lstats->rx_crc_errors = oct->link_stats.fromwire.fcs_err; in liquidio_get_stats64()
2079 lstats->rx_frame_errors = oct->link_stats.fromwire.frame_err; in liquidio_get_stats64()
2081 lstats->rx_fifo_errors = oct->link_stats.fromwire.fifo_err; in liquidio_get_stats64()
2083 lstats->rx_errors = lstats->rx_length_errors + lstats->rx_crc_errors + in liquidio_get_stats64()
2084 lstats->rx_frame_errors + lstats->rx_fifo_errors; in liquidio_get_stats64()
2087 lstats->tx_aborted_errors = oct->link_stats.fromhost.fw_err_pko; in liquidio_get_stats64()
2088 lstats->tx_carrier_errors = oct->link_stats.fromhost.fw_err_link; in liquidio_get_stats64()
2089 lstats->tx_fifo_errors = oct->link_stats.fromhost.fifo_err; in liquidio_get_stats64()
2091 lstats->tx_errors = lstats->tx_aborted_errors + in liquidio_get_stats64()
2092 lstats->tx_carrier_errors + in liquidio_get_stats64()
2093 lstats->tx_fifo_errors; in liquidio_get_stats64()
2097 * hwtstamp_ioctl - Handler for SIOCSHWTSTAMP ioctl
2106 if (copy_from_user(&conf, ifr->ifr_data, sizeof(conf))) in hwtstamp_ioctl()
2107 return -EFAULT; in hwtstamp_ioctl()
2110 return -EINVAL; in hwtstamp_ioctl()
2117 return -ERANGE; in hwtstamp_ioctl()
2141 return -ERANGE; in hwtstamp_ioctl()
2150 return copy_to_user(ifr->ifr_data, &conf, sizeof(conf)) ? -EFAULT : 0; in hwtstamp_ioctl()
2154 * liquidio_ioctl - ioctl handler
2165 if (lio->oct_dev->ptp_enable) in liquidio_ioctl()
2169 return -EOPNOTSUPP; in liquidio_ioctl()
2174 * handle_timestamp - handle a Tx timestamp response
2189 finfo = (struct octnet_buf_free_info *)skb->cb; in handle_timestamp()
2190 lio = finfo->lio; in handle_timestamp()
2191 sc = finfo->sc; in handle_timestamp()
2192 oct = lio->oct_dev; in handle_timestamp()
2193 resp = (struct oct_timestamp_resp *)sc->virtrptr; in handle_timestamp()
2196 dev_err(&oct->pci_dev->dev, "Tx timestamp instruction failed. Status: %llx\n", in handle_timestamp()
2198 resp->timestamp = 0; in handle_timestamp()
2201 octeon_swap_8B_data(&resp->timestamp, 1); in handle_timestamp()
2203 if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) != 0)) { in handle_timestamp()
2205 u64 ns = resp->timestamp; in handle_timestamp()
2207 netif_info(lio, tx_done, lio->netdev, in handle_timestamp()
2210 ts.hwtstamp = ns_to_ktime(ns + lio->ptp_adjust); in handle_timestamp()
2219 * send_nic_timestamp_pkt - Send a data packet that will be timestamped
2236 lio = finfo->lio; in send_nic_timestamp_pkt()
2238 sc = octeon_alloc_soft_command_resp(oct, &ndata->cmd, in send_nic_timestamp_pkt()
2240 finfo->sc = sc; in send_nic_timestamp_pkt()
2243 dev_err(&oct->pci_dev->dev, "No memory for timestamped data packet\n"); in send_nic_timestamp_pkt()
2247 if (ndata->reqtype == REQTYPE_NORESP_NET) in send_nic_timestamp_pkt()
2248 ndata->reqtype = REQTYPE_RESP_NET; in send_nic_timestamp_pkt()
2249 else if (ndata->reqtype == REQTYPE_NORESP_NET_SG) in send_nic_timestamp_pkt()
2250 ndata->reqtype = REQTYPE_RESP_NET_SG; in send_nic_timestamp_pkt()
2252 sc->callback = handle_timestamp; in send_nic_timestamp_pkt()
2253 sc->callback_arg = finfo->skb; in send_nic_timestamp_pkt()
2254 sc->iq_no = ndata->q_no; in send_nic_timestamp_pkt()
2258 (&sc->cmd.cmd3.ih3))->dlengsz; in send_nic_timestamp_pkt()
2261 (&sc->cmd.cmd2.ih2))->dlengsz; in send_nic_timestamp_pkt()
2265 retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd, in send_nic_timestamp_pkt()
2266 sc, len, ndata->reqtype); in send_nic_timestamp_pkt()
2269 dev_err(&oct->pci_dev->dev, "timestamp data packet failed status: %x\n", in send_nic_timestamp_pkt()
2273 netif_info(lio, tx_queued, lio->netdev, "Queued timestamp packet\n"); in send_nic_timestamp_pkt()
2280 * liquidio_xmit - Transmit networks packets to the Octeon interface
2304 oct = lio->oct_dev; in liquidio_xmit()
2308 iq_no = lio->linfo.txpciq[q_idx].s.q_no; in liquidio_xmit()
2310 stats = &oct->instr_queue[iq_no]->stats; in liquidio_xmit()
2315 if (!(atomic_read(&lio->ifstate) & LIO_IFSTATE_RUNNING) || in liquidio_xmit()
2316 (!lio->linfo.link.s.link_up) || in liquidio_xmit()
2317 (skb->len <= 0)) { in liquidio_xmit()
2318 netif_info(lio, tx_err, lio->netdev, in liquidio_xmit()
2320 lio->linfo.link.s.link_up); in liquidio_xmit()
2324 /* Use space in skb->cb to store info used to unmap and in liquidio_xmit()
2327 finfo = (struct octnet_buf_free_info *)skb->cb; in liquidio_xmit()
2328 finfo->lio = lio; in liquidio_xmit()
2329 finfo->skb = skb; in liquidio_xmit()
2330 finfo->sc = NULL; in liquidio_xmit()
2341 netif_info(lio, tx_err, lio->netdev, "Transmit failed iq:%d full\n", in liquidio_xmit()
2343 stats->tx_iq_busy++; in liquidio_xmit()
2347 /* pr_info(" XMIT - valid Qs: %d, 1st Q no: %d, cpu: %d, q_no:%d\n", in liquidio_xmit()
2348 * lio->linfo.num_txpciq, lio->txq, cpu, ndata.q_no); in liquidio_xmit()
2351 ndata.datasize = skb->len; in liquidio_xmit()
2356 if (skb->ip_summed == CHECKSUM_PARTIAL) { in liquidio_xmit()
2357 if (skb->encapsulation) { in liquidio_xmit()
2359 stats->tx_vxlan++; in liquidio_xmit()
2364 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { in liquidio_xmit()
2365 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; in liquidio_xmit()
2369 if (skb_shinfo(skb)->nr_frags == 0) { in liquidio_xmit()
2370 cmdsetup.s.u.datasize = skb->len; in liquidio_xmit()
2374 dptr = dma_map_single(&oct->pci_dev->dev, in liquidio_xmit()
2375 skb->data, in liquidio_xmit()
2376 skb->len, in liquidio_xmit()
2378 if (dma_mapping_error(&oct->pci_dev->dev, dptr)) { in liquidio_xmit()
2379 dev_err(&oct->pci_dev->dev, "%s DMA mapping error 1\n", in liquidio_xmit()
2381 stats->tx_dmamap_fail++; in liquidio_xmit()
2389 finfo->dptr = dptr; in liquidio_xmit()
2397 spin_lock(&lio->glist_lock[q_idx]); in liquidio_xmit()
2399 lio_list_delete_head(&lio->glist[q_idx]); in liquidio_xmit()
2400 spin_unlock(&lio->glist_lock[q_idx]); in liquidio_xmit()
2403 netif_info(lio, tx_err, lio->netdev, in liquidio_xmit()
2409 cmdsetup.s.u.gatherptrs = (skb_shinfo(skb)->nr_frags + 1); in liquidio_xmit()
2412 memset(g->sg, 0, g->sg_size); in liquidio_xmit()
2414 g->sg[0].ptr[0] = dma_map_single(&oct->pci_dev->dev, in liquidio_xmit()
2415 skb->data, in liquidio_xmit()
2416 (skb->len - skb->data_len), in liquidio_xmit()
2418 if (dma_mapping_error(&oct->pci_dev->dev, g->sg[0].ptr[0])) { in liquidio_xmit()
2419 dev_err(&oct->pci_dev->dev, "%s DMA mapping error 2\n", in liquidio_xmit()
2421 stats->tx_dmamap_fail++; in liquidio_xmit()
2424 add_sg_size(&g->sg[0], (skb->len - skb->data_len), 0); in liquidio_xmit()
2426 frags = skb_shinfo(skb)->nr_frags; in liquidio_xmit()
2428 while (frags--) { in liquidio_xmit()
2429 frag = &skb_shinfo(skb)->frags[i - 1]; in liquidio_xmit()
2431 g->sg[(i >> 2)].ptr[(i & 3)] = in liquidio_xmit()
2432 skb_frag_dma_map(&oct->pci_dev->dev, in liquidio_xmit()
2436 if (dma_mapping_error(&oct->pci_dev->dev, in liquidio_xmit()
2437 g->sg[i >> 2].ptr[i & 3])) { in liquidio_xmit()
2438 dma_unmap_single(&oct->pci_dev->dev, in liquidio_xmit()
2439 g->sg[0].ptr[0], in liquidio_xmit()
2440 skb->len - skb->data_len, in liquidio_xmit()
2443 frag = &skb_shinfo(skb)->frags[j - 1]; in liquidio_xmit()
2444 dma_unmap_page(&oct->pci_dev->dev, in liquidio_xmit()
2445 g->sg[j >> 2].ptr[j & 3], in liquidio_xmit()
2449 dev_err(&oct->pci_dev->dev, "%s DMA mapping error 3\n", in liquidio_xmit()
2454 add_sg_size(&g->sg[(i >> 2)], skb_frag_size(frag), in liquidio_xmit()
2459 dptr = g->sg_dma_ptr; in liquidio_xmit()
2465 finfo->dptr = dptr; in liquidio_xmit()
2466 finfo->g = g; in liquidio_xmit()
2479 if (skb_shinfo(skb)->gso_size) { in liquidio_xmit()
2480 tx_info->s.gso_size = skb_shinfo(skb)->gso_size; in liquidio_xmit()
2481 tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs; in liquidio_xmit()
2482 stats->tx_gso++; in liquidio_xmit()
2487 irh->priority = skb_vlan_tag_get(skb) >> 13; in liquidio_xmit()
2488 irh->vlan = skb_vlan_tag_get(skb) & 0xfff; in liquidio_xmit()
2500 netif_info(lio, tx_queued, lio->netdev, "Transmit queued successfully\n"); in liquidio_xmit()
2507 if (tx_info->s.gso_segs) in liquidio_xmit()
2508 stats->tx_done += tx_info->s.gso_segs; in liquidio_xmit()
2510 stats->tx_done++; in liquidio_xmit()
2511 stats->tx_tot_bytes += ndata.datasize; in liquidio_xmit()
2516 stats->tx_dropped++; in liquidio_xmit()
2517 netif_info(lio, tx_err, lio->netdev, "IQ%d Transmit dropped:%llu\n", in liquidio_xmit()
2518 iq_no, stats->tx_dropped); in liquidio_xmit()
2520 dma_unmap_single(&oct->pci_dev->dev, dptr, in liquidio_xmit()
2530 * liquidio_tx_timeout - Network device Tx timeout
2540 netif_info(lio, tx_err, lio->netdev, in liquidio_tx_timeout()
2542 netdev->stats.tx_dropped); in liquidio_tx_timeout()
2552 struct octeon_device *oct = lio->oct_dev; in liquidio_vlan_rx_add_vid()
2561 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_vlan_rx_add_vid()
2565 ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); in liquidio_vlan_rx_add_vid()
2567 dev_err(&oct->pci_dev->dev, "Add VLAN filter failed in core (ret: 0x%x)\n", in liquidio_vlan_rx_add_vid()
2570 ret = -EIO; in liquidio_vlan_rx_add_vid()
2581 struct octeon_device *oct = lio->oct_dev; in liquidio_vlan_rx_kill_vid()
2590 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_vlan_rx_kill_vid()
2594 ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); in liquidio_vlan_rx_kill_vid()
2596 dev_err(&oct->pci_dev->dev, "Del VLAN filter failed in core (ret: 0x%x)\n", in liquidio_vlan_rx_kill_vid()
2599 ret = -EIO; in liquidio_vlan_rx_kill_vid()
2605 * liquidio_set_rxcsum_command - Sending command to enable/disable RX checksum offload
2615 struct octeon_device *oct = lio->oct_dev; in liquidio_set_rxcsum_command()
2624 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_set_rxcsum_command()
2628 ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); in liquidio_set_rxcsum_command()
2630 dev_err(&oct->pci_dev->dev, in liquidio_set_rxcsum_command()
2634 ret = -EIO; in liquidio_set_rxcsum_command()
2640 * liquidio_vxlan_port_command - Sending command to add/delete VxLAN UDP port to firmware
2652 struct octeon_device *oct = lio->oct_dev; in liquidio_vxlan_port_command()
2662 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_vxlan_port_command()
2666 ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl); in liquidio_vxlan_port_command()
2668 dev_err(&oct->pci_dev->dev, in liquidio_vxlan_port_command()
2672 ret = -EIO; in liquidio_vxlan_port_command()
2683 htons(ti->port), in liquidio_udp_tunnel_set_port()
2694 htons(ti->port), in liquidio_udp_tunnel_unset_port()
2707 * liquidio_fix_features - Net device fix features
2718 !(lio->dev_capability & NETIF_F_RXCSUM)) in liquidio_fix_features()
2722 !(lio->dev_capability & NETIF_F_HW_CSUM)) in liquidio_fix_features()
2725 if ((request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) in liquidio_fix_features()
2728 if ((request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) in liquidio_fix_features()
2731 if ((request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) in liquidio_fix_features()
2735 if (!(request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && in liquidio_fix_features()
2736 (lio->dev_capability & NETIF_F_LRO)) in liquidio_fix_features()
2740 !(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER)) in liquidio_fix_features()
2747 * liquidio_set_features - Net device set features
2757 (lio->dev_capability & NETIF_F_LRO) && in liquidio_set_features()
2758 !(netdev->features & NETIF_F_LRO)) in liquidio_set_features()
2762 (lio->dev_capability & NETIF_F_LRO) && in liquidio_set_features()
2763 (netdev->features & NETIF_F_LRO)) in liquidio_set_features()
2770 if (!(netdev->features & NETIF_F_RXCSUM) && in liquidio_set_features()
2771 (lio->enc_dev_capability & NETIF_F_RXCSUM) && in liquidio_set_features()
2776 else if ((netdev->features & NETIF_F_RXCSUM) && in liquidio_set_features()
2777 (lio->enc_dev_capability & NETIF_F_RXCSUM) && in liquidio_set_features()
2783 (lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER) && in liquidio_set_features()
2784 !(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) in liquidio_set_features()
2788 (lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER) && in liquidio_set_features()
2789 (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) in liquidio_set_features()
2800 struct octeon_device *oct = lio->oct_dev; in __liquidio_set_vf_mac()
2805 return -EINVAL; in __liquidio_set_vf_mac()
2807 if (vfidx < 0 || vfidx >= oct->sriov_info.max_vfs) in __liquidio_set_vf_mac()
2808 return -EINVAL; in __liquidio_set_vf_mac()
2817 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in __liquidio_set_vf_mac()
2828 oct->sriov_info.vf_macaddr[vfidx] = nctrl.udd[0]; in __liquidio_set_vf_mac()
2832 ret = -EIO; in __liquidio_set_vf_mac()
2840 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_mac()
2843 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_set_vf_mac()
2844 return -EINVAL; in liquidio_set_vf_mac()
2857 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_spoofchk()
2861 if (!(oct->fw_info.app_cap_flags & LIQUIDIO_SPOOFCHK_CAP)) { in liquidio_set_vf_spoofchk()
2862 netif_info(lio, drv, lio->netdev, in liquidio_set_vf_spoofchk()
2864 return -EOPNOTSUPP; in liquidio_set_vf_spoofchk()
2867 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) { in liquidio_set_vf_spoofchk()
2868 netif_info(lio, drv, lio->netdev, "Invalid vfidx %d\n", vfidx); in liquidio_set_vf_spoofchk()
2869 return -EINVAL; in liquidio_set_vf_spoofchk()
2873 if (oct->sriov_info.vf_spoofchk[vfidx]) in liquidio_set_vf_spoofchk()
2877 if (!oct->sriov_info.vf_spoofchk[vfidx]) in liquidio_set_vf_spoofchk()
2890 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_set_vf_spoofchk()
2896 netif_info(lio, drv, lio->netdev, in liquidio_set_vf_spoofchk()
2899 return -1; in liquidio_set_vf_spoofchk()
2902 oct->sriov_info.vf_spoofchk[vfidx] = enable; in liquidio_set_vf_spoofchk()
2903 netif_info(lio, drv, lio->netdev, "VF %u spoofchk is %s\n", vfidx, in liquidio_set_vf_spoofchk()
2913 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_vlan()
2918 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_set_vf_vlan()
2919 return -EINVAL; in liquidio_set_vf_vlan()
2922 return -EPROTONOSUPPORT; in liquidio_set_vf_vlan()
2925 return -EINVAL; in liquidio_set_vf_vlan()
2932 if (oct->sriov_info.vf_vlantci[vfidx] == vlantci) in liquidio_set_vf_vlan()
2946 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_set_vf_vlan()
2952 ret = -EIO; in liquidio_set_vf_vlan()
2956 oct->sriov_info.vf_vlantci[vfidx] = vlantci; in liquidio_set_vf_vlan()
2965 struct octeon_device *oct = lio->oct_dev; in liquidio_get_vf_config()
2968 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_get_vf_config()
2969 return -EINVAL; in liquidio_get_vf_config()
2973 ivi->vf = vfidx; in liquidio_get_vf_config()
2974 macaddr = 2 + (u8 *)&oct->sriov_info.vf_macaddr[vfidx]; in liquidio_get_vf_config()
2975 ether_addr_copy(&ivi->mac[0], macaddr); in liquidio_get_vf_config()
2976 ivi->vlan = oct->sriov_info.vf_vlantci[vfidx] & VLAN_VID_MASK; in liquidio_get_vf_config()
2977 ivi->qos = oct->sriov_info.vf_vlantci[vfidx] >> VLAN_PRIO_SHIFT; in liquidio_get_vf_config()
2978 if (oct->sriov_info.trusted_vf.active && in liquidio_get_vf_config()
2979 oct->sriov_info.trusted_vf.id == vfidx) in liquidio_get_vf_config()
2980 ivi->trusted = true; in liquidio_get_vf_config()
2982 ivi->trusted = false; in liquidio_get_vf_config()
2983 ivi->linkstate = oct->sriov_info.vf_linkstate[vfidx]; in liquidio_get_vf_config()
2984 ivi->spoofchk = oct->sriov_info.vf_spoofchk[vfidx]; in liquidio_get_vf_config()
2985 ivi->max_tx_rate = lio->linfo.link.s.speed; in liquidio_get_vf_config()
2986 ivi->min_tx_rate = 0; in liquidio_get_vf_config()
2993 struct octeon_device *oct = lio->oct_dev; in liquidio_send_vf_trust_cmd()
2999 return -ENOMEM; in liquidio_send_vf_trust_cmd()
3001 sc->iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_send_vf_trust_cmd()
3008 init_completion(&sc->complete); in liquidio_send_vf_trust_cmd()
3009 sc->sc_status = OCTEON_REQUEST_PENDING; in liquidio_send_vf_trust_cmd()
3014 retval = -1; in liquidio_send_vf_trust_cmd()
3021 WRITE_ONCE(sc->caller_is_done, true); in liquidio_send_vf_trust_cmd()
3031 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_trust()
3033 if (strcmp(oct->fw_info.liquidio_firmware_version, "1.7.1") < 0) { in liquidio_set_vf_trust()
3035 return -EOPNOTSUPP; in liquidio_set_vf_trust()
3038 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) { in liquidio_set_vf_trust()
3039 netif_info(lio, drv, lio->netdev, "Invalid vfidx %d\n", vfidx); in liquidio_set_vf_trust()
3040 return -EINVAL; in liquidio_set_vf_trust()
3046 if (oct->sriov_info.trusted_vf.active && in liquidio_set_vf_trust()
3047 oct->sriov_info.trusted_vf.id == vfidx) in liquidio_set_vf_trust()
3050 if (oct->sriov_info.trusted_vf.active) { in liquidio_set_vf_trust()
3051 netif_info(lio, drv, lio->netdev, "More than one trusted VF is not allowed\n"); in liquidio_set_vf_trust()
3052 return -EPERM; in liquidio_set_vf_trust()
3057 if (!oct->sriov_info.trusted_vf.active) in liquidio_set_vf_trust()
3063 oct->sriov_info.trusted_vf.id = vfidx; in liquidio_set_vf_trust()
3064 oct->sriov_info.trusted_vf.active = true; in liquidio_set_vf_trust()
3066 oct->sriov_info.trusted_vf.active = false; in liquidio_set_vf_trust()
3069 netif_info(lio, drv, lio->netdev, "VF %u is %strusted\n", vfidx, in liquidio_set_vf_trust()
3072 netif_info(lio, drv, lio->netdev, "Failed to set VF trusted\n"); in liquidio_set_vf_trust()
3073 return -1; in liquidio_set_vf_trust()
3083 struct octeon_device *oct = lio->oct_dev; in liquidio_set_vf_link_state()
3087 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_set_vf_link_state()
3088 return -EINVAL; in liquidio_set_vf_link_state()
3090 if (oct->sriov_info.vf_linkstate[vfidx] == linkstate) in liquidio_set_vf_link_state()
3099 nctrl.iq_no = lio->linfo.txpciq[0].s.q_no; in liquidio_set_vf_link_state()
3105 oct->sriov_info.vf_linkstate[vfidx] = linkstate; in liquidio_set_vf_link_state()
3107 ret = -EIO; in liquidio_set_vf_link_state()
3119 oct = priv->oct; in liquidio_eswitch_mode_get()
3121 *mode = oct->eswitch_mode; in liquidio_eswitch_mode_get()
3135 oct = priv->oct; in liquidio_eswitch_mode_set()
3137 if (!(oct->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP)) in liquidio_eswitch_mode_set()
3138 return -EINVAL; in liquidio_eswitch_mode_set()
3140 if (oct->eswitch_mode == mode) in liquidio_eswitch_mode_set()
3145 oct->eswitch_mode = mode; in liquidio_eswitch_mode_set()
3151 oct->eswitch_mode = mode; in liquidio_eswitch_mode_set()
3155 ret = -EINVAL; in liquidio_eswitch_mode_set()
3171 struct octeon_device *oct = lio->oct_dev; in liquidio_get_port_parent_id()
3173 if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV) in liquidio_get_port_parent_id()
3174 return -EOPNOTSUPP; in liquidio_get_port_parent_id()
3176 ppid->id_len = ETH_ALEN; in liquidio_get_port_parent_id()
3177 ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2); in liquidio_get_port_parent_id()
3186 struct octeon_device *oct = lio->oct_dev; in liquidio_get_vf_stats()
3190 if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced) in liquidio_get_vf_stats()
3191 return -EINVAL; in liquidio_get_vf_stats()
3196 vf_stats->rx_packets = stats.rx_packets; in liquidio_get_vf_stats()
3197 vf_stats->tx_packets = stats.tx_packets; in liquidio_get_vf_stats()
3198 vf_stats->rx_bytes = stats.rx_bytes; in liquidio_get_vf_stats()
3199 vf_stats->tx_bytes = stats.tx_bytes; in liquidio_get_vf_stats()
3200 vf_stats->broadcast = stats.broadcast; in liquidio_get_vf_stats()
3201 vf_stats->multicast = stats.multicast; in liquidio_get_vf_stats()
3235 * liquidio_init - Entry point for the liquidio module
3247 return -EINVAL; in liquidio_init()
3253 if (hs->pci_dev) { in liquidio_init()
3254 wait_for_completion(&hs->init); in liquidio_init()
3255 if (!hs->init_ok) { in liquidio_init()
3257 dev_err(&hs->pci_dev->dev, in liquidio_init()
3260 return -EIO; in liquidio_init()
3267 if (hs->pci_dev) { in liquidio_init()
3268 wait_for_completion_timeout(&hs->started, in liquidio_init()
3270 if (!hs->started_ok) { in liquidio_init()
3272 dev_err(&hs->pci_dev->dev, in liquidio_init()
3275 return -EIO; in liquidio_init()
3286 struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt; in lio_nic_info()
3291 if (recv_pkt->buffer_size[0] != (sizeof(*ls) + OCT_DROQ_INFO_SIZE)) { in lio_nic_info()
3292 dev_err(&oct->pci_dev->dev, "Malformed NIC_INFO, len=%d, ifidx=%d\n", in lio_nic_info()
3293 recv_pkt->buffer_size[0], in lio_nic_info()
3294 recv_pkt->rh.r_nic_info.gmxport); in lio_nic_info()
3298 gmxport = recv_pkt->rh.r_nic_info.gmxport; in lio_nic_info()
3299 ls = (union oct_link_status *)(get_rbd(recv_pkt->buffer_ptr[0]) + in lio_nic_info()
3303 for (i = 0; i < oct->ifcount; i++) { in lio_nic_info()
3304 if (oct->props[i].gmxport == gmxport) { in lio_nic_info()
3305 update_link_status(oct->props[i].netdev, ls); in lio_nic_info()
3311 for (i = 0; i < recv_pkt->buffer_count; i++) in lio_nic_info()
3312 recv_buffer_free(recv_pkt->buffer_ptr[i]); in lio_nic_info()
3318 * setup_nic_devices - Setup network interfaces
3330 unsigned long micro; in setup_nic_devices() local
3363 for (i = 0; i < octeon_dev->ifcount; i++) { in setup_nic_devices()
3369 resp = (struct liquidio_if_cfg_resp *)sc->virtrptr; in setup_nic_devices()
3370 vdata = (struct lio_version *)sc->virtdptr; in setup_nic_devices()
3373 vdata->major = cpu_to_be16(LIQUIDIO_BASE_MAJOR_VERSION); in setup_nic_devices()
3374 vdata->minor = cpu_to_be16(LIQUIDIO_BASE_MINOR_VERSION); in setup_nic_devices()
3375 vdata->micro = cpu_to_be16(LIQUIDIO_BASE_MICRO_VERSION); in setup_nic_devices()
3378 num_iqueues = octeon_dev->sriov_info.num_pf_rings; in setup_nic_devices()
3379 num_oqueues = octeon_dev->sriov_info.num_pf_rings; in setup_nic_devices()
3380 base_queue = octeon_dev->sriov_info.pf_srn; in setup_nic_devices()
3382 gmx_port_id = octeon_dev->pf_num; in setup_nic_devices()
3383 ifidx_or_pfnum = octeon_dev->pf_num; in setup_nic_devices()
3396 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3406 sc->iq_no = 0; in setup_nic_devices()
3412 init_completion(&sc->complete); in setup_nic_devices()
3413 sc->sc_status = OCTEON_REQUEST_PENDING; in setup_nic_devices()
3417 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3422 return(-EIO); in setup_nic_devices()
3426 * response arrived or timed-out. in setup_nic_devices()
3432 retval = resp->status; in setup_nic_devices()
3434 dev_err(&octeon_dev->pci_dev->dev, "iq/oq config failed\n"); in setup_nic_devices()
3435 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3438 snprintf(octeon_dev->fw_info.liquidio_firmware_version, in setup_nic_devices()
3440 resp->cfg_info.liquidio_firmware_version); in setup_nic_devices()
3443 fw_ver = octeon_dev->fw_info.liquidio_firmware_version; in setup_nic_devices()
3447 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3450 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3452 } else if (atomic_read(octeon_dev->adapter_fw_state) == in setup_nic_devices()
3454 dev_info(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3455 "Using auto-loaded firmware version %s.\n", in setup_nic_devices()
3459 /* extract micro version field; point past '<maj>.<min>.' */ in setup_nic_devices()
3461 if (kstrtoul(micro_ver, 10, µ) != 0) in setup_nic_devices()
3462 micro = 0; in setup_nic_devices()
3463 octeon_dev->fw_info.ver.maj = LIQUIDIO_BASE_MAJOR_VERSION; in setup_nic_devices()
3464 octeon_dev->fw_info.ver.min = LIQUIDIO_BASE_MINOR_VERSION; in setup_nic_devices()
3465 octeon_dev->fw_info.ver.rev = micro; in setup_nic_devices()
3467 octeon_swap_8B_data((u64 *)(&resp->cfg_info), in setup_nic_devices()
3470 num_iqueues = hweight64(resp->cfg_info.iqmask); in setup_nic_devices()
3471 num_oqueues = hweight64(resp->cfg_info.oqmask); in setup_nic_devices()
3474 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3476 resp->cfg_info.iqmask, in setup_nic_devices()
3477 resp->cfg_info.oqmask); in setup_nic_devices()
3478 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3490 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3492 i, resp->cfg_info.iqmask, resp->cfg_info.oqmask, in setup_nic_devices()
3497 dev_err(&octeon_dev->pci_dev->dev, "Device allocation failed\n"); in setup_nic_devices()
3498 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3502 SET_NETDEV_DEV(netdev, &octeon_dev->pci_dev->dev); in setup_nic_devices()
3507 netdev->netdev_ops = &lionetdevops; in setup_nic_devices()
3511 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3513 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3519 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3521 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3529 lio->ifidx = ifidx_or_pfnum; in setup_nic_devices()
3531 props = &octeon_dev->props[i]; in setup_nic_devices()
3532 props->gmxport = resp->cfg_info.linfo.gmxport; in setup_nic_devices()
3533 props->netdev = netdev; in setup_nic_devices()
3535 lio->linfo.num_rxpciq = num_oqueues; in setup_nic_devices()
3536 lio->linfo.num_txpciq = num_iqueues; in setup_nic_devices()
3538 lio->linfo.rxpciq[j].u64 = in setup_nic_devices()
3539 resp->cfg_info.linfo.rxpciq[j].u64; in setup_nic_devices()
3542 lio->linfo.txpciq[j].u64 = in setup_nic_devices()
3543 resp->cfg_info.linfo.txpciq[j].u64; in setup_nic_devices()
3545 lio->linfo.hw_addr = resp->cfg_info.linfo.hw_addr; in setup_nic_devices()
3546 lio->linfo.gmxport = resp->cfg_info.linfo.gmxport; in setup_nic_devices()
3547 lio->linfo.link.u64 = resp->cfg_info.linfo.link.u64; in setup_nic_devices()
3549 WRITE_ONCE(sc->caller_is_done, true); in setup_nic_devices()
3551 lio->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); in setup_nic_devices()
3555 lio->dev_capability = NETIF_F_HIGHDMA in setup_nic_devices()
3568 lio->enc_dev_capability = NETIF_F_IP_CSUM in setup_nic_devices()
3576 netdev->hw_enc_features = (lio->enc_dev_capability & in setup_nic_devices()
3579 netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels; in setup_nic_devices()
3581 lio->dev_capability |= NETIF_F_GSO_UDP_TUNNEL; in setup_nic_devices()
3583 netdev->vlan_features = lio->dev_capability; in setup_nic_devices()
3585 lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | in setup_nic_devices()
3589 netdev->features = (lio->dev_capability & ~NETIF_F_LRO); in setup_nic_devices()
3591 netdev->hw_features = lio->dev_capability; in setup_nic_devices()
3593 netdev->hw_features = netdev->hw_features & in setup_nic_devices()
3596 /* MTU range: 68 - 16000 */ in setup_nic_devices()
3597 netdev->min_mtu = LIO_MIN_MTU_SIZE; in setup_nic_devices()
3598 netdev->max_mtu = LIO_MAX_MTU_SIZE; in setup_nic_devices()
3603 lio->oct_dev = octeon_dev; in setup_nic_devices()
3604 lio->octprops = props; in setup_nic_devices()
3605 lio->netdev = netdev; in setup_nic_devices()
3607 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3609 lio->linfo.gmxport, CVM_CAST64(lio->linfo.hw_addr)); in setup_nic_devices()
3611 for (j = 0; j < octeon_dev->sriov_info.max_vfs; j++) { in setup_nic_devices()
3616 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3623 /* 64-bit swap required on LE machines */ in setup_nic_devices()
3624 octeon_swap_8B_data(&lio->linfo.hw_addr, 1); in setup_nic_devices()
3626 mac[j] = *((u8 *)(((u8 *)&lio->linfo.hw_addr) + 2 + j)); in setup_nic_devices()
3630 ether_addr_copy(netdev->dev_addr, mac); in setup_nic_devices()
3635 lio->txq = lio->linfo.txpciq[0].s.q_no; in setup_nic_devices()
3636 lio->rxq = lio->linfo.rxpciq[0].s.q_no; in setup_nic_devices()
3638 lio->linfo.num_txpciq, in setup_nic_devices()
3639 lio->linfo.num_rxpciq)) { in setup_nic_devices()
3640 dev_err(&octeon_dev->pci_dev->dev, "I/O queues creation failed\n"); in setup_nic_devices()
3646 lio->tx_qsize = octeon_get_tx_qsize(octeon_dev, lio->txq); in setup_nic_devices()
3647 lio->rx_qsize = octeon_get_rx_qsize(octeon_dev, lio->rxq); in setup_nic_devices()
3650 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3657 if (lio->oct_dev->chip_id == OCTEON_CN23XX_PF_VID) in setup_nic_devices()
3658 octeon_dev->priv_flags = OCT_PRIV_FLAG_DEFAULT; in setup_nic_devices()
3660 octeon_dev->priv_flags = 0x0; in setup_nic_devices()
3662 if (netdev->features & NETIF_F_LRO) in setup_nic_devices()
3669 if ((debug != -1) && (debug & NETIF_MSG_HW)) in setup_nic_devices()
3676 if ((octeon_dev->fw_info.app_cap_flags & in setup_nic_devices()
3686 dev_err(&octeon_dev->pci_dev->dev, "Device registration failed\n"); in setup_nic_devices()
3690 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3694 lio->link_changes++; in setup_nic_devices()
3707 dev_dbg(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3710 if (octeon_dev->subsystem_id == in setup_nic_devices()
3712 octeon_dev->subsystem_id == in setup_nic_devices()
3714 cur_ver = OCT_FW_VER(octeon_dev->fw_info.ver.maj, in setup_nic_devices()
3715 octeon_dev->fw_info.ver.min, in setup_nic_devices()
3716 octeon_dev->fw_info.ver.rev); in setup_nic_devices()
3720 dev_info(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3722 octeon_dev->speed_setting = 25; in setup_nic_devices()
3723 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3728 if (octeon_dev->speed_setting == 0) { in setup_nic_devices()
3729 octeon_dev->speed_setting = 25; in setup_nic_devices()
3730 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3733 octeon_dev->no_speed_setting = 1; in setup_nic_devices()
3734 octeon_dev->speed_setting = 10; in setup_nic_devices()
3736 octeon_dev->speed_boot = octeon_dev->speed_setting; in setup_nic_devices()
3739 if (octeon_dev->speed_boot == 25 && in setup_nic_devices()
3740 !octeon_dev->no_speed_setting) { in setup_nic_devices()
3742 octeon_dev->props[lio->ifidx].fec_boot = in setup_nic_devices()
3743 octeon_dev->props[lio->ifidx].fec; in setup_nic_devices()
3750 dev_err(&octeon_dev->pci_dev->dev, "devlink alloc failed\n"); in setup_nic_devices()
3755 lio_devlink->oct = octeon_dev; in setup_nic_devices()
3757 if (devlink_register(devlink, &octeon_dev->pci_dev->dev)) { in setup_nic_devices()
3759 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3764 octeon_dev->devlink = devlink; in setup_nic_devices()
3765 octeon_dev->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY; in setup_nic_devices()
3771 while (i--) { in setup_nic_devices()
3772 dev_err(&octeon_dev->pci_dev->dev, in setup_nic_devices()
3779 return -ENODEV; in setup_nic_devices()
3785 unsigned int num_vfs_alloced = oct->sriov_info.num_vfs_alloced; in octeon_enable_sriov()
3791 err = pci_enable_sriov(oct->pci_dev, in octeon_enable_sriov()
3792 oct->sriov_info.num_vfs_alloced); in octeon_enable_sriov()
3794 dev_err(&oct->pci_dev->dev, in octeon_enable_sriov()
3797 oct->sriov_info.num_vfs_alloced = 0; in octeon_enable_sriov()
3800 oct->sriov_info.sriov_enabled = 1; in octeon_enable_sriov()
3809 if (vfdev->is_virtfn && in octeon_enable_sriov()
3810 (vfdev->physfn == oct->pci_dev)) { in octeon_enable_sriov()
3811 oct->sriov_info.dpiring_to_vfpcidev_lut[u] = in octeon_enable_sriov()
3813 u += oct->sriov_info.rings_per_vf; in octeon_enable_sriov()
3827 if (pci_vfs_assigned(oct->pci_dev)) { in lio_pci_sriov_disable()
3828 dev_err(&oct->pci_dev->dev, "VFs are still assigned to VMs.\n"); in lio_pci_sriov_disable()
3829 return -EPERM; in lio_pci_sriov_disable()
3832 pci_disable_sriov(oct->pci_dev); in lio_pci_sriov_disable()
3836 oct->sriov_info.dpiring_to_vfpcidev_lut[u] = NULL; in lio_pci_sriov_disable()
3837 u += oct->sriov_info.rings_per_vf; in lio_pci_sriov_disable()
3840 oct->sriov_info.num_vfs_alloced = 0; in lio_pci_sriov_disable()
3841 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d disabled VFs\n", in lio_pci_sriov_disable()
3842 oct->pf_num); in lio_pci_sriov_disable()
3852 if ((num_vfs == oct->sriov_info.num_vfs_alloced) && in liquidio_enable_sriov()
3853 (oct->sriov_info.sriov_enabled)) { in liquidio_enable_sriov()
3854 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d already enabled num_vfs:%d\n", in liquidio_enable_sriov()
3855 oct->pf_num, num_vfs); in liquidio_enable_sriov()
3862 } else if (num_vfs > oct->sriov_info.max_vfs) { in liquidio_enable_sriov()
3863 dev_err(&oct->pci_dev->dev, in liquidio_enable_sriov()
3865 oct->sriov_info.max_vfs, num_vfs); in liquidio_enable_sriov()
3866 ret = -EPERM; in liquidio_enable_sriov()
3868 oct->sriov_info.num_vfs_alloced = num_vfs; in liquidio_enable_sriov()
3870 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d num_vfs:%d\n", in liquidio_enable_sriov()
3871 oct->pf_num, num_vfs); in liquidio_enable_sriov()
3874 dev_info(&oct->pci_dev->dev, in liquidio_enable_sriov()
3883 * liquidio_init_nic_module - initialize the NIC
3894 dev_dbg(&oct->pci_dev->dev, "Initializing network interfaces\n"); in liquidio_init_nic_module()
3900 oct->ifcount = num_nic_ports; in liquidio_init_nic_module()
3902 memset(oct->props, 0, sizeof(struct octdev_props) * num_nic_ports); in liquidio_init_nic_module()
3905 oct->props[i].gmxport = -1; in liquidio_init_nic_module()
3909 dev_err(&oct->pci_dev->dev, "Setup NIC devices failed\n"); in liquidio_init_nic_module()
3916 if (!oct->octeon_id && in liquidio_init_nic_module()
3917 oct->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP) { in liquidio_init_nic_module()
3927 dev_dbg(&oct->pci_dev->dev, "Network interfaces ready\n"); in liquidio_init_nic_module()
3933 oct->ifcount = 0; in liquidio_init_nic_module()
3939 * nic_starter - finish init
3949 oct = (struct octeon_device *)wk->ctxptr; in nic_starter()
3951 if (atomic_read(&oct->status) == OCT_DEV_RUNNING) in nic_starter()
3959 if (atomic_read(&oct->status) != OCT_DEV_CORE_OK) { in nic_starter()
3960 schedule_delayed_work(&oct->nic_poll_work.work, in nic_starter()
3965 atomic_set(&oct->status, OCT_DEV_RUNNING); in nic_starter()
3967 if (oct->app_mode && oct->app_mode == CVM_DRV_NIC_APP) { in nic_starter()
3968 dev_dbg(&oct->pci_dev->dev, "Starting NIC module\n"); in nic_starter()
3971 dev_err(&oct->pci_dev->dev, "NIC initialization failed\n"); in nic_starter()
3973 handshake[oct->octeon_id].started_ok = 1; in nic_starter()
3975 dev_err(&oct->pci_dev->dev, in nic_starter()
3977 oct->app_mode); in nic_starter()
3980 complete(&handshake[oct->octeon_id].started); in nic_starter()
3987 struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt; in octeon_recv_vf_drv_notice()
3992 notice = recv_pkt->rh.r.ossp; in octeon_recv_vf_drv_notice()
3993 data = (u64 *)(get_rbd(recv_pkt->buffer_ptr[0]) + OCT_DROQ_INFO_SIZE); in octeon_recv_vf_drv_notice()
3995 /* the first 64-bit word of data is the vf_num */ in octeon_recv_vf_drv_notice()
3998 vf_idx = (int)vf_num - 1; in octeon_recv_vf_drv_notice()
4000 cores_crashed = READ_ONCE(oct->cores_crashed); in octeon_recv_vf_drv_notice()
4003 if (!(oct->sriov_info.vf_drv_loaded_mask & BIT_ULL(vf_idx))) { in octeon_recv_vf_drv_notice()
4004 oct->sriov_info.vf_drv_loaded_mask |= BIT_ULL(vf_idx); in octeon_recv_vf_drv_notice()
4005 dev_info(&oct->pci_dev->dev, in octeon_recv_vf_drv_notice()
4011 if (oct->sriov_info.vf_drv_loaded_mask & BIT_ULL(vf_idx)) { in octeon_recv_vf_drv_notice()
4012 oct->sriov_info.vf_drv_loaded_mask &= ~BIT_ULL(vf_idx); in octeon_recv_vf_drv_notice()
4013 dev_info(&oct->pci_dev->dev, in octeon_recv_vf_drv_notice()
4021 oct->sriov_info.vf_macaddr[vf_idx] = data[1]; in octeon_recv_vf_drv_notice()
4022 dev_info(&oct->pci_dev->dev, in octeon_recv_vf_drv_notice()
4027 for (i = 0; i < recv_pkt->buffer_count; i++) in octeon_recv_vf_drv_notice()
4028 recv_buffer_free(recv_pkt->buffer_ptr[i]); in octeon_recv_vf_drv_notice()
4035 * octeon_device_init - Device initialization for each Octeon device that is probed
4045 (struct octeon_device_priv *)octeon_dev->priv; in octeon_device_init()
4046 atomic_set(&octeon_dev->status, OCT_DEV_BEGIN_STATE); in octeon_device_init()
4054 atomic_set(&octeon_dev->status, OCT_DEV_PCI_ENABLE_DONE); in octeon_device_init()
4058 dev_err(&octeon_dev->pci_dev->dev, "Chip specific setup failed\n"); in octeon_device_init()
4062 atomic_set(&octeon_dev->status, OCT_DEV_PCI_MAP_DONE); in octeon_device_init()
4066 * during de-initialization (see 'octeon_destroy_resources'). in octeon_device_init()
4068 octeon_register_device(octeon_dev, octeon_dev->pci_dev->bus->number, in octeon_device_init()
4069 PCI_SLOT(octeon_dev->pci_dev->devfn), in octeon_device_init()
4070 PCI_FUNC(octeon_dev->pci_dev->devfn), in octeon_device_init()
4073 octeon_dev->app_mode = CVM_DRV_INVALID_APP; in octeon_device_init()
4084 atomic_cmpxchg(octeon_dev->adapter_fw_state, in octeon_device_init()
4089 fw_state = atomic_cmpxchg(octeon_dev->adapter_fw_state, in octeon_device_init()
4106 if (octeon_dev->fn_list.soft_reset(octeon_dev)) in octeon_device_init()
4123 INIT_DELAYED_WORK(&octeon_dev->nic_poll_work.work, nic_starter); in octeon_device_init()
4124 octeon_dev->nic_poll_work.ctxptr = (void *)octeon_dev; in octeon_device_init()
4125 schedule_delayed_work(&octeon_dev->nic_poll_work.work, in octeon_device_init()
4128 atomic_set(&octeon_dev->status, OCT_DEV_DISPATCH_INIT_DONE); in octeon_device_init()
4131 dev_err(&octeon_dev->pci_dev->dev, "setting io queues off failed\n"); in octeon_device_init()
4136 ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); in octeon_device_init()
4138 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: Failed to configure device registers\n"); in octeon_device_init()
4146 dev_err(&octeon_dev->pci_dev->dev, "sc buffer pool allocation failed\n"); in octeon_device_init()
4149 atomic_set(&octeon_dev->status, OCT_DEV_SC_BUFF_POOL_INIT_DONE); in octeon_device_init()
4153 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4157 atomic_set(&octeon_dev->status, OCT_DEV_INSTR_QUEUE_INIT_DONE); in octeon_device_init()
4163 dev_err(&octeon_dev->pci_dev->dev, "Response list allocation failed\n"); in octeon_device_init()
4166 atomic_set(&octeon_dev->status, OCT_DEV_RESP_LIST_INIT_DONE); in octeon_device_init()
4169 dev_err(&octeon_dev->pci_dev->dev, "Output queue initialization failed\n"); in octeon_device_init()
4173 atomic_set(&octeon_dev->status, OCT_DEV_DROQ_INIT_DONE); in octeon_device_init()
4176 if (octeon_dev->fn_list.setup_mbox(octeon_dev)) { in octeon_device_init()
4177 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: Mailbox setup failed\n"); in octeon_device_init()
4180 atomic_set(&octeon_dev->status, OCT_DEV_MBOX_SETUP_DONE); in octeon_device_init()
4184 octeon_dev->sriov_info.num_pf_rings)) { in octeon_device_init()
4185 dev_err(&octeon_dev->pci_dev->dev, "OCTEON: ioq vector allocation failed\n"); in octeon_device_init()
4188 atomic_set(&octeon_dev->status, OCT_DEV_MSIX_ALLOC_VECTOR_DONE); in octeon_device_init()
4195 ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); in octeon_device_init()
4197 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4204 dev_dbg(&octeon_dev->pci_dev->dev, "Initializing droq tasklet\n"); in octeon_device_init()
4205 tasklet_setup(&oct_priv->droq_tasklet, octeon_droq_bh); in octeon_device_init()
4210 octeon_dev->sriov_info.num_pf_rings)) in octeon_device_init()
4214 octeon_dev->fn_list.enable_interrupt(octeon_dev, OCTEON_ALL_INTR); in octeon_device_init()
4216 atomic_set(&octeon_dev->status, OCT_DEV_INTR_SET_DONE); in octeon_device_init()
4226 for (j = 0; j < octeon_dev->num_oqs; j++) in octeon_device_init()
4227 writel(octeon_dev->droq[j]->max_count, in octeon_device_init()
4228 octeon_dev->droq[j]->pkts_credit_reg); in octeon_device_init()
4231 ret = octeon_dev->fn_list.enable_io_queues(octeon_dev); in octeon_device_init()
4233 dev_err(&octeon_dev->pci_dev->dev, "Failed to enable input/output queues"); in octeon_device_init()
4237 atomic_set(&octeon_dev->status, OCT_DEV_IO_QUEUES_DONE); in octeon_device_init()
4240 dev_dbg(&octeon_dev->pci_dev->dev, "Waiting for DDR initialization...\n"); in octeon_device_init()
4242 dev_info(&octeon_dev->pci_dev->dev, in octeon_device_init()
4243 "WAITING. Set ddr_timeout to non-zero value to proceed with initialization.\n"); in octeon_device_init()
4248 /* Wait for the octeon to initialize DDR after the soft-reset.*/ in octeon_device_init()
4252 /* user probably pressed Control-C */ in octeon_device_init()
4258 dev_err(&octeon_dev->pci_dev->dev, in octeon_device_init()
4265 dev_err(&octeon_dev->pci_dev->dev, "Board not responding\n"); in octeon_device_init()
4272 dev_dbg(&octeon_dev->pci_dev->dev, "Initializing consoles\n"); in octeon_device_init()
4275 dev_err(&octeon_dev->pci_dev->dev, "Could not access board consoles\n"); in octeon_device_init()
4284 dev_err(&octeon_dev->pci_dev->dev, "Could not access board console\n"); in octeon_device_init()
4290 octeon_dev->console[0].print = octeon_dbg_console_print; in octeon_device_init()
4293 atomic_set(&octeon_dev->status, OCT_DEV_CONSOLE_INIT_DONE); in octeon_device_init()
4295 dev_dbg(&octeon_dev->pci_dev->dev, "Loading firmware\n"); in octeon_device_init()
4298 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n"); in octeon_device_init()
4302 atomic_set(octeon_dev->adapter_fw_state, FW_HAS_BEEN_LOADED); in octeon_device_init()
4305 handshake[octeon_dev->octeon_id].init_ok = 1; in octeon_device_init()
4306 complete(&handshake[octeon_dev->octeon_id].init); in octeon_device_init()
4308 atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK); in octeon_device_init()
4309 oct_priv->dev = octeon_dev; in octeon_device_init()
4315 * octeon_dbg_console_print - Debug console print function
4331 dev_info(&oct->pci_dev->dev, "%u: %s%s\n", console_num, prefix, in octeon_dbg_console_print()
4334 dev_info(&oct->pci_dev->dev, "%u: %s\n", console_num, prefix); in octeon_dbg_console_print()
4336 dev_info(&oct->pci_dev->dev, "%u: %s\n", console_num, suffix); in octeon_dbg_console_print()
4342 * liquidio_exit - Exits the module