162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is part of the Chelsio T4 Ethernet driver for Linux. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright (c) 2003-2017 Chelsio Communications, Inc. All rights reserved. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * This software is available to you under a choice of one of two 762306a36Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 862306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 962306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the 1062306a36Sopenharmony_ci * OpenIB.org BSD license below: 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or 1362306a36Sopenharmony_ci * without modification, are permitted provided that the following 1462306a36Sopenharmony_ci * conditions are met: 1562306a36Sopenharmony_ci * 1662306a36Sopenharmony_ci * - Redistributions of source code must retain the above 1762306a36Sopenharmony_ci * copyright notice, this list of conditions and the following 1862306a36Sopenharmony_ci * disclaimer. 1962306a36Sopenharmony_ci * 2062306a36Sopenharmony_ci * - Redistributions in binary form must reproduce the above 2162306a36Sopenharmony_ci * copyright notice, this list of conditions and the following 2262306a36Sopenharmony_ci * disclaimer in the documentation and/or other materials 2362306a36Sopenharmony_ci * provided with the distribution. 2462306a36Sopenharmony_ci * 2562306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 2662306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2762306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2862306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 2962306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 3062306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 3162306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3262306a36Sopenharmony_ci * SOFTWARE. 3362306a36Sopenharmony_ci */ 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#ifndef __CXGB4_PTP_H__ 3662306a36Sopenharmony_ci#define __CXGB4_PTP_H__ 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci/* Maximum parts-per-billion adjustment that is acceptable */ 3962306a36Sopenharmony_ci#define MAX_PTP_FREQ_ADJ 1000000 4062306a36Sopenharmony_ci#define PTP_CLOCK_MAX_ADJTIME 10000000 /* 10 ms */ 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define PTP_MIN_LENGTH 63 4362306a36Sopenharmony_ci#define PTP_IN_TRANSMIT_PACKET_MAXNUM 240 4462306a36Sopenharmony_ci#define PTP_EVENT_PORT 319 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_cienum ptp_rx_filter_mode { 4762306a36Sopenharmony_ci PTP_TS_NONE = 0, 4862306a36Sopenharmony_ci PTP_TS_L2, 4962306a36Sopenharmony_ci PTP_TS_L4, 5062306a36Sopenharmony_ci PTP_TS_L2_L4 5162306a36Sopenharmony_ci}; 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_cistruct port_info; 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_cistatic inline bool cxgb4_xmit_with_hwtstamp(struct sk_buff *skb) 5662306a36Sopenharmony_ci{ 5762306a36Sopenharmony_ci return skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP; 5862306a36Sopenharmony_ci} 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_cistatic inline void cxgb4_xmit_hwtstamp_pending(struct sk_buff *skb) 6162306a36Sopenharmony_ci{ 6262306a36Sopenharmony_ci skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 6362306a36Sopenharmony_ci} 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_civoid cxgb4_ptp_init(struct adapter *adap); 6662306a36Sopenharmony_civoid cxgb4_ptp_stop(struct adapter *adap); 6762306a36Sopenharmony_cibool cxgb4_ptp_is_ptp_tx(struct sk_buff *skb); 6862306a36Sopenharmony_cibool cxgb4_ptp_is_ptp_rx(struct sk_buff *skb); 6962306a36Sopenharmony_ciint cxgb4_ptprx_timestamping(struct port_info *pi, u8 port, u16 mode); 7062306a36Sopenharmony_ciint cxgb4_ptp_redirect_rx_packet(struct adapter *adap, struct port_info *pi); 7162306a36Sopenharmony_ciint cxgb4_ptp_txtype(struct adapter *adap, u8 port_id); 7262306a36Sopenharmony_civoid cxgb4_ptp_read_hwstamp(struct adapter *adap, struct port_info *pi); 7362306a36Sopenharmony_cibool is_ptp_enabled(struct sk_buff *skb, struct net_device *dev); 7462306a36Sopenharmony_ci#endif /* __CXGB4_PTP_H__ */ 75