@@ -224,6 +224,8 @@ struct ixgbe_rx_queue_stats {
224
224
u64 csum_err ;
225
225
};
226
226
227
+ #define IXGBE_TS_HDR_LEN 8
228
+
227
229
enum ixgbe_ring_state_t {
228
230
__IXGBE_TX_FDIR_INIT_DONE ,
229
231
__IXGBE_TX_XPS_INIT_DONE ,
@@ -282,6 +284,8 @@ struct ixgbe_ring {
282
284
u16 next_to_use ;
283
285
u16 next_to_clean ;
284
286
287
+ unsigned long last_rx_timestamp ;
288
+
285
289
union {
286
290
u16 next_to_alloc ;
287
291
struct {
@@ -640,6 +644,8 @@ struct ixgbe_adapter {
640
644
#define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 22)
641
645
#define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 23)
642
646
#define IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE BIT(24)
647
+ #define IXGBE_FLAG_RX_HWTSTAMP_ENABLED BIT(25)
648
+ #define IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER BIT(26)
643
649
644
650
u32 flags2 ;
645
651
#define IXGBE_FLAG2_RSC_CAPABLE (u32)(1 << 0)
@@ -756,9 +762,12 @@ struct ixgbe_adapter {
756
762
unsigned long last_rx_ptp_check ;
757
763
unsigned long last_rx_timestamp ;
758
764
spinlock_t tmreg_lock ;
759
- struct cyclecounter cc ;
760
- struct timecounter tc ;
765
+ struct cyclecounter hw_cc ;
766
+ struct timecounter hw_tc ;
761
767
u32 base_incval ;
768
+ u32 tx_hwtstamp_timeouts ;
769
+ u32 rx_hwtstamp_cleared ;
770
+ void (* ptp_setup_sdp )(struct ixgbe_adapter * );
762
771
763
772
/* SR-IOV */
764
773
DECLARE_BITMAP (active_vfs , IXGBE_MAX_VF_FUNCTIONS );
@@ -969,12 +978,33 @@ void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter);
969
978
void ixgbe_ptp_stop (struct ixgbe_adapter * adapter );
970
979
void ixgbe_ptp_overflow_check (struct ixgbe_adapter * adapter );
971
980
void ixgbe_ptp_rx_hang (struct ixgbe_adapter * adapter );
972
- void ixgbe_ptp_rx_hwtstamp (struct ixgbe_adapter * adapter , struct sk_buff * skb );
981
+ void ixgbe_ptp_rx_pktstamp (struct ixgbe_q_vector * , struct sk_buff * );
982
+ void ixgbe_ptp_rx_rgtstamp (struct ixgbe_q_vector * , struct sk_buff * skb );
983
+ static inline void ixgbe_ptp_rx_hwtstamp (struct ixgbe_ring * rx_ring ,
984
+ union ixgbe_adv_rx_desc * rx_desc ,
985
+ struct sk_buff * skb )
986
+ {
987
+ if (unlikely (ixgbe_test_staterr (rx_desc , IXGBE_RXD_STAT_TSIP ))) {
988
+ ixgbe_ptp_rx_pktstamp (rx_ring -> q_vector , skb );
989
+ return ;
990
+ }
991
+
992
+ if (unlikely (!ixgbe_test_staterr (rx_desc , IXGBE_RXDADV_STAT_TS )))
993
+ return ;
994
+
995
+ ixgbe_ptp_rx_rgtstamp (rx_ring -> q_vector , skb );
996
+
997
+ /* Update the last_rx_timestamp timer in order to enable watchdog check
998
+ * for error case of latched timestamp on a dropped packet.
999
+ */
1000
+ rx_ring -> last_rx_timestamp = jiffies ;
1001
+ }
1002
+
973
1003
int ixgbe_ptp_set_ts_config (struct ixgbe_adapter * adapter , struct ifreq * ifr );
974
1004
int ixgbe_ptp_get_ts_config (struct ixgbe_adapter * adapter , struct ifreq * ifr );
975
1005
void ixgbe_ptp_start_cyclecounter (struct ixgbe_adapter * adapter );
976
1006
void ixgbe_ptp_reset (struct ixgbe_adapter * adapter );
977
- void ixgbe_ptp_check_pps_event (struct ixgbe_adapter * adapter , u32 eicr );
1007
+ void ixgbe_ptp_check_pps_event (struct ixgbe_adapter * adapter );
978
1008
#ifdef CONFIG_PCI_IOV
979
1009
void ixgbe_sriov_reinit (struct ixgbe_adapter * adapter );
980
1010
#endif
0 commit comments