Lines Matching +full:num +full:- +full:cs

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()
571 u32 oct_id = oct->octeon_id; in __retrieve_octeon_config_info()
576 if (oct->chip_id == OCTEON_CN66XX) { in __retrieve_octeon_config_info()
578 } else if ((oct->chip_id == OCTEON_CN68XX) && in __retrieve_octeon_config_info()
581 } else if ((oct->chip_id == OCTEON_CN68XX) && in __retrieve_octeon_config_info()
584 } else if (oct->chip_id == OCTEON_CN23XX_PF_VID) { in __retrieve_octeon_config_info()
586 } else if (oct->chip_id == OCTEON_CN23XX_VF_VID) { in __retrieve_octeon_config_info()
598 switch (oct->chip_id) { in __verify_octeon_config_info()
621 dev_err(&oct->pci_dev->dev, "Configuration verification failed\n"); in oct_get_config_info()
640 return oct_dev_app_str[app_mode - CVM_DRV_APP_START]; in get_oct_app_string()
641 return oct_dev_app_str[CVM_DRV_INVALID_APP - CVM_DRV_APP_START]; in get_oct_app_string()
649 if (oct->io_qmask.oq & BIT_ULL(i)) in octeon_free_device_mem()
650 vfree(oct->droq[i]); in octeon_free_device_mem()
654 if (oct->io_qmask.iq & BIT_ULL(i)) in octeon_free_device_mem()
655 vfree(oct->instr_queue[i]); in octeon_free_device_mem()
658 i = oct->octeon_id; in octeon_free_device_mem()
662 octeon_device_count--; in octeon_free_device_mem()
692 configsize += (8 - (configsize & 0x7)); in octeon_allocate_device_mem()
696 octdevsize += (8 - (octdevsize & 0x7)); in octeon_allocate_device_mem()
699 priv_size += (8 - (priv_size & 0x7)); in octeon_allocate_device_mem()
709 oct->priv = (void *)(buf + octdevsize); in octeon_allocate_device_mem()
710 oct->chip = (void *)(buf + octdevsize + priv_size); in octeon_allocate_device_mem()
711 oct->dispatch.dlist = (struct octeon_dispatch *) in octeon_allocate_device_mem()
741 spin_lock_init(&oct->pci_win_lock); in octeon_allocate_device()
742 spin_lock_init(&oct->mem_access_lock); in octeon_allocate_device()
744 oct->octeon_id = oct_idx; in octeon_allocate_device()
745 snprintf(oct->device_name, sizeof(oct->device_name), in octeon_allocate_device()
746 "LiquidIO%d", (oct->octeon_id)); in octeon_allocate_device()
752 * @param octeon_dev - pointer to the octeon device structure.
753 * @param bus - PCIe bus #
754 * @param dev - PCIe device #
755 * @param func - PCIe function #
756 * @param is_pf - TRUE for PF, FALSE for VF
764 oct->loc.bus = bus; in octeon_register_device()
765 oct->loc.dev = dev; in octeon_register_device()
766 oct->loc.func = func; in octeon_register_device()
768 oct->adapter_refcount = &adapter_refcounts[oct->octeon_id]; in octeon_register_device()
769 atomic_set(oct->adapter_refcount, 0); in octeon_register_device()
771 /* Like the reference count, the f/w state is shared 'per-adapter' */ in octeon_register_device()
772 oct->adapter_fw_state = &adapter_fw_states[oct->octeon_id]; in octeon_register_device()
773 atomic_set(oct->adapter_fw_state, FW_NEEDS_TO_BE_LOADED); in octeon_register_device()
776 for (idx = (int)oct->octeon_id - 1; idx >= 0; idx--) { in octeon_register_device()
778 dev_err(&oct->pci_dev->dev, in octeon_register_device()
782 atomic_inc(oct->adapter_refcount); in octeon_register_device()
788 if ((octeon_device[idx]->loc.bus == bus) && in octeon_register_device()
789 (octeon_device[idx]->loc.dev == dev)) { in octeon_register_device()
790 oct->adapter_refcount = in octeon_register_device()
791 octeon_device[idx]->adapter_refcount; in octeon_register_device()
792 oct->adapter_fw_state = in octeon_register_device()
793 octeon_device[idx]->adapter_fw_state; in octeon_register_device()
799 atomic_inc(oct->adapter_refcount); in octeon_register_device()
800 refcount = atomic_read(oct->adapter_refcount); in octeon_register_device()
802 dev_dbg(&oct->pci_dev->dev, "%s: %02x:%02x:%d refcount %u", __func__, in octeon_register_device()
803 oct->loc.bus, oct->loc.dev, oct->loc.func, refcount); in octeon_register_device()
808 /** Deregister a device at de-initialization time.
809 * @param octeon_dev - pointer to the octeon device structure.
816 atomic_dec(oct->adapter_refcount); in octeon_deregister_device()
817 refcount = atomic_read(oct->adapter_refcount); in octeon_deregister_device()
819 dev_dbg(&oct->pci_dev->dev, "%s: %04d:%02d:%d refcount %u", __func__, in octeon_deregister_device()
820 oct->loc.bus, oct->loc.dev, oct->loc.func, refcount); in octeon_deregister_device()
835 oct->ioq_vector = vzalloc(size); in octeon_allocate_ioq_vector()
836 if (!oct->ioq_vector) in octeon_allocate_ioq_vector()
837 return -1; in octeon_allocate_ioq_vector()
839 ioq_vector = &oct->ioq_vector[i]; in octeon_allocate_ioq_vector()
840 ioq_vector->oct_dev = oct; in octeon_allocate_ioq_vector()
841 ioq_vector->iq_index = i; in octeon_allocate_ioq_vector()
842 ioq_vector->droq_index = i; in octeon_allocate_ioq_vector()
843 ioq_vector->mbox = oct->mbox[i]; in octeon_allocate_ioq_vector()
846 cpumask_set_cpu(cpu_num, &ioq_vector->affinity_mask); in octeon_allocate_ioq_vector()
848 if (oct->chip_id == OCTEON_CN23XX_PF_VID) in octeon_allocate_ioq_vector()
849 ioq_vector->ioq_num = i + oct->sriov_info.pf_srn; in octeon_allocate_ioq_vector()
851 ioq_vector->ioq_num = i; in octeon_allocate_ioq_vector()
860 vfree(oct->ioq_vector); in octeon_free_ioq_vector()
869 int numa_node = dev_to_node(&oct->pci_dev->dev); in octeon_setup_instr_queues()
879 oct->num_iqs = 0; in octeon_setup_instr_queues()
881 oct->instr_queue[0] = vzalloc_node(sizeof(*oct->instr_queue[0]), in octeon_setup_instr_queues()
883 if (!oct->instr_queue[0]) in octeon_setup_instr_queues()
884 oct->instr_queue[0] = in octeon_setup_instr_queues()
886 if (!oct->instr_queue[0]) in octeon_setup_instr_queues()
888 memset(oct->instr_queue[0], 0, sizeof(struct octeon_instr_queue)); in octeon_setup_instr_queues()
889 oct->instr_queue[0]->q_index = 0; in octeon_setup_instr_queues()
890 oct->instr_queue[0]->app_ctx = (void *)(size_t)0; in octeon_setup_instr_queues()
891 oct->instr_queue[0]->ifidx = 0; in octeon_setup_instr_queues()
894 txpciq.s.pkind = oct->pfvf_hsword.pkind; in octeon_setup_instr_queues()
899 vfree(oct->instr_queue[0]); in octeon_setup_instr_queues()
900 oct->instr_queue[0] = NULL; in octeon_setup_instr_queues()
904 oct->num_iqs++; in octeon_setup_instr_queues()
913 int numa_node = dev_to_node(&oct->pci_dev->dev); in octeon_setup_output_queues()
927 oct->num_oqs = 0; in octeon_setup_output_queues()
928 oct->droq[0] = vzalloc_node(sizeof(*oct->droq[0]), numa_node); in octeon_setup_output_queues()
929 if (!oct->droq[0]) in octeon_setup_output_queues()
930 oct->droq[0] = vzalloc(sizeof(*oct->droq[0])); in octeon_setup_output_queues()
931 if (!oct->droq[0]) in octeon_setup_output_queues()
935 vfree(oct->droq[oq_no]); in octeon_setup_output_queues()
936 oct->droq[oq_no] = NULL; in octeon_setup_output_queues()
939 oct->num_oqs++; in octeon_setup_output_queues()
951 } else if (oct->chip_id == OCTEON_CN23XX_VF_VID) { in octeon_set_io_queues_off()
958 for (q_no = 0; q_no < oct->sriov_info.rings_per_vf; q_no++) { in octeon_set_io_queues_off()
967 loop--; in octeon_set_io_queues_off()
970 dev_err(&oct->pci_dev->dev, in octeon_set_io_queues_off()
973 return -1; in octeon_set_io_queues_off()
984 dev_err(&oct->pci_dev->dev, in octeon_set_io_queues_off()
986 return -1; in octeon_set_io_queues_off()
1016 oct->dispatch.count = 0; in octeon_init_dispatch_list()
1019 oct->dispatch.dlist[i].opcode = 0; in octeon_init_dispatch_list()
1020 INIT_LIST_HEAD(&oct->dispatch.dlist[i].list); in octeon_init_dispatch_list()
1026 spin_lock_init(&oct->dispatch.lock); in octeon_init_dispatch_list()
1038 spin_lock_bh(&oct->dispatch.lock); in octeon_delete_dispatch_list()
1043 dispatch = &oct->dispatch.dlist[i].list; in octeon_delete_dispatch_list()
1044 while (dispatch->next != dispatch) { in octeon_delete_dispatch_list()
1045 temp = dispatch->next; in octeon_delete_dispatch_list()
1049 oct->dispatch.dlist[i].opcode = 0; in octeon_delete_dispatch_list()
1052 oct->dispatch.count = 0; in octeon_delete_dispatch_list()
1054 spin_unlock_bh(&oct->dispatch.lock); in octeon_delete_dispatch_list()
1073 spin_lock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1075 if (octeon_dev->dispatch.count == 0) { in octeon_get_dispatch()
1076 spin_unlock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1080 if (!(octeon_dev->dispatch.dlist[idx].opcode)) { in octeon_get_dispatch()
1081 spin_unlock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1085 if (octeon_dev->dispatch.dlist[idx].opcode == combined_opcode) { in octeon_get_dispatch()
1086 fn = octeon_dev->dispatch.dlist[idx].dispatch_fn; in octeon_get_dispatch()
1089 &octeon_dev->dispatch.dlist[idx].list) { in octeon_get_dispatch()
1090 if (((struct octeon_dispatch *)dispatch)->opcode == in octeon_get_dispatch()
1093 dispatch)->dispatch_fn; in octeon_get_dispatch()
1099 spin_unlock_bh(&octeon_dev->dispatch.lock); in octeon_get_dispatch()
1105 * octeon_id - id of the octeon device.
1106 * opcode - opcode for which driver should call the registered function
1107 * subcode - subcode for which driver should call the registered function
1108 * fn - The function to call when a packet with "opcode" arrives in
1110 * fn_arg - The argument to be passed when calling function "fn".
1132 spin_lock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1134 if (oct->dispatch.dlist[idx].opcode == 0) { in octeon_register_dispatch_fn()
1135 oct->dispatch.dlist[idx].opcode = combined_opcode; in octeon_register_dispatch_fn()
1136 oct->dispatch.dlist[idx].dispatch_fn = fn; in octeon_register_dispatch_fn()
1137 oct->dispatch.dlist[idx].arg = fn_arg; in octeon_register_dispatch_fn()
1138 oct->dispatch.count++; in octeon_register_dispatch_fn()
1139 spin_unlock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1143 spin_unlock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1152 dev_dbg(&oct->pci_dev->dev, in octeon_register_dispatch_fn()
1158 dispatch->opcode = combined_opcode; in octeon_register_dispatch_fn()
1159 dispatch->dispatch_fn = fn; in octeon_register_dispatch_fn()
1160 dispatch->arg = fn_arg; in octeon_register_dispatch_fn()
1165 spin_lock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1166 list_add(&dispatch->list, &oct->dispatch.dlist[idx].list); in octeon_register_dispatch_fn()
1167 oct->dispatch.count++; in octeon_register_dispatch_fn()
1168 spin_unlock_bh(&oct->dispatch.lock); in octeon_register_dispatch_fn()
1175 dev_err(&oct->pci_dev->dev, in octeon_register_dispatch_fn()
1189 struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt; in octeon_core_drv_init()
1190 struct octeon_core_setup *cs = NULL; in octeon_core_drv_init() local
1200 if (atomic_read(&oct->status) >= OCT_DEV_RUNNING) { in octeon_core_drv_init()
1201 dev_err(&oct->pci_dev->dev, "Received CORE OK when device state is 0x%x\n", in octeon_core_drv_init()
1202 atomic_read(&oct->status)); in octeon_core_drv_init()
1208 (u32)recv_pkt->rh.r_core_drv_init.app_mode), in octeon_core_drv_init()
1209 sizeof(app_name) - 1); in octeon_core_drv_init()
1210 oct->app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode; in octeon_core_drv_init()
1211 if (recv_pkt->rh.r_core_drv_init.app_mode == CVM_DRV_NIC_APP) { in octeon_core_drv_init()
1212 oct->fw_info.max_nic_ports = in octeon_core_drv_init()
1213 (u32)recv_pkt->rh.r_core_drv_init.max_nic_ports; in octeon_core_drv_init()
1214 oct->fw_info.num_gmx_ports = in octeon_core_drv_init()
1215 (u32)recv_pkt->rh.r_core_drv_init.num_gmx_ports; in octeon_core_drv_init()
1218 if (oct->fw_info.max_nic_ports < num_nic_ports) { in octeon_core_drv_init()
1219 dev_err(&oct->pci_dev->dev, in octeon_core_drv_init()
1221 num_nic_ports, oct->fw_info.max_nic_ports); in octeon_core_drv_init()
1224 oct->fw_info.app_cap_flags = recv_pkt->rh.r_core_drv_init.app_cap_flags; in octeon_core_drv_init()
1225 oct->fw_info.app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode; in octeon_core_drv_init()
1226 oct->pfvf_hsword.app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode; in octeon_core_drv_init()
1228 oct->pfvf_hsword.pkind = recv_pkt->rh.r_core_drv_init.pkind; in octeon_core_drv_init()
1230 for (i = 0; i < oct->num_iqs; i++) in octeon_core_drv_init()
1231 oct->instr_queue[i]->txpciq.s.pkind = oct->pfvf_hsword.pkind; in octeon_core_drv_init()
1233 atomic_set(&oct->status, OCT_DEV_CORE_OK); in octeon_core_drv_init()
1235 cs = &core_setup[oct->octeon_id]; in octeon_core_drv_init()
1237 if (recv_pkt->buffer_size[0] != (sizeof(*cs) + OCT_DROQ_INFO_SIZE)) { in octeon_core_drv_init()
1238 dev_dbg(&oct->pci_dev->dev, "Core setup bytes expected %u found %d\n", in octeon_core_drv_init()
1239 (u32)sizeof(*cs), in octeon_core_drv_init()
1240 recv_pkt->buffer_size[0]); in octeon_core_drv_init()
1243 memcpy(cs, get_rbd( in octeon_core_drv_init()
1244 recv_pkt->buffer_ptr[0]) + OCT_DROQ_INFO_SIZE, sizeof(*cs)); in octeon_core_drv_init()
1246 strncpy(oct->boardinfo.name, cs->boardname, OCT_BOARD_NAME); in octeon_core_drv_init()
1247 strncpy(oct->boardinfo.serial_number, cs->board_serial_number, in octeon_core_drv_init()
1250 octeon_swap_8B_data((u64 *)cs, (sizeof(*cs) >> 3)); in octeon_core_drv_init()
1252 oct->boardinfo.major = cs->board_rev_major; in octeon_core_drv_init()
1253 oct->boardinfo.minor = cs->board_rev_minor; in octeon_core_drv_init()
1255 dev_info(&oct->pci_dev->dev, in octeon_core_drv_init()
1257 app_name, CVM_CAST64(cs->corefreq)); in octeon_core_drv_init()
1260 for (i = 0; i < recv_pkt->buffer_count; i++) in octeon_core_drv_init()
1261 recv_buffer_free(recv_pkt->buffer_ptr[i]); in octeon_core_drv_init()
1270 (oct->io_qmask.iq & BIT_ULL(q_no))) in octeon_get_tx_qsize()
1271 return oct->instr_queue[q_no]->max_count; in octeon_get_tx_qsize()
1273 return -1; in octeon_get_tx_qsize()
1279 (oct->io_qmask.oq & BIT_ULL(q_no))) in octeon_get_rx_qsize()
1280 return oct->droq[q_no]->max_count; in octeon_get_rx_qsize()
1281 return -1; in octeon_get_rx_qsize()
1306 /* scratch register address is same in all the OCT-II and CN70XX models */
1310 * @param octeon_id - The id for which the octeon device pointer is required.
1328 spin_lock_irqsave(&oct->pci_win_lock, flags); in lio_pci_readq()
1334 if ((oct->chip_id == OCTEON_CN66XX) || in lio_pci_readq()
1335 (oct->chip_id == OCTEON_CN68XX) || in lio_pci_readq()
1336 (oct->chip_id == OCTEON_CN23XX_PF_VID)) in lio_pci_readq()
1338 writel(addrhi, oct->reg_list.pci_win_rd_addr_hi); in lio_pci_readq()
1341 readl(oct->reg_list.pci_win_rd_addr_hi); in lio_pci_readq()
1343 writel(addr & 0xffffffff, oct->reg_list.pci_win_rd_addr_lo); in lio_pci_readq()
1344 readl(oct->reg_list.pci_win_rd_addr_lo); in lio_pci_readq()
1346 val64 = readq(oct->reg_list.pci_win_rd_data); in lio_pci_readq()
1348 spin_unlock_irqrestore(&oct->pci_win_lock, flags); in lio_pci_readq()
1359 spin_lock_irqsave(&oct->pci_win_lock, flags); in lio_pci_writeq()
1361 writeq(addr, oct->reg_list.pci_win_wr_addr); in lio_pci_writeq()
1364 writel(val >> 32, oct->reg_list.pci_win_wr_data_hi); in lio_pci_writeq()
1366 readl(oct->reg_list.pci_win_wr_data_hi); in lio_pci_writeq()
1368 writel(val & 0xffffffff, oct->reg_list.pci_win_wr_data_lo); in lio_pci_writeq()
1370 spin_unlock_irqrestore(&oct->pci_win_lock, flags); in lio_pci_writeq()
1414 * @param dev - octeon device pointer passed as a void *.
1424 return octeon_dev->octeon_id; in lio_get_device_id()
1425 return -1; in lio_get_device_id()
1436 pkts_pend = (u32)atomic_read(&droq->pkts_pending); in lio_enable_irq()
1437 writel(droq->pkt_count - pkts_pend, droq->pkts_sent_reg); in lio_enable_irq()
1438 droq->pkt_count = pkts_pend; in lio_enable_irq()
1439 oct = droq->oct_dev; in lio_enable_irq()
1442 spin_lock_bh(&iq->lock); in lio_enable_irq()
1443 writel(iq->pkts_processed, iq->inst_cnt_reg); in lio_enable_irq()
1444 iq->pkt_in_done -= iq->pkts_processed; in lio_enable_irq()
1445 iq->pkts_processed = 0; in lio_enable_irq()
1447 spin_unlock_bh(&iq->lock); in lio_enable_irq()
1448 oct = iq->oct_dev; in lio_enable_irq()
1455 writeq(CN23XX_INTR_RESEND, droq->pkts_sent_reg); in lio_enable_irq()
1458 instr_cnt = readq(iq->inst_cnt_reg); in lio_enable_irq()
1461 iq->inst_cnt_reg); in lio_enable_irq()