mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 15:12:45 +07:00
e1f24a79f4
This patch adds support to query the congestion related hardware counters through new command and links them with other hw counters being available in hw_counters sysfs location. In order to reuse existing infrastructure it renames related q_counter data structures to more generic counters to reflect q_counters and congestion counters and maybe some other counters in the future. New hardware counters: * rp_cnp_handled - CNP packets handled by the reaction point * rp_cnp_ignored - CNP packets ignored by the reaction point * np_cnp_sent - CNP packets sent by notification point to respond to CE marked RoCE packets * np_ecn_marked_roce_packets - CE marked RoCE packets received by notification point It also avoids returning ENOSYS which is specific for invalid system call and produces the following checkpatch.pl warning. WARNING: ENOSYS means 'invalid syscall nr' and nothing else + return -ENOSYS; Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Eli Cohen <eli@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
60 lines
2.2 KiB
C
60 lines
2.2 KiB
C
/*
|
|
* Copyright (c) 2017, 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.
|
|
*/
|
|
|
|
#include "cmd.h"
|
|
|
|
int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey)
|
|
{
|
|
u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {};
|
|
u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {};
|
|
int err;
|
|
|
|
MLX5_SET(query_special_contexts_in, in, opcode,
|
|
MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS);
|
|
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
|
if (!err)
|
|
*null_mkey = MLX5_GET(query_special_contexts_out, out,
|
|
null_mkey);
|
|
return err;
|
|
}
|
|
|
|
int mlx5_cmd_query_cong_counter(struct mlx5_core_dev *dev,
|
|
bool reset, void *out, int out_size)
|
|
{
|
|
u32 in[MLX5_ST_SZ_DW(query_cong_statistics_in)] = { };
|
|
|
|
MLX5_SET(query_cong_statistics_in, in, opcode,
|
|
MLX5_CMD_OP_QUERY_CONG_STATISTICS);
|
|
MLX5_SET(query_cong_statistics_in, in, clear, reset);
|
|
return mlx5_cmd_exec(dev, in, sizeof(in), out, out_size);
|
|
}
|