* [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors
@ 2015-05-12 12:03 Edward Cree
2015-05-12 12:04 ` [PATCH net-next 1/2] sfc: nicer log message on PTP probe fail Edward Cree
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Edward Cree @ 2015-05-12 12:03 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
When the NIC doesn't support PTP, probe-time MCDI commands fail in
predictable ways. Instead of logging cryptic MCDI errors, just log that
PTP isn't supported.
v2: Hopefully stop Thunderbird mangling the patches.
Edward Cree (2):
sfc: nicer log message on PTP probe fail
sfc: suppress some MCDI error messages in PTP
drivers/net/ethernet/sfc/ptp.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH net-next 1/2] sfc: nicer log message on PTP probe fail 2015-05-12 12:03 [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors Edward Cree @ 2015-05-12 12:04 ` Edward Cree 2015-05-12 12:05 ` [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP Edward Cree 2015-05-13 19:12 ` [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors David Miller 2 siblings, 0 replies; 5+ messages in thread From: Edward Cree @ 2015-05-12 12:04 UTC (permalink / raw) To: David Miller; +Cc: netdev, linux-net-drivers Signed-off-by: Edward Cree <ecree@solarflare.com> --- drivers/net/ethernet/sfc/ptp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index a2e9aee..8c5c96a 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -604,7 +604,12 @@ static int efx_ptp_disable(struct efx_nic *efx) rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf), NULL); rc = (rc == -EALREADY) ? 0 : rc; - if (rc) + /* If we get ENOSYS, the NIC doesn't support PTP, and thus this function + * should only have been called during probe. + */ + if (rc == -ENOSYS || rc == -EPERM) + netif_info(efx, probe, efx->net_dev, "no PTP support\n"); + else if (rc) efx_mcdi_display_error(efx, MC_CMD_PTP, MC_CMD_PTP_IN_DISABLE_LEN, outbuf, sizeof(outbuf), rc); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP 2015-05-12 12:03 [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors Edward Cree 2015-05-12 12:04 ` [PATCH net-next 1/2] sfc: nicer log message on PTP probe fail Edward Cree @ 2015-05-12 12:05 ` Edward Cree 2015-05-13 19:12 ` [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors David Miller 2 siblings, 0 replies; 5+ messages in thread From: Edward Cree @ 2015-05-12 12:05 UTC (permalink / raw) To: David Miller; +Cc: netdev, linux-net-drivers Also, remove a needless netif_err() from efx_ptp_update_stats() - if the MCDI fails it'll print its own error message, we don't need another that adds no information. Signed-off-by: Edward Cree <ecree@solarflare.com> --- drivers/net/ethernet/sfc/ptp.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 8c5c96a..5578c54 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -389,11 +389,8 @@ size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats) MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf), NULL); - if (rc) { - netif_err(efx, hw, efx->net_dev, - "MC_CMD_PTP_OP_STATUS failed (%d)\n", rc); + if (rc) memset(outbuf, 0, sizeof(outbuf)); - } efx_nic_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, efx_ptp_stat_mask, stats, _MCDI_PTR(outbuf, 0), false); @@ -490,14 +487,20 @@ static int efx_ptp_get_attributes(struct efx_nic *efx) */ MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_GET_ATTRIBUTES); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &out_len); - if (rc == 0) + rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &out_len); + if (rc == 0) { fmt = MCDI_DWORD(outbuf, PTP_OUT_GET_ATTRIBUTES_TIME_FORMAT); - else if (rc == -EINVAL) + } else if (rc == -EINVAL) { fmt = MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS; - else + } else if (rc == -EPERM) { + netif_info(efx, probe, efx->net_dev, "no PTP support\n"); return rc; + } else { + efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), + outbuf, sizeof(outbuf), rc); + return rc; + } if (fmt == MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_27FRACTION) { ptp->ns_to_nic_time = efx_ptp_ns_to_s27; @@ -541,8 +544,8 @@ static int efx_ptp_get_timestamp_corrections(struct efx_nic *efx) MC_CMD_PTP_OP_GET_TIMESTAMP_CORRECTIONS); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); if (rc == 0) { efx->ptp_data->ts_corrections.tx = MCDI_DWORD(outbuf, PTP_OUT_GET_TIMESTAMP_CORRECTIONS_TRANSMIT); @@ -558,6 +561,8 @@ static int efx_ptp_get_timestamp_corrections(struct efx_nic *efx) efx->ptp_data->ts_corrections.pps_out = 0; efx->ptp_data->ts_corrections.pps_in = 0; } else { + efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), outbuf, + sizeof(outbuf), rc); return rc; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors 2015-05-12 12:03 [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors Edward Cree 2015-05-12 12:04 ` [PATCH net-next 1/2] sfc: nicer log message on PTP probe fail Edward Cree 2015-05-12 12:05 ` [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP Edward Cree @ 2015-05-13 19:12 ` David Miller 2 siblings, 0 replies; 5+ messages in thread From: David Miller @ 2015-05-13 19:12 UTC (permalink / raw) To: ecree; +Cc: netdev, linux-net-drivers From: Edward Cree <ecree@solarflare.com> Date: Tue, 12 May 2015 13:03:27 +0100 > When the NIC doesn't support PTP, probe-time MCDI commands fail in > predictable ways. Instead of logging cryptic MCDI errors, just log that > PTP isn't supported. > > v2: Hopefully stop Thunderbird mangling the patches. Series applied, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 0/2] Bowdlerise PTP MCDI errors @ 2015-05-11 12:19 Edward Cree 2015-05-11 12:20 ` [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP Edward Cree 0 siblings, 1 reply; 5+ messages in thread From: Edward Cree @ 2015-05-11 12:19 UTC (permalink / raw) To: David Miller; +Cc: netdev, linux-net-drivers When the NIC doesn't support PTP, probe-time MCDI commands fail in predictable ways. Instead of logging cryptic MCDI errors, just log that PTP isn't supported. Edward Cree (2): sfc: nicer log message on PTP probe fail sfc: suppress some MCDI error messages in PTP drivers/net/ethernet/sfc/ptp.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP 2015-05-11 12:19 [PATCH net-next 0/2] " Edward Cree @ 2015-05-11 12:20 ` Edward Cree 0 siblings, 0 replies; 5+ messages in thread From: Edward Cree @ 2015-05-11 12:20 UTC (permalink / raw) To: David Miller; +Cc: netdev, linux-net-drivers Also, remove a needless netif_err() from efx_ptp_update_stats() - if the MCDI fails it'll print its own error message, we don't need another that adds no information. Signed-off-by: Edward Cree <ecree@solarflare.com> --- drivers/net/ethernet/sfc/ptp.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 8c5c96a..5578c54 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -389,11 +389,8 @@ size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats) MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf), NULL); - if (rc) { - netif_err(efx, hw, efx->net_dev, - "MC_CMD_PTP_OP_STATUS failed (%d)\n", rc); + if (rc) memset(outbuf, 0, sizeof(outbuf)); - } efx_nic_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, efx_ptp_stat_mask, stats, _MCDI_PTR(outbuf, 0), false); @@ -490,14 +487,20 @@ static int efx_ptp_get_attributes(struct efx_nic *efx) */ MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_GET_ATTRIBUTES); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &out_len); - if (rc == 0) + rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &out_len); + if (rc == 0) { fmt = MCDI_DWORD(outbuf, PTP_OUT_GET_ATTRIBUTES_TIME_FORMAT); - else if (rc == -EINVAL) + } else if (rc == -EINVAL) { fmt = MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS; - else + } else if (rc == -EPERM) { + netif_info(efx, probe, efx->net_dev, "no PTP support\n"); return rc; + } else { + efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), + outbuf, sizeof(outbuf), rc); + return rc; + } if (fmt == MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_27FRACTION) { ptp->ns_to_nic_time = efx_ptp_ns_to_s27; @@ -541,8 +544,8 @@ static int efx_ptp_get_timestamp_corrections(struct efx_nic *efx) MC_CMD_PTP_OP_GET_TIMESTAMP_CORRECTIONS); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); if (rc == 0) { efx->ptp_data->ts_corrections.tx = MCDI_DWORD(outbuf, PTP_OUT_GET_TIMESTAMP_CORRECTIONS_TRANSMIT); @@ -558,6 +561,8 @@ static int efx_ptp_get_timestamp_corrections(struct efx_nic *efx) efx->ptp_data->ts_corrections.pps_out = 0; efx->ptp_data->ts_corrections.pps_in = 0; } else { + efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), outbuf, + sizeof(outbuf), rc); return rc; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-13 19:12 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-05-12 12:03 [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors Edward Cree 2015-05-12 12:04 ` [PATCH net-next 1/2] sfc: nicer log message on PTP probe fail Edward Cree 2015-05-12 12:05 ` [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP Edward Cree 2015-05-13 19:12 ` [PATCH net-next v2 0/2] sfc: Bowdlerise PTP MCDI errors David Miller -- strict thread matches above, loose matches on Subject: below -- 2015-05-11 12:19 [PATCH net-next 0/2] " Edward Cree 2015-05-11 12:20 ` [PATCH net-next 2/2] sfc: suppress some MCDI error messages in PTP Edward Cree
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.