Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright(c) 2024 Intel Corporation. */
3
4#ifndef _IAVF_PTP_H_
5#define _IAVF_PTP_H_
6
7#include "iavf_types.h"
8
9/* bit indicating whether a 40bit timestamp is valid */
10#define IAVF_PTP_40B_TSTAMP_VALID BIT(24)
11
12#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
13void iavf_ptp_init(struct iavf_adapter *adapter);
14void iavf_ptp_release(struct iavf_adapter *adapter);
15void iavf_ptp_process_caps(struct iavf_adapter *adapter);
16bool iavf_ptp_cap_supported(const struct iavf_adapter *adapter, u32 cap);
17void iavf_virtchnl_send_ptp_cmd(struct iavf_adapter *adapter);
18int iavf_ptp_set_ts_config(struct iavf_adapter *adapter,
19 struct kernel_hwtstamp_config *config,
20 struct netlink_ext_ack *extack);
21u64 iavf_ptp_extend_32b_timestamp(u64 cached_phc_time, u32 in_tstamp);
22#else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
23static inline void iavf_ptp_init(struct iavf_adapter *adapter) { }
24static inline void iavf_ptp_release(struct iavf_adapter *adapter) { }
25static inline void iavf_ptp_process_caps(struct iavf_adapter *adapter) { }
26static inline bool iavf_ptp_cap_supported(const struct iavf_adapter *adapter,
27 u32 cap)
28{
29 return false;
30}
31
32static inline void iavf_virtchnl_send_ptp_cmd(struct iavf_adapter *adapter) { }
33static inline int iavf_ptp_set_ts_config(struct iavf_adapter *adapter,
34 struct kernel_hwtstamp_config *config,
35 struct netlink_ext_ack *extack)
36{
37 return -1;
38}
39
40static inline u64 iavf_ptp_extend_32b_timestamp(u64 cached_phc_time,
41 u32 in_tstamp)
42{
43 return 0;
44}
45
46#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
47#endif /* _IAVF_PTP_H_ */