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