18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is part of the Chelsio T4 Ethernet driver for Linux. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (c) 2003-2017 Chelsio Communications, Inc. All rights reserved. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 78c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 88c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 98c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the 108c2ecf20Sopenharmony_ci * OpenIB.org BSD license below: 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or 138c2ecf20Sopenharmony_ci * without modification, are permitted provided that the following 148c2ecf20Sopenharmony_ci * conditions are met: 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above 178c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 188c2ecf20Sopenharmony_ci * disclaimer. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above 218c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 228c2ecf20Sopenharmony_ci * disclaimer in the documentation and/or other materials 238c2ecf20Sopenharmony_ci * provided with the distribution. 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 268c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 278c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 288c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 298c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 308c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 318c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 328c2ecf20Sopenharmony_ci * SOFTWARE. 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#ifndef __CXGB4_PTP_H__ 368c2ecf20Sopenharmony_ci#define __CXGB4_PTP_H__ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* Maximum parts-per-billion adjustment that is acceptable */ 398c2ecf20Sopenharmony_ci#define MAX_PTP_FREQ_ADJ 1000000 408c2ecf20Sopenharmony_ci#define PTP_CLOCK_MAX_ADJTIME 10000000 /* 10 ms */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define PTP_MIN_LENGTH 63 438c2ecf20Sopenharmony_ci#define PTP_IN_TRANSMIT_PACKET_MAXNUM 240 448c2ecf20Sopenharmony_ci#define PTP_EVENT_PORT 319 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cienum ptp_rx_filter_mode { 478c2ecf20Sopenharmony_ci PTP_TS_NONE = 0, 488c2ecf20Sopenharmony_ci PTP_TS_L2, 498c2ecf20Sopenharmony_ci PTP_TS_L4, 508c2ecf20Sopenharmony_ci PTP_TS_L2_L4 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistruct port_info; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic inline bool cxgb4_xmit_with_hwtstamp(struct sk_buff *skb) 568c2ecf20Sopenharmony_ci{ 578c2ecf20Sopenharmony_ci return skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP; 588c2ecf20Sopenharmony_ci} 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cistatic inline void cxgb4_xmit_hwtstamp_pending(struct sk_buff *skb) 618c2ecf20Sopenharmony_ci{ 628c2ecf20Sopenharmony_ci skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 638c2ecf20Sopenharmony_ci} 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_civoid cxgb4_ptp_init(struct adapter *adap); 668c2ecf20Sopenharmony_civoid cxgb4_ptp_stop(struct adapter *adap); 678c2ecf20Sopenharmony_cibool cxgb4_ptp_is_ptp_tx(struct sk_buff *skb); 688c2ecf20Sopenharmony_cibool cxgb4_ptp_is_ptp_rx(struct sk_buff *skb); 698c2ecf20Sopenharmony_ciint cxgb4_ptprx_timestamping(struct port_info *pi, u8 port, u16 mode); 708c2ecf20Sopenharmony_ciint cxgb4_ptp_redirect_rx_packet(struct adapter *adap, struct port_info *pi); 718c2ecf20Sopenharmony_ciint cxgb4_ptp_txtype(struct adapter *adap, u8 port_id); 728c2ecf20Sopenharmony_civoid cxgb4_ptp_read_hwstamp(struct adapter *adap, struct port_info *pi); 738c2ecf20Sopenharmony_cibool is_ptp_enabled(struct sk_buff *skb, struct net_device *dev); 748c2ecf20Sopenharmony_ci#endif /* __CXGB4_PTP_H__ */ 75