0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef __MLX5_FPGA_CONN_H__
0035 #define __MLX5_FPGA_CONN_H__
0036
0037 #include <linux/mlx5/cq.h>
0038 #include <linux/mlx5/qp.h>
0039
0040 #include "fpga/core.h"
0041 #include "fpga/sdk.h"
0042 #include "wq.h"
0043
0044 struct mlx5_fpga_conn {
0045 struct mlx5_fpga_device *fdev;
0046
0047 void (*recv_cb)(void *cb_arg, struct mlx5_fpga_dma_buf *buf);
0048 void *cb_arg;
0049
0050
0051 u32 fpga_qpc[MLX5_ST_SZ_DW(fpga_qpc)];
0052 u32 fpga_qpn;
0053
0054
0055 struct {
0056 struct mlx5_cqwq wq;
0057 struct mlx5_wq_ctrl wq_ctrl;
0058 struct mlx5_core_cq mcq;
0059 struct tasklet_struct tasklet;
0060 } cq;
0061
0062
0063 struct {
0064 bool active;
0065 int sgid_index;
0066 struct mlx5_wq_qp wq;
0067 struct mlx5_wq_ctrl wq_ctrl;
0068 u32 qpn;
0069 struct {
0070 spinlock_t lock;
0071 unsigned int pc;
0072 unsigned int cc;
0073 unsigned int size;
0074 struct mlx5_fpga_dma_buf **bufs;
0075 struct list_head backlog;
0076 } sq;
0077 struct {
0078 unsigned int pc;
0079 unsigned int cc;
0080 unsigned int size;
0081 struct mlx5_fpga_dma_buf **bufs;
0082 } rq;
0083 } qp;
0084 };
0085
0086 int mlx5_fpga_conn_device_init(struct mlx5_fpga_device *fdev);
0087 void mlx5_fpga_conn_device_cleanup(struct mlx5_fpga_device *fdev);
0088 struct mlx5_fpga_conn *
0089 mlx5_fpga_conn_create(struct mlx5_fpga_device *fdev,
0090 struct mlx5_fpga_conn_attr *attr,
0091 enum mlx5_ifc_fpga_qp_type qp_type);
0092 void mlx5_fpga_conn_destroy(struct mlx5_fpga_conn *conn);
0093 int mlx5_fpga_conn_send(struct mlx5_fpga_conn *conn,
0094 struct mlx5_fpga_dma_buf *buf);
0095
0096 #endif