Lines Matching refs:ionic
57 new_coal = ionic_coal_usec_to_hw(lif->ionic, cur_moder.usec); in ionic_dim_work()
64 ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, in ionic_dim_work()
147 ionic_port_identify(lif->ionic); in ionic_link_status_check()
203 struct device *dev = lif->ionic->dev; in ionic_request_irq()
221 struct ionic *ionic = lif->ionic; in ionic_intr_alloc() local
224 index = find_first_zero_bit(ionic->intrs, ionic->nintrs); in ionic_intr_alloc()
225 if (index == ionic->nintrs) { in ionic_intr_alloc()
227 __func__, index, ionic->nintrs); in ionic_intr_alloc()
231 set_bit(index, ionic->intrs); in ionic_intr_alloc()
232 ionic_intr_init(&ionic->idev, intr, index); in ionic_intr_alloc()
237 static void ionic_intr_free(struct ionic *ionic, int index) in ionic_intr_free() argument
239 if (index != IONIC_INTR_INDEX_NOT_ASSIGNED && index < ionic->nintrs) in ionic_intr_free()
240 clear_bit(index, ionic->intrs); in ionic_intr_free()
262 idev = &lif->ionic->idev; in ionic_qcq_enable()
263 dev = lif->ionic->dev; in ionic_qcq_enable()
309 struct ionic_dev *idev = &lif->ionic->idev; in ionic_qcq_disable()
323 dev_dbg(lif->ionic->dev, "q_disable.index %d q_disable.qtype %d\n", in ionic_qcq_disable()
334 struct ionic_dev *idev = &lif->ionic->idev; in ionic_lif_qcq_deinit()
357 devm_free_irq(lif->ionic->dev, qcq->intr.vector, &qcq->napi); in ionic_qcq_intr_free()
359 ionic_intr_free(lif->ionic, qcq->intr.index); in ionic_qcq_intr_free()
365 struct device *dev = lif->ionic->dev; in ionic_qcq_free()
404 struct device *dev = lif->ionic->dev; in ionic_qcqs_free()
456 err = ionic_bus_get_irq(lif->ionic, qcq->intr.index); in ionic_alloc_qcq_interrupt()
463 ionic_intr_mask_assert(lif->ionic->idev.intr_ctrl, qcq->intr.index, in ionic_alloc_qcq_interrupt()
474 dev_to_node(lif->ionic->dev)); in ionic_alloc_qcq_interrupt()
482 ionic_intr_free(lif->ionic, qcq->intr.index); in ionic_alloc_qcq_interrupt()
495 struct ionic_dev *idev = &lif->ionic->idev; in ionic_qcq_alloc()
496 struct device *dev = lif->ionic->dev; in ionic_qcq_alloc()
630 ionic_intr_free(lif->ionic, new->intr.index); in ionic_qcq_alloc()
643 struct device *dev = lif->ionic->dev; in ionic_qcqs_alloc()
657 if (lif->ionic->nnqs_per_lif) { in ionic_qcqs_alloc()
673 lif->txqcqs = devm_kcalloc(dev, lif->ionic->ntxqs_per_lif, in ionic_qcqs_alloc()
677 lif->rxqcqs = devm_kcalloc(dev, lif->ionic->nrxqs_per_lif, in ionic_qcqs_alloc()
682 lif->txqstats = devm_kcalloc(dev, lif->ionic->ntxqs_per_lif, in ionic_qcqs_alloc()
686 lif->rxqstats = devm_kcalloc(dev, lif->ionic->nrxqs_per_lif, in ionic_qcqs_alloc()
711 struct device *dev = lif->ionic->dev; in ionic_lif_txq_init()
772 struct device *dev = lif->ionic->dev; in ionic_lif_rxq_init()
849 dev_dbg(lif->ionic->dev, "notifyq event:\n"); in ionic_notifyq_service()
892 struct ionic_dev *idev = &lif->ionic->idev; in ionic_adminq_napi()
1266 struct device *dev = lif->ionic->dev; in ionic_set_nic_features()
1295 dev_info_once(lif->ionic->dev, "NIC is not supporting vlan offload, likely in SmartNIC mode\n"); in ionic_set_nic_features()
1597 tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz); in ionic_lif_rss_config()
1621 tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz); in ionic_lif_rss_init()
1632 tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz); in ionic_lif_rss_deinit()
1681 for (i = 0; i < lif->ionic->ntxqs_per_lif && lif->txqcqs[i]; i++) { in ionic_txrx_free()
1683 devm_kfree(lif->ionic->dev, lif->txqcqs[i]); in ionic_txrx_free()
1689 for (i = 0; i < lif->ionic->nrxqs_per_lif && lif->rxqcqs[i]; i++) { in ionic_txrx_free()
1691 devm_kfree(lif->ionic->dev, lif->rxqcqs[i]); in ionic_txrx_free()
1725 ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, in ionic_txrx_alloc()
1746 ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, in ionic_txrx_alloc()
1807 dev_err(lif->ionic->dev, "%s: bad qcq %d\n", __func__, i); in ionic_txrx_enable()
1916 struct ionic *ionic = lif->ionic; in ionic_get_vf_config() local
1922 down_read(&ionic->vf_op_lock); in ionic_get_vf_config()
1924 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_get_vf_config()
1928 ivf->vlan = le16_to_cpu(ionic->vfs[vf].vlanid); in ionic_get_vf_config()
1930 ivf->spoofchk = ionic->vfs[vf].spoofchk; in ionic_get_vf_config()
1931 ivf->linkstate = ionic->vfs[vf].linkstate; in ionic_get_vf_config()
1932 ivf->max_tx_rate = le32_to_cpu(ionic->vfs[vf].maxrate); in ionic_get_vf_config()
1933 ivf->trusted = ionic->vfs[vf].trusted; in ionic_get_vf_config()
1934 ether_addr_copy(ivf->mac, ionic->vfs[vf].macaddr); in ionic_get_vf_config()
1937 up_read(&ionic->vf_op_lock); in ionic_get_vf_config()
1945 struct ionic *ionic = lif->ionic; in ionic_get_vf_stats() local
1952 down_read(&ionic->vf_op_lock); in ionic_get_vf_stats()
1954 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_get_vf_stats()
1958 vs = &ionic->vfs[vf].stats; in ionic_get_vf_stats()
1974 up_read(&ionic->vf_op_lock); in ionic_get_vf_stats()
1981 struct ionic *ionic = lif->ionic; in ionic_set_vf_mac() local
1990 down_write(&ionic->vf_op_lock); in ionic_set_vf_mac()
1992 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_set_vf_mac()
1995 ret = ionic_set_vf_config(ionic, vf, IONIC_VF_ATTR_MAC, mac); in ionic_set_vf_mac()
1997 ether_addr_copy(ionic->vfs[vf].macaddr, mac); in ionic_set_vf_mac()
2000 up_write(&ionic->vf_op_lock); in ionic_set_vf_mac()
2008 struct ionic *ionic = lif->ionic; in ionic_set_vf_vlan() local
2024 down_write(&ionic->vf_op_lock); in ionic_set_vf_vlan()
2026 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_set_vf_vlan()
2029 ret = ionic_set_vf_config(ionic, vf, in ionic_set_vf_vlan()
2032 ionic->vfs[vf].vlanid = cpu_to_le16(vlan); in ionic_set_vf_vlan()
2035 up_write(&ionic->vf_op_lock); in ionic_set_vf_vlan()
2043 struct ionic *ionic = lif->ionic; in ionic_set_vf_rate() local
2053 down_write(&ionic->vf_op_lock); in ionic_set_vf_rate()
2055 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_set_vf_rate()
2058 ret = ionic_set_vf_config(ionic, vf, in ionic_set_vf_rate()
2061 lif->ionic->vfs[vf].maxrate = cpu_to_le32(tx_max); in ionic_set_vf_rate()
2064 up_write(&ionic->vf_op_lock); in ionic_set_vf_rate()
2071 struct ionic *ionic = lif->ionic; in ionic_set_vf_spoofchk() local
2078 down_write(&ionic->vf_op_lock); in ionic_set_vf_spoofchk()
2080 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_set_vf_spoofchk()
2083 ret = ionic_set_vf_config(ionic, vf, in ionic_set_vf_spoofchk()
2086 ionic->vfs[vf].spoofchk = data; in ionic_set_vf_spoofchk()
2089 up_write(&ionic->vf_op_lock); in ionic_set_vf_spoofchk()
2096 struct ionic *ionic = lif->ionic; in ionic_set_vf_trust() local
2103 down_write(&ionic->vf_op_lock); in ionic_set_vf_trust()
2105 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_set_vf_trust()
2108 ret = ionic_set_vf_config(ionic, vf, in ionic_set_vf_trust()
2111 ionic->vfs[vf].trusted = data; in ionic_set_vf_trust()
2114 up_write(&ionic->vf_op_lock); in ionic_set_vf_trust()
2121 struct ionic *ionic = lif->ionic; in ionic_set_vf_link_state() local
2142 down_write(&ionic->vf_op_lock); in ionic_set_vf_link_state()
2144 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) { in ionic_set_vf_link_state()
2147 ret = ionic_set_vf_config(ionic, vf, in ionic_set_vf_link_state()
2150 ionic->vfs[vf].linkstate = set; in ionic_set_vf_link_state()
2153 up_write(&ionic->vf_op_lock); in ionic_set_vf_link_state()
2218 tx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->ntxqs_per_lif, in ionic_reconfigure_queues()
2224 rx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->nrxqs_per_lif, in ionic_reconfigure_queues()
2307 for (i = 0; i < lif->ionic->ntxqs_per_lif; i++) { in ionic_reconfigure_queues()
2316 ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, in ionic_reconfigure_queues()
2323 ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, in ionic_reconfigure_queues()
2365 devm_kfree(lif->ionic->dev, tx_qcqs[i]); in ionic_reconfigure_queues()
2371 devm_kfree(lif->ionic->dev, rx_qcqs[i]); in ionic_reconfigure_queues()
2378 devm_kfree(lif->ionic->dev, rx_qcqs); in ionic_reconfigure_queues()
2382 devm_kfree(lif->ionic->dev, tx_qcqs); in ionic_reconfigure_queues()
2389 for (i = lif->nxqs; i < lif->ionic->ntxqs_per_lif; i++) { in ionic_reconfigure_queues()
2404 int ionic_lif_alloc(struct ionic *ionic) in ionic_lif_alloc() argument
2406 struct device *dev = ionic->dev; in ionic_lif_alloc()
2418 ionic->ntxqs_per_lif, ionic->ntxqs_per_lif); in ionic_lif_alloc()
2429 ionic->lif = lif; in ionic_lif_alloc()
2438 err = ionic_lif_identify(ionic, lif->lif_type, lif->identity); in ionic_lif_alloc()
2440 dev_err(ionic->dev, "Cannot identify type %d: %d\n", in ionic_lif_alloc()
2449 lif->neqs = ionic->neqs_per_lif; in ionic_lif_alloc()
2450 lif->nxqs = ionic->ntxqs_per_lif; in ionic_lif_alloc()
2452 lif->ionic = ionic; in ionic_lif_alloc()
2460 lif->rx_coalesce_hw = ionic_coal_usec_to_hw(lif->ionic, in ionic_lif_alloc()
2494 tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz); in ionic_lif_alloc()
2526 struct ionic_dev *idev = &lif->ionic->idev; in ionic_lif_reset()
2528 mutex_lock(&lif->ionic->dev_cmd_lock); in ionic_lif_reset()
2530 ionic_dev_cmd_wait(lif->ionic, DEVCMD_TIMEOUT); in ionic_lif_reset()
2531 mutex_unlock(&lif->ionic->dev_cmd_lock); in ionic_lif_reset()
2536 struct ionic *ionic = lif->ionic; in ionic_lif_handle_fw_down() local
2541 dev_info(ionic->dev, "FW Down: Stopping LIFs\n"); in ionic_lif_handle_fw_down()
2546 dev_info(ionic->dev, "Surprise FW stop, stopping queues\n"); in ionic_lif_handle_fw_down()
2557 ionic_reset(ionic); in ionic_lif_handle_fw_down()
2560 dev_info(ionic->dev, "FW Down: LIFs stopped\n"); in ionic_lif_handle_fw_down()
2565 struct ionic *ionic = lif->ionic; in ionic_lif_handle_fw_up() local
2571 dev_info(ionic->dev, "FW Up: restarting LIFs\n"); in ionic_lif_handle_fw_up()
2573 ionic_init_devinfo(ionic); in ionic_lif_handle_fw_up()
2574 err = ionic_identify(ionic); in ionic_lif_handle_fw_up()
2577 err = ionic_port_identify(ionic); in ionic_lif_handle_fw_up()
2580 err = ionic_port_init(ionic); in ionic_lif_handle_fw_up()
2609 dev_info(ionic->dev, "FW Up: LIFs restarted\n"); in ionic_lif_handle_fw_up()
2620 dev_err(ionic->dev, "FW Up: LIFs restart failed - err %d\n", err); in ionic_lif_handle_fw_up()
2625 struct device *dev = lif->ionic->dev; in ionic_lif_free()
2645 ionic_bus_unmap_dbpage(lif->ionic, lif->kern_dbpage); in ionic_lif_free()
2678 struct device *dev = lif->ionic->dev; in ionic_lif_adminq_init()
2685 idev = &lif->ionic->idev; in ionic_lif_adminq_init()
2689 mutex_lock(&lif->ionic->dev_cmd_lock); in ionic_lif_adminq_init()
2691 err = ionic_dev_cmd_wait(lif->ionic, DEVCMD_TIMEOUT); in ionic_lif_adminq_init()
2693 mutex_unlock(&lif->ionic->dev_cmd_lock); in ionic_lif_adminq_init()
2723 struct device *dev = lif->ionic->dev; in ionic_lif_notifyq_init()
2823 struct ionic_dev *idev = &lif->ionic->idev; in ionic_lif_init()
2824 struct device *dev = lif->ionic->dev; in ionic_lif_init()
2829 mutex_lock(&lif->ionic->dev_cmd_lock); in ionic_lif_init()
2831 err = ionic_dev_cmd_wait(lif->ionic, DEVCMD_TIMEOUT); in ionic_lif_init()
2833 mutex_unlock(&lif->ionic->dev_cmd_lock); in ionic_lif_init()
2841 lif->dbid_count = le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif); in ionic_lif_init()
2858 lif->kern_dbpage = ionic_bus_map_dbpage(lif->ionic, dbpage_num); in ionic_lif_init()
2869 if (lif->ionic->nnqs_per_lif) { in ionic_lif_init()
2902 ionic_bus_unmap_dbpage(lif->ionic, lif->kern_dbpage); in ionic_lif_init()
2944 struct ionic *ionic = container_of(nb, struct ionic, nb); in ionic_lif_notify() local
2947 if (!lif || lif->ionic != ionic) in ionic_lif_notify()
2963 INIT_WORK(&lif->ionic->nb_work, ionic_lif_notify_work); in ionic_lif_register()
2965 lif->ionic->nb.notifier_call = ionic_lif_notify; in ionic_lif_register()
2967 err = register_netdevice_notifier(&lif->ionic->nb); in ionic_lif_register()
2969 lif->ionic->nb.notifier_call = NULL; in ionic_lif_register()
2974 dev_err(lif->ionic->dev, "Cannot register net device, aborting\n"); in ionic_lif_register()
2985 if (lif->ionic->nb.notifier_call) { in ionic_lif_unregister()
2986 unregister_netdevice_notifier(&lif->ionic->nb); in ionic_lif_unregister()
2987 cancel_work_sync(&lif->ionic->nb_work); in ionic_lif_unregister()
2988 lif->ionic->nb.notifier_call = NULL; in ionic_lif_unregister()
2999 struct ionic *ionic = lif->ionic; in ionic_lif_queue_identify() local
3004 idev = &lif->ionic->idev; in ionic_lif_queue_identify()
3023 mutex_lock(&ionic->dev_cmd_lock); in ionic_lif_queue_identify()
3026 err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); in ionic_lif_queue_identify()
3037 mutex_unlock(&ionic->dev_cmd_lock); in ionic_lif_queue_identify()
3040 dev_err(ionic->dev, "qtype %d not supported\n", qtype); in ionic_lif_queue_identify()
3043 dev_err(ionic->dev, "q_ident failed, not supported on older FW\n"); in ionic_lif_queue_identify()
3046 dev_err(ionic->dev, "q_ident failed, qtype %d: %d\n", in ionic_lif_queue_identify()
3051 dev_dbg(ionic->dev, " qtype[%d].version = %d\n", in ionic_lif_queue_identify()
3053 dev_dbg(ionic->dev, " qtype[%d].supported = 0x%02x\n", in ionic_lif_queue_identify()
3055 dev_dbg(ionic->dev, " qtype[%d].features = 0x%04llx\n", in ionic_lif_queue_identify()
3057 dev_dbg(ionic->dev, " qtype[%d].desc_sz = %d\n", in ionic_lif_queue_identify()
3059 dev_dbg(ionic->dev, " qtype[%d].comp_sz = %d\n", in ionic_lif_queue_identify()
3061 dev_dbg(ionic->dev, " qtype[%d].sg_desc_sz = %d\n", in ionic_lif_queue_identify()
3063 dev_dbg(ionic->dev, " qtype[%d].max_sg_elems = %d\n", in ionic_lif_queue_identify()
3065 dev_dbg(ionic->dev, " qtype[%d].sg_desc_stride = %d\n", in ionic_lif_queue_identify()
3070 int ionic_lif_identify(struct ionic *ionic, u8 lif_type, in ionic_lif_identify() argument
3073 struct ionic_dev *idev = &ionic->idev; in ionic_lif_identify()
3079 mutex_lock(&ionic->dev_cmd_lock); in ionic_lif_identify()
3081 err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); in ionic_lif_identify()
3083 mutex_unlock(&ionic->dev_cmd_lock); in ionic_lif_identify()
3087 dev_dbg(ionic->dev, "capabilities 0x%llx\n", in ionic_lif_identify()
3090 dev_dbg(ionic->dev, "eth.max_ucast_filters %d\n", in ionic_lif_identify()
3092 dev_dbg(ionic->dev, "eth.max_mcast_filters %d\n", in ionic_lif_identify()
3094 dev_dbg(ionic->dev, "eth.features 0x%llx\n", in ionic_lif_identify()
3096 dev_dbg(ionic->dev, "eth.queue_count[IONIC_QTYPE_ADMINQ] %d\n", in ionic_lif_identify()
3098 dev_dbg(ionic->dev, "eth.queue_count[IONIC_QTYPE_NOTIFYQ] %d\n", in ionic_lif_identify()
3100 dev_dbg(ionic->dev, "eth.queue_count[IONIC_QTYPE_RXQ] %d\n", in ionic_lif_identify()
3102 dev_dbg(ionic->dev, "eth.queue_count[IONIC_QTYPE_TXQ] %d\n", in ionic_lif_identify()
3104 dev_dbg(ionic->dev, "eth.config.name %s\n", lid->eth.config.name); in ionic_lif_identify()
3105 dev_dbg(ionic->dev, "eth.config.mac %pM\n", lid->eth.config.mac); in ionic_lif_identify()
3106 dev_dbg(ionic->dev, "eth.config.mtu %d\n", in ionic_lif_identify()
3112 int ionic_lif_size(struct ionic *ionic) in ionic_lif_size() argument
3114 struct ionic_identity *ident = &ionic->ident; in ionic_lif_size()
3148 err = ionic_bus_alloc_irq_vectors(ionic, nintrs); in ionic_lif_size()
3150 dev_err(ionic->dev, "Can't get intrs from OS: %d\n", err); in ionic_lif_size()
3157 ionic_bus_free_irq_vectors(ionic); in ionic_lif_size()
3161 ionic->nnqs_per_lif = nnqs_per_lif; in ionic_lif_size()
3162 ionic->neqs_per_lif = neqs; in ionic_lif_size()
3163 ionic->ntxqs_per_lif = nxqs; in ionic_lif_size()
3164 ionic->nrxqs_per_lif = nxqs; in ionic_lif_size()
3165 ionic->nintrs = nintrs; in ionic_lif_size()
3167 ionic_debugfs_add_sizes(ionic); in ionic_lif_size()
3184 dev_err(ionic->dev, "Can't get minimum %d intrs from OS\n", min_intrs); in ionic_lif_size()