Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: Store vf_index in nic_data for Ef10.

Added function efx_ef10_get_vf_index to store the vf_index
in nic_data during probe

vf_index is needed in future patches to access a particular
VF in the VF data structure.

Moved efx_ef10_probe_pf and efx_ef10_probe_vf in order to
used efx_ef10_remove

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shradha Shah and committed by
David S. Miller
88a37de6 862f894c

+52 -17
+51 -17
drivers/net/ethernet/sfc/ef10.c
··· 119 119 return 0; 120 120 } 121 121 122 + #ifdef CONFIG_SFC_SRIOV 123 + static int efx_ef10_get_vf_index(struct efx_nic *efx) 124 + { 125 + MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN); 126 + struct efx_ef10_nic_data *nic_data = efx->nic_data; 127 + size_t outlen; 128 + int rc; 129 + 130 + rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, 131 + sizeof(outbuf), &outlen); 132 + if (rc) 133 + return rc; 134 + if (outlen < sizeof(outbuf)) 135 + return -EIO; 136 + 137 + nic_data->vf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_VF); 138 + return 0; 139 + } 140 + #endif 141 + 122 142 static int efx_ef10_init_datapath_caps(struct efx_nic *efx) 123 143 { 124 144 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); ··· 347 327 efx->nic_data = NULL; 348 328 return rc; 349 329 } 350 - 351 - static int efx_ef10_probe_pf(struct efx_nic *efx) 352 - { 353 - return efx_ef10_probe(efx); 354 - } 355 - 356 - #ifdef CONFIG_SFC_SRIOV 357 - static int efx_ef10_probe_vf(struct efx_nic *efx) 358 - { 359 - return efx_ef10_probe(efx); 360 - } 361 - #else 362 - static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) 363 - { 364 - return 0; 365 - } 366 - #endif 367 330 368 331 static int efx_ef10_free_vis(struct efx_nic *efx) 369 332 { ··· 563 560 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); 564 561 kfree(nic_data); 565 562 } 563 + 564 + static int efx_ef10_probe_pf(struct efx_nic *efx) 565 + { 566 + return efx_ef10_probe(efx); 567 + } 568 + 569 + #ifdef CONFIG_SFC_SRIOV 570 + static int efx_ef10_probe_vf(struct efx_nic *efx) 571 + { 572 + int rc; 573 + 574 + rc = efx_ef10_probe(efx); 575 + if (rc) 576 + return rc; 577 + 578 + rc = efx_ef10_get_vf_index(efx); 579 + if (rc) 580 + goto fail; 581 + 582 + return 0; 583 + 584 + fail: 585 + efx_ef10_remove(efx); 586 + return rc; 587 + } 588 + #else 589 + static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) 590 + { 591 + return 0; 592 + } 593 + #endif 566 594 567 595 static int efx_ef10_alloc_vis(struct efx_nic *efx, 568 596 unsigned int min_vis, unsigned int max_vis)
+1
drivers/net/ethernet/sfc/nic.h
··· 525 525 bool must_probe_vswitching; 526 526 unsigned int pf_index; 527 527 #ifdef CONFIG_SFC_SRIOV 528 + unsigned int vf_index; 528 529 struct ef10_vf *vf; 529 530 #endif 530 531 u8 vport_mac[ETH_ALEN];