diff options
author | Richard Cochran <richardcochran@gmail.com> | 2014-11-21 15:51:10 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-01-22 21:10:18 -0500 |
commit | 61d7f75f45231e4a2f2ab7d975555f55f0019800 (patch) | |
tree | d300e7edf09a859f8cd1de2d694fe2f933f01938 /drivers/net/ethernet/intel/igb/igb_main.c | |
parent | ba5b8dcdb865efaa35692516a7153dc631ba6ffa (diff) |
igb: refactor time sync interrupt handling
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>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index d1480f3054fe..135ac5c45abd 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -5384,6 +5384,19 @@ void igb_update_stats(struct igb_adapter *adapter, | |||
5384 | } | 5384 | } |
5385 | } | 5385 | } |
5386 | 5386 | ||
5387 | static void igb_tsync_interrupt(struct igb_adapter *adapter) | ||
5388 | { | ||
5389 | struct e1000_hw *hw = &adapter->hw; | ||
5390 | u32 tsicr = rd32(E1000_TSICR); | ||
5391 | |||
5392 | if (tsicr & E1000_TSICR_TXTS) { | ||
5393 | /* acknowledge the interrupt */ | ||
5394 | wr32(E1000_TSICR, E1000_TSICR_TXTS); | ||
5395 | /* retrieve hardware timestamp */ | ||
5396 | schedule_work(&adapter->ptp_tx_work); | ||
5397 | } | ||
5398 | } | ||
5399 | |||
5387 | static irqreturn_t igb_msix_other(int irq, void *data) | 5400 | static irqreturn_t igb_msix_other(int irq, void *data) |
5388 | { | 5401 | { |
5389 | struct igb_adapter *adapter = data; | 5402 | struct igb_adapter *adapter = data; |
@@ -5415,16 +5428,8 @@ static irqreturn_t igb_msix_other(int irq, void *data) | |||
5415 | mod_timer(&adapter->watchdog_timer, jiffies + 1); | 5428 | mod_timer(&adapter->watchdog_timer, jiffies + 1); |
5416 | } | 5429 | } |
5417 | 5430 | ||
5418 | if (icr & E1000_ICR_TS) { | 5431 | if (icr & E1000_ICR_TS) |
5419 | u32 tsicr = rd32(E1000_TSICR); | 5432 | igb_tsync_interrupt(adapter); |
5420 | |||
5421 | if (tsicr & E1000_TSICR_TXTS) { | ||
5422 | /* acknowledge the interrupt */ | ||
5423 | wr32(E1000_TSICR, E1000_TSICR_TXTS); | ||
5424 | /* retrieve hardware timestamp */ | ||
5425 | schedule_work(&adapter->ptp_tx_work); | ||
5426 | } | ||
5427 | } | ||
5428 | 5433 | ||
5429 | wr32(E1000_EIMS, adapter->eims_other); | 5434 | wr32(E1000_EIMS, adapter->eims_other); |
5430 | 5435 | ||
@@ -6203,16 +6208,8 @@ static irqreturn_t igb_intr_msi(int irq, void *data) | |||
6203 | mod_timer(&adapter->watchdog_timer, jiffies + 1); | 6208 | mod_timer(&adapter->watchdog_timer, jiffies + 1); |
6204 | } | 6209 | } |
6205 | 6210 | ||
6206 | if (icr & E1000_ICR_TS) { | 6211 | if (icr & E1000_ICR_TS) |
6207 | u32 tsicr = rd32(E1000_TSICR); | 6212 | igb_tsync_interrupt(adapter); |
6208 | |||
6209 | if (tsicr & E1000_TSICR_TXTS) { | ||
6210 | /* acknowledge the interrupt */ | ||
6211 | wr32(E1000_TSICR, E1000_TSICR_TXTS); | ||
6212 | /* retrieve hardware timestamp */ | ||
6213 | schedule_work(&adapter->ptp_tx_work); | ||
6214 | } | ||
6215 | } | ||
6216 | 6213 | ||
6217 | napi_schedule(&q_vector->napi); | 6214 | napi_schedule(&q_vector->napi); |
6218 | 6215 | ||
@@ -6257,16 +6254,8 @@ static irqreturn_t igb_intr(int irq, void *data) | |||
6257 | mod_timer(&adapter->watchdog_timer, jiffies + 1); | 6254 | mod_timer(&adapter->watchdog_timer, jiffies + 1); |
6258 | } | 6255 | } |
6259 | 6256 | ||
6260 | if (icr & E1000_ICR_TS) { | 6257 | if (icr & E1000_ICR_TS) |
6261 | u32 tsicr = rd32(E1000_TSICR); | 6258 | igb_tsync_interrupt(adapter); |
6262 | |||
6263 | if (tsicr & E1000_TSICR_TXTS) { | ||
6264 | /* acknowledge the interrupt */ | ||
6265 | wr32(E1000_TSICR, E1000_TSICR_TXTS); | ||
6266 | /* retrieve hardware timestamp */ | ||
6267 | schedule_work(&adapter->ptp_tx_work); | ||
6268 | } | ||
6269 | } | ||
6270 | 6259 | ||
6271 | napi_schedule(&q_vector->napi); | 6260 | napi_schedule(&q_vector->napi); |
6272 | 6261 | ||