diff options
| author | 2020-01-10 11:24:37 -0800 | |
|---|---|---|
| committer | 2020-01-10 11:24:37 -0800 | |
| commit | 7112f8b075b4565fb81bcd472433f9f1eea3dcb8 (patch) | |
| tree | 92736655396a9f6650487cc1ac7350d0dcf35669 /drivers/net/ethernet/sfc/mcdi_functions.c | |
| parent | Merge branch 'mptcp-prereq' (diff) | |
| parent | sfc: move RPS code (diff) | |
| download | linux-dev-7112f8b075b4565fb81bcd472433f9f1eea3dcb8.tar.xz linux-dev-7112f8b075b4565fb81bcd472433f9f1eea3dcb8.zip | |
Merge branch 'sfc-even-more-code-refactoring'
Alex Maftei says:
====================
sfc: even more code refactoring
Splitting even more of the driver code into different files, which
will later be used in another driver for a new product.
This is a continuation to my previous patch series, and the one
before it.
There will be a stand-alone patch as well after this - after which
the refactoring will be concluded, for now.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/mcdi_functions.c')
| -rw-r--r-- | drivers/net/ethernet/sfc/mcdi_functions.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi_functions.c b/drivers/net/ethernet/sfc/mcdi_functions.c index f022e2b9e975..f5dad8bffc3d 100644 --- a/drivers/net/ethernet/sfc/mcdi_functions.c +++ b/drivers/net/ethernet/sfc/mcdi_functions.c @@ -347,3 +347,43 @@ fail: efx_mcdi_display_error(efx, MC_CMD_FINI_RXQ, MC_CMD_FINI_RXQ_IN_LEN, outbuf, outlen, rc); } + +int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode) +{ + switch (vi_window_mode) { + case MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_8K: + efx->vi_stride = 8192; + break; + case MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_16K: + efx->vi_stride = 16384; + break; + case MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_64K: + efx->vi_stride = 65536; + break; + default: + netif_err(efx, probe, efx->net_dev, + "Unrecognised VI window mode %d\n", + vi_window_mode); + return -EIO; + } + netif_dbg(efx, probe, efx->net_dev, "vi_stride = %u\n", + efx->vi_stride); + return 0; +} + +int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index) +{ + MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN); + size_t outlen; + int rc; + + rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, + sizeof(outbuf), &outlen); + if (rc) + return rc; + if (outlen < sizeof(outbuf)) + return -EIO; + + *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF); + return 0; +} |
