cxgb4_ptp.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * This file is part of the Chelsio T4 Ethernet driver for Linux.
  3. *
  4. * Copyright (c) 2003-2017 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef __CXGB4_PTP_H__
  35. #define __CXGB4_PTP_H__
  36. /* Maximum parts-per-billion adjustment that is acceptable */
  37. #define MAX_PTP_FREQ_ADJ 1000000
  38. #define PTP_CLOCK_MAX_ADJTIME 10000000 /* 10 ms */
  39. #define PTP_MIN_LENGTH 63
  40. #define PTP_IN_TRANSMIT_PACKET_MAXNUM 240
  41. #define PTP_EVENT_PORT 319
  42. enum ptp_rx_filter_mode {
  43. PTP_TS_NONE = 0,
  44. PTP_TS_L2,
  45. PTP_TS_L4,
  46. PTP_TS_L2_L4
  47. };
  48. struct port_info;
  49. static inline bool cxgb4_xmit_with_hwtstamp(struct sk_buff *skb)
  50. {
  51. return skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP;
  52. }
  53. static inline void cxgb4_xmit_hwtstamp_pending(struct sk_buff *skb)
  54. {
  55. skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
  56. }
  57. void cxgb4_ptp_init(struct adapter *adap);
  58. void cxgb4_ptp_stop(struct adapter *adap);
  59. bool cxgb4_ptp_is_ptp_tx(struct sk_buff *skb);
  60. bool cxgb4_ptp_is_ptp_rx(struct sk_buff *skb);
  61. int cxgb4_ptprx_timestamping(struct port_info *pi, u8 port, u16 mode);
  62. int cxgb4_ptp_redirect_rx_packet(struct adapter *adap, struct port_info *pi);
  63. int cxgb4_ptp_txtype(struct adapter *adap, u8 port_id);
  64. void cxgb4_ptp_read_hwstamp(struct adapter *adap, struct port_info *pi);
  65. bool is_ptp_enabled(struct sk_buff *skb, struct net_device *dev);
  66. #endif /* __CXGB4_PTP_H__ */