Lines Matching +full:num +full:- +full:rings

7  * Copyright (c) 2003-2016 Cavium, Inc.
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
80 /* Num of desc for rx rings */
83 /* Num of desc for tx rings */
109 /* Num of desc for rx rings */
112 /* Num of desc for tx rings */
188 /* Num of desc for rx rings */
191 /* Num of desc for tx rings */
217 /* Num of desc for rx rings */
220 /* Num of desc for tx rings */
246 /* Num of desc for rx rings */
249 /* Num of desc for tx rings */
275 /* Num of desc for rx rings */
278 /* Num of desc for tx rings */
354 /* Num of desc for rx rings */
357 /* Num of desc for tx rings */
383 /* Num of desc for rx rings */
386 /* Num of desc for tx rings */
457 /* Num of desc for rx rings */
460 /* Num of desc for tx rings */
486 /* Num of desc for rx rings */
489 /* Num of desc for tx rings */
531 "BEGIN", "PCI-ENABLE-DONE", "PCI-MAP-DONE", "DISPATCH-INIT-DONE",
532 "IQ-INIT-DONE", "SCBUFF-POOL-INIT-DONE", "RESPLIST-INIT-DONE",
533 "DROQ-INIT-DONE", "MBOX-SETUP-DONE", "MSIX-ALLOC-VECTOR-DONE",
534 "INTR-SET-DONE", "IO-QUEUES-INIT-DONE", "CONSOLE-INIT-DONE",
535 "HOST-READY", "CORE-READY", "RUNNING", "IN-RESET",
554 if (conf_type < 0 || conf_type > (NUM_OCTEON_CONFS - 1)) in oct_set_config_info()
572 u32 oct_id = oct->octeon_id; in __retrieve_octeon_config_info()
577 if (oct->chip_id == OCTEON_CN66XX) { in __retrieve_octeon_config_info()
579 } else if ((oct->chip_id == OCTEON_CN68XX) && in __retrieve_octeon_config_info()
582 } else if ((oct->chip_id == OCTEON_CN68XX) && in __retrieve_octeon_config_info()
585 } else if (oct->chip_id == OCTEON_CN23XX_PF_VID) { in __retrieve_octeon_config_info()
587 } else if (oct->chip_id == OCTEON_CN23XX_VF_VID) { in __retrieve_octeon_config_info()
599 switch (oct->chip_id) { in __verify_octeon_config_info()
622 dev_err(&oct->pci_dev->dev, "Configuration verification failed\n"); in oct_get_config_info()
642 return oct_dev_app_str[app_mode - CVM_DRV_APP_START]; in get_oct_app_string()
643 return oct_dev_app_str[CVM_DRV_INVALID_APP - CVM_DRV_APP_START]; in get_oct_app_string()
651 if (oct->io_qmask.oq & BIT_ULL(i)) in octeon_free_device_mem()
652 vfree(oct->droq[i]); in octeon_free_device_mem()
656 if (oct->io_qmask.iq & BIT_ULL(i)) in octeon_free_device_mem()
657 vfree(oct->instr_queue[i]); in octeon_free_device_mem()
660 i = oct->octeon_id; in octeon_free_device_mem()
664 octeon_device_count--; in octeon_free_device_mem()
695 configsize += (8 - (configsize & 0x7)); in octeon_allocate_device_mem()
699 octdevsize += (8 - (octdevsize & 0x7)); in octeon_allocate_device_mem()
702 priv_size += (8 - (priv_size & 0x7)); in octeon_allocate_device_mem()
712 oct->priv = (void *)(buf + octdevsize); in octeon_allocate_device_mem()
713 oct->chip = (void *)(buf + octdevsize + priv_size); in octeon_allocate_device_mem()
714 oct->dispatch.dlist = (struct octeon_dispatch *) in octeon_allocate_device_mem()
744 spin_lock_init(&oct->pci_win_lock); in octeon_allocate_device()
745 spin_lock_init(&oct->mem_access_lock); in octeon_allocate_device()
747 oct->octeon_id = oct_idx; in octeon_allocate_device()
748 snprintf(oct->device_name, sizeof(oct->device_name), in octeon_allocate_device()
749 "LiquidIO%d", (oct->octeon_id)); in octeon_allocate_device()
756 * @param octeon_dev - pointer to the octeon device structure.
757 * @param bus - PCIe bus #
758 * @param dev - PCIe device #
759 * @param func - PCIe function #
760 * @param is_pf - TRUE for PF, FALSE for VF
768 oct->loc.bus = bus; in octeon_register_device()
769 oct->loc.dev = dev; in octeon_register_device()
770 oct->loc.func = func; in octeon_register_device()
772 oct->adapter_refcount = &adapter_refcounts[oct->octeon_id]; in octeon_register_device()
773 atomic_set(oct->adapter_refcount, 0); in octeon_register_device()
775 /* Like the reference count, the f/w state is shared 'per-adapter' */ in octeon_register_device()
776 oct->adapter_fw_state = &adapter_fw_states[oct->octeon_id]; in octeon_register_device()
777 atomic_set(oct->adapter_fw_state, FW_NEEDS_TO_BE_LOADED); in octeon_register_device()
780 for (idx = (int)oct->octeon_id - 1; idx >= 0; idx--) { in octeon_register_device()
782 dev_err(&oct->pci_dev->dev, in octeon_register_device()
786 atomic_inc(oct->adapter_refcount); in octeon_register_device()
792 if ((octeon_device[idx]->loc.bus == bus) && in octeon_register_device()
793 (octeon_device[idx]->loc.dev == dev)) { in octeon_register_device()
794 oct->adapter_refcount = in octeon_register_device()
795 octeon_device[idx]->adapter_refcount; in octeon_register_device()
796 oct->adapter_fw_state = in octeon_register_device()
797 octeon_device[idx]->adapter_fw_state; in octeon_register_device()
803 atomic_inc(oct->adapter_refcount); in octeon_register_device()
804 refcount = atomic_read(oct->adapter_refcount); in octeon_register_device()
806 dev_dbg(&oct->pci_dev->dev, "%s: %02x:%02x:%d refcount %u", __func__, in octeon_register_device()
807 oct->loc.bus, oct->loc.dev, oct->loc.func, refcount); in octeon_register_device()
813 /** Deregister a device at de-initialization time.
814 * @param octeon_dev - pointer to the octeon device structure.
821 atomic_dec(oct->adapter_refcount); in octeon_deregister_device()
822 refcount = atomic_read(oct->adapter_refcount); in octeon_deregister_device()
824 dev_dbg(&oct->pci_dev->dev, "%s: %04d:%02d:%d refcount %u", __func__, in octeon_deregister_device()
825 oct->loc.bus, oct->loc.dev, oct->loc.func, refcount); in octeon_deregister_device()
841 oct->ioq_vector = vzalloc(size); in octeon_allocate_ioq_vector()
842 if (!oct->ioq_vector) in octeon_allocate_ioq_vector()
843 return -1; in octeon_allocate_ioq_vector()
845 ioq_vector = &oct->ioq_vector[i]; in octeon_allocate_ioq_vector()
846 ioq_vector->oct_dev = oct; in octeon_allocate_ioq_vector()
847 ioq_vector->iq_index = i; in octeon_allocate_ioq_vector()
848 ioq_vector->droq_index = i; in octeon_allocate_ioq_vector()
849 ioq_vector->mbox = oct->mbox[i]; in octeon_allocate_ioq_vector()
852 cpumask_set_cpu(cpu_num, &ioq_vector->affinity_mask); in octeon_allocate_ioq_vector()
854 if (oct->chip_id == OCTEON_CN23XX_PF_VID) in octeon_allocate_ioq_vector()
855 ioq_vector->ioq_num = i + oct->sriov_info.pf_srn; in octeon_allocate_ioq_vector()
857 ioq_vector->ioq_num = i; in octeon_allocate_ioq_vector()
867 vfree(oct->ioq_vector); in octeon_free_ioq_vector()
877 int numa_node = dev_to_node(&oct->pci_dev->dev); in octeon_setup_instr_queues()
887 oct->num_iqs = 0; in octeon_setup_instr_queues()
889 oct->instr_queue[0] = vzalloc_node(sizeof(*oct->instr_queue[0]), in octeon_setup_instr_queues()
891 if (!oct->instr_queue[0]) in octeon_setup_instr_queues()
892 oct->instr_queue[0] = in octeon_setup_instr_queues()
894 if (!oct->instr_queue[0]) in octeon_setup_instr_queues()
896 memset(oct->instr_queue[0], 0, sizeof(struct octeon_instr_queue)); in octeon_setup_instr_queues()
897 oct->instr_queue[0]->q_index = 0; in octeon_setup_instr_queues()
898 oct->instr_queue[0]->app_ctx = (void *)(size_t)0; in octeon_setup_instr_queues()
899 oct->instr_queue[0]->ifidx = 0; in octeon_setup_instr_queues()
902 txpciq.s.pkind = oct->pfvf_hsword.pkind; in octeon_setup_instr_queues()
907 vfree(oct->instr_queue[0]); in octeon_setup_instr_queues()
908 oct->instr_queue[0] = NULL; in octeon_setup_instr_queues()
912 oct->num_iqs++; in octeon_setup_instr_queues()
922 int numa_node = dev_to_node(&oct->pci_dev->dev); in octeon_setup_output_queues()
936 oct->num_oqs = 0; in octeon_setup_output_queues()
937 oct->droq[0] = vzalloc_node(sizeof(*oct->droq[0]), numa_node); in octeon_setup_output_queues()
938 if (!oct->droq[0]) in octeon_setup_output_queues()
939 oct->droq[0] = vzalloc(sizeof(*oct->droq[0])); in octeon_setup_output_queues()
940 if (!oct->droq[0]) in octeon_setup_output_queues()
944 vfree(oct->droq[oq_no]); in octeon_setup_output_queues()
945 oct->droq[oq_no] = NULL; in octeon_setup_output_queues()
948 oct->num_oqs++; in octeon_setup_output_queues()
961 } else if (oct->chip_id == OCTEON_CN23XX_VF_VID) { in octeon_set_io_queues_off()
968 for (q_no = 0; q_no < oct->sriov_info.rings_per_vf; q_no++) { in octeon_set_io_queues_off()
977 loop--; in octeon_set_io_queues_off()
980 dev_err(&oct->pci_dev->dev, in octeon_set_io_queues_off()
983 return -1; in octeon_set_io_queues_off()
994 dev_err(&oct->pci_dev->dev, in octeon_set_io_queues_off()
996 return -1; in octeon_set_io_queues_off()
1027 oct->dispatch.count = 0; in octeon_init_dispatch_list()
1030 oct->dispatch.dlist[i].opcode = 0; in octeon_init_dispatch_list()
1031 INIT_LIST_HEAD(&oct->dispatch.dlist[i].list); in octeon_init_dispatch_list()
1037 spin_lock_init(&oct->dispatch.lock); in octeon_init_dispatch_list()
1050 spin_lock_bh(&oct->dispatch.lock); in octeon_delete_dispatch_list()
1055 dispatch = &oct->dispatch.dlist[i].list; in octeon_delete_dispatch_list()
1056 while (dispatch->next != dispatch) { in octeon_delete_dispatch_list()
1057 temp = dispatch->next; in octeon_delete_dispatch_list()
1061 oct->dispatch.dlist[i].opcode = 0; in octeon_delete_dispatch_list()
1064 oct->dispatch.count = 0; in octeon_delete_dispatch_list()
1066 spin_unlock_bh(&oct->dispatch.lock); in octeon_delete_dispatch_list()
1086 spin_lock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1088 if (octeon_dev->dispatch.count == 0) { in octeon_get_dispatch()
1089 spin_unlock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1093 if (!(octeon_dev->dispatch.dlist[idx].opcode)) { in octeon_get_dispatch()
1094 spin_unlock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1098 if (octeon_dev->dispatch.dlist[idx].opcode == combined_opcode) { in octeon_get_dispatch()
1099 fn = octeon_dev->dispatch.dlist[idx].dispatch_fn; in octeon_get_dispatch()
1102 &octeon_dev->dispatch.dlist[idx].list) { in octeon_get_dispatch()
1103 if (((struct octeon_dispatch *)dispatch)->opcode == in octeon_get_dispatch()
1106 dispatch)->dispatch_fn; in octeon_get_dispatch()
1112 spin_unlock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1118 * octeon_id - id of the octeon device.
1119 * opcode - opcode for which driver should call the registered function
1120 * subcode - subcode for which driver should call the registered function
1121 * fn - The function to call when a packet with "opcode" arrives in
1123 * fn_arg - The argument to be passed when calling function "fn".
1145 spin_lock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1147 if (oct->dispatch.dlist[idx].opcode == 0) { in octeon_register_dispatch_fn()
1148 oct->dispatch.dlist[idx].opcode = combined_opcode; in octeon_register_dispatch_fn()
1149 oct->dispatch.dlist[idx].dispatch_fn = fn; in octeon_register_dispatch_fn()
1150 oct->dispatch.dlist[idx].arg = fn_arg; in octeon_register_dispatch_fn()
1151 oct->dispatch.count++; in octeon_register_dispatch_fn()
1152 spin_unlock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1156 spin_unlock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1165 dev_dbg(&oct->pci_dev->dev, in octeon_register_dispatch_fn()
1171 dispatch->opcode = combined_opcode; in octeon_register_dispatch_fn()
1172 dispatch->dispatch_fn = fn; in octeon_register_dispatch_fn()
1173 dispatch->arg = fn_arg; in octeon_register_dispatch_fn()
1178 spin_lock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1179 list_add(&dispatch->list, &oct->dispatch.dlist[idx].list); in octeon_register_dispatch_fn()
1180 oct->dispatch.count++; in octeon_register_dispatch_fn()
1181 spin_unlock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1188 dev_err(&oct->pci_dev->dev, in octeon_register_dispatch_fn()
1203 struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt; in octeon_core_drv_init()
1214 if (atomic_read(&oct->status) >= OCT_DEV_RUNNING) { in octeon_core_drv_init()
1215 dev_err(&oct->pci_dev->dev, "Received CORE OK when device state is 0x%x\n", in octeon_core_drv_init()
1216 atomic_read(&oct->status)); in octeon_core_drv_init()
1222 (u32)recv_pkt->rh.r_core_drv_init.app_mode), in octeon_core_drv_init()
1224 oct->app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode; in octeon_core_drv_init()
1225 if (recv_pkt->rh.r_core_drv_init.app_mode == CVM_DRV_NIC_APP) { in octeon_core_drv_init()
1226 oct->fw_info.max_nic_ports = in octeon_core_drv_init()
1227 (u32)recv_pkt->rh.r_core_drv_init.max_nic_ports; in octeon_core_drv_init()
1228 oct->fw_info.num_gmx_ports = in octeon_core_drv_init()
1229 (u32)recv_pkt->rh.r_core_drv_init.num_gmx_ports; in octeon_core_drv_init()
1232 if (oct->fw_info.max_nic_ports < num_nic_ports) { in octeon_core_drv_init()
1233 dev_err(&oct->pci_dev->dev, in octeon_core_drv_init()
1235 num_nic_ports, oct->fw_info.max_nic_ports); in octeon_core_drv_init()
1238 oct->fw_info.app_cap_flags = recv_pkt->rh.r_core_drv_init.app_cap_flags; in octeon_core_drv_init()
1239 oct->fw_info.app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode; in octeon_core_drv_init()
1240 oct->pfvf_hsword.app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode; in octeon_core_drv_init()
1242 oct->pfvf_hsword.pkind = recv_pkt->rh.r_core_drv_init.pkind; in octeon_core_drv_init()
1244 for (i = 0; i < oct->num_iqs; i++) in octeon_core_drv_init()
1245 oct->instr_queue[i]->txpciq.s.pkind = oct->pfvf_hsword.pkind; in octeon_core_drv_init()
1247 atomic_set(&oct->status, OCT_DEV_CORE_OK); in octeon_core_drv_init()
1249 cs = &core_setup[oct->octeon_id]; in octeon_core_drv_init()
1251 if (recv_pkt->buffer_size[0] != (sizeof(*cs) + OCT_DROQ_INFO_SIZE)) { in octeon_core_drv_init()
1252 dev_dbg(&oct->pci_dev->dev, "Core setup bytes expected %u found %d\n", in octeon_core_drv_init()
1254 recv_pkt->buffer_size[0]); in octeon_core_drv_init()
1258 recv_pkt->buffer_ptr[0]) + OCT_DROQ_INFO_SIZE, sizeof(*cs)); in octeon_core_drv_init()
1260 strscpy(oct->boardinfo.name, cs->boardname, in octeon_core_drv_init()
1261 sizeof(oct->boardinfo.name)); in octeon_core_drv_init()
1262 strscpy(oct->boardinfo.serial_number, cs->board_serial_number, in octeon_core_drv_init()
1263 sizeof(oct->boardinfo.serial_number)); in octeon_core_drv_init()
1267 oct->boardinfo.major = cs->board_rev_major; in octeon_core_drv_init()
1268 oct->boardinfo.minor = cs->board_rev_minor; in octeon_core_drv_init()
1270 dev_info(&oct->pci_dev->dev, in octeon_core_drv_init()
1272 app_name, CVM_CAST64(cs->corefreq)); in octeon_core_drv_init()
1275 for (i = 0; i < recv_pkt->buffer_count; i++) in octeon_core_drv_init()
1276 recv_buffer_free(recv_pkt->buffer_ptr[i]); in octeon_core_drv_init()
1286 (oct->io_qmask.iq & BIT_ULL(q_no))) in octeon_get_tx_qsize()
1287 return oct->instr_queue[q_no]->max_count; in octeon_get_tx_qsize()
1289 return -1; in octeon_get_tx_qsize()
1296 (oct->io_qmask.oq & BIT_ULL(q_no))) in octeon_get_rx_qsize()
1297 return oct->droq[q_no]->max_count; in octeon_get_rx_qsize()
1298 return -1; in octeon_get_rx_qsize()
1325 /* scratch register address is same in all the OCT-II and CN70XX models */
1329 * @param octeon_id - The id for which the octeon device pointer is required.
1348 spin_lock_irqsave(&oct->pci_win_lock, flags); in lio_pci_readq()
1354 if ((oct->chip_id == OCTEON_CN66XX) || in lio_pci_readq()
1355 (oct->chip_id == OCTEON_CN68XX) || in lio_pci_readq()
1356 (oct->chip_id == OCTEON_CN23XX_PF_VID)) in lio_pci_readq()
1358 writel(addrhi, oct->reg_list.pci_win_rd_addr_hi); in lio_pci_readq()
1361 readl(oct->reg_list.pci_win_rd_addr_hi); in lio_pci_readq()
1363 writel(addr & 0xffffffff, oct->reg_list.pci_win_rd_addr_lo); in lio_pci_readq()
1364 readl(oct->reg_list.pci_win_rd_addr_lo); in lio_pci_readq()
1366 val64 = readq(oct->reg_list.pci_win_rd_data); in lio_pci_readq()
1368 spin_unlock_irqrestore(&oct->pci_win_lock, flags); in lio_pci_readq()
1380 spin_lock_irqsave(&oct->pci_win_lock, flags); in lio_pci_writeq()
1382 writeq(addr, oct->reg_list.pci_win_wr_addr); in lio_pci_writeq()
1385 writel(val >> 32, oct->reg_list.pci_win_wr_data_hi); in lio_pci_writeq()
1387 readl(oct->reg_list.pci_win_wr_data_hi); in lio_pci_writeq()
1389 writel(val & 0xffffffff, oct->reg_list.pci_win_wr_data_lo); in lio_pci_writeq()
1391 spin_unlock_irqrestore(&oct->pci_win_lock, flags); in lio_pci_writeq()
1438 * @param dev - octeon device pointer passed as a void *.
1448 return octeon_dev->octeon_id; in lio_get_device_id()
1449 return -1; in lio_get_device_id()
1460 pkts_pend = (u32)atomic_read(&droq->pkts_pending); in lio_enable_irq()
1461 writel(droq->pkt_count - pkts_pend, droq->pkts_sent_reg); in lio_enable_irq()
1462 droq->pkt_count = pkts_pend; in lio_enable_irq()
1463 oct = droq->oct_dev; in lio_enable_irq()
1466 spin_lock_bh(&iq->lock); in lio_enable_irq()
1467 writel(iq->pkts_processed, iq->inst_cnt_reg); in lio_enable_irq()
1468 iq->pkt_in_done -= iq->pkts_processed; in lio_enable_irq()
1469 iq->pkts_processed = 0; in lio_enable_irq()
1471 spin_unlock_bh(&iq->lock); in lio_enable_irq()
1472 oct = iq->oct_dev; in lio_enable_irq()
1479 writeq(CN23XX_INTR_RESEND, droq->pkts_sent_reg); in lio_enable_irq()
1482 instr_cnt = readq(iq->inst_cnt_reg); in lio_enable_irq()
1485 iq->inst_cnt_reg); in lio_enable_irq()