Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is part of the Chelsio T4 Ethernet driver for Linux.
0003  *
0004  * Copyright (c) 2003-2017 Chelsio Communications, Inc. All rights reserved.
0005  *
0006  * This software is available to you under a choice of one of two
0007  * licenses.  You may choose to be licensed under the terms of the GNU
0008  * General Public License (GPL) Version 2, available from the file
0009  * COPYING in the main directory of this source tree, or the
0010  * OpenIB.org BSD license below:
0011  *
0012  *     Redistribution and use in source and binary forms, with or
0013  *     without modification, are permitted provided that the following
0014  *     conditions are met:
0015  *
0016  *      - Redistributions of source code must retain the above
0017  *        copyright notice, this list of conditions and the following
0018  *        disclaimer.
0019  *
0020  *      - Redistributions in binary form must reproduce the above
0021  *        copyright notice, this list of conditions and the following
0022  *        disclaimer in the documentation and/or other materials
0023  *        provided with the distribution.
0024  *
0025  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0026  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0027  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0028  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0029  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0030  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0031  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0032  * SOFTWARE.
0033  */
0034 
0035 #ifndef __CXGB4_PTP_H__
0036 #define __CXGB4_PTP_H__
0037 
0038 /* Maximum parts-per-billion adjustment that is acceptable */
0039 #define MAX_PTP_FREQ_ADJ        1000000
0040 #define PTP_CLOCK_MAX_ADJTIME       10000000 /* 10 ms */
0041 
0042 #define PTP_MIN_LENGTH          63
0043 #define PTP_IN_TRANSMIT_PACKET_MAXNUM   240
0044 #define PTP_EVENT_PORT          319
0045 
0046 enum ptp_rx_filter_mode {
0047     PTP_TS_NONE = 0,
0048     PTP_TS_L2,
0049     PTP_TS_L4,
0050     PTP_TS_L2_L4
0051 };
0052 
0053 struct port_info;
0054 
0055 static inline bool cxgb4_xmit_with_hwtstamp(struct sk_buff *skb)
0056 {
0057     return skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP;
0058 }
0059 
0060 static inline void cxgb4_xmit_hwtstamp_pending(struct sk_buff *skb)
0061 {
0062     skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
0063 }
0064 
0065 void cxgb4_ptp_init(struct adapter *adap);
0066 void cxgb4_ptp_stop(struct adapter *adap);
0067 bool cxgb4_ptp_is_ptp_tx(struct sk_buff *skb);
0068 bool cxgb4_ptp_is_ptp_rx(struct sk_buff *skb);
0069 int cxgb4_ptprx_timestamping(struct port_info *pi, u8 port, u16 mode);
0070 int cxgb4_ptp_redirect_rx_packet(struct adapter *adap, struct port_info *pi);
0071 int cxgb4_ptp_txtype(struct adapter *adap, u8 port_id);
0072 void cxgb4_ptp_read_hwstamp(struct adapter *adap, struct port_info *pi);
0073 bool is_ptp_enabled(struct sk_buff *skb, struct net_device *dev);
0074 #endif /* __CXGB4_PTP_H__ */