18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/****************************************************************************
38c2ecf20Sopenharmony_ci * Driver for Solarflare network controllers and boards
48c2ecf20Sopenharmony_ci * Copyright 2005-2006 Fen Systems Ltd.
58c2ecf20Sopenharmony_ci * Copyright 2006-2013 Solarflare Communications Inc.
68c2ecf20Sopenharmony_ci * Copyright 2019-2020 Xilinx Inc.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef EFX_PTP_H
108c2ecf20Sopenharmony_ci#define EFX_PTP_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/net_tstamp.h>
138c2ecf20Sopenharmony_ci#include "net_driver.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct ethtool_ts_info;
168c2ecf20Sopenharmony_ciint efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel);
178c2ecf20Sopenharmony_civoid efx_ptp_defer_probe_with_channel(struct efx_nic *efx);
188c2ecf20Sopenharmony_cistruct efx_channel *efx_ptp_channel(struct efx_nic *efx);
198c2ecf20Sopenharmony_civoid efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel);
208c2ecf20Sopenharmony_civoid efx_ptp_remove(struct efx_nic *efx);
218c2ecf20Sopenharmony_ciint efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr);
228c2ecf20Sopenharmony_ciint efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr);
238c2ecf20Sopenharmony_civoid efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info);
248c2ecf20Sopenharmony_cibool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
258c2ecf20Sopenharmony_ciint efx_ptp_get_mode(struct efx_nic *efx);
268c2ecf20Sopenharmony_ciint efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
278c2ecf20Sopenharmony_ci			unsigned int new_mode);
288c2ecf20Sopenharmony_ciint efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
298c2ecf20Sopenharmony_civoid efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
308c2ecf20Sopenharmony_cisize_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings);
318c2ecf20Sopenharmony_cisize_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats);
328c2ecf20Sopenharmony_civoid efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
338c2ecf20Sopenharmony_civoid __efx_rx_skb_attach_timestamp(struct efx_channel *channel,
348c2ecf20Sopenharmony_ci				   struct sk_buff *skb);
358c2ecf20Sopenharmony_cistatic inline void efx_rx_skb_attach_timestamp(struct efx_channel *channel,
368c2ecf20Sopenharmony_ci					       struct sk_buff *skb)
378c2ecf20Sopenharmony_ci{
388c2ecf20Sopenharmony_ci	if (channel->sync_events_state == SYNC_EVENTS_VALID)
398c2ecf20Sopenharmony_ci		__efx_rx_skb_attach_timestamp(channel, skb);
408c2ecf20Sopenharmony_ci}
418c2ecf20Sopenharmony_civoid efx_ptp_start_datapath(struct efx_nic *efx);
428c2ecf20Sopenharmony_civoid efx_ptp_stop_datapath(struct efx_nic *efx);
438c2ecf20Sopenharmony_cibool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx);
448c2ecf20Sopenharmony_ciktime_t efx_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue);
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#endif /* EFX_PTP_H */
47