igc: Don't reschedule ptp_tx work
authorAndre Guedes <andre.guedes@intel.com>
Tue, 28 Jul 2020 23:37:52 +0000 (16:37 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 28 Sep 2020 21:42:45 +0000 (14:42 -0700)
The ptp_tx work is scheduled only if TSICR.TXTS bit is set, therefore
TSYNCTXCTL.TXTT_0 bit is expected to be set when we check it igc_ptp_tx_
work(). If it isn't, something is really off and rescheduling the ptp_tx
work to check it later doesn't help much. This patch changes the code to
WARN_ON_ONCE() if this situation ever happens.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igc/igc_ptp.c

index dbe0776..791f406 100644 (file)
@@ -429,11 +429,10 @@ static void igc_ptp_tx_work(struct work_struct *work)
        }
 
        tsynctxctl = rd32(IGC_TSYNCTXCTL);
-       if (tsynctxctl & IGC_TSYNCTXCTL_TXTT_0)
-               igc_ptp_tx_hwtstamp(adapter);
-       else
-               /* reschedule to check later */
-               schedule_work(&adapter->ptp_tx_work);
+       if (WARN_ON_ONCE(!(tsynctxctl & IGC_TSYNCTXCTL_TXTT_0)))
+               return;
+
+       igc_ptp_tx_hwtstamp(adapter);
 }
 
 /**