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 #ifndef __MLX5_FPGA_H__
0034 #define __MLX5_FPGA_H__
0035
0036 #include <linux/mlx5/driver.h>
0037
0038 enum mlx5_fpga_id {
0039 MLX5_FPGA_NEWTON = 0,
0040 MLX5_FPGA_EDISON = 1,
0041 MLX5_FPGA_MORSE = 2,
0042 MLX5_FPGA_MORSEQ = 3,
0043 };
0044
0045 enum mlx5_fpga_image {
0046 MLX5_FPGA_IMAGE_USER = 0,
0047 MLX5_FPGA_IMAGE_FACTORY,
0048 };
0049
0050 enum mlx5_fpga_status {
0051 MLX5_FPGA_STATUS_SUCCESS = 0,
0052 MLX5_FPGA_STATUS_FAILURE = 1,
0053 MLX5_FPGA_STATUS_IN_PROGRESS = 2,
0054 MLX5_FPGA_STATUS_NONE = 0xFFFF,
0055 };
0056
0057 struct mlx5_fpga_query {
0058 enum mlx5_fpga_image admin_image;
0059 enum mlx5_fpga_image oper_image;
0060 enum mlx5_fpga_status status;
0061 };
0062
0063 enum mlx5_fpga_qpc_field_select {
0064 MLX5_FPGA_QPC_STATE = BIT(0),
0065 };
0066
0067 struct mlx5_fpga_qp_counters {
0068 u64 rx_ack_packets;
0069 u64 rx_send_packets;
0070 u64 tx_ack_packets;
0071 u64 tx_send_packets;
0072 u64 rx_total_drop;
0073 };
0074
0075 int mlx5_fpga_caps(struct mlx5_core_dev *dev);
0076 int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query);
0077 int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op);
0078 int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr,
0079 void *buf, bool write);
0080 int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void *caps, int size);
0081
0082 int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc,
0083 u32 *fpga_qpn);
0084 int mlx5_fpga_modify_qp(struct mlx5_core_dev *dev, u32 fpga_qpn,
0085 enum mlx5_fpga_qpc_field_select fields, void *fpga_qpc);
0086 int mlx5_fpga_query_qp(struct mlx5_core_dev *dev, u32 fpga_qpn, void *fpga_qpc);
0087 int mlx5_fpga_query_qp_counters(struct mlx5_core_dev *dev, u32 fpga_qpn,
0088 bool clear, struct mlx5_fpga_qp_counters *data);
0089 int mlx5_fpga_destroy_qp(struct mlx5_core_dev *dev, u32 fpga_qpn);
0090
0091 #endif