diff options
author | Dave Airlie <airlied@redhat.com> | 2014-06-05 06:28:59 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-06-05 06:28:59 -0400 |
commit | 8d4ad9d4bb0a618c975a32d77087694ec6336f68 (patch) | |
tree | d18d12688174a623e3503b11118e44ef8186c90b /drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |
parent | 5ea1f752ae04be403a3dc8ec876a60d7f5f6990a (diff) | |
parent | 9e9a928eed8796a0a1aaed7e0b676db86ba84594 (diff) |
Merge commit '9e9a928eed8796a0a1aaed7e0b676db86ba84594' into drm-next
Merge drm-fixes into drm-next.
Both i915 and radeon need this done for later patches.
Conflicts:
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_gem_gtt.c
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index 63515a6f67fa..8902ae683457 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
@@ -435,10 +435,8 @@ void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter) | |||
435 | void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter) | 435 | void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter) |
436 | { | 436 | { |
437 | struct ixgbe_hw *hw = &adapter->hw; | 437 | struct ixgbe_hw *hw = &adapter->hw; |
438 | struct ixgbe_ring *rx_ring; | ||
439 | u32 tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); | 438 | u32 tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); |
440 | unsigned long rx_event; | 439 | unsigned long rx_event; |
441 | int n; | ||
442 | 440 | ||
443 | /* if we don't have a valid timestamp in the registers, just update the | 441 | /* if we don't have a valid timestamp in the registers, just update the |
444 | * timeout counter and exit | 442 | * timeout counter and exit |
@@ -450,18 +448,15 @@ void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter) | |||
450 | 448 | ||
451 | /* determine the most recent watchdog or rx_timestamp event */ | 449 | /* determine the most recent watchdog or rx_timestamp event */ |
452 | rx_event = adapter->last_rx_ptp_check; | 450 | rx_event = adapter->last_rx_ptp_check; |
453 | for (n = 0; n < adapter->num_rx_queues; n++) { | 451 | if (time_after(adapter->last_rx_timestamp, rx_event)) |
454 | rx_ring = adapter->rx_ring[n]; | 452 | rx_event = adapter->last_rx_timestamp; |
455 | if (time_after(rx_ring->last_rx_timestamp, rx_event)) | ||
456 | rx_event = rx_ring->last_rx_timestamp; | ||
457 | } | ||
458 | 453 | ||
459 | /* only need to read the high RXSTMP register to clear the lock */ | 454 | /* only need to read the high RXSTMP register to clear the lock */ |
460 | if (time_is_before_jiffies(rx_event + 5*HZ)) { | 455 | if (time_is_before_jiffies(rx_event + 5*HZ)) { |
461 | IXGBE_READ_REG(hw, IXGBE_RXSTMPH); | 456 | IXGBE_READ_REG(hw, IXGBE_RXSTMPH); |
462 | adapter->last_rx_ptp_check = jiffies; | 457 | adapter->last_rx_ptp_check = jiffies; |
463 | 458 | ||
464 | e_warn(drv, "clearing RX Timestamp hang"); | 459 | e_warn(drv, "clearing RX Timestamp hang\n"); |
465 | } | 460 | } |
466 | } | 461 | } |
467 | 462 | ||
@@ -517,7 +512,7 @@ static void ixgbe_ptp_tx_hwtstamp_work(struct work_struct *work) | |||
517 | dev_kfree_skb_any(adapter->ptp_tx_skb); | 512 | dev_kfree_skb_any(adapter->ptp_tx_skb); |
518 | adapter->ptp_tx_skb = NULL; | 513 | adapter->ptp_tx_skb = NULL; |
519 | clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); | 514 | clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); |
520 | e_warn(drv, "clearing Tx Timestamp hang"); | 515 | e_warn(drv, "clearing Tx Timestamp hang\n"); |
521 | return; | 516 | return; |
522 | } | 517 | } |
523 | 518 | ||
@@ -530,35 +525,22 @@ static void ixgbe_ptp_tx_hwtstamp_work(struct work_struct *work) | |||
530 | } | 525 | } |
531 | 526 | ||
532 | /** | 527 | /** |
533 | * __ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp | 528 | * ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp |
534 | * @q_vector: structure containing interrupt and ring information | 529 | * @adapter: pointer to adapter struct |
535 | * @skb: particular skb to send timestamp with | 530 | * @skb: particular skb to send timestamp with |
536 | * | 531 | * |
537 | * if the timestamp is valid, we convert it into the timecounter ns | 532 | * if the timestamp is valid, we convert it into the timecounter ns |
538 | * value, then store that result into the shhwtstamps structure which | 533 | * value, then store that result into the shhwtstamps structure which |
539 | * is passed up the network stack | 534 | * is passed up the network stack |
540 | */ | 535 | */ |
541 | void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | 536 | void ixgbe_ptp_rx_hwtstamp(struct ixgbe_adapter *adapter, struct sk_buff *skb) |
542 | struct sk_buff *skb) | ||
543 | { | 537 | { |
544 | struct ixgbe_adapter *adapter; | 538 | struct ixgbe_hw *hw = &adapter->hw; |
545 | struct ixgbe_hw *hw; | ||
546 | struct skb_shared_hwtstamps *shhwtstamps; | 539 | struct skb_shared_hwtstamps *shhwtstamps; |
547 | u64 regval = 0, ns; | 540 | u64 regval = 0, ns; |
548 | u32 tsyncrxctl; | 541 | u32 tsyncrxctl; |
549 | unsigned long flags; | 542 | unsigned long flags; |
550 | 543 | ||
551 | /* we cannot process timestamps on a ring without a q_vector */ | ||
552 | if (!q_vector || !q_vector->adapter) | ||
553 | return; | ||
554 | |||
555 | adapter = q_vector->adapter; | ||
556 | hw = &adapter->hw; | ||
557 | |||
558 | /* | ||
559 | * Read the tsyncrxctl register afterwards in order to prevent taking an | ||
560 | * I/O hit on every packet. | ||
561 | */ | ||
562 | tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); | 544 | tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); |
563 | if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) | 545 | if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) |
564 | return; | 546 | return; |
@@ -566,13 +548,17 @@ void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | |||
566 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL); | 548 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL); |
567 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32; | 549 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32; |
568 | 550 | ||
569 | |||
570 | spin_lock_irqsave(&adapter->tmreg_lock, flags); | 551 | spin_lock_irqsave(&adapter->tmreg_lock, flags); |
571 | ns = timecounter_cyc2time(&adapter->tc, regval); | 552 | ns = timecounter_cyc2time(&adapter->tc, regval); |
572 | spin_unlock_irqrestore(&adapter->tmreg_lock, flags); | 553 | spin_unlock_irqrestore(&adapter->tmreg_lock, flags); |
573 | 554 | ||
574 | shhwtstamps = skb_hwtstamps(skb); | 555 | shhwtstamps = skb_hwtstamps(skb); |
575 | shhwtstamps->hwtstamp = ns_to_ktime(ns); | 556 | shhwtstamps->hwtstamp = ns_to_ktime(ns); |
557 | |||
558 | /* Update the last_rx_timestamp timer in order to enable watchdog check | ||
559 | * for error case of latched timestamp on a dropped packet. | ||
560 | */ | ||
561 | adapter->last_rx_timestamp = jiffies; | ||
576 | } | 562 | } |
577 | 563 | ||
578 | int ixgbe_ptp_get_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr) | 564 | int ixgbe_ptp_get_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr) |