xref: /linux/drivers/net/ethernet/intel/iavf/iavf_ptp.h (revision 1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95)
13247d65aSJacob Keller /* SPDX-License-Identifier: GPL-2.0 */
23247d65aSJacob Keller /* Copyright(c) 2024 Intel Corporation. */
33247d65aSJacob Keller 
43247d65aSJacob Keller #ifndef _IAVF_PTP_H_
53247d65aSJacob Keller #define _IAVF_PTP_H_
63247d65aSJacob Keller 
73247d65aSJacob Keller #include "iavf_types.h"
83247d65aSJacob Keller 
9*48ccdcd8SJacob Keller /* bit indicating whether a 40bit timestamp is valid */
10*48ccdcd8SJacob Keller #define IAVF_PTP_40B_TSTAMP_VALID	BIT(24)
11*48ccdcd8SJacob Keller 
12d734223bSJacob Keller #if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
13d734223bSJacob Keller void iavf_ptp_init(struct iavf_adapter *adapter);
14d734223bSJacob Keller void iavf_ptp_release(struct iavf_adapter *adapter);
15d734223bSJacob Keller void iavf_ptp_process_caps(struct iavf_adapter *adapter);
16d734223bSJacob Keller bool iavf_ptp_cap_supported(const struct iavf_adapter *adapter, u32 cap);
1752e3beacSJacob Keller void iavf_virtchnl_send_ptp_cmd(struct iavf_adapter *adapter);
1851534239SJacob Keller int iavf_ptp_set_ts_config(struct iavf_adapter *adapter,
1951534239SJacob Keller 			   struct kernel_hwtstamp_config *config,
2051534239SJacob Keller 			   struct netlink_ext_ack *extack);
21*48ccdcd8SJacob Keller u64 iavf_ptp_extend_32b_timestamp(u64 cached_phc_time, u32 in_tstamp);
22d734223bSJacob Keller #else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
iavf_ptp_init(struct iavf_adapter * adapter)23d734223bSJacob Keller static inline void iavf_ptp_init(struct iavf_adapter *adapter) { }
iavf_ptp_release(struct iavf_adapter * adapter)24d734223bSJacob Keller static inline void iavf_ptp_release(struct iavf_adapter *adapter) { }
iavf_ptp_process_caps(struct iavf_adapter * adapter)25d734223bSJacob Keller static inline void iavf_ptp_process_caps(struct iavf_adapter *adapter) { }
iavf_ptp_cap_supported(const struct iavf_adapter * adapter,u32 cap)2652e3beacSJacob Keller static inline bool iavf_ptp_cap_supported(const struct iavf_adapter *adapter,
2752e3beacSJacob Keller 					  u32 cap)
28d734223bSJacob Keller {
29d734223bSJacob Keller 	return false;
30d734223bSJacob Keller }
3152e3beacSJacob Keller 
iavf_virtchnl_send_ptp_cmd(struct iavf_adapter * adapter)3252e3beacSJacob Keller static inline void iavf_virtchnl_send_ptp_cmd(struct iavf_adapter *adapter) { }
iavf_ptp_set_ts_config(struct iavf_adapter * adapter,struct kernel_hwtstamp_config * config,struct netlink_ext_ack * extack)3351534239SJacob Keller static inline int iavf_ptp_set_ts_config(struct iavf_adapter *adapter,
3451534239SJacob Keller 					 struct kernel_hwtstamp_config *config,
3551534239SJacob Keller 					 struct netlink_ext_ack *extack)
3651534239SJacob Keller {
3751534239SJacob Keller 	return -1;
3851534239SJacob Keller }
39*48ccdcd8SJacob Keller 
iavf_ptp_extend_32b_timestamp(u64 cached_phc_time,u32 in_tstamp)40*48ccdcd8SJacob Keller static inline u64 iavf_ptp_extend_32b_timestamp(u64 cached_phc_time,
41*48ccdcd8SJacob Keller 						u32 in_tstamp)
42*48ccdcd8SJacob Keller {
43*48ccdcd8SJacob Keller 	return 0;
44*48ccdcd8SJacob Keller }
45*48ccdcd8SJacob Keller 
46d734223bSJacob Keller #endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
473247d65aSJacob Keller #endif /* _IAVF_PTP_H_ */
48