Commit 8d9f9dd4 authored by Daniel Pieczko's avatar Daniel Pieczko Committed by David S. Miller

sfc: Record [rt]x_dpcpu_fw_id in EF10 nic_data

The (future) code to add/remove vswitches and vports will be
dependent on the firmware variant.
To simplify the checking of the firmware variant, record
values for rx_dpcpu_fw_id and tx_dpcpu_fw_id in EF10 nic_data.

There was only one place where this was previously used:
efx_mcdi_print_fwver() in ethtool.c.
The MC_CMD_GET_CAPABILITIES can be replaced and the values from
nic_data used instead.

Note that the printing of "?" if the MC command fails or if the
outlength is incorrect no longer apply, because errors are returned
in efx_ef10_init_datapath_caps() in both of these cases.
Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e3d36293
...@@ -118,6 +118,13 @@ static int efx_ef10_init_datapath_caps(struct efx_nic *efx) ...@@ -118,6 +118,13 @@ static int efx_ef10_init_datapath_caps(struct efx_nic *efx)
nic_data->datapath_caps = nic_data->datapath_caps =
MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1);
/* record the DPCPU firmware IDs to determine VEB vswitching support.
*/
nic_data->rx_dpcpu_fw_id =
MCDI_WORD(outbuf, GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID);
nic_data->tx_dpcpu_fw_id =
MCDI_WORD(outbuf, GET_CAPABILITIES_OUT_TX_DPCPU_FW_ID);
if (!(nic_data->datapath_caps & if (!(nic_data->datapath_caps &
(1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) {
netif_err(efx, drv, efx->net_dev, netif_err(efx, drv, efx->net_dev,
......
...@@ -1083,9 +1083,7 @@ void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -1083,9 +1083,7 @@ void efx_mcdi_process_event(struct efx_channel *channel,
void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
{ {
MCDI_DECLARE_BUF(outbuf, MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_VERSION_OUT_LEN);
max(MC_CMD_GET_VERSION_OUT_LEN,
MC_CMD_GET_CAPABILITIES_OUT_LEN));
size_t outlength; size_t outlength;
const __le16 *ver_words; const __le16 *ver_words;
size_t offset; size_t offset;
...@@ -1110,19 +1108,11 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) ...@@ -1110,19 +1108,11 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
* single version. Report which variants are running. * single version. Report which variants are running.
*/ */
if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0) { if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0) {
BUILD_BUG_ON(MC_CMD_GET_CAPABILITIES_IN_LEN != 0); struct efx_ef10_nic_data *nic_data = efx->nic_data;
rc = efx_mcdi_rpc(efx, MC_CMD_GET_CAPABILITIES, NULL, 0,
outbuf, sizeof(outbuf), &outlength); offset += snprintf(buf + offset, len - offset, " rx%x tx%x",
if (rc || outlength < MC_CMD_GET_CAPABILITIES_OUT_LEN) nic_data->rx_dpcpu_fw_id,
offset += snprintf( nic_data->tx_dpcpu_fw_id);
buf + offset, len - offset, " rx? tx?");
else
offset += snprintf(
buf + offset, len - offset, " rx%x tx%x",
MCDI_WORD(outbuf,
GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID),
MCDI_WORD(outbuf,
GET_CAPABILITIES_OUT_TX_DPCPU_FW_ID));
/* It's theoretically possible for the string to exceed 31 /* It's theoretically possible for the string to exceed 31
* characters, though in practice the first three version * characters, though in practice the first three version
......
...@@ -491,6 +491,8 @@ enum { ...@@ -491,6 +491,8 @@ enum {
* after MC reboot * after MC reboot
* @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of
* %MC_CMD_GET_CAPABILITIES response) * %MC_CMD_GET_CAPABILITIES response)
* @rx_dpcpu_fw_id: Firmware ID of the RxDPCPU
* @tx_dpcpu_fw_id: Firmware ID of the TxDPCPU
*/ */
struct efx_ef10_nic_data { struct efx_ef10_nic_data {
struct efx_buffer mcdi_buf; struct efx_buffer mcdi_buf;
...@@ -509,6 +511,8 @@ struct efx_ef10_nic_data { ...@@ -509,6 +511,8 @@ struct efx_ef10_nic_data {
bool workaround_35388; bool workaround_35388;
bool must_check_datapath_caps; bool must_check_datapath_caps;
u32 datapath_caps; u32 datapath_caps;
unsigned int rx_dpcpu_fw_id;
unsigned int tx_dpcpu_fw_id;
}; };
int efx_init_sriov(void); int efx_init_sriov(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment