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

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>

+43 -22
+1 -1
drivers/net/ethernet/sfc/Kconfig
··· 7 7 select I2C_ALGOBIT 8 8 select PTP_1588_CLOCK 9 9 ---help--- 10 - This driver supports 10-gigabit Ethernet cards based on 10 + This driver supports 10/40-gigabit Ethernet cards based on 11 11 the Solarflare SFC4000, SFC9000-family and SFC9100-family 12 12 controllers. 13 13
+37 -21
drivers/net/ethernet/sfc/ef10.c
··· 94 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 99 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); 100 100 struct efx_ef10_nic_data *nic_data = efx->nic_data; ··· 107 107 outbuf, sizeof(outbuf), &outlen); 108 108 if (rc) 109 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)) { 112 - nic_data->datapath_caps = 113 - MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); 114 - if (!(nic_data->datapath_caps & 115 - (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { 116 - netif_err(efx, drv, efx->net_dev, 117 - "Capabilities don't indicate TSO support.\n"); 118 - return -ENODEV; 119 - } 116 + nic_data->datapath_caps = 117 + MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); 118 + 119 + if (!(nic_data->datapath_caps & 120 + (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { 121 + netif_err(efx, drv, efx->net_dev, 122 + "current firmware does not support TSO\n"); 123 + return -ENODEV; 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 133 return 0; ··· 228 217 if (rc) 229 218 goto fail3; 230 219 231 - rc = efx_ef10_init_capabilities(efx); 220 + rc = efx_ef10_init_datapath_caps(efx); 232 221 if (rc < 0) 233 222 goto fail3; 234 223 235 224 efx->rx_packet_len_offset = 236 225 ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE; 237 - 238 - if (!(nic_data->datapath_caps & 239 - (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) { 240 - netif_err(efx, probe, efx->net_dev, 241 - "current firmware does not support an RX prefix\n"); 242 - rc = -ENODEV; 243 - goto fail3; 244 - } 245 226 246 227 rc = efx_mcdi_port_get_number(efx); 247 228 if (rc < 0) ··· 262 259 rc = efx_mcdi_mon_probe(efx); 263 260 if (rc) 264 261 goto fail3; 265 - 266 - efx_ptp_probe(efx); 267 262 268 263 return 0; 269 264 ··· 342 341 { 343 342 struct efx_ef10_nic_data *nic_data = efx->nic_data; 344 343 int rc; 344 + 345 + if (nic_data->must_check_datapath_caps) { 346 + rc = efx_ef10_init_datapath_caps(efx); 347 + if (rc) 348 + return rc; 349 + nic_data->must_check_datapath_caps = false; 350 + } 345 351 346 352 if (nic_data->must_realloc_vis) { 347 353 /* We cannot let the number of VIs change now */ ··· 717 709 nic_data->must_realloc_vis = true; 718 710 nic_data->must_restore_filters = true; 719 711 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; 712 + 713 + /* The datapath firmware might have been changed */ 714 + nic_data->must_check_datapath_caps = true; 715 + 716 + /* MAC statistics have been cleared on the NIC; clear the local 717 + * statistic that we update with efx_update_diff_stat(). 718 + */ 719 + nic_data->stats[EF10_STAT_rx_bad_bytes] = 0; 720 720 721 721 return -EIO; 722 722 }
+2
drivers/net/ethernet/sfc/mcdi_port.c
··· 556 556 case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break; 557 557 case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break; 558 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 560 default: return -EINVAL; 560 561 } 561 562 } else { ··· 842 841 [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, 843 842 [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, 844 843 [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, 844 + [MCDI_EVENT_LINKCHANGE_SPEED_40G] = 40000, 845 845 }; 846 846 847 847 void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev)
+3
drivers/net/ethernet/sfc/nic.h
··· 400 400 * @rx_rss_context: Firmware handle for our RSS context 401 401 * @stats: Hardware statistics 402 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 405 * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of 404 406 * %MC_CMD_GET_CAPABILITIES response) 405 407 */ ··· 415 413 u32 rx_rss_context; 416 414 u64 stats[EF10_STAT_COUNT]; 417 415 bool workaround_35388; 416 + bool must_check_datapath_caps; 418 417 u32 datapath_caps; 419 418 }; 420 419