• Home
  • Raw
  • Download

Lines Matching refs:efx

15 static int efx_ef10_evb_port_assign(struct efx_nic *efx, unsigned int port_id,  in efx_ef10_evb_port_assign()  argument
19 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_evb_port_assign()
26 return efx_mcdi_rpc(efx, MC_CMD_EVB_PORT_ASSIGN, inbuf, sizeof(inbuf), in efx_ef10_evb_port_assign()
30 static int efx_ef10_vswitch_alloc(struct efx_nic *efx, unsigned int port_id, in efx_ef10_vswitch_alloc() argument
43 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VSWITCH_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_vswitch_alloc()
49 rc = efx_mcdi_rpc(efx, MC_CMD_VSWITCH_ALLOC, inbuf, in efx_ef10_vswitch_alloc()
52 efx_mcdi_display_error(efx, MC_CMD_VSWITCH_ALLOC, in efx_ef10_vswitch_alloc()
59 static int efx_ef10_vswitch_free(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vswitch_free() argument
65 return efx_mcdi_rpc(efx, MC_CMD_VSWITCH_FREE, inbuf, sizeof(inbuf), in efx_ef10_vswitch_free()
69 static int efx_ef10_vport_alloc(struct efx_nic *efx, in efx_ef10_vport_alloc() argument
92 rc = efx_mcdi_rpc(efx, MC_CMD_VPORT_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_vport_alloc()
103 static int efx_ef10_vport_free(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vport_free() argument
109 return efx_mcdi_rpc(efx, MC_CMD_VPORT_FREE, inbuf, sizeof(inbuf), in efx_ef10_vport_free()
113 static void efx_ef10_sriov_free_vf_vports(struct efx_nic *efx) in efx_ef10_sriov_free_vf_vports() argument
115 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_free_vf_vports()
121 for (i = 0; i < efx->vf_count; i++) { in efx_ef10_sriov_free_vf_vports()
130 efx_ef10_evb_port_assign(efx, EVB_PORT_ID_NULL, i); in efx_ef10_sriov_free_vf_vports()
135 efx_ef10_vport_del_mac(efx, vf->vport_id, vf->mac); in efx_ef10_sriov_free_vf_vports()
140 efx_ef10_vport_free(efx, vf->vport_id); in efx_ef10_sriov_free_vf_vports()
144 vf->efx = NULL; in efx_ef10_sriov_free_vf_vports()
148 static void efx_ef10_sriov_free_vf_vswitching(struct efx_nic *efx) in efx_ef10_sriov_free_vf_vswitching() argument
150 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_free_vf_vswitching()
152 efx_ef10_sriov_free_vf_vports(efx); in efx_ef10_sriov_free_vf_vswitching()
157 static int efx_ef10_sriov_assign_vf_vport(struct efx_nic *efx, in efx_ef10_sriov_assign_vf_vport() argument
160 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_assign_vf_vport()
167 rc = efx_ef10_vport_alloc(efx, EVB_PORT_ID_ASSIGNED, in efx_ef10_sriov_assign_vf_vport()
173 rc = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac); in efx_ef10_sriov_assign_vf_vport()
179 rc = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); in efx_ef10_sriov_assign_vf_vport()
187 static int efx_ef10_sriov_alloc_vf_vswitching(struct efx_nic *efx) in efx_ef10_sriov_alloc_vf_vswitching() argument
189 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_alloc_vf_vswitching()
193 nic_data->vf = kcalloc(efx->vf_count, sizeof(struct ef10_vf), in efx_ef10_sriov_alloc_vf_vswitching()
198 for (i = 0; i < efx->vf_count; i++) { in efx_ef10_sriov_alloc_vf_vswitching()
200 nic_data->vf[i].efx = NULL; in efx_ef10_sriov_alloc_vf_vswitching()
203 rc = efx_ef10_sriov_assign_vf_vport(efx, i); in efx_ef10_sriov_alloc_vf_vswitching()
210 efx_ef10_sriov_free_vf_vports(efx); in efx_ef10_sriov_alloc_vf_vswitching()
216 static int efx_ef10_sriov_restore_vf_vswitching(struct efx_nic *efx) in efx_ef10_sriov_restore_vf_vswitching() argument
221 for (i = 0; i < efx->vf_count; i++) { in efx_ef10_sriov_restore_vf_vswitching()
222 rc = efx_ef10_sriov_assign_vf_vport(efx, i); in efx_ef10_sriov_restore_vf_vswitching()
229 efx_ef10_sriov_free_vf_vswitching(efx); in efx_ef10_sriov_restore_vf_vswitching()
233 static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx) in efx_ef10_vadaptor_alloc_set_features() argument
238 rc = efx_ef10_vadaptor_alloc(efx, efx->vport_id); in efx_ef10_vadaptor_alloc_set_features()
242 rc = efx_ef10_vadaptor_query(efx, efx->vport_id, in efx_ef10_vadaptor_alloc_set_features()
249 efx->fixed_features |= NETIF_F_HW_VLAN_CTAG_FILTER; in efx_ef10_vadaptor_alloc_set_features()
251 efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; in efx_ef10_vadaptor_alloc_set_features()
256 efx_ef10_vadaptor_free(efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_vadaptor_alloc_set_features()
264 int efx_ef10_vswitching_probe_pf(struct efx_nic *efx) in efx_ef10_vswitching_probe_pf() argument
266 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vswitching_probe_pf()
267 struct net_device *net_dev = efx->net_dev; in efx_ef10_vswitching_probe_pf()
270 if (pci_sriov_get_totalvfs(efx->pci_dev) <= 0) { in efx_ef10_vswitching_probe_pf()
272 efx_ef10_vadaptor_alloc_set_features(efx); in efx_ef10_vswitching_probe_pf()
276 rc = efx_ef10_vswitch_alloc(efx, EVB_PORT_ID_ASSIGNED, in efx_ef10_vswitching_probe_pf()
281 rc = efx_ef10_vport_alloc(efx, EVB_PORT_ID_ASSIGNED, in efx_ef10_vswitching_probe_pf()
283 EFX_EF10_NO_VLAN, &efx->vport_id); in efx_ef10_vswitching_probe_pf()
287 rc = efx_ef10_vport_add_mac(efx, efx->vport_id, net_dev->dev_addr); in efx_ef10_vswitching_probe_pf()
292 rc = efx_ef10_vadaptor_alloc_set_features(efx); in efx_ef10_vswitching_probe_pf()
298 efx_ef10_vport_del_mac(efx, efx->vport_id, nic_data->vport_mac); in efx_ef10_vswitching_probe_pf()
301 efx_ef10_vport_free(efx, efx->vport_id); in efx_ef10_vswitching_probe_pf()
302 efx->vport_id = EVB_PORT_ID_ASSIGNED; in efx_ef10_vswitching_probe_pf()
304 efx_ef10_vswitch_free(efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_vswitching_probe_pf()
309 int efx_ef10_vswitching_probe_vf(struct efx_nic *efx) in efx_ef10_vswitching_probe_vf() argument
311 return efx_ef10_vadaptor_alloc_set_features(efx); in efx_ef10_vswitching_probe_vf()
314 int efx_ef10_vswitching_restore_pf(struct efx_nic *efx) in efx_ef10_vswitching_restore_pf() argument
316 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vswitching_restore_pf()
322 rc = efx_ef10_vswitching_probe_pf(efx); in efx_ef10_vswitching_restore_pf()
326 rc = efx_ef10_sriov_restore_vf_vswitching(efx); in efx_ef10_vswitching_restore_pf()
335 int efx_ef10_vswitching_restore_vf(struct efx_nic *efx) in efx_ef10_vswitching_restore_vf() argument
337 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vswitching_restore_vf()
343 rc = efx_ef10_vadaptor_free(efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_vswitching_restore_vf()
351 void efx_ef10_vswitching_remove_pf(struct efx_nic *efx) in efx_ef10_vswitching_remove_pf() argument
353 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vswitching_remove_pf()
355 efx_ef10_sriov_free_vf_vswitching(efx); in efx_ef10_vswitching_remove_pf()
357 efx_ef10_vadaptor_free(efx, efx->vport_id); in efx_ef10_vswitching_remove_pf()
359 if (efx->vport_id == EVB_PORT_ID_ASSIGNED) in efx_ef10_vswitching_remove_pf()
363 efx_ef10_vport_del_mac(efx, efx->vport_id, in efx_ef10_vswitching_remove_pf()
364 efx->net_dev->dev_addr); in efx_ef10_vswitching_remove_pf()
367 efx_ef10_vport_free(efx, efx->vport_id); in efx_ef10_vswitching_remove_pf()
368 efx->vport_id = EVB_PORT_ID_ASSIGNED; in efx_ef10_vswitching_remove_pf()
371 if (!pci_vfs_assigned(efx->pci_dev)) in efx_ef10_vswitching_remove_pf()
372 efx_ef10_vswitch_free(efx, efx->vport_id); in efx_ef10_vswitching_remove_pf()
375 void efx_ef10_vswitching_remove_vf(struct efx_nic *efx) in efx_ef10_vswitching_remove_vf() argument
377 efx_ef10_vadaptor_free(efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_vswitching_remove_vf()
380 static int efx_ef10_pci_sriov_enable(struct efx_nic *efx, int num_vfs) in efx_ef10_pci_sriov_enable() argument
383 struct pci_dev *dev = efx->pci_dev; in efx_ef10_pci_sriov_enable()
385 efx->vf_count = num_vfs; in efx_ef10_pci_sriov_enable()
387 rc = efx_ef10_sriov_alloc_vf_vswitching(efx); in efx_ef10_pci_sriov_enable()
397 efx_ef10_sriov_free_vf_vswitching(efx); in efx_ef10_pci_sriov_enable()
399 efx->vf_count = 0; in efx_ef10_pci_sriov_enable()
400 netif_err(efx, probe, efx->net_dev, in efx_ef10_pci_sriov_enable()
411 static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force) in efx_ef10_pci_sriov_disable() argument
413 struct pci_dev *dev = efx->pci_dev; in efx_ef10_pci_sriov_disable()
414 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_pci_sriov_disable()
419 netif_info(efx, drv, efx->net_dev, "VFs are assigned to guests; " in efx_ef10_pci_sriov_disable()
425 for (i = 0; i < efx->vf_count; i++) in efx_ef10_pci_sriov_disable()
432 efx_ef10_sriov_free_vf_vswitching(efx); in efx_ef10_pci_sriov_disable()
433 efx->vf_count = 0; in efx_ef10_pci_sriov_disable()
437 int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs) in efx_ef10_sriov_configure() argument
440 return efx_ef10_pci_sriov_disable(efx, false); in efx_ef10_sriov_configure()
442 return efx_ef10_pci_sriov_enable(efx, num_vfs); in efx_ef10_sriov_configure()
445 int efx_ef10_sriov_init(struct efx_nic *efx) in efx_ef10_sriov_init() argument
450 void efx_ef10_sriov_fini(struct efx_nic *efx) in efx_ef10_sriov_fini() argument
452 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_fini()
457 if (pci_num_vf(efx->pci_dev) && !pci_vfs_assigned(efx->pci_dev)) in efx_ef10_sriov_fini()
458 pci_disable_sriov(efx->pci_dev); in efx_ef10_sriov_fini()
463 rc = efx_ef10_pci_sriov_disable(efx, true); in efx_ef10_sriov_fini()
465 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_sriov_fini()
468 netif_dbg(efx, drv, efx->net_dev, "SRIOV disabled\n"); in efx_ef10_sriov_fini()
471 static int efx_ef10_vport_del_vf_mac(struct efx_nic *efx, unsigned int port_id, in efx_ef10_vport_del_vf_mac() argument
482 rc = efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, in efx_ef10_vport_del_vf_mac()
488 int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac) in efx_ef10_sriov_set_vf_mac() argument
490 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_set_vf_mac()
497 if (vf_i >= efx->vf_count) in efx_ef10_sriov_set_vf_mac()
501 if (vf->efx) { in efx_ef10_sriov_set_vf_mac()
502 efx_device_detach_sync(vf->efx); in efx_ef10_sriov_set_vf_mac()
503 efx_net_stop(vf->efx->net_dev); in efx_ef10_sriov_set_vf_mac()
505 down_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_mac()
506 vf->efx->type->filter_table_remove(vf->efx); in efx_ef10_sriov_set_vf_mac()
508 rc = efx_ef10_vadaptor_free(vf->efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_sriov_set_vf_mac()
510 up_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_mac()
515 rc = efx_ef10_evb_port_assign(efx, EVB_PORT_ID_NULL, vf_i); in efx_ef10_sriov_set_vf_mac()
520 rc = efx_ef10_vport_del_vf_mac(efx, vf->vport_id, vf->mac); in efx_ef10_sriov_set_vf_mac()
526 rc = efx_ef10_vport_add_mac(efx, vf->vport_id, mac); in efx_ef10_sriov_set_vf_mac()
530 if (vf->efx) in efx_ef10_sriov_set_vf_mac()
531 ether_addr_copy(vf->efx->net_dev->dev_addr, mac); in efx_ef10_sriov_set_vf_mac()
536 rc = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); in efx_ef10_sriov_set_vf_mac()
540 if (vf->efx) { in efx_ef10_sriov_set_vf_mac()
542 rc = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_sriov_set_vf_mac()
544 up_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_mac()
547 vf->efx->type->filter_table_probe(vf->efx); in efx_ef10_sriov_set_vf_mac()
548 up_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_mac()
549 efx_net_open(vf->efx->net_dev); in efx_ef10_sriov_set_vf_mac()
550 efx_device_attach_if_not_resetting(vf->efx); in efx_ef10_sriov_set_vf_mac()
560 int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan, in efx_ef10_sriov_set_vf_vlan() argument
563 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_set_vf_vlan()
568 if (vf_i >= efx->vf_count) in efx_ef10_sriov_set_vf_vlan()
579 if (vf->efx) { in efx_ef10_sriov_set_vf_vlan()
580 efx_device_detach_sync(vf->efx); in efx_ef10_sriov_set_vf_vlan()
581 efx_net_stop(vf->efx->net_dev); in efx_ef10_sriov_set_vf_vlan()
583 mutex_lock(&vf->efx->mac_lock); in efx_ef10_sriov_set_vf_vlan()
584 down_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_vlan()
585 vf->efx->type->filter_table_remove(vf->efx); in efx_ef10_sriov_set_vf_vlan()
587 rc = efx_ef10_vadaptor_free(vf->efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_sriov_set_vf_vlan()
593 rc = efx_ef10_evb_port_assign(efx, EVB_PORT_ID_NULL, vf_i); in efx_ef10_sriov_set_vf_vlan()
595 netif_warn(efx, drv, efx->net_dev, in efx_ef10_sriov_set_vf_vlan()
597 netif_warn(efx, drv, efx->net_dev, in efx_ef10_sriov_set_vf_vlan()
599 netif_warn(efx, drv, efx->net_dev, in efx_ef10_sriov_set_vf_vlan()
607 rc = efx_ef10_vport_del_mac(efx, vf->vport_id, vf->mac); in efx_ef10_sriov_set_vf_vlan()
613 rc = efx_ef10_vport_free(efx, vf->vport_id); in efx_ef10_sriov_set_vf_vlan()
623 rc = efx_ef10_vport_alloc(efx, EVB_PORT_ID_ASSIGNED, in efx_ef10_sriov_set_vf_vlan()
631 rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac); in efx_ef10_sriov_set_vf_vlan()
639 rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); in efx_ef10_sriov_set_vf_vlan()
646 if (vf->efx) { in efx_ef10_sriov_set_vf_vlan()
647 rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED); in efx_ef10_sriov_set_vf_vlan()
653 if (vf->efx) { in efx_ef10_sriov_set_vf_vlan()
654 rc2 = vf->efx->type->filter_table_probe(vf->efx); in efx_ef10_sriov_set_vf_vlan()
658 up_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_vlan()
659 mutex_unlock(&vf->efx->mac_lock); in efx_ef10_sriov_set_vf_vlan()
661 rc2 = efx_net_open(vf->efx->net_dev); in efx_ef10_sriov_set_vf_vlan()
665 efx_device_attach_if_not_resetting(vf->efx); in efx_ef10_sriov_set_vf_vlan()
670 if (vf->efx) { in efx_ef10_sriov_set_vf_vlan()
671 up_write(&vf->efx->filter_sem); in efx_ef10_sriov_set_vf_vlan()
672 mutex_unlock(&vf->efx->mac_lock); in efx_ef10_sriov_set_vf_vlan()
675 if (vf->efx) { in efx_ef10_sriov_set_vf_vlan()
676 netif_err(efx, drv, efx->net_dev, in efx_ef10_sriov_set_vf_vlan()
678 efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH); in efx_ef10_sriov_set_vf_vlan()
680 netif_err(efx, drv, efx->net_dev, in efx_ef10_sriov_set_vf_vlan()
683 netif_err(efx, drv, efx->net_dev, in efx_ef10_sriov_set_vf_vlan()
690 static int efx_ef10_sriov_set_privilege_mask(struct efx_nic *efx, int vf_i, in efx_ef10_sriov_set_privilege_mask() argument
695 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_set_privilege_mask()
707 rc = efx_mcdi_rpc(efx, MC_CMD_PRIVILEGE_MASK, in efx_ef10_sriov_set_privilege_mask()
729 rc = efx_mcdi_rpc(efx, MC_CMD_PRIVILEGE_MASK, in efx_ef10_sriov_set_privilege_mask()
741 int efx_ef10_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf_i, bool spoofchk) in efx_ef10_sriov_set_vf_spoofchk() argument
743 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_set_vf_spoofchk()
751 return efx_ef10_sriov_set_privilege_mask(efx, vf_i, in efx_ef10_sriov_set_vf_spoofchk()
756 int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i, in efx_ef10_sriov_set_vf_link_state() argument
760 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_set_vf_link_state()
773 return efx_mcdi_rpc(efx, MC_CMD_LINK_STATE_MODE, inbuf, sizeof(inbuf), in efx_ef10_sriov_set_vf_link_state()
777 int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i, in efx_ef10_sriov_get_vf_config() argument
783 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_sriov_get_vf_config()
788 if (vf_i >= efx->vf_count) in efx_ef10_sriov_get_vf_config()
809 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_STATE_MODE, inbuf, sizeof(inbuf), in efx_ef10_sriov_get_vf_config()