1/* SPDX-License-Identifier: GPL-2.0-only */ 2/**************************************************************************** 3 * Driver for Solarflare network controllers and boards 4 * Copyright 2005-2006 Fen Systems Ltd. 5 * Copyright 2006-2013 Solarflare Communications Inc. 6 * Copyright 2019-2020 Xilinx Inc. 7 */ 8 9#ifndef EFX_PTP_H 10#define EFX_PTP_H 11 12#include <linux/net_tstamp.h> 13#include "net_driver.h" 14 15struct ethtool_ts_info; 16int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel); 17void efx_ptp_defer_probe_with_channel(struct efx_nic *efx); 18struct efx_channel *efx_ptp_channel(struct efx_nic *efx); 19void efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel); 20void efx_ptp_remove(struct efx_nic *efx); 21int efx_ptp_set_ts_config(struct efx_nic *efx, 22 struct kernel_hwtstamp_config *config, 23 struct netlink_ext_ack *extack); 24int efx_ptp_get_ts_config(struct efx_nic *efx, 25 struct kernel_hwtstamp_config *config); 26void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); 27bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); 28int efx_ptp_get_mode(struct efx_nic *efx); 29int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, 30 unsigned int new_mode); 31int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); 32void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); 33size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings); 34size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats); 35void efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev); 36void __efx_rx_skb_attach_timestamp(struct efx_channel *channel, 37 struct sk_buff *skb); 38static inline void efx_rx_skb_attach_timestamp(struct efx_channel *channel, 39 struct sk_buff *skb) 40{ 41 if (channel->sync_events_state == SYNC_EVENTS_VALID) 42 __efx_rx_skb_attach_timestamp(channel, skb); 43} 44void efx_ptp_start_datapath(struct efx_nic *efx); 45void efx_ptp_stop_datapath(struct efx_nic *efx); 46bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx); 47ktime_t efx_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue); 48 49#endif /* EFX_PTP_H */ 50