/* * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
*/
static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp, int index, int *is_str)
{ int outlen = MLX5_ST_SZ_BYTES(query_qp_out);
u32 in[MLX5_ST_SZ_DW(query_qp_in)] = {};
u64 param = 0;
u32 *out; int state;
u32 *qpc; int err;
out = kzalloc(outlen, GFP_KERNEL); if (!out) return 0;
MLX5_SET(query_qp_in, in, opcode, MLX5_CMD_OP_QUERY_QP);
MLX5_SET(query_qp_in, in, qpn, qp->qpn);
err = mlx5_cmd_exec_inout(dev, query_qp, in, out); if (err) goto out;
*is_str = 0;
qpc = MLX5_ADDR_OF(query_qp_out, out, qpc); switch (index) { case QP_PID:
param = qp->pid; break; case QP_STATE:
state = MLX5_GET(qpc, qpc, state);
param = (unsignedlong)mlx5_qp_state_str(state);
*is_str = 1; break; case QP_XPORT:
param = (unsignedlong)mlx5_qp_type_str(MLX5_GET(qpc, qpc, st));
*is_str = 1; break; case QP_MTU: switch (MLX5_GET(qpc, qpc, mtu)) { case IB_MTU_256:
param = 256; break; case IB_MTU_512:
param = 512; break; case IB_MTU_1024:
param = 1024; break; case IB_MTU_2048:
param = 2048; break; case IB_MTU_4096:
param = 4096; break; default:
param = 0;
} break; case QP_N_RECV:
param = 1 << MLX5_GET(qpc, qpc, log_rq_size); break; case QP_RECV_SZ:
param = 1 << (MLX5_GET(qpc, qpc, log_rq_stride) + 4); break; case QP_N_SEND: if (!MLX5_GET(qpc, qpc, no_sq))
param = 1 << MLX5_GET(qpc, qpc, log_sq_size); break; case QP_LOG_PG_SZ:
param = MLX5_GET(qpc, qpc, log_page_size) + 12; break; case QP_RQPN:
param = MLX5_GET(qpc, qpc, remote_qpn); break;
}
out:
kfree(out); return param;
}
static u64 eq_read_field(struct mlx5_core_dev *dev, struct mlx5_eq *eq, int index)
{ int outlen = MLX5_ST_SZ_BYTES(query_eq_out);
u32 in[MLX5_ST_SZ_DW(query_eq_in)] = {};
u64 param = 0; void *ctx;
u32 *out; int err;
out = kzalloc(outlen, GFP_KERNEL); if (!out) return param;
MLX5_SET(query_eq_in, in, opcode, MLX5_CMD_OP_QUERY_EQ);
MLX5_SET(query_eq_in, in, eq_number, eq->eqn);
err = mlx5_cmd_exec_inout(dev, query_eq, in, out); if (err) {
mlx5_core_warn(dev, "failed to query eq\n"); goto out;
}
ctx = MLX5_ADDR_OF(query_eq_out, out, eq_context_entry);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.