Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /* QLogic qede NIC Driver
0003  * Copyright (c) 2015-2017  QLogic Corporation
0004  * Copyright (c) 2019-2020 Marvell International Ltd.
0005  */
0006 
0007 #ifndef _QEDE_PTP_H_
0008 #define _QEDE_PTP_H_
0009 
0010 #include <linux/ptp_clock_kernel.h>
0011 #include <linux/net_tstamp.h>
0012 #include <linux/timecounter.h>
0013 #include "qede.h"
0014 
0015 void qede_ptp_rx_ts(struct qede_dev *edev, struct sk_buff *skb);
0016 void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);
0017 int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *req);
0018 void qede_ptp_disable(struct qede_dev *edev);
0019 int qede_ptp_enable(struct qede_dev *edev);
0020 int qede_ptp_get_ts_info(struct qede_dev *edev, struct ethtool_ts_info *ts);
0021 
0022 static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,
0023                      union eth_rx_cqe *cqe,
0024                      struct sk_buff *skb)
0025 {
0026     /* Check if this packet was timestamped */
0027     if (unlikely(le16_to_cpu(cqe->fast_path_regular.pars_flags.flags) &
0028              (1 << PARSING_AND_ERR_FLAGS_TIMESTAMPRECORDED_SHIFT))) {
0029         if (likely(le16_to_cpu(cqe->fast_path_regular.pars_flags.flags)
0030             & (1 << PARSING_AND_ERR_FLAGS_TIMESYNCPKT_SHIFT))) {
0031             qede_ptp_rx_ts(edev, skb);
0032         } else {
0033             DP_INFO(edev,
0034                 "Timestamp recorded for non PTP packets\n");
0035         }
0036     }
0037 }
0038 #endif /* _QEDE_PTP_H_ */