igb: refactor time sync interrupt handling
authorRichard Cochran <richardcochran@gmail.com>
Fri, 21 Nov 2014 20:51:10 +0000 (20:51 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 23 Jan 2015 02:10:18 +0000 (18:10 -0800)
The code that handles the time sync interrupt is repeated in three
different places. This patch refactors the identical code blocks into
a single helper function.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igb/igb_main.c

index d1480f3054feb48b242e776a6dd7b125dd2d68dd..135ac5c45abd9a36d2e0683cd75cac6aaa77a877 100644 (file)
@@ -5384,6 +5384,19 @@ void igb_update_stats(struct igb_adapter *adapter,
        }
 }
 
+static void igb_tsync_interrupt(struct igb_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 tsicr = rd32(E1000_TSICR);
+
+       if (tsicr & E1000_TSICR_TXTS) {
+               /* acknowledge the interrupt */
+               wr32(E1000_TSICR, E1000_TSICR_TXTS);
+               /* retrieve hardware timestamp */
+               schedule_work(&adapter->ptp_tx_work);
+       }
+}
+
 static irqreturn_t igb_msix_other(int irq, void *data)
 {
        struct igb_adapter *adapter = data;
@@ -5415,16 +5428,8 @@ static irqreturn_t igb_msix_other(int irq, void *data)
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       if (icr & E1000_ICR_TS) {
-               u32 tsicr = rd32(E1000_TSICR);
-
-               if (tsicr & E1000_TSICR_TXTS) {
-                       /* acknowledge the interrupt */
-                       wr32(E1000_TSICR, E1000_TSICR_TXTS);
-                       /* retrieve hardware timestamp */
-                       schedule_work(&adapter->ptp_tx_work);
-               }
-       }
+       if (icr & E1000_ICR_TS)
+               igb_tsync_interrupt(adapter);
 
        wr32(E1000_EIMS, adapter->eims_other);
 
@@ -6203,16 +6208,8 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       if (icr & E1000_ICR_TS) {
-               u32 tsicr = rd32(E1000_TSICR);
-
-               if (tsicr & E1000_TSICR_TXTS) {
-                       /* acknowledge the interrupt */
-                       wr32(E1000_TSICR, E1000_TSICR_TXTS);
-                       /* retrieve hardware timestamp */
-                       schedule_work(&adapter->ptp_tx_work);
-               }
-       }
+       if (icr & E1000_ICR_TS)
+               igb_tsync_interrupt(adapter);
 
        napi_schedule(&q_vector->napi);
 
@@ -6257,16 +6254,8 @@ static irqreturn_t igb_intr(int irq, void *data)
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       if (icr & E1000_ICR_TS) {
-               u32 tsicr = rd32(E1000_TSICR);
-
-               if (tsicr & E1000_TSICR_TXTS) {
-                       /* acknowledge the interrupt */
-                       wr32(E1000_TSICR, E1000_TSICR_TXTS);
-                       /* retrieve hardware timestamp */
-                       schedule_work(&adapter->ptp_tx_work);
-               }
-       }
+       if (icr & E1000_ICR_TS)
+               igb_tsync_interrupt(adapter);
 
        napi_schedule(&q_vector->napi);