diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2012-12-05 01:51:29 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-01-23 17:33:29 -0500 |
commit | 39dfb71bc03c5a4015d25611c0f1121991d548e6 (patch) | |
tree | 94ac91f7ec8027289e24e9c95c0f4d176a214c6e /drivers | |
parent | b1e50f7ac7fd44f8da05b160a90dddde90b7e8cc (diff) |
ixgbe: Inline Rx PTP descriptor handling
This change is meant to inline the Rx PTP descriptor handling. The main
motivation is to avoid unnecessary jumps into function calls that we then
immediately exit because we are not performing timestamps.
The net result of this change is that ixgbe_ptp_rx_tstamp drops from .5% CPU
utilization in my performance runs to 0%, and the only value tested is the Rx
descriptor which should already be warm in the cache if not stored in a
register.
Cc: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Jacob Keller <Jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe.h | 21 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 21 |
2 files changed, 23 insertions, 19 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 261859822ee5..cd4c83b1a977 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -755,9 +755,24 @@ extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter); | |||
755 | extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); | 755 | extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); |
756 | extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); | 756 | extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); |
757 | extern void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); | 757 | extern void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); |
758 | extern void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, | 758 | extern void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, |
759 | union ixgbe_adv_rx_desc *rx_desc, | 759 | struct sk_buff *skb); |
760 | struct sk_buff *skb); | 760 | static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, |
761 | union ixgbe_adv_rx_desc *rx_desc, | ||
762 | struct sk_buff *skb) | ||
763 | { | ||
764 | if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS))) | ||
765 | return; | ||
766 | |||
767 | __ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, skb); | ||
768 | |||
769 | /* | ||
770 | * Update the last_rx_timestamp timer in order to enable watchdog check | ||
771 | * for error case of latched timestamp on a dropped packet. | ||
772 | */ | ||
773 | rx_ring->last_rx_timestamp = jiffies; | ||
774 | } | ||
775 | |||
761 | extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | 776 | extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, |
762 | struct ifreq *ifr, int cmd); | 777 | struct ifreq *ifr, int cmd); |
763 | extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); | 778 | extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index 63046167fe6a..53d204759711 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
@@ -531,18 +531,16 @@ static void ixgbe_ptp_tx_hwtstamp_work(struct work_struct *work) | |||
531 | } | 531 | } |
532 | 532 | ||
533 | /** | 533 | /** |
534 | * ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp | 534 | * __ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp |
535 | * @q_vector: structure containing interrupt and ring information | 535 | * @q_vector: structure containing interrupt and ring information |
536 | * @rx_desc: the rx descriptor | ||
537 | * @skb: particular skb to send timestamp with | 536 | * @skb: particular skb to send timestamp with |
538 | * | 537 | * |
539 | * if the timestamp is valid, we convert it into the timecounter ns | 538 | * if the timestamp is valid, we convert it into the timecounter ns |
540 | * value, then store that result into the shhwtstamps structure which | 539 | * value, then store that result into the shhwtstamps structure which |
541 | * is passed up the network stack | 540 | * is passed up the network stack |
542 | */ | 541 | */ |
543 | void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, | 542 | void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, |
544 | union ixgbe_adv_rx_desc *rx_desc, | 543 | struct sk_buff *skb) |
545 | struct sk_buff *skb) | ||
546 | { | 544 | { |
547 | struct ixgbe_adapter *adapter; | 545 | struct ixgbe_adapter *adapter; |
548 | struct ixgbe_hw *hw; | 546 | struct ixgbe_hw *hw; |
@@ -552,15 +550,12 @@ void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, | |||
552 | unsigned long flags; | 550 | unsigned long flags; |
553 | 551 | ||
554 | /* we cannot process timestamps on a ring without a q_vector */ | 552 | /* we cannot process timestamps on a ring without a q_vector */ |
555 | if (!rx_ring->q_vector || !rx_ring->q_vector->adapter) | 553 | if (!q_vector || !q_vector->adapter) |
556 | return; | 554 | return; |
557 | 555 | ||
558 | adapter = rx_ring->q_vector->adapter; | 556 | adapter = q_vector->adapter; |
559 | hw = &adapter->hw; | 557 | hw = &adapter->hw; |
560 | 558 | ||
561 | if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS))) | ||
562 | return; | ||
563 | |||
564 | /* | 559 | /* |
565 | * Read the tsyncrxctl register afterwards in order to prevent taking an | 560 | * Read the tsyncrxctl register afterwards in order to prevent taking an |
566 | * I/O hit on every packet. | 561 | * I/O hit on every packet. |
@@ -569,12 +564,6 @@ void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, | |||
569 | if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) | 564 | if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) |
570 | return; | 565 | return; |
571 | 566 | ||
572 | /* | ||
573 | * Update the last_rx_timestamp timer in order to enable watchdog check | ||
574 | * for error case of latched timestamp on a dropped packet. | ||
575 | */ | ||
576 | rx_ring->last_rx_timestamp = jiffies; | ||
577 | |||
578 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL); | 567 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL); |
579 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32; | 568 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32; |
580 | 569 | ||