Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / drivers / infiniband / hw / i40iw / i40iw_virtchnl.h
1 /*******************************************************************************
2 *
3 * Copyright (c) 2015-2016 Intel Corporation.  All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses.  You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenFabrics.org BSD license below:
10 *
11 *   Redistribution and use in source and binary forms, with or
12 *   without modification, are permitted provided that the following
13 *   conditions are met:
14 *
15 *    - Redistributions of source code must retain the above
16 *       copyright notice, this list of conditions and the following
17 *       disclaimer.
18 *
19 *    - Redistributions in binary form must reproduce the above
20 *       copyright notice, this list of conditions and the following
21 *       disclaimer in the documentation and/or other materials
22 *       provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 *******************************************************************************/
34
35 #ifndef I40IW_VIRTCHNL_H
36 #define I40IW_VIRTCHNL_H
37
38 #include "i40iw_hmc.h"
39
40 #pragma pack(push, 1)
41
42 struct i40iw_virtchnl_op_buf {
43         u16 iw_op_code;
44         u16 iw_op_ver;
45         u16 iw_chnl_buf_len;
46         u16 rsvd;
47         u64 iw_chnl_op_ctx;
48         /* Member alignment MUST be maintained above this location */
49         u8 iw_chnl_buf[1];
50 };
51
52 struct i40iw_virtchnl_resp_buf {
53         u64 iw_chnl_op_ctx;
54         u16 iw_chnl_buf_len;
55         s16 iw_op_ret_code;
56         /* Member alignment MUST be maintained above this location */
57         u16 rsvd[2];
58         u8 iw_chnl_buf[1];
59 };
60
61 enum i40iw_virtchnl_ops {
62         I40IW_VCHNL_OP_GET_VER = 0,
63         I40IW_VCHNL_OP_GET_HMC_FCN,
64         I40IW_VCHNL_OP_ADD_HMC_OBJ_RANGE,
65         I40IW_VCHNL_OP_DEL_HMC_OBJ_RANGE,
66         I40IW_VCHNL_OP_GET_STATS
67 };
68
69 #define I40IW_VCHNL_OP_GET_VER_V0 0
70 #define I40IW_VCHNL_OP_GET_HMC_FCN_V0 0
71 #define I40IW_VCHNL_OP_ADD_HMC_OBJ_RANGE_V0 0
72 #define I40IW_VCHNL_OP_DEL_HMC_OBJ_RANGE_V0 0
73 #define I40IW_VCHNL_OP_GET_STATS_V0 0
74 #define I40IW_VCHNL_CHNL_VER_V0 0
75
76 struct i40iw_dev_hw_stats;
77
78 struct i40iw_virtchnl_hmc_obj_range {
79         u16 obj_type;
80         u16 rsvd;
81         u32 start_index;
82         u32 obj_count;
83 };
84
85 enum i40iw_status_code i40iw_vchnl_recv_pf(struct i40iw_sc_dev *dev,
86                                            u32 vf_id,
87                                            u8 *msg,
88                                            u16 len);
89
90 enum i40iw_status_code i40iw_vchnl_recv_vf(struct i40iw_sc_dev *dev,
91                                            u32 vf_id,
92                                            u8 *msg,
93                                            u16 len);
94
95 struct i40iw_virtchnl_req {
96         struct i40iw_sc_dev *dev;
97         struct i40iw_virtchnl_op_buf *vchnl_msg;
98         void *parm;
99         u32 vf_id;
100         u16 parm_len;
101         s16 ret_code;
102 };
103
104 #pragma pack(pop)
105
106 enum i40iw_status_code i40iw_vchnl_vf_get_ver(struct i40iw_sc_dev *dev,
107                                               u32 *vchnl_ver);
108
109 enum i40iw_status_code i40iw_vchnl_vf_get_hmc_fcn(struct i40iw_sc_dev *dev,
110                                                   u16 *hmc_fcn);
111
112 enum i40iw_status_code i40iw_vchnl_vf_add_hmc_objs(struct i40iw_sc_dev *dev,
113                                                    enum i40iw_hmc_rsrc_type rsrc_type,
114                                                    u32 start_index,
115                                                    u32 rsrc_count);
116
117 enum i40iw_status_code i40iw_vchnl_vf_del_hmc_obj(struct i40iw_sc_dev *dev,
118                                                   enum i40iw_hmc_rsrc_type rsrc_type,
119                                                   u32 start_index,
120                                                   u32 rsrc_count);
121
122 enum i40iw_status_code i40iw_vchnl_vf_get_pe_stats(struct i40iw_sc_dev *dev,
123                                                    struct i40iw_dev_hw_stats *hw_stats);
124 #endif