aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2013-09-05 17:50:59 -0400
committerBen Hutchings <bhutchings@solarflare.com>2013-09-11 10:29:52 -0400
commite5a2538a48309b9aac12e517782e1fa514a0f9b3 (patch)
tree79e6823aeae51d9ddebf7cd9673bf46cafd587b9 /drivers/net
parent869070c5300d1b6f0f72f5444e69fe65e34c6bde (diff)
sfc: Clean up validation of datapath capabilities
Rename efx_ef10_init_capabilities() to the more specific efx_ef10_init_datapath_caps(). Stop accepting short responses to MC_CMD_GET_CAPABILITIES; we don't need to support pre-production firmware. Move the check for RX prefix support from efx_ef10_probe() into efx_ef10_init_datapath_caps() and use consistent error messages for missing TSO support and missing RX prefix support. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/sfc/ef10.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 80a6eea49e36..a4956b86d145 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -94,7 +94,7 @@ static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx)
94 return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]); 94 return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]);
95} 95}
96 96
97static int efx_ef10_init_capabilities(struct efx_nic *efx) 97static int efx_ef10_init_datapath_caps(struct efx_nic *efx)
98{ 98{
99 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); 99 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN);
100 struct efx_ef10_nic_data *nic_data = efx->nic_data; 100 struct efx_ef10_nic_data *nic_data = efx->nic_data;
@@ -107,16 +107,27 @@ static int efx_ef10_init_capabilities(struct efx_nic *efx)
107 outbuf, sizeof(outbuf), &outlen); 107 outbuf, sizeof(outbuf), &outlen);
108 if (rc) 108 if (rc)
109 return rc; 109 return rc;
110 if (outlen < sizeof(outbuf)) {
111 netif_err(efx, drv, efx->net_dev,
112 "unable to read datapath firmware capabilities\n");
113 return -EIO;
114 }
110 115
111 if (outlen >= sizeof(outbuf)) { 116 nic_data->datapath_caps =
112 nic_data->datapath_caps = 117 MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1);
113 MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); 118
114 if (!(nic_data->datapath_caps & 119 if (!(nic_data->datapath_caps &
115 (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { 120 (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) {
116 netif_err(efx, drv, efx->net_dev, 121 netif_err(efx, drv, efx->net_dev,
117 "Capabilities don't indicate TSO support.\n"); 122 "current firmware does not support TSO\n");
118 return -ENODEV; 123 return -ENODEV;
119 } 124 }
125
126 if (!(nic_data->datapath_caps &
127 (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) {
128 netif_err(efx, probe, efx->net_dev,
129 "current firmware does not support an RX prefix\n");
130 return -ENODEV;
120 } 131 }
121 132
122 return 0; 133 return 0;
@@ -217,21 +228,13 @@ static int efx_ef10_probe(struct efx_nic *efx)
217 if (rc) 228 if (rc)
218 goto fail3; 229 goto fail3;
219 230
220 rc = efx_ef10_init_capabilities(efx); 231 rc = efx_ef10_init_datapath_caps(efx);
221 if (rc < 0) 232 if (rc < 0)
222 goto fail3; 233 goto fail3;
223 234
224 efx->rx_packet_len_offset = 235 efx->rx_packet_len_offset =
225 ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE; 236 ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE;
226 237
227 if (!(nic_data->datapath_caps &
228 (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) {
229 netif_err(efx, probe, efx->net_dev,
230 "current firmware does not support an RX prefix\n");
231 rc = -ENODEV;
232 goto fail3;
233 }
234
235 rc = efx_mcdi_port_get_number(efx); 238 rc = efx_mcdi_port_get_number(efx);
236 if (rc < 0) 239 if (rc < 0)
237 goto fail3; 240 goto fail3;