diff options
author | Jakub Kicinski <kubakici@wp.pl> | 2014-04-02 06:33:33 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-04-11 08:58:08 -0400 |
commit | 5499a968d49f22ef166a360ffd74364bfb7233d6 (patch) | |
tree | 0678005d7b22b2da19cb9fcb0ad37feff0696926 | |
parent | 06c14e5adbccfc2b6e0cfc1f7ce4f4bf73791d28 (diff) |
igb: fix last_rx_timestamp usage
last_rx_timestamp should be updated only when rx time stamp is
read. Also it's only used with NICs that have per-interface time
stamping resources so it can be moved to adapter structure and
set in igb_ptp_rx_rgtstamp().
Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
Acked-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb.h | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ptp.c | 14 |
3 files changed, 11 insertions, 23 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 7fbe1e925143..27130065d92a 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -241,7 +241,6 @@ struct igb_ring { | |||
241 | struct igb_tx_buffer *tx_buffer_info; | 241 | struct igb_tx_buffer *tx_buffer_info; |
242 | struct igb_rx_buffer *rx_buffer_info; | 242 | struct igb_rx_buffer *rx_buffer_info; |
243 | }; | 243 | }; |
244 | unsigned long last_rx_timestamp; | ||
245 | void *desc; /* descriptor ring memory */ | 244 | void *desc; /* descriptor ring memory */ |
246 | unsigned long flags; /* ring specific flags */ | 245 | unsigned long flags; /* ring specific flags */ |
247 | void __iomem *tail; /* pointer to ring tail register */ | 246 | void __iomem *tail; /* pointer to ring tail register */ |
@@ -437,6 +436,7 @@ struct igb_adapter { | |||
437 | struct hwtstamp_config tstamp_config; | 436 | struct hwtstamp_config tstamp_config; |
438 | unsigned long ptp_tx_start; | 437 | unsigned long ptp_tx_start; |
439 | unsigned long last_rx_ptp_check; | 438 | unsigned long last_rx_ptp_check; |
439 | unsigned long last_rx_timestamp; | ||
440 | spinlock_t tmreg_lock; | 440 | spinlock_t tmreg_lock; |
441 | struct cyclecounter cc; | 441 | struct cyclecounter cc; |
442 | struct timecounter tc; | 442 | struct timecounter tc; |
@@ -533,20 +533,6 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter); | |||
533 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); | 533 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); |
534 | void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va, | 534 | void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va, |
535 | struct sk_buff *skb); | 535 | struct sk_buff *skb); |
536 | static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring, | ||
537 | union e1000_adv_rx_desc *rx_desc, | ||
538 | struct sk_buff *skb) | ||
539 | { | ||
540 | if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TS) && | ||
541 | !igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) | ||
542 | igb_ptp_rx_rgtstamp(rx_ring->q_vector, skb); | ||
543 | |||
544 | /* Update the last_rx_timestamp timer in order to enable watchdog check | ||
545 | * for error case of latched timestamp on a dropped packet. | ||
546 | */ | ||
547 | rx_ring->last_rx_timestamp = jiffies; | ||
548 | } | ||
549 | |||
550 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); | 536 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); |
551 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); | 537 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); |
552 | #ifdef CONFIG_IGB_HWMON | 538 | #ifdef CONFIG_IGB_HWMON |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 720ad122b26d..fb98d4602f9d 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -6954,7 +6954,9 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring, | |||
6954 | 6954 | ||
6955 | igb_rx_checksum(rx_ring, rx_desc, skb); | 6955 | igb_rx_checksum(rx_ring, rx_desc, skb); |
6956 | 6956 | ||
6957 | igb_ptp_rx_hwtstamp(rx_ring, rx_desc, skb); | 6957 | if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TS) && |
6958 | !igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) | ||
6959 | igb_ptp_rx_rgtstamp(rx_ring->q_vector, skb); | ||
6958 | 6960 | ||
6959 | if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && | 6961 | if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && |
6960 | igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { | 6962 | igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 2cca8fd5e574..9209d652e1c9 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -427,10 +427,8 @@ static void igb_ptp_overflow_check(struct work_struct *work) | |||
427 | void igb_ptp_rx_hang(struct igb_adapter *adapter) | 427 | void igb_ptp_rx_hang(struct igb_adapter *adapter) |
428 | { | 428 | { |
429 | struct e1000_hw *hw = &adapter->hw; | 429 | struct e1000_hw *hw = &adapter->hw; |
430 | struct igb_ring *rx_ring; | ||
431 | u32 tsyncrxctl = rd32(E1000_TSYNCRXCTL); | 430 | u32 tsyncrxctl = rd32(E1000_TSYNCRXCTL); |
432 | unsigned long rx_event; | 431 | unsigned long rx_event; |
433 | int n; | ||
434 | 432 | ||
435 | if (hw->mac.type != e1000_82576) | 433 | if (hw->mac.type != e1000_82576) |
436 | return; | 434 | return; |
@@ -445,11 +443,8 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter) | |||
445 | 443 | ||
446 | /* Determine the most recent watchdog or rx_timestamp event */ | 444 | /* Determine the most recent watchdog or rx_timestamp event */ |
447 | rx_event = adapter->last_rx_ptp_check; | 445 | rx_event = adapter->last_rx_ptp_check; |
448 | for (n = 0; n < adapter->num_rx_queues; n++) { | 446 | if (time_after(adapter->last_rx_timestamp, rx_event)) |
449 | rx_ring = adapter->rx_ring[n]; | 447 | rx_event = adapter->last_rx_timestamp; |
450 | if (time_after(rx_ring->last_rx_timestamp, rx_event)) | ||
451 | rx_event = rx_ring->last_rx_timestamp; | ||
452 | } | ||
453 | 448 | ||
454 | /* Only need to read the high RXSTMP register to clear the lock */ | 449 | /* Only need to read the high RXSTMP register to clear the lock */ |
455 | if (time_is_before_jiffies(rx_event + 5 * HZ)) { | 450 | if (time_is_before_jiffies(rx_event + 5 * HZ)) { |
@@ -540,6 +535,11 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, | |||
540 | regval |= (u64)rd32(E1000_RXSTMPH) << 32; | 535 | regval |= (u64)rd32(E1000_RXSTMPH) << 32; |
541 | 536 | ||
542 | igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval); | 537 | igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval); |
538 | |||
539 | /* Update the last_rx_timestamp timer in order to enable watchdog check | ||
540 | * for error case of latched timestamp on a dropped packet. | ||
541 | */ | ||
542 | adapter->last_rx_timestamp = jiffies; | ||
543 | } | 543 | } |
544 | 544 | ||
545 | /** | 545 | /** |