0001
0002
0003
0004
0005
0006
0007 #ifndef _QEDE_PTP_H_
0008 #define _QEDE_PTP_H_
0009
0010 #include <linux/ptp_clock_kernel.h>
0011 #include <linux/net_tstamp.h>
0012 #include <linux/timecounter.h>
0013 #include "qede.h"
0014
0015 void qede_ptp_rx_ts(struct qede_dev *edev, struct sk_buff *skb);
0016 void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);
0017 int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *req);
0018 void qede_ptp_disable(struct qede_dev *edev);
0019 int qede_ptp_enable(struct qede_dev *edev);
0020 int qede_ptp_get_ts_info(struct qede_dev *edev, struct ethtool_ts_info *ts);
0021
0022 static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,
0023 union eth_rx_cqe *cqe,
0024 struct sk_buff *skb)
0025 {
0026
0027 if (unlikely(le16_to_cpu(cqe->fast_path_regular.pars_flags.flags) &
0028 (1 << PARSING_AND_ERR_FLAGS_TIMESTAMPRECORDED_SHIFT))) {
0029 if (likely(le16_to_cpu(cqe->fast_path_regular.pars_flags.flags)
0030 & (1 << PARSING_AND_ERR_FLAGS_TIMESYNCPKT_SHIFT))) {
0031 qede_ptp_rx_ts(edev, skb);
0032 } else {
0033 DP_INFO(edev,
0034 "Timestamp recorded for non PTP packets\n");
0035 }
0036 }
0037 }
0038 #endif