diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2014-02-23 07:19:06 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-03-07 14:26:49 -0500 |
commit | 3121e3c441b5eccdd15e6c320ec32215b334b9ec (patch) | |
tree | caee56913d52fd2019ff11fcb7ce3af2d765eb36 /drivers/net/ethernet/mellanox/mlx5 | |
parent | 1b01d33560e78417334c2dc673bbfac6c644424c (diff) |
mlx5: Implement create_mr and destroy_mr
Support create_mr and destroy_mr verbs. Creating ib_mr may be done
for either ib_mr that will register regular page lists like
alloc_fast_reg_mr routine, or indirect ib_mrs that can register other
(pre-registered) ib_mrs in an indirect manner.
In addition user may request signature enable, that will mean that the
created ib_mr may be attached with signature attributes (BSF, PSVs).
Currently we only allow direct/indirect registration modes.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/mr.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c index 35e514dc7b7d..bb746bbe73c6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c | |||
@@ -144,3 +144,64 @@ int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, | |||
144 | return err; | 144 | return err; |
145 | } | 145 | } |
146 | EXPORT_SYMBOL(mlx5_core_dump_fill_mkey); | 146 | EXPORT_SYMBOL(mlx5_core_dump_fill_mkey); |
147 | |||
148 | int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, | ||
149 | int npsvs, u32 *sig_index) | ||
150 | { | ||
151 | struct mlx5_allocate_psv_in in; | ||
152 | struct mlx5_allocate_psv_out out; | ||
153 | int i, err; | ||
154 | |||
155 | if (npsvs > MLX5_MAX_PSVS) | ||
156 | return -EINVAL; | ||
157 | |||
158 | memset(&in, 0, sizeof(in)); | ||
159 | memset(&out, 0, sizeof(out)); | ||
160 | |||
161 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_CREATE_PSV); | ||
162 | in.npsv_pd = cpu_to_be32((npsvs << 28) | pdn); | ||
163 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | ||
164 | if (err) { | ||
165 | mlx5_core_err(dev, "cmd exec failed %d\n", err); | ||
166 | return err; | ||
167 | } | ||
168 | |||
169 | if (out.hdr.status) { | ||
170 | mlx5_core_err(dev, "create_psv bad status %d\n", out.hdr.status); | ||
171 | return mlx5_cmd_status_to_err(&out.hdr); | ||
172 | } | ||
173 | |||
174 | for (i = 0; i < npsvs; i++) | ||
175 | sig_index[i] = be32_to_cpu(out.psv_idx[i]) & 0xffffff; | ||
176 | |||
177 | return err; | ||
178 | } | ||
179 | EXPORT_SYMBOL(mlx5_core_create_psv); | ||
180 | |||
181 | int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num) | ||
182 | { | ||
183 | struct mlx5_destroy_psv_in in; | ||
184 | struct mlx5_destroy_psv_out out; | ||
185 | int err; | ||
186 | |||
187 | memset(&in, 0, sizeof(in)); | ||
188 | memset(&out, 0, sizeof(out)); | ||
189 | |||
190 | in.psv_number = cpu_to_be32(psv_num); | ||
191 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_PSV); | ||
192 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | ||
193 | if (err) { | ||
194 | mlx5_core_err(dev, "destroy_psv cmd exec failed %d\n", err); | ||
195 | goto out; | ||
196 | } | ||
197 | |||
198 | if (out.hdr.status) { | ||
199 | mlx5_core_err(dev, "destroy_psv bad status %d\n", out.hdr.status); | ||
200 | err = mlx5_cmd_status_to_err(&out.hdr); | ||
201 | goto out; | ||
202 | } | ||
203 | |||
204 | out: | ||
205 | return err; | ||
206 | } | ||
207 | EXPORT_SYMBOL(mlx5_core_destroy_psv); | ||