Lines Matching refs:efx
85 struct efx_nic *efx; member
192 return EFX_VI_BASE + vf->index * efx_vf_size(vf->efx) + index; in abs_index()
195 static int efx_siena_sriov_cmd(struct efx_nic *efx, bool enable, in efx_siena_sriov_cmd() argument
206 MCDI_SET_DWORD(inbuf, SRIOV_IN_VF_COUNT, efx->vf_count); in efx_siena_sriov_cmd()
208 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SRIOV, inbuf, MC_CMD_SRIOV_IN_LEN, in efx_siena_sriov_cmd()
228 static void efx_siena_sriov_usrev(struct efx_nic *efx, bool enabled) in efx_siena_sriov_usrev() argument
230 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_usrev()
236 efx_writeo(efx, ®, FR_CZ_USR_EV_CFG); in efx_siena_sriov_usrev()
239 static int efx_siena_sriov_memcpy(struct efx_nic *efx, in efx_siena_sriov_memcpy() argument
290 rc = efx_mcdi_rpc(efx, MC_CMD_MEMCPY, inbuf, used, NULL, 0, NULL); in efx_siena_sriov_memcpy()
302 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_tx_filter() local
308 efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, in efx_siena_sriov_reset_tx_filter()
310 netif_dbg(efx, hw, efx->net_dev, "Removed vf %s tx filter %d\n", in efx_siena_sriov_reset_tx_filter()
331 rc = efx_filter_insert_filter(efx, &filter, true); in efx_siena_sriov_reset_tx_filter()
333 netif_warn(efx, hw, efx->net_dev, in efx_siena_sriov_reset_tx_filter()
337 netif_dbg(efx, hw, efx->net_dev, "Inserted vf %s tx filter %d\n", in efx_siena_sriov_reset_tx_filter()
346 struct efx_nic *efx = vf->efx; in efx_siena_sriov_reset_rx_filter() local
352 efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, in efx_siena_sriov_reset_rx_filter()
354 netif_dbg(efx, hw, efx->net_dev, "Removed vf %s rx filter %d\n", in efx_siena_sriov_reset_rx_filter()
371 rc = efx_filter_insert_filter(efx, &filter, true); in efx_siena_sriov_reset_rx_filter()
373 netif_warn(efx, hw, efx->net_dev, in efx_siena_sriov_reset_rx_filter()
377 netif_dbg(efx, hw, efx->net_dev, "Inserted vf %s rx filter %d\n", in efx_siena_sriov_reset_rx_filter()
385 struct efx_nic *efx = vf->efx; in __efx_siena_sriov_update_vf_addr() local
386 struct siena_nic_data *nic_data = efx->nic_data; in __efx_siena_sriov_update_vf_addr()
400 struct efx_nic *efx = vf->efx; in __efx_siena_sriov_push_vf_status() local
401 struct siena_nic_data *nic_data = efx->nic_data; in __efx_siena_sriov_push_vf_status()
427 copy[1].from_rid = efx->pci_dev->devfn; in __efx_siena_sriov_push_vf_status()
444 copy[pos].from_rid = efx->pci_dev->devfn; in __efx_siena_sriov_push_vf_status()
451 efx_siena_sriov_memcpy(efx, copy, ARRAY_SIZE(copy)); in __efx_siena_sriov_push_vf_status()
463 efx_siena_sriov_memcpy(efx, copy, pos + 1); in __efx_siena_sriov_push_vf_status()
471 efx_farch_generate_event(efx, in __efx_siena_sriov_push_vf_status()
472 EFX_VI_BASE + vf->index * efx_vf_size(efx), in __efx_siena_sriov_push_vf_status()
476 static void efx_siena_sriov_bufs(struct efx_nic *efx, unsigned offset, in efx_siena_sriov_bufs() argument
488 efx_sram_writeq(efx, efx->membase + FR_BZ_BUF_FULL_TBL, in efx_siena_sriov_bufs()
493 static bool bad_vf_index(struct efx_nic *efx, unsigned index) in bad_vf_index() argument
495 return index >= efx_vf_size(efx); in bad_vf_index()
509 static bool map_vi_index(struct efx_nic *efx, unsigned abs_index, in map_vi_index() argument
512 struct siena_nic_data *nic_data = efx->nic_data; in map_vi_index()
517 vf_i = (abs_index - EFX_VI_BASE) / efx_vf_size(efx); in map_vi_index()
518 if (vf_i >= efx->vf_init_count) in map_vi_index()
524 *rel_index_out = abs_index % efx_vf_size(efx); in map_vi_index()
530 struct efx_nic *efx = vf->efx; in efx_vfdi_init_evq() local
538 if (bad_vf_index(efx, vf_evq) || in efx_vfdi_init_evq()
541 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_evq()
547 efx_siena_sriov_bufs(efx, buftbl, req->u.init_evq.addr, buf_count); in efx_vfdi_init_evq()
553 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, abs_evq); in efx_vfdi_init_evq()
558 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, abs_evq); in efx_vfdi_init_evq()
571 struct efx_nic *efx = vf->efx; in efx_vfdi_init_rxq() local
580 if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_rxq) || in efx_vfdi_init_rxq()
584 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_rxq()
592 efx_siena_sriov_bufs(efx, buftbl, req->u.init_rxq.addr, buf_count); in efx_vfdi_init_rxq()
604 efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL, in efx_vfdi_init_rxq()
612 struct efx_nic *efx = vf->efx; in efx_vfdi_init_txq() local
621 if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_txq) || in efx_vfdi_init_txq()
625 netif_err(efx, hw, efx->net_dev, in efx_vfdi_init_txq()
636 efx_siena_sriov_bufs(efx, buftbl, req->u.init_txq.addr, buf_count); in efx_vfdi_init_txq()
642 FRF_CZ_TX_DPT_Q_MASK_WIDTH, min(efx->vi_scale, 1U), in efx_vfdi_init_txq()
650 efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL, in efx_vfdi_init_txq()
678 struct efx_nic *efx = vf->efx; in efx_vfdi_fini_all_queues() local
680 unsigned count = efx_vf_size(efx); in efx_vfdi_fini_all_queues()
681 unsigned vf_offset = EFX_VI_BASE + vf->index * efx_vf_size(efx); in efx_vfdi_fini_all_queues()
691 siena_prepare_flush(efx); in efx_vfdi_fini_all_queues()
702 efx_writeo(efx, ®, FR_AZ_TX_FLUSH_DESCQ); in efx_vfdi_fini_all_queues()
714 rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, in efx_vfdi_fini_all_queues()
735 siena_finish_flush(efx); in efx_vfdi_fini_all_queues()
741 efx_writeo_table(efx, ®, FR_BZ_RX_DESC_PTR_TBL, in efx_vfdi_fini_all_queues()
743 efx_writeo_table(efx, ®, FR_BZ_TX_DESC_PTR_TBL, in efx_vfdi_fini_all_queues()
745 efx_writeo_table(efx, ®, FR_BZ_EVQ_PTR_TBL, in efx_vfdi_fini_all_queues()
747 efx_writeo_table(efx, ®, FR_BZ_TIMER_TBL, in efx_vfdi_fini_all_queues()
750 efx_siena_sriov_bufs(efx, vf->buftbl_base, NULL, in efx_vfdi_fini_all_queues()
751 EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx)); in efx_vfdi_fini_all_queues()
761 struct efx_nic *efx = vf->efx; in efx_vfdi_insert_filter() local
762 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_insert_filter()
767 if (bad_vf_index(efx, vf_rxq) || vf->rx_filtering) { in efx_vfdi_insert_filter()
769 netif_err(efx, hw, efx->net_dev, in efx_vfdi_insert_filter()
793 struct efx_nic *efx = vf->efx; in efx_vfdi_remove_all_filters() local
794 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_remove_all_filters()
805 struct efx_nic *efx = vf->efx; in efx_vfdi_set_status_page() local
806 struct siena_nic_data *nic_data = efx->nic_data; in efx_vfdi_set_status_page()
816 netif_err(efx, hw, efx->net_dev, in efx_vfdi_set_status_page()
873 struct efx_nic *efx = vf->efx; in efx_siena_sriov_vfdi() local
882 copy[0].to_rid = efx->pci_dev->devfn; in efx_siena_sriov_vfdi()
885 rc = efx_siena_sriov_memcpy(efx, copy, 1); in efx_siena_sriov_vfdi()
889 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
899 netif_dbg(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
904 netif_dbg(efx, hw, efx->net_dev, in efx_siena_sriov_vfdi()
929 (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()
1059 netif_info(efx, probe, efx->net_dev, "no SR-IOV VFs probed\n"); in efx_siena_sriov_probe()
1066 efx->vf_count = count; in efx_siena_sriov_probe()
1068 efx->extra_channel_type[EFX_EXTRA_CHANNEL_IOV] = &efx_siena_sriov_channel_type; in efx_siena_sriov_probe()
1080 struct efx_nic *efx = nic_data->efx; in efx_siena_sriov_peer_work() local
1103 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_peer_work()
1128 &efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_peer_work()
1153 dma_free_coherent(&efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_peer_work()
1159 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_peer_work()
1169 static void efx_siena_sriov_free_local(struct efx_nic *efx) in efx_siena_sriov_free_local() argument
1171 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_free_local()
1186 dma_free_coherent(&efx->pci_dev->dev, EFX_PAGE_SIZE, in efx_siena_sriov_free_local()
1192 static int efx_siena_sriov_vf_alloc(struct efx_nic *efx) in efx_siena_sriov_vf_alloc() argument
1196 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vf_alloc()
1198 nic_data->vf = kcalloc(efx->vf_count, sizeof(*nic_data->vf), in efx_siena_sriov_vf_alloc()
1203 for (index = 0; index < efx->vf_count; ++index) { in efx_siena_sriov_vf_alloc()
1206 vf->efx = efx; in efx_siena_sriov_vf_alloc()
1221 static void efx_siena_sriov_vfs_fini(struct efx_nic *efx) in efx_siena_sriov_vfs_fini() argument
1223 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vfs_fini()
1227 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_vfs_fini()
1230 efx_nic_free_buffer(efx, &vf->buf); in efx_siena_sriov_vfs_fini()
1239 static int efx_siena_sriov_vfs_init(struct efx_nic *efx) in efx_siena_sriov_vfs_init() argument
1241 struct pci_dev *pci_dev = efx->pci_dev; in efx_siena_sriov_vfs_init()
1242 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_vfs_init()
1257 for (index = 0; index < efx->vf_count; ++index) { in efx_siena_sriov_vfs_init()
1262 buftbl_base += EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx); in efx_siena_sriov_vfs_init()
1270 rc = efx_nic_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE, in efx_siena_sriov_vfs_init()
1281 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_vfs_init()
1285 int efx_siena_sriov_init(struct efx_nic *efx) in efx_siena_sriov_init() argument
1287 struct net_device *net_dev = efx->net_dev; in efx_siena_sriov_init()
1288 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_init()
1297 if (efx->vf_count == 0) in efx_siena_sriov_init()
1300 rc = efx_siena_sriov_cmd(efx, true, NULL, NULL); in efx_siena_sriov_init()
1304 rc = efx_nic_alloc_buffer(efx, &nic_data->vfdi_status, in efx_siena_sriov_init()
1313 vfdi_status->vi_scale = efx->vi_scale; in efx_siena_sriov_init()
1314 vfdi_status->rss_rxq_count = efx->rss_spread; in efx_siena_sriov_init()
1315 vfdi_status->peer_count = 1 + efx->vf_count; in efx_siena_sriov_init()
1316 vfdi_status->timer_quantum_ns = efx->timer_quantum_ns; in efx_siena_sriov_init()
1318 rc = efx_siena_sriov_vf_alloc(efx); in efx_siena_sriov_init()
1327 rc = efx_siena_sriov_vfs_init(efx); in efx_siena_sriov_init()
1333 efx->vf_init_count = efx->vf_count; in efx_siena_sriov_init()
1336 efx_siena_sriov_usrev(efx, true); in efx_siena_sriov_init()
1340 rc = pci_enable_sriov(efx->pci_dev, efx->vf_count); in efx_siena_sriov_init()
1344 netif_info(efx, probe, net_dev, in efx_siena_sriov_init()
1346 efx->vf_count, efx_vf_size(efx)); in efx_siena_sriov_init()
1350 efx_siena_sriov_usrev(efx, false); in efx_siena_sriov_init()
1352 efx->vf_init_count = 0; in efx_siena_sriov_init()
1354 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_init()
1357 efx_siena_sriov_free_local(efx); in efx_siena_sriov_init()
1360 efx_nic_free_buffer(efx, &nic_data->vfdi_status); in efx_siena_sriov_init()
1362 efx_siena_sriov_cmd(efx, false, NULL, NULL); in efx_siena_sriov_init()
1367 void efx_siena_sriov_fini(struct efx_nic *efx) in efx_siena_sriov_fini() argument
1371 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_fini()
1373 if (efx->vf_init_count == 0) in efx_siena_sriov_fini()
1378 efx_siena_sriov_usrev(efx, false); in efx_siena_sriov_fini()
1380 efx->vf_init_count = 0; in efx_siena_sriov_fini()
1384 for (pos = 0; pos < efx->vf_count; ++pos) { in efx_siena_sriov_fini()
1391 pci_disable_sriov(efx->pci_dev); in efx_siena_sriov_fini()
1394 efx_siena_sriov_vfs_fini(efx); in efx_siena_sriov_fini()
1395 efx_siena_sriov_free_local(efx); in efx_siena_sriov_fini()
1397 efx_nic_free_buffer(efx, &nic_data->vfdi_status); in efx_siena_sriov_fini()
1398 efx_siena_sriov_cmd(efx, false, NULL, NULL); in efx_siena_sriov_fini()
1403 struct efx_nic *efx = channel->efx; in efx_siena_sriov_event() local
1415 netif_vdbg(efx, hw, efx->net_dev, in efx_siena_sriov_event()
1419 if (map_vi_index(efx, qid, &vf, NULL)) in efx_siena_sriov_event()
1450 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_event()
1458 void efx_siena_sriov_flr(struct efx_nic *efx, unsigned vf_i) in efx_siena_sriov_flr() argument
1460 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_flr()
1463 if (vf_i > efx->vf_init_count) in efx_siena_sriov_flr()
1466 netif_info(efx, hw, efx->net_dev, in efx_siena_sriov_flr()
1476 int efx_siena_sriov_mac_address_changed(struct efx_nic *efx) in efx_siena_sriov_mac_address_changed() argument
1478 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_mac_address_changed()
1481 if (!efx->vf_init_count) in efx_siena_sriov_mac_address_changed()
1484 efx->net_dev->dev_addr); in efx_siena_sriov_mac_address_changed()
1490 void efx_siena_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event) in efx_siena_sriov_tx_flush_done() argument
1496 if (map_vi_index(efx, queue, &vf, &qid)) in efx_siena_sriov_tx_flush_done()
1509 void efx_siena_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event) in efx_siena_sriov_rx_flush_done() argument
1517 if (map_vi_index(efx, queue, &vf, &qid)) in efx_siena_sriov_rx_flush_done()
1534 void efx_siena_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq) in efx_siena_sriov_desc_fetch_err() argument
1539 if (map_vi_index(efx, dmaq, &vf, &rel)) in efx_siena_sriov_desc_fetch_err()
1543 netif_err(efx, hw, efx->net_dev, in efx_siena_sriov_desc_fetch_err()
1550 void efx_siena_sriov_reset(struct efx_nic *efx) in efx_siena_sriov_reset() argument
1552 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_reset()
1559 if (efx->vf_init_count == 0) in efx_siena_sriov_reset()
1562 efx_siena_sriov_usrev(efx, true); in efx_siena_sriov_reset()
1563 (void)efx_siena_sriov_cmd(efx, true, NULL, NULL); in efx_siena_sriov_reset()
1565 if (efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) in efx_siena_sriov_reset()
1568 for (vf_i = 0; vf_i < efx->vf_init_count; ++vf_i) { in efx_siena_sriov_reset()
1573 efx_nic_free_buffer(efx, &buf); in efx_siena_sriov_reset()
1593 int efx_siena_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac) in efx_siena_sriov_set_vf_mac() argument
1595 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_set_vf_mac()
1598 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_mac()
1610 int efx_siena_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, in efx_siena_sriov_set_vf_vlan() argument
1613 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_set_vf_vlan()
1617 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_vlan()
1630 int efx_siena_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf_i, in efx_siena_sriov_set_vf_spoofchk() argument
1633 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_set_vf_spoofchk()
1637 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_set_vf_spoofchk()
1654 int efx_siena_sriov_get_vf_config(struct efx_nic *efx, int vf_i, in efx_siena_sriov_get_vf_config() argument
1657 struct siena_nic_data *nic_data = efx->nic_data; in efx_siena_sriov_get_vf_config()
1661 if (vf_i >= efx->vf_init_count) in efx_siena_sriov_get_vf_config()
1677 bool efx_siena_sriov_wanted(struct efx_nic *efx) in efx_siena_sriov_wanted() argument
1679 return efx->vf_count != 0; in efx_siena_sriov_wanted()
1682 int efx_siena_sriov_configure(struct efx_nic *efx, int num_vfs) in efx_siena_sriov_configure() argument