qp.c (e4da3fbfbd1de56d2367653e3823e6445e49f8a9) qp.c (f9baff509f8a05a79626defdbdf4f4aa4efd373b)
1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved.
4 * Copyright (c) 2005, 2006, 2007, 2008 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU

--- 105 unchanged lines hidden (view full) ---

114 int ret = 0;
115
116 if (cur_state >= MLX4_QP_NUM_STATE || new_state >= MLX4_QP_NUM_STATE ||
117 !op[cur_state][new_state])
118 return -EINVAL;
119
120 if (op[cur_state][new_state] == MLX4_CMD_2RST_QP)
121 return mlx4_cmd(dev, 0, qp->qpn, 2,
1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved.
4 * Copyright (c) 2005, 2006, 2007, 2008 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU

--- 105 unchanged lines hidden (view full) ---

114 int ret = 0;
115
116 if (cur_state >= MLX4_QP_NUM_STATE || new_state >= MLX4_QP_NUM_STATE ||
117 !op[cur_state][new_state])
118 return -EINVAL;
119
120 if (op[cur_state][new_state] == MLX4_CMD_2RST_QP)
121 return mlx4_cmd(dev, 0, qp->qpn, 2,
122 MLX4_CMD_2RST_QP, MLX4_CMD_TIME_CLASS_A);
122 MLX4_CMD_2RST_QP, MLX4_CMD_TIME_CLASS_A,
123 MLX4_CMD_WRAPPED);
123
124 mailbox = mlx4_alloc_cmd_mailbox(dev);
125 if (IS_ERR(mailbox))
126 return PTR_ERR(mailbox);
127
128 if (cur_state == MLX4_QP_STATE_RST && new_state == MLX4_QP_STATE_INIT) {
129 u64 mtt_addr = mlx4_mtt_addr(dev, mtt);
130 context->mtt_base_addr_h = mtt_addr >> 32;

--- 4 unchanged lines hidden (view full) ---

135 *(__be32 *) mailbox->buf = cpu_to_be32(optpar);
136 memcpy(mailbox->buf + 8, context, sizeof *context);
137
138 ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn =
139 cpu_to_be32(qp->qpn);
140
141 ret = mlx4_cmd(dev, mailbox->dma, qp->qpn | (!!sqd_event << 31),
142 new_state == MLX4_QP_STATE_RST ? 2 : 0,
124
125 mailbox = mlx4_alloc_cmd_mailbox(dev);
126 if (IS_ERR(mailbox))
127 return PTR_ERR(mailbox);
128
129 if (cur_state == MLX4_QP_STATE_RST && new_state == MLX4_QP_STATE_INIT) {
130 u64 mtt_addr = mlx4_mtt_addr(dev, mtt);
131 context->mtt_base_addr_h = mtt_addr >> 32;

--- 4 unchanged lines hidden (view full) ---

136 *(__be32 *) mailbox->buf = cpu_to_be32(optpar);
137 memcpy(mailbox->buf + 8, context, sizeof *context);
138
139 ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn =
140 cpu_to_be32(qp->qpn);
141
142 ret = mlx4_cmd(dev, mailbox->dma, qp->qpn | (!!sqd_event << 31),
143 new_state == MLX4_QP_STATE_RST ? 2 : 0,
143 op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C);
144 op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C,
145 MLX4_CMD_WRAPPED);
144
145 mlx4_free_cmd_mailbox(dev, mailbox);
146 return ret;
147}
148EXPORT_SYMBOL_GPL(mlx4_qp_modify);
149
150int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base)
151{

--- 108 unchanged lines hidden (view full) ---

260 mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn);
261 mlx4_table_put(dev, &qp_table->qp_table, qp->qpn);
262}
263EXPORT_SYMBOL_GPL(mlx4_qp_free);
264
265static int mlx4_CONF_SPECIAL_QP(struct mlx4_dev *dev, u32 base_qpn)
266{
267 return mlx4_cmd(dev, 0, base_qpn, 0, MLX4_CMD_CONF_SPECIAL_QP,
146
147 mlx4_free_cmd_mailbox(dev, mailbox);
148 return ret;
149}
150EXPORT_SYMBOL_GPL(mlx4_qp_modify);
151
152int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base)
153{

--- 108 unchanged lines hidden (view full) ---

262 mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn);
263 mlx4_table_put(dev, &qp_table->qp_table, qp->qpn);
264}
265EXPORT_SYMBOL_GPL(mlx4_qp_free);
266
267static int mlx4_CONF_SPECIAL_QP(struct mlx4_dev *dev, u32 base_qpn)
268{
269 return mlx4_cmd(dev, 0, base_qpn, 0, MLX4_CMD_CONF_SPECIAL_QP,
268 MLX4_CMD_TIME_CLASS_B);
270 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE);
269}
270
271int mlx4_init_qp_table(struct mlx4_dev *dev)
272{
273 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
274 int err;
275 int reserved_from_top = 0;
276

--- 60 unchanged lines hidden (view full) ---

337 struct mlx4_cmd_mailbox *mailbox;
338 int err;
339
340 mailbox = mlx4_alloc_cmd_mailbox(dev);
341 if (IS_ERR(mailbox))
342 return PTR_ERR(mailbox);
343
344 err = mlx4_cmd_box(dev, 0, mailbox->dma, qp->qpn, 0,
271}
272
273int mlx4_init_qp_table(struct mlx4_dev *dev)
274{
275 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
276 int err;
277 int reserved_from_top = 0;
278

--- 60 unchanged lines hidden (view full) ---

339 struct mlx4_cmd_mailbox *mailbox;
340 int err;
341
342 mailbox = mlx4_alloc_cmd_mailbox(dev);
343 if (IS_ERR(mailbox))
344 return PTR_ERR(mailbox);
345
346 err = mlx4_cmd_box(dev, 0, mailbox->dma, qp->qpn, 0,
345 MLX4_CMD_QUERY_QP, MLX4_CMD_TIME_CLASS_A);
347 MLX4_CMD_QUERY_QP, MLX4_CMD_TIME_CLASS_A,
348 MLX4_CMD_WRAPPED);
346 if (!err)
347 memcpy(context, mailbox->buf + 8, sizeof *context);
348
349 mlx4_free_cmd_mailbox(dev, mailbox);
350 return err;
351}
352EXPORT_SYMBOL_GPL(mlx4_qp_query);
353

--- 31 unchanged lines hidden ---
349 if (!err)
350 memcpy(context, mailbox->buf + 8, sizeof *context);
351
352 mlx4_free_cmd_mailbox(dev, mailbox);
353 return err;
354}
355EXPORT_SYMBOL_GPL(mlx4_qp_query);
356

--- 31 unchanged lines hidden ---