162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/****************************************************************************
362306a36Sopenharmony_ci * Driver for Solarflare network controllers and boards
462306a36Sopenharmony_ci * Copyright 2005-2006 Fen Systems Ltd.
562306a36Sopenharmony_ci * Copyright 2006-2013 Solarflare Communications Inc.
662306a36Sopenharmony_ci * Copyright 2019-2020 Xilinx Inc.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef EFX_PTP_H
1062306a36Sopenharmony_ci#define EFX_PTP_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/net_tstamp.h>
1362306a36Sopenharmony_ci#include "net_driver.h"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct ethtool_ts_info;
1662306a36Sopenharmony_civoid efx_siena_ptp_defer_probe_with_channel(struct efx_nic *efx);
1762306a36Sopenharmony_cistruct efx_channel *efx_siena_ptp_channel(struct efx_nic *efx);
1862306a36Sopenharmony_ciint efx_siena_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr);
1962306a36Sopenharmony_ciint efx_siena_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr);
2062306a36Sopenharmony_civoid efx_siena_ptp_get_ts_info(struct efx_nic *efx,
2162306a36Sopenharmony_ci			       struct ethtool_ts_info *ts_info);
2262306a36Sopenharmony_cibool efx_siena_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
2362306a36Sopenharmony_ciint efx_siena_ptp_get_mode(struct efx_nic *efx);
2462306a36Sopenharmony_ciint efx_siena_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
2562306a36Sopenharmony_ci			      unsigned int new_mode);
2662306a36Sopenharmony_ciint efx_siena_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
2762306a36Sopenharmony_civoid efx_siena_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
2862306a36Sopenharmony_cisize_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings);
2962306a36Sopenharmony_cisize_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats);
3062306a36Sopenharmony_civoid efx_siena_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
3162306a36Sopenharmony_civoid __efx_siena_rx_skb_attach_timestamp(struct efx_channel *channel,
3262306a36Sopenharmony_ci					 struct sk_buff *skb);
3362306a36Sopenharmony_cistatic inline void efx_rx_skb_attach_timestamp(struct efx_channel *channel,
3462306a36Sopenharmony_ci					       struct sk_buff *skb)
3562306a36Sopenharmony_ci{
3662306a36Sopenharmony_ci	if (channel->sync_events_state == SYNC_EVENTS_VALID)
3762306a36Sopenharmony_ci		__efx_siena_rx_skb_attach_timestamp(channel, skb);
3862306a36Sopenharmony_ci}
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_civoid efx_siena_ptp_start_datapath(struct efx_nic *efx);
4162306a36Sopenharmony_civoid efx_siena_ptp_stop_datapath(struct efx_nic *efx);
4262306a36Sopenharmony_cibool efx_siena_ptp_use_mac_tx_timestamps(struct efx_nic *efx);
4362306a36Sopenharmony_ciktime_t efx_siena_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue);
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#endif /* EFX_PTP_H */
46