浏览代码

sfc: improve PTP error reporting

Log a message if PTP probing fails; if we then, unexpectedly, get PTP
 events, only log a message for the first one on each device.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Edward Cree 7 年之前
父节点
当前提交
acaef3c156
共有 3 个文件被更改,包括 13 次插入2 次删除
  1. 8 1
      drivers/net/ethernet/sfc/ef10.c
  2. 2 0
      drivers/net/ethernet/sfc/net_driver.h
  3. 3 1
      drivers/net/ethernet/sfc/ptp.c

+ 8 - 1
drivers/net/ethernet/sfc/ef10.c

@@ -747,7 +747,14 @@ static int efx_ef10_probe(struct efx_nic *efx)
 	if (rc && rc != -EPERM)
 	if (rc && rc != -EPERM)
 		goto fail5;
 		goto fail5;
 
 
-	efx_ptp_probe(efx, NULL);
+	rc = efx_ptp_probe(efx, NULL);
+	/* Failure to probe PTP is not fatal.
+	 * In the case of EPERM, efx_ptp_probe will print its own message (in
+	 * efx_ptp_get_attributes()), so we don't need to.
+	 */
+	if (rc && rc != -EPERM)
+		netif_warn(efx, drv, efx->net_dev,
+			   "Failed to probe PTP, rc=%d\n", rc);
 
 
 #ifdef CONFIG_SFC_SRIOV
 #ifdef CONFIG_SFC_SRIOV
 	if ((efx->pci_dev->physfn) && (!efx->pci_dev->is_physfn)) {
 	if ((efx->pci_dev->physfn) && (!efx->pci_dev->is_physfn)) {

+ 2 - 0
drivers/net/ethernet/sfc/net_driver.h

@@ -813,6 +813,7 @@ struct vfdi_status;
  * @vf_init_count: Number of VFs that have been fully initialised.
  * @vf_init_count: Number of VFs that have been fully initialised.
  * @vi_scale: log2 number of vnics per VF.
  * @vi_scale: log2 number of vnics per VF.
  * @ptp_data: PTP state data
  * @ptp_data: PTP state data
+ * @ptp_warned: has this NIC seen and warned about unexpected PTP events?
  * @vpd_sn: Serial number read from VPD
  * @vpd_sn: Serial number read from VPD
  * @monitor_work: Hardware monitor workitem
  * @monitor_work: Hardware monitor workitem
  * @biu_lock: BIU (bus interface unit) lock
  * @biu_lock: BIU (bus interface unit) lock
@@ -968,6 +969,7 @@ struct efx_nic {
 #endif
 #endif
 
 
 	struct efx_ptp_data *ptp_data;
 	struct efx_ptp_data *ptp_data;
+	bool ptp_warned;
 
 
 	char *vpd_sn;
 	char *vpd_sn;
 
 

+ 3 - 1
drivers/net/ethernet/sfc/ptp.c

@@ -1662,9 +1662,11 @@ void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev)
 	int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE);
 	int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE);
 
 
 	if (!ptp) {
 	if (!ptp) {
-		if (net_ratelimit())
+		if (!efx->ptp_warned) {
 			netif_warn(efx, drv, efx->net_dev,
 			netif_warn(efx, drv, efx->net_dev,
 				   "Received PTP event but PTP not set up\n");
 				   "Received PTP event but PTP not set up\n");
+			efx->ptp_warned = true;
+		}
 		return;
 		return;
 	}
 	}