1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #ifndef __MLX5_FPGA_H__
34 #define __MLX5_FPGA_H__
35
36 #include <linux/mlx5/driver.h>
37
38 enum mlx5_fpga_device_id {
39 MLX5_FPGA_DEVICE_UNKNOWN = 0,
40 MLX5_FPGA_DEVICE_KU040 = 1,
41 MLX5_FPGA_DEVICE_KU060 = 2,
42 MLX5_FPGA_DEVICE_KU060_2 = 3,
43 };
44
45 enum mlx5_fpga_image {
46 MLX5_FPGA_IMAGE_USER = 0,
47 MLX5_FPGA_IMAGE_FACTORY,
48 };
49
50 enum mlx5_fpga_status {
51 MLX5_FPGA_STATUS_SUCCESS = 0,
52 MLX5_FPGA_STATUS_FAILURE = 1,
53 MLX5_FPGA_STATUS_IN_PROGRESS = 2,
54 MLX5_FPGA_STATUS_NONE = 0xFFFF,
55 };
56
57 struct mlx5_fpga_query {
58 enum mlx5_fpga_image admin_image;
59 enum mlx5_fpga_image oper_image;
60 enum mlx5_fpga_status status;
61 };
62
63 enum mlx5_fpga_qpc_field_select {
64 MLX5_FPGA_QPC_STATE = BIT(0),
65 };
66
67 struct mlx5_fpga_qp_counters {
68 u64 rx_ack_packets;
69 u64 rx_send_packets;
70 u64 tx_ack_packets;
71 u64 tx_send_packets;
72 u64 rx_total_drop;
73 };
74
75 int mlx5_fpga_caps(struct mlx5_core_dev *dev);
76 int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query);
77 int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op);
78 int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr,
79 void *buf, bool write);
80 int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void *caps, int size);
81
82 int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc,
83 u32 *fpga_qpn);
84 int mlx5_fpga_modify_qp(struct mlx5_core_dev *dev, u32 fpga_qpn,
85 enum mlx5_fpga_qpc_field_select fields, void *fpga_qpc);
86 int mlx5_fpga_query_qp(struct mlx5_core_dev *dev, u32 fpga_qpn, void *fpga_qpc);
87 int mlx5_fpga_query_qp_counters(struct mlx5_core_dev *dev, u32 fpga_qpn,
88 bool clear, struct mlx5_fpga_qp_counters *data);
89 int mlx5_fpga_destroy_qp(struct mlx5_core_dev *dev, u32 fpga_qpn);
90
91 #endif