diff options
author | David S. Miller <davem@davemloft.net> | 2013-09-16 21:42:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-16 21:43:54 -0400 |
commit | 1ef68ec462571955f2a667ddf1ffe279848709d7 (patch) | |
tree | 8879bdadfaea06316cbaa0eb1583806ce45d2cc0 | |
parent | 3f96a532113131d5a65ac9e00fc83cfa31b0295f (diff) | |
parent | a915ccc9f2c80aa4c329262d89f93ea16d8792c9 (diff) |
Merge branch 'sfc-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc
Ben Hutchings says:
====================
Some bug fixes and future-proofing for the recently added SFC9120
support:
1. Minimal support for the 40G configuration.
2. Disable the incomplete PTP/hardware timestamping support.
3. Reset MAC stats properly after a firmware upgrade.
4. Re-check the datapath firmware capabilities after the controller is
reset.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/sfc/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/ef10.c | 58 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/mcdi_port.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/nic.h | 3 |
4 files changed, 43 insertions, 22 deletions
diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig index 8b7152565c5e..088921294448 100644 --- a/drivers/net/ethernet/sfc/Kconfig +++ b/drivers/net/ethernet/sfc/Kconfig | |||
@@ -7,7 +7,7 @@ config SFC | |||
7 | select I2C_ALGOBIT | 7 | select I2C_ALGOBIT |
8 | select PTP_1588_CLOCK | 8 | select PTP_1588_CLOCK |
9 | ---help--- | 9 | ---help--- |
10 | This driver supports 10-gigabit Ethernet cards based on | 10 | This driver supports 10/40-gigabit Ethernet cards based on |
11 | the Solarflare SFC4000, SFC9000-family and SFC9100-family | 11 | the Solarflare SFC4000, SFC9000-family and SFC9100-family |
12 | controllers. | 12 | controllers. |
13 | 13 | ||
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 5f42313b4965..9f18ae984f9e 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 | ||
97 | static int efx_ef10_init_capabilities(struct efx_nic *efx) | 97 | static 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; |
@@ -260,8 +263,6 @@ static int efx_ef10_probe(struct efx_nic *efx) | |||
260 | if (rc) | 263 | if (rc) |
261 | goto fail3; | 264 | goto fail3; |
262 | 265 | ||
263 | efx_ptp_probe(efx); | ||
264 | |||
265 | return 0; | 266 | return 0; |
266 | 267 | ||
267 | fail3: | 268 | fail3: |
@@ -342,6 +343,13 @@ static int efx_ef10_init_nic(struct efx_nic *efx) | |||
342 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 343 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
343 | int rc; | 344 | int rc; |
344 | 345 | ||
346 | if (nic_data->must_check_datapath_caps) { | ||
347 | rc = efx_ef10_init_datapath_caps(efx); | ||
348 | if (rc) | ||
349 | return rc; | ||
350 | nic_data->must_check_datapath_caps = false; | ||
351 | } | ||
352 | |||
345 | if (nic_data->must_realloc_vis) { | 353 | if (nic_data->must_realloc_vis) { |
346 | /* We cannot let the number of VIs change now */ | 354 | /* We cannot let the number of VIs change now */ |
347 | rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, | 355 | rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, |
@@ -710,6 +718,14 @@ static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) | |||
710 | nic_data->must_restore_filters = true; | 718 | nic_data->must_restore_filters = true; |
711 | nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; | 719 | nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; |
712 | 720 | ||
721 | /* The datapath firmware might have been changed */ | ||
722 | nic_data->must_check_datapath_caps = true; | ||
723 | |||
724 | /* MAC statistics have been cleared on the NIC; clear the local | ||
725 | * statistic that we update with efx_update_diff_stat(). | ||
726 | */ | ||
727 | nic_data->stats[EF10_STAT_rx_bad_bytes] = 0; | ||
728 | |||
713 | return -EIO; | 729 | return -EIO; |
714 | } | 730 | } |
715 | 731 | ||
diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/mcdi_port.c index 8d33da6697fb..7b6be61d549f 100644 --- a/drivers/net/ethernet/sfc/mcdi_port.c +++ b/drivers/net/ethernet/sfc/mcdi_port.c | |||
@@ -556,6 +556,7 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec | |||
556 | case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break; | 556 | case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break; |
557 | case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break; | 557 | case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break; |
558 | case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break; | 558 | case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break; |
559 | case 40000: caps = 1 << MC_CMD_PHY_CAP_40000FDX_LBN; break; | ||
559 | default: return -EINVAL; | 560 | default: return -EINVAL; |
560 | } | 561 | } |
561 | } else { | 562 | } else { |
@@ -841,6 +842,7 @@ static unsigned int efx_mcdi_event_link_speed[] = { | |||
841 | [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, | 842 | [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, |
842 | [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, | 843 | [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, |
843 | [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, | 844 | [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, |
845 | [MCDI_EVENT_LINKCHANGE_SPEED_40G] = 40000, | ||
844 | }; | 846 | }; |
845 | 847 | ||
846 | void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) | 848 | void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 4b1e188f7a2f..fda29d39032f 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -400,6 +400,8 @@ enum { | |||
400 | * @rx_rss_context: Firmware handle for our RSS context | 400 | * @rx_rss_context: Firmware handle for our RSS context |
401 | * @stats: Hardware statistics | 401 | * @stats: Hardware statistics |
402 | * @workaround_35388: Flag: firmware supports workaround for bug 35388 | 402 | * @workaround_35388: Flag: firmware supports workaround for bug 35388 |
403 | * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated | ||
404 | * after MC reboot | ||
403 | * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of | 405 | * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of |
404 | * %MC_CMD_GET_CAPABILITIES response) | 406 | * %MC_CMD_GET_CAPABILITIES response) |
405 | */ | 407 | */ |
@@ -413,6 +415,7 @@ struct efx_ef10_nic_data { | |||
413 | u32 rx_rss_context; | 415 | u32 rx_rss_context; |
414 | u64 stats[EF10_STAT_COUNT]; | 416 | u64 stats[EF10_STAT_COUNT]; |
415 | bool workaround_35388; | 417 | bool workaround_35388; |
418 | bool must_check_datapath_caps; | ||
416 | u32 datapath_caps; | 419 | u32 datapath_caps; |
417 | }; | 420 | }; |
418 | 421 | ||