2 * This file is part of the Chelsio T4 Ethernet driver for Linux.
4 * Copyright (c) 2003-2017 Chelsio Communications, Inc. All rights reserved.
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:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
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.
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
35 #ifndef __CXGB4_PTP_H__
36 #define __CXGB4_PTP_H__
38 /* Maximum parts-per-billion adjustment that is acceptable */
39 #define MAX_PTP_FREQ_ADJ 1000000
40 #define PTP_CLOCK_MAX_ADJTIME 10000000 /* 10 ms */
42 #define PTP_MIN_LENGTH 63
43 #define PTP_IN_TRANSMIT_PACKET_MAXNUM 240
44 #define PTP_EVENT_PORT 319
46 enum ptp_rx_filter_mode
{
55 static inline bool cxgb4_xmit_with_hwtstamp(struct sk_buff
*skb
)
57 return skb_shinfo(skb
)->tx_flags
& SKBTX_HW_TSTAMP
;
60 static inline void cxgb4_xmit_hwtstamp_pending(struct sk_buff
*skb
)
62 skb_shinfo(skb
)->tx_flags
|= SKBTX_IN_PROGRESS
;
65 void cxgb4_ptp_init(struct adapter
*adap
);
66 void cxgb4_ptp_stop(struct adapter
*adap
);
67 bool cxgb4_ptp_is_ptp_tx(struct sk_buff
*skb
);
68 bool cxgb4_ptp_is_ptp_rx(struct sk_buff
*skb
);
69 int cxgb4_ptprx_timestamping(struct port_info
*pi
, u8 port
, u16 mode
);
70 int cxgb4_ptp_redirect_rx_packet(struct adapter
*adap
, struct port_info
*pi
);
71 int cxgb4_ptp_txtype(struct adapter
*adap
, u8 port_id
);
72 void cxgb4_ptp_read_hwstamp(struct adapter
*adap
, struct port_info
*pi
);
73 bool is_ptp_enabled(struct sk_buff
*skb
, struct net_device
*dev
);
74 #endif /* __CXGB4_PTP_H__ */