Lines Matching refs:efx
88 struct efx_nic *efx; member
195 return EFX_VI_BASE + vf->index * efx_vf_size(vf->efx) + index; in abs_index()
198 static int efx_siena_sriov_cmd(struct efx_nic *efx, bool enable, in efx_siena_sriov_cmd() argument
209 MCDI_SET_DWORD(inbuf, SRIOV_IN_VF_COUNT, efx->vf_count); in efx_siena_sriov_cmd()
211 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SRIOV, inbuf, MC_CMD_SRIOV_IN_LEN, in efx_siena_sriov_cmd()
231 static void efx_siena_sriov_usrev(struct efx_nic *efx, bool enabled) in efx_siena_sriov_usrev() argument
233 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_usrev()
239 efx_writeo(efx, ®, FR_CZ_USR_EV_CFG); in efx_siena_sriov_usrev()
242 static int efx_siena_sriov_memcpy(struct efx_nic *efx, in efx_siena_sriov_memcpy() argument
293 rc = efx_mcdi_rpc(efx, MC_CMD_MEMCPY, inbuf, used, NULL, 0, NULL); in efx_siena_sriov_memcpy()
305 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_tx_filter() local
311 efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, in efx_siena_sriov_reset_tx_filter()
313 netif_dbg(efx, hw, efx->net_dev, "Removed vf %s tx filter %d\n", in efx_siena_sriov_reset_tx_filter()
334 rc = efx_filter_insert_filter(efx, &filter, true); in efx_siena_sriov_reset_tx_filter()
336 netif_warn(efx, hw, efx->net_dev, in efx_siena_sriov_reset_tx_filter()
340 netif_dbg(efx, hw, efx->net_dev, "Inserted vf %s tx filter %d\n", in efx_siena_sriov_reset_tx_filter()
349 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_rx_filter() local
355 efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, in efx_siena_sriov_reset_rx_filter()
357 netif_dbg(efx, hw, efx->net_dev, "Removed vf %s rx filter %d\n", in efx_siena_sriov_reset_rx_filter()
374 rc = efx_filter_insert_filter(efx, &filter, true); in efx_siena_sriov_reset_rx_filter()
376 netif_warn(efx, hw, efx->net_dev, in efx_siena_sriov_reset_rx_filter()
380 netif_dbg(efx, hw, efx->net_dev, "Inserted vf %s rx filter %d\n", in efx_siena_sriov_reset_rx_filter()
388 struct efx_nic *efx = vf->efx; in __efx_siena_sriov_update_vf_addr() local
389 struct siena_nic_data *nic_data = efx->nic_data; in __efx_siena_sriov_update_vf_addr()
403 struct efx_nic *efx = vf->efx; in __efx_siena_sriov_push_vf_status() local
404 struct siena_nic_data *nic_data = efx->nic_data; in __efx_siena_sriov_push_vf_status()
430 copy[1].from_rid = efx->pci_dev->devfn; in __efx_siena_sriov_push_vf_status()
447 copy[pos].from_rid = efx->pci_dev->devfn; in __efx_siena_sriov_push_vf_status()
454 efx_siena_sriov_memcpy(efx, copy, ARRAY_SIZE(copy)); in __efx_siena_sriov_push_vf_status()
466 efx_siena_sriov_memcpy(efx, copy, pos + 1); in __efx_siena_sriov_push_vf_status()
474 efx_farch_generate_event(efx, in __efx_siena_sriov_push_vf_status()
475 EFX_VI_BASE + vf->index * efx_vf_size(efx), in __efx_siena_sriov_push_vf_status()
479 static void efx_siena_sriov_bufs(struct efx_nic *efx, unsigned offset, in efx_siena_sriov_bufs() argument
491 efx_sram_writeq(efx, efx->membase + FR_BZ_BUF_FULL_TBL, in efx_siena_sriov_bufs()
496 static bool bad_vf_index(struct efx_nic *efx, unsigned index) in bad_vf_index() argument
498 return index >= efx_vf_size(efx); in bad_vf_index()
512 static bool map_vi_index(struct efx_nic *efx, unsigned abs_index, in map_vi_index() argument
515 struct siena_nic_data *nic_data = efx->nic_data; in map_vi_index()
520 vf_i = (abs_index - EFX_VI_BASE) / efx_vf_size(efx); in map_vi_index()
521 if (vf_i >= efx->vf_init_count) in map_vi_index()
527 *rel_index_out = abs_index % efx_vf_size(efx); in map_vi_index()
533 struct efx_nic *efx = vf->efx; in efx_vfdi_init_evq() local
541 if (bad_vf_index(efx, vf_evq) || in efx_vfdi_init_evq()
544 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_evq()
550 efx_siena_sriov_bufs(efx, buftbl, req->u.init_evq.addr, buf_count); in efx_vfdi_init_evq()
556 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, abs_evq); in efx_vfdi_init_evq()
561 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, abs_evq); in efx_vfdi_init_evq()
574 struct efx_nic *efx = vf->efx; in efx_vfdi_init_rxq() local
583 if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_rxq) || in efx_vfdi_init_rxq()
587 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_rxq()
595 efx_siena_sriov_bufs(efx, buftbl, req->u.init_rxq.addr, buf_count); in efx_vfdi_init_rxq()
607 efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL, in efx_vfdi_init_rxq()
615 struct efx_nic *efx = vf->efx; in efx_vfdi_init_txq() local
624 if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_txq) || in efx_vfdi_init_txq()
628 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_txq()
639 efx_siena_sriov_bufs(efx, buftbl, req->u.init_txq.addr, buf_count); in efx_vfdi_init_txq()
645 FRF_CZ_TX_DPT_Q_MASK_WIDTH, min(efx->vi_scale, 1U), in efx_vfdi_init_txq()
653 efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL, in efx_vfdi_init_txq()
681 struct efx_nic *efx = vf->efx; in efx_vfdi_fini_all_queues() local
683 unsigned count = efx_vf_size(efx); in efx_vfdi_fini_all_queues()
684 unsigned vf_offset = EFX_VI_BASE + vf->index * efx_vf_size(efx); in efx_vfdi_fini_all_queues()
694 siena_prepare_flush(efx); in efx_vfdi_fini_all_queues()
705 efx_writeo(efx, ®, FR_AZ_TX_FLUSH_DESCQ); in efx_vfdi_fini_all_queues()
717 rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, in efx_vfdi_fini_all_queues()
738 siena_finish_flush(efx); in efx_vfdi_fini_all_queues()
744 efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL, in efx_vfdi_fini_all_queues()
746 efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL, in efx_vfdi_fini_all_queues()
748 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, in efx_vfdi_fini_all_queues()
750 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, in efx_vfdi_fini_all_queues()
753 efx_siena_sriov_bufs(efx, vf->buftbl_base, NULL, in efx_vfdi_fini_all_queues()
754 EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx)); in efx_vfdi_fini_all_queues()
764 struct efx_nic *efx = vf->efx; in efx_vfdi_insert_filter() local
765 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_insert_filter()
770 if (bad_vf_index(efx, vf_rxq) || vf->rx_filtering) { in efx_vfdi_insert_filter()
772 netif_err(efx, hw, efx->net_dev, in efx_vfdi_insert_filter()
796 struct efx_nic *efx = vf->efx; in efx_vfdi_remove_all_filters() local
797 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_remove_all_filters()
808 struct efx_nic *efx = vf->efx; in efx_vfdi_set_status_page() local
809 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_set_status_page()
819 netif_err(efx, hw, efx->net_dev, in efx_vfdi_set_status_page()
876 struct efx_nic *efx = vf->efx; in efx_siena_sriov_vfdi() local
885 copy[0].to_rid = efx->pci_dev->devfn; in efx_siena_sriov_vfdi()
888 rc = efx_siena_sriov_memcpy(efx, copy, 1); in efx_siena_sriov_vfdi()
892 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
902 netif_dbg(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
907 netif_dbg(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
932 (void)efx_siena_sriov_memcpy(efx, copy, ARRAY_SIZE(copy)); in efx_siena_sriov_vfdi()
945 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_vf() local
973 copy_req[k].from_rid = efx->pci_dev->devfn; in efx_siena_sriov_reset_vf()
979 rc = efx_siena_sriov_memcpy(efx, copy_req, count); in efx_siena_sriov_reset_vf()
982 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_reset_vf()
992 efx_siena_sriov_bufs(efx, buftbl, vf->evq0_addrs, vf->evq0_count); in efx_siena_sriov_reset_vf()
998 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, abs_evq); in efx_siena_sriov_reset_vf()
1003 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, abs_evq); in efx_siena_sriov_reset_vf()
1005 efx_writed(efx, &ptr, FR_BZ_EVQ_RPTR + FR_BZ_EVQ_RPTR_STEP * abs_evq); in efx_siena_sriov_reset_vf()
1013 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_vf_work() local
1016 if (!efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) { in efx_siena_sriov_reset_vf_work()
1018 efx_nic_free_buffer(efx, &buf); in efx_siena_sriov_reset_vf_work()
1022 static void efx_siena_sriov_handle_no_channel(struct efx_nic *efx) in efx_siena_sriov_handle_no_channel() argument
1024 netif_err(efx, drv, efx->net_dev, in efx_siena_sriov_handle_no_channel()
1027 efx->vf_count = 0; in efx_siena_sriov_handle_no_channel()
1032 struct siena_nic_data *nic_data = channel->efx->nic_data; in efx_siena_sriov_probe_channel()
1042 snprintf(buf, len, "%s-iov", channel->efx->name); in efx_siena_sriov_get_channel_name()
1054 void efx_siena_sriov_probe(struct efx_nic *efx) in efx_siena_sriov_probe() argument
1061 if (efx_siena_sriov_cmd(efx, false, &efx->vi_scale, &count)) { in efx_siena_sriov_probe()
1062 netif_info(efx, probe, efx->net_dev, "no SR-IOV VFs probed\n"); in efx_siena_sriov_probe()
1069 efx->vf_count = count; in efx_siena_sriov_probe()
1071 efx->extra_channel_type[EFX_EXTRA_CHANNEL_IOV] = &efx_siena_sriov_channel_type; in efx_siena_sriov_probe()
1083 struct efx_nic *efx = nic_data->efx; in efx_siena_sriov_peer_work() local
1106 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_peer_work()
1131 &efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_peer_work()
1156 dma_free_coherent(&efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_peer_work()
1162 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_peer_work()
1172 static void efx_siena_sriov_free_local(struct efx_nic *efx) in efx_siena_sriov_free_local() argument
1174 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_free_local()
1189 dma_free_coherent(&efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_free_local()
1195 static int efx_siena_sriov_vf_alloc(struct efx_nic *efx) in efx_siena_sriov_vf_alloc() argument
1199 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vf_alloc()
1201 nic_data->vf = kcalloc(efx->vf_count, sizeof(*nic_data->vf), in efx_siena_sriov_vf_alloc()
1206 for (index = 0; index < efx->vf_count; ++index) { in efx_siena_sriov_vf_alloc()
1209 vf->efx = efx; in efx_siena_sriov_vf_alloc()
1224 static void efx_siena_sriov_vfs_fini(struct efx_nic *efx) in efx_siena_sriov_vfs_fini() argument
1226 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vfs_fini()
1230 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_vfs_fini()
1233 efx_nic_free_buffer(efx, &vf->buf); in efx_siena_sriov_vfs_fini()
1242 static int efx_siena_sriov_vfs_init(struct efx_nic *efx) in efx_siena_sriov_vfs_init() argument
1244 struct pci_dev *pci_dev = efx->pci_dev; in efx_siena_sriov_vfs_init()
1245 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vfs_init()
1260 for (index = 0; index < efx->vf_count; ++index) { in efx_siena_sriov_vfs_init()
1265 buftbl_base += EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx); in efx_siena_sriov_vfs_init()
1273 rc = efx_nic_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE, in efx_siena_sriov_vfs_init()
1284 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_vfs_init()
1288 int efx_siena_sriov_init(struct efx_nic *efx) in efx_siena_sriov_init() argument
1290 struct net_device *net_dev = efx->net_dev; in efx_siena_sriov_init()
1291 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_init()
1300 if (efx->vf_count == 0) in efx_siena_sriov_init()
1303 rc = efx_siena_sriov_cmd(efx, true, NULL, NULL); in efx_siena_sriov_init()
1307 rc = efx_nic_alloc_buffer(efx, &nic_data->vfdi_status, in efx_siena_sriov_init()
1316 vfdi_status->vi_scale = efx->vi_scale; in efx_siena_sriov_init()
1317 vfdi_status->rss_rxq_count = efx->rss_spread; in efx_siena_sriov_init()
1318 vfdi_status->peer_count = 1 + efx->vf_count; in efx_siena_sriov_init()
1319 vfdi_status->timer_quantum_ns = efx->timer_quantum_ns; in efx_siena_sriov_init()
1321 rc = efx_siena_sriov_vf_alloc(efx); in efx_siena_sriov_init()
1330 rc = efx_siena_sriov_vfs_init(efx); in efx_siena_sriov_init()
1336 efx->vf_init_count = efx->vf_count; in efx_siena_sriov_init()
1339 efx_siena_sriov_usrev(efx, true); in efx_siena_sriov_init()
1343 rc = pci_enable_sriov(efx->pci_dev, efx->vf_count); in efx_siena_sriov_init()
1347 netif_info(efx, probe, net_dev, in efx_siena_sriov_init()
1349 efx->vf_count, efx_vf_size(efx)); in efx_siena_sriov_init()
1353 efx_siena_sriov_usrev(efx, false); in efx_siena_sriov_init()
1355 efx->vf_init_count = 0; in efx_siena_sriov_init()
1357 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_init()
1360 efx_siena_sriov_free_local(efx); in efx_siena_sriov_init()
1363 efx_nic_free_buffer(efx, &nic_data->vfdi_status); in efx_siena_sriov_init()
1365 efx_siena_sriov_cmd(efx, false, NULL, NULL); in efx_siena_sriov_init()
1370 void efx_siena_sriov_fini(struct efx_nic *efx) in efx_siena_sriov_fini() argument
1374 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_fini()
1376 if (efx->vf_init_count == 0) in efx_siena_sriov_fini()
1381 efx_siena_sriov_usrev(efx, false); in efx_siena_sriov_fini()
1383 efx->vf_init_count = 0; in efx_siena_sriov_fini()
1387 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_fini()
1394 pci_disable_sriov(efx->pci_dev); in efx_siena_sriov_fini()
1397 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_fini()
1398 efx_siena_sriov_free_local(efx); in efx_siena_sriov_fini()
1400 efx_nic_free_buffer(efx, &nic_data->vfdi_status); in efx_siena_sriov_fini()
1401 efx_siena_sriov_cmd(efx, false, NULL, NULL); in efx_siena_sriov_fini()
1406 struct efx_nic *efx = channel->efx; in efx_siena_sriov_event() local
1418 netif_vdbg(efx, hw, efx->net_dev, in efx_siena_sriov_event()
1422 if (map_vi_index(efx, qid, &vf, NULL)) in efx_siena_sriov_event()
1453 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_event()
1461 void efx_siena_sriov_flr(struct efx_nic *efx, unsigned vf_i) in efx_siena_sriov_flr() argument
1463 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_flr()
1466 if (vf_i > efx->vf_init_count) in efx_siena_sriov_flr()
1469 netif_info(efx, hw, efx->net_dev, in efx_siena_sriov_flr()
1479 int efx_siena_sriov_mac_address_changed(struct efx_nic *efx) in efx_siena_sriov_mac_address_changed() argument
1481 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_mac_address_changed()
1484 if (!efx->vf_init_count) in efx_siena_sriov_mac_address_changed()
1487 efx->net_dev->dev_addr); in efx_siena_sriov_mac_address_changed()
1493 void efx_siena_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event) in efx_siena_sriov_tx_flush_done() argument
1499 if (map_vi_index(efx, queue, &vf, &qid)) in efx_siena_sriov_tx_flush_done()
1512 void efx_siena_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event) in efx_siena_sriov_rx_flush_done() argument
1520 if (map_vi_index(efx, queue, &vf, &qid)) in efx_siena_sriov_rx_flush_done()
1537 void efx_siena_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq) in efx_siena_sriov_desc_fetch_err() argument
1542 if (map_vi_index(efx, dmaq, &vf, &rel)) in efx_siena_sriov_desc_fetch_err()
1546 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_desc_fetch_err()
1553 void efx_siena_sriov_reset(struct efx_nic *efx) in efx_siena_sriov_reset() argument
1555 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_reset()
1562 if (efx->vf_init_count == 0) in efx_siena_sriov_reset()
1565 efx_siena_sriov_usrev(efx, true); in efx_siena_sriov_reset()
1566 (void)efx_siena_sriov_cmd(efx, true, NULL, NULL); in efx_siena_sriov_reset()
1568 if (efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) in efx_siena_sriov_reset()
1571 for (vf_i = 0; vf_i < efx->vf_init_count; ++vf_i) { in efx_siena_sriov_reset()
1576 efx_nic_free_buffer(efx, &buf); in efx_siena_sriov_reset()
1596 int efx_siena_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac) in efx_siena_sriov_set_vf_mac() argument
1598 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_set_vf_mac()
1601 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_mac()
1613 int efx_siena_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, in efx_siena_sriov_set_vf_vlan() argument
1616 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_set_vf_vlan()
1620 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_vlan()
1633 int efx_siena_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf_i, in efx_siena_sriov_set_vf_spoofchk() argument
1636 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_set_vf_spoofchk()
1640 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_spoofchk()
1657 int efx_siena_sriov_get_vf_config(struct efx_nic *efx, int vf_i, in efx_siena_sriov_get_vf_config() argument
1660 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_get_vf_config()
1664 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_get_vf_config()
1680 bool efx_siena_sriov_wanted(struct efx_nic *efx) in efx_siena_sriov_wanted() argument
1682 return efx->vf_count != 0; in efx_siena_sriov_wanted()
1685 int efx_siena_sriov_configure(struct efx_nic *efx, int num_vfs) in efx_siena_sriov_configure() argument