Lines Matching refs:efx
87 struct efx_nic *efx; member
194 return EFX_VI_BASE + vf->index * efx_vf_size(vf->efx) + index; in abs_index()
197 static int efx_siena_sriov_cmd(struct efx_nic *efx, bool enable, in efx_siena_sriov_cmd() argument
208 MCDI_SET_DWORD(inbuf, SRIOV_IN_VF_COUNT, efx->vf_count); in efx_siena_sriov_cmd()
210 rc = efx_mcdi_rpc(efx, MC_CMD_SRIOV, inbuf, MC_CMD_SRIOV_IN_LEN, in efx_siena_sriov_cmd()
230 static void efx_siena_sriov_usrev(struct efx_nic *efx, bool enabled) in efx_siena_sriov_usrev() argument
232 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_usrev()
238 efx_writeo(efx, ®, FR_CZ_USR_EV_CFG); in efx_siena_sriov_usrev()
241 static int efx_siena_sriov_memcpy(struct efx_nic *efx, in efx_siena_sriov_memcpy() argument
292 rc = efx_mcdi_rpc(efx, MC_CMD_MEMCPY, inbuf, used, NULL, 0, NULL); in efx_siena_sriov_memcpy()
304 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_tx_filter() local
310 efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, in efx_siena_sriov_reset_tx_filter()
312 netif_dbg(efx, hw, efx->net_dev, "Removed vf %s tx filter %d\n", in efx_siena_sriov_reset_tx_filter()
333 rc = efx_filter_insert_filter(efx, &filter, true); in efx_siena_sriov_reset_tx_filter()
335 netif_warn(efx, hw, efx->net_dev, in efx_siena_sriov_reset_tx_filter()
339 netif_dbg(efx, hw, efx->net_dev, "Inserted vf %s tx filter %d\n", in efx_siena_sriov_reset_tx_filter()
348 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_rx_filter() local
354 efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, in efx_siena_sriov_reset_rx_filter()
356 netif_dbg(efx, hw, efx->net_dev, "Removed vf %s rx filter %d\n", in efx_siena_sriov_reset_rx_filter()
373 rc = efx_filter_insert_filter(efx, &filter, true); in efx_siena_sriov_reset_rx_filter()
375 netif_warn(efx, hw, efx->net_dev, in efx_siena_sriov_reset_rx_filter()
379 netif_dbg(efx, hw, efx->net_dev, "Inserted vf %s rx filter %d\n", in efx_siena_sriov_reset_rx_filter()
387 struct efx_nic *efx = vf->efx; in __efx_siena_sriov_update_vf_addr() local
388 struct siena_nic_data *nic_data = efx->nic_data; in __efx_siena_sriov_update_vf_addr()
402 struct efx_nic *efx = vf->efx; in __efx_siena_sriov_push_vf_status() local
403 struct siena_nic_data *nic_data = efx->nic_data; in __efx_siena_sriov_push_vf_status()
429 copy[1].from_rid = efx->pci_dev->devfn; in __efx_siena_sriov_push_vf_status()
446 copy[pos].from_rid = efx->pci_dev->devfn; in __efx_siena_sriov_push_vf_status()
453 efx_siena_sriov_memcpy(efx, copy, ARRAY_SIZE(copy)); in __efx_siena_sriov_push_vf_status()
465 efx_siena_sriov_memcpy(efx, copy, pos + 1); in __efx_siena_sriov_push_vf_status()
473 efx_farch_generate_event(efx, in __efx_siena_sriov_push_vf_status()
474 EFX_VI_BASE + vf->index * efx_vf_size(efx), in __efx_siena_sriov_push_vf_status()
478 static void efx_siena_sriov_bufs(struct efx_nic *efx, unsigned offset, in efx_siena_sriov_bufs() argument
490 efx_sram_writeq(efx, efx->membase + FR_BZ_BUF_FULL_TBL, in efx_siena_sriov_bufs()
495 static bool bad_vf_index(struct efx_nic *efx, unsigned index) in bad_vf_index() argument
497 return index >= efx_vf_size(efx); in bad_vf_index()
511 static bool map_vi_index(struct efx_nic *efx, unsigned abs_index, in map_vi_index() argument
518 vf_i = (abs_index - EFX_VI_BASE) / efx_vf_size(efx); in map_vi_index()
519 if (vf_i >= efx->vf_init_count) in map_vi_index()
523 *vf_out = efx->vf + vf_i; in map_vi_index()
525 *rel_index_out = abs_index % efx_vf_size(efx); in map_vi_index()
531 struct efx_nic *efx = vf->efx; in efx_vfdi_init_evq() local
539 if (bad_vf_index(efx, vf_evq) || in efx_vfdi_init_evq()
542 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_evq()
548 efx_siena_sriov_bufs(efx, buftbl, req->u.init_evq.addr, buf_count); in efx_vfdi_init_evq()
554 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, abs_evq); in efx_vfdi_init_evq()
559 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, abs_evq); in efx_vfdi_init_evq()
572 struct efx_nic *efx = vf->efx; in efx_vfdi_init_rxq() local
581 if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_rxq) || in efx_vfdi_init_rxq()
585 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_rxq()
593 efx_siena_sriov_bufs(efx, buftbl, req->u.init_rxq.addr, buf_count); in efx_vfdi_init_rxq()
605 efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL, in efx_vfdi_init_rxq()
613 struct efx_nic *efx = vf->efx; in efx_vfdi_init_txq() local
622 if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_txq) || in efx_vfdi_init_txq()
626 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_txq()
637 efx_siena_sriov_bufs(efx, buftbl, req->u.init_txq.addr, buf_count); in efx_vfdi_init_txq()
643 FRF_CZ_TX_DPT_Q_MASK_WIDTH, min(efx->vi_scale, 1U), in efx_vfdi_init_txq()
651 efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL, in efx_vfdi_init_txq()
679 struct efx_nic *efx = vf->efx; in efx_vfdi_fini_all_queues() local
681 unsigned count = efx_vf_size(efx); in efx_vfdi_fini_all_queues()
682 unsigned vf_offset = EFX_VI_BASE + vf->index * efx_vf_size(efx); in efx_vfdi_fini_all_queues()
692 siena_prepare_flush(efx); in efx_vfdi_fini_all_queues()
703 efx_writeo(efx, ®, FR_AZ_TX_FLUSH_DESCQ); in efx_vfdi_fini_all_queues()
715 rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, in efx_vfdi_fini_all_queues()
736 siena_finish_flush(efx); in efx_vfdi_fini_all_queues()
742 efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL, in efx_vfdi_fini_all_queues()
744 efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL, in efx_vfdi_fini_all_queues()
746 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, in efx_vfdi_fini_all_queues()
748 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, in efx_vfdi_fini_all_queues()
751 efx_siena_sriov_bufs(efx, vf->buftbl_base, NULL, in efx_vfdi_fini_all_queues()
752 EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx)); in efx_vfdi_fini_all_queues()
762 struct efx_nic *efx = vf->efx; in efx_vfdi_insert_filter() local
763 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_insert_filter()
768 if (bad_vf_index(efx, vf_rxq) || vf->rx_filtering) { in efx_vfdi_insert_filter()
770 netif_err(efx, hw, efx->net_dev, in efx_vfdi_insert_filter()
794 struct efx_nic *efx = vf->efx; in efx_vfdi_remove_all_filters() local
795 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_remove_all_filters()
806 struct efx_nic *efx = vf->efx; in efx_vfdi_set_status_page() local
807 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_set_status_page()
817 netif_err(efx, hw, efx->net_dev, in efx_vfdi_set_status_page()
874 struct efx_nic *efx = vf->efx; in efx_siena_sriov_vfdi() local
883 copy[0].to_rid = efx->pci_dev->devfn; in efx_siena_sriov_vfdi()
886 rc = efx_siena_sriov_memcpy(efx, copy, 1); in efx_siena_sriov_vfdi()
890 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
900 netif_dbg(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
905 netif_dbg(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
930 (void)efx_siena_sriov_memcpy(efx, copy, ARRAY_SIZE(copy)); in efx_siena_sriov_vfdi()
942 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_vf() local
970 copy_req[k].from_rid = efx->pci_dev->devfn; in efx_siena_sriov_reset_vf()
976 rc = efx_siena_sriov_memcpy(efx, copy_req, count); in efx_siena_sriov_reset_vf()
979 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_reset_vf()
989 efx_siena_sriov_bufs(efx, buftbl, vf->evq0_addrs, vf->evq0_count); in efx_siena_sriov_reset_vf()
995 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, abs_evq); in efx_siena_sriov_reset_vf()
1000 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, abs_evq); in efx_siena_sriov_reset_vf()
1002 efx_writed(efx, &ptr, FR_BZ_EVQ_RPTR + FR_BZ_EVQ_RPTR_STEP * abs_evq); in efx_siena_sriov_reset_vf()
1010 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_vf_work() local
1013 if (!efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) { in efx_siena_sriov_reset_vf_work()
1015 efx_nic_free_buffer(efx, &buf); in efx_siena_sriov_reset_vf_work()
1019 static void efx_siena_sriov_handle_no_channel(struct efx_nic *efx) in efx_siena_sriov_handle_no_channel() argument
1021 netif_err(efx, drv, efx->net_dev, in efx_siena_sriov_handle_no_channel()
1024 efx->vf_count = 0; in efx_siena_sriov_handle_no_channel()
1029 struct siena_nic_data *nic_data = channel->efx->nic_data; in efx_siena_sriov_probe_channel()
1039 snprintf(buf, len, "%s-iov", channel->efx->name); in efx_siena_sriov_get_channel_name()
1051 void efx_siena_sriov_probe(struct efx_nic *efx) in efx_siena_sriov_probe() argument
1058 if (efx_siena_sriov_cmd(efx, false, &efx->vi_scale, &count)) in efx_siena_sriov_probe()
1064 efx->vf_count = count; in efx_siena_sriov_probe()
1066 efx->extra_channel_type[EFX_EXTRA_CHANNEL_IOV] = &efx_siena_sriov_channel_type; in efx_siena_sriov_probe()
1078 struct efx_nic *efx = nic_data->efx; in efx_siena_sriov_peer_work() local
1101 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_peer_work()
1102 vf = efx->vf + pos; in efx_siena_sriov_peer_work()
1126 &efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_peer_work()
1151 dma_free_coherent(&efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_peer_work()
1157 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_peer_work()
1158 vf = efx->vf + pos; in efx_siena_sriov_peer_work()
1167 static void efx_siena_sriov_free_local(struct efx_nic *efx) in efx_siena_sriov_free_local() argument
1169 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_free_local()
1184 dma_free_coherent(&efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_free_local()
1190 static int efx_siena_sriov_vf_alloc(struct efx_nic *efx) in efx_siena_sriov_vf_alloc() argument
1195 efx->vf = kzalloc(sizeof(struct efx_vf) * efx->vf_count, GFP_KERNEL); in efx_siena_sriov_vf_alloc()
1196 if (!efx->vf) in efx_siena_sriov_vf_alloc()
1199 for (index = 0; index < efx->vf_count; ++index) { in efx_siena_sriov_vf_alloc()
1200 vf = efx->vf + index; in efx_siena_sriov_vf_alloc()
1202 vf->efx = efx; in efx_siena_sriov_vf_alloc()
1217 static void efx_siena_sriov_vfs_fini(struct efx_nic *efx) in efx_siena_sriov_vfs_fini() argument
1222 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_vfs_fini()
1223 vf = efx->vf + pos; in efx_siena_sriov_vfs_fini()
1225 efx_nic_free_buffer(efx, &vf->buf); in efx_siena_sriov_vfs_fini()
1234 static int efx_siena_sriov_vfs_init(struct efx_nic *efx) in efx_siena_sriov_vfs_init() argument
1236 struct pci_dev *pci_dev = efx->pci_dev; in efx_siena_sriov_vfs_init()
1237 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vfs_init()
1252 for (index = 0; index < efx->vf_count; ++index) { in efx_siena_sriov_vfs_init()
1253 vf = efx->vf + index; in efx_siena_sriov_vfs_init()
1257 buftbl_base += EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx); in efx_siena_sriov_vfs_init()
1265 rc = efx_nic_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE, in efx_siena_sriov_vfs_init()
1276 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_vfs_init()
1280 int efx_siena_sriov_init(struct efx_nic *efx) in efx_siena_sriov_init() argument
1282 struct net_device *net_dev = efx->net_dev; in efx_siena_sriov_init()
1283 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_init()
1292 if (efx->vf_count == 0) in efx_siena_sriov_init()
1295 rc = efx_siena_sriov_cmd(efx, true, NULL, NULL); in efx_siena_sriov_init()
1299 rc = efx_nic_alloc_buffer(efx, &nic_data->vfdi_status, in efx_siena_sriov_init()
1308 vfdi_status->vi_scale = efx->vi_scale; in efx_siena_sriov_init()
1309 vfdi_status->rss_rxq_count = efx->rss_spread; in efx_siena_sriov_init()
1310 vfdi_status->peer_count = 1 + efx->vf_count; in efx_siena_sriov_init()
1311 vfdi_status->timer_quantum_ns = efx->timer_quantum_ns; in efx_siena_sriov_init()
1313 rc = efx_siena_sriov_vf_alloc(efx); in efx_siena_sriov_init()
1322 rc = efx_siena_sriov_vfs_init(efx); in efx_siena_sriov_init()
1328 efx->vf_init_count = efx->vf_count; in efx_siena_sriov_init()
1331 efx_siena_sriov_usrev(efx, true); in efx_siena_sriov_init()
1335 rc = pci_enable_sriov(efx->pci_dev, efx->vf_count); in efx_siena_sriov_init()
1339 netif_info(efx, probe, net_dev, in efx_siena_sriov_init()
1341 efx->vf_count, efx_vf_size(efx)); in efx_siena_sriov_init()
1345 efx_siena_sriov_usrev(efx, false); in efx_siena_sriov_init()
1347 efx->vf_init_count = 0; in efx_siena_sriov_init()
1349 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_init()
1352 efx_siena_sriov_free_local(efx); in efx_siena_sriov_init()
1353 kfree(efx->vf); in efx_siena_sriov_init()
1355 efx_nic_free_buffer(efx, &nic_data->vfdi_status); in efx_siena_sriov_init()
1357 efx_siena_sriov_cmd(efx, false, NULL, NULL); in efx_siena_sriov_init()
1362 void efx_siena_sriov_fini(struct efx_nic *efx) in efx_siena_sriov_fini() argument
1366 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_fini()
1368 if (efx->vf_init_count == 0) in efx_siena_sriov_fini()
1373 efx_siena_sriov_usrev(efx, false); in efx_siena_sriov_fini()
1375 efx->vf_init_count = 0; in efx_siena_sriov_fini()
1379 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_fini()
1380 vf = efx->vf + pos; in efx_siena_sriov_fini()
1386 pci_disable_sriov(efx->pci_dev); in efx_siena_sriov_fini()
1389 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_fini()
1390 efx_siena_sriov_free_local(efx); in efx_siena_sriov_fini()
1391 kfree(efx->vf); in efx_siena_sriov_fini()
1392 efx_nic_free_buffer(efx, &nic_data->vfdi_status); in efx_siena_sriov_fini()
1393 efx_siena_sriov_cmd(efx, false, NULL, NULL); in efx_siena_sriov_fini()
1398 struct efx_nic *efx = channel->efx; in efx_siena_sriov_event() local
1410 netif_vdbg(efx, hw, efx->net_dev, in efx_siena_sriov_event()
1414 if (map_vi_index(efx, qid, &vf, NULL)) in efx_siena_sriov_event()
1445 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_event()
1453 void efx_siena_sriov_flr(struct efx_nic *efx, unsigned vf_i) in efx_siena_sriov_flr() argument
1457 if (vf_i > efx->vf_init_count) in efx_siena_sriov_flr()
1459 vf = efx->vf + vf_i; in efx_siena_sriov_flr()
1460 netif_info(efx, hw, efx->net_dev, in efx_siena_sriov_flr()
1470 void efx_siena_sriov_mac_address_changed(struct efx_nic *efx) in efx_siena_sriov_mac_address_changed() argument
1472 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_mac_address_changed()
1475 if (!efx->vf_init_count) in efx_siena_sriov_mac_address_changed()
1478 efx->net_dev->dev_addr); in efx_siena_sriov_mac_address_changed()
1482 void efx_siena_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event) in efx_siena_sriov_tx_flush_done() argument
1488 if (map_vi_index(efx, queue, &vf, &qid)) in efx_siena_sriov_tx_flush_done()
1501 void efx_siena_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event) in efx_siena_sriov_rx_flush_done() argument
1509 if (map_vi_index(efx, queue, &vf, &qid)) in efx_siena_sriov_rx_flush_done()
1526 void efx_siena_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq) in efx_siena_sriov_desc_fetch_err() argument
1531 if (map_vi_index(efx, dmaq, &vf, &rel)) in efx_siena_sriov_desc_fetch_err()
1535 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_desc_fetch_err()
1542 void efx_siena_sriov_reset(struct efx_nic *efx) in efx_siena_sriov_reset() argument
1550 if (efx->vf_init_count == 0) in efx_siena_sriov_reset()
1553 efx_siena_sriov_usrev(efx, true); in efx_siena_sriov_reset()
1554 (void)efx_siena_sriov_cmd(efx, true, NULL, NULL); in efx_siena_sriov_reset()
1556 if (efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) in efx_siena_sriov_reset()
1559 for (vf_i = 0; vf_i < efx->vf_init_count; ++vf_i) { in efx_siena_sriov_reset()
1560 vf = efx->vf + vf_i; in efx_siena_sriov_reset()
1564 efx_nic_free_buffer(efx, &buf); in efx_siena_sriov_reset()
1587 struct efx_nic *efx = netdev_priv(net_dev); in efx_siena_sriov_set_vf_mac() local
1590 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_mac()
1592 vf = efx->vf + vf_i; in efx_siena_sriov_set_vf_mac()
1605 struct efx_nic *efx = netdev_priv(net_dev); in efx_siena_sriov_set_vf_vlan() local
1609 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_vlan()
1611 vf = efx->vf + vf_i; in efx_siena_sriov_set_vf_vlan()
1625 struct efx_nic *efx = netdev_priv(net_dev); in efx_siena_sriov_set_vf_spoofchk() local
1629 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_spoofchk()
1631 vf = efx->vf + vf_i; in efx_siena_sriov_set_vf_spoofchk()
1649 struct efx_nic *efx = netdev_priv(net_dev); in efx_siena_sriov_get_vf_config() local
1653 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_get_vf_config()
1655 vf = efx->vf + vf_i; in efx_siena_sriov_get_vf_config()