1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020 Mellanox Technologies. */
4 #ifndef __MLX5_EN_PTP_H__
5 #define __MLX5_EN_PTP_H__
11 struct mlx5e_txqsq txqsq;
12 struct mlx5e_cq ts_cq;
15 struct mlx5e_skb_fifo skb_fifo;
16 struct mlx5e_ptp_cq_stats *cq_stats;
22 MLX5E_PTP_STATE_NUM_STATES,
27 struct mlx5e_ptpsq ptpsq[MLX5E_MAX_NUM_TC];
29 struct napi_struct napi;
31 struct net_device *netdev;
36 /* data path - accessed per napi poll */
37 struct mlx5e_ch_stats *stats;
40 struct mlx5e_priv *priv;
41 struct mlx5_core_dev *mdev;
42 struct hwtstamp_config *tstamp;
43 DECLARE_BITMAP(state, MLX5E_PTP_STATE_NUM_STATES);
46 int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
47 u8 lag_port, struct mlx5e_ptp **cp);
48 void mlx5e_ptp_close(struct mlx5e_ptp *c);
49 void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c);
50 void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c);
51 int mlx5e_ptp_get_rqn(struct mlx5e_ptp *c, u32 *rqn);
52 int mlx5e_ptp_alloc_rx_fs(struct mlx5e_priv *priv);
53 void mlx5e_ptp_free_rx_fs(struct mlx5e_priv *priv);
54 int mlx5e_ptp_rx_manage_fs(struct mlx5e_priv *priv, bool set);
57 MLX5E_SKB_CB_CQE_HWTSTAMP = BIT(0),
58 MLX5E_SKB_CB_PORT_HWTSTAMP = BIT(1),
61 void mlx5e_skb_cb_hwtstamp_handler(struct sk_buff *skb, int hwtstamp_type,
63 struct mlx5e_ptp_cq_stats *cq_stats);
65 void mlx5e_skb_cb_hwtstamp_init(struct sk_buff *skb);
66 #endif /* __MLX5_EN_PTP_H__ */