ptp.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef EFX_PTP_H
  9. #define EFX_PTP_H
  10. #include <linux/net_tstamp.h>
  11. #include "net_driver.h"
  12. struct ethtool_ts_info;
  13. int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel);
  14. void efx_ptp_defer_probe_with_channel(struct efx_nic *efx);
  15. struct efx_channel *efx_ptp_channel(struct efx_nic *efx);
  16. void efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel);
  17. void efx_ptp_remove(struct efx_nic *efx);
  18. int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr);
  19. int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr);
  20. void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info);
  21. bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
  22. int efx_ptp_get_mode(struct efx_nic *efx);
  23. int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
  24. unsigned int new_mode);
  25. int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
  26. void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
  27. size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings);
  28. size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats);
  29. void efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
  30. void __efx_rx_skb_attach_timestamp(struct efx_channel *channel,
  31. struct sk_buff *skb);
  32. static inline void efx_rx_skb_attach_timestamp(struct efx_channel *channel,
  33. struct sk_buff *skb)
  34. {
  35. if (channel->sync_events_state == SYNC_EVENTS_VALID)
  36. __efx_rx_skb_attach_timestamp(channel, skb);
  37. }
  38. void efx_ptp_start_datapath(struct efx_nic *efx);
  39. void efx_ptp_stop_datapath(struct efx_nic *efx);
  40. bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx);
  41. ktime_t efx_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue);
  42. #endif /* EFX_PTP_H */