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
34 #ifndef __MLX5_FPGA_CONN_H__
35 #define __MLX5_FPGA_CONN_H__
36
37 #include <linux/mlx5/cq.h>
38 #include <linux/mlx5/qp.h>
39
40 #include "fpga/core.h"
41 #include "fpga/sdk.h"
42 #include "wq.h"
43
44 struct mlx5_fpga_conn {
45 struct mlx5_fpga_device *fdev;
46
47 void (*recv_cb)(void *cb_arg, struct mlx5_fpga_dma_buf *buf);
48 void *cb_arg;
49
50
51 u32 fpga_qpc[MLX5_ST_SZ_DW(fpga_qpc)];
52 u32 fpga_qpn;
53
54
55 struct {
56 struct mlx5_cqwq wq;
57 struct mlx5_wq_ctrl wq_ctrl;
58 struct mlx5_core_cq mcq;
59 struct tasklet_struct tasklet;
60 } cq;
61
62
63 struct {
64 bool active;
65 int sgid_index;
66 struct mlx5_wq_qp wq;
67 struct mlx5_wq_ctrl wq_ctrl;
68 struct mlx5_core_qp mqp;
69 struct {
70 spinlock_t lock;
71 unsigned int pc;
72 unsigned int cc;
73 unsigned int size;
74 struct mlx5_fpga_dma_buf **bufs;
75 struct list_head backlog;
76 } sq;
77 struct {
78 unsigned int pc;
79 unsigned int cc;
80 unsigned int size;
81 struct mlx5_fpga_dma_buf **bufs;
82 } rq;
83 } qp;
84 };
85
86 int mlx5_fpga_conn_device_init(struct mlx5_fpga_device *fdev);
87 void mlx5_fpga_conn_device_cleanup(struct mlx5_fpga_device *fdev);
88 struct mlx5_fpga_conn *
89 mlx5_fpga_conn_create(struct mlx5_fpga_device *fdev,
90 struct mlx5_fpga_conn_attr *attr,
91 enum mlx5_ifc_fpga_qp_type qp_type);
92 void mlx5_fpga_conn_destroy(struct mlx5_fpga_conn *conn);
93 int mlx5_fpga_conn_send(struct mlx5_fpga_conn *conn,
94 struct mlx5_fpga_dma_buf *buf);
95
96 #endif