mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-11-05 08:07:50 +10:00
RDMA/efa: Add Network HW statistics counters
Update device API and request network counters. Expose newly added counters through ib core counters mechanism. Reviewed-by: David Shoolman <shoolman@amazon.com> Reviewed-by: Yonatan Nachum <ynachum@amazon.com> Signed-off-by: Basel Nassar <baselna@amazon.com> Signed-off-by: Michael Margolin <mrgolin@amazon.com> Link: https://patch.msgid.link/20250706070740.22534-1-mrgolin@amazon.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
8ab05a5456
commit
475ac071ba
@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
|
||||
/*
|
||||
* Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
* Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _EFA_ADMIN_CMDS_H_
|
||||
@ -68,6 +68,7 @@ enum efa_admin_get_stats_type {
|
||||
EFA_ADMIN_GET_STATS_TYPE_MESSAGES = 1,
|
||||
EFA_ADMIN_GET_STATS_TYPE_RDMA_READ = 2,
|
||||
EFA_ADMIN_GET_STATS_TYPE_RDMA_WRITE = 3,
|
||||
EFA_ADMIN_GET_STATS_TYPE_NETWORK = 4,
|
||||
};
|
||||
|
||||
enum efa_admin_get_stats_scope {
|
||||
@ -651,6 +652,18 @@ struct efa_admin_rdma_write_stats {
|
||||
u64 write_recv_bytes;
|
||||
};
|
||||
|
||||
struct efa_admin_network_stats {
|
||||
u64 retrans_bytes;
|
||||
|
||||
u64 retrans_pkts;
|
||||
|
||||
u64 retrans_timeout_events;
|
||||
|
||||
u64 unresponsive_remote_events;
|
||||
|
||||
u64 impaired_remote_conn_events;
|
||||
};
|
||||
|
||||
struct efa_admin_acq_get_stats_resp {
|
||||
struct efa_admin_acq_common_desc acq_common_desc;
|
||||
|
||||
@ -662,6 +675,8 @@ struct efa_admin_acq_get_stats_resp {
|
||||
struct efa_admin_rdma_read_stats rdma_read_stats;
|
||||
|
||||
struct efa_admin_rdma_write_stats rdma_write_stats;
|
||||
|
||||
struct efa_admin_network_stats network_stats;
|
||||
} u;
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
|
||||
/*
|
||||
* Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
* Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "efa_com.h"
|
||||
@ -769,6 +769,11 @@ int efa_com_get_stats(struct efa_com_dev *edev,
|
||||
struct efa_com_admin_queue *aq = &edev->aq;
|
||||
struct efa_admin_aq_get_stats_cmd cmd = {};
|
||||
struct efa_admin_acq_get_stats_resp resp;
|
||||
struct efa_admin_rdma_write_stats *rws;
|
||||
struct efa_admin_rdma_read_stats *rrs;
|
||||
struct efa_admin_messages_stats *ms;
|
||||
struct efa_admin_network_stats *ns;
|
||||
struct efa_admin_basic_stats *bs;
|
||||
int err;
|
||||
|
||||
cmd.aq_common_descriptor.opcode = EFA_ADMIN_GET_STATS;
|
||||
@ -791,29 +796,41 @@ int efa_com_get_stats(struct efa_com_dev *edev,
|
||||
|
||||
switch (cmd.type) {
|
||||
case EFA_ADMIN_GET_STATS_TYPE_BASIC:
|
||||
result->basic_stats.tx_bytes = resp.u.basic_stats.tx_bytes;
|
||||
result->basic_stats.tx_pkts = resp.u.basic_stats.tx_pkts;
|
||||
result->basic_stats.rx_bytes = resp.u.basic_stats.rx_bytes;
|
||||
result->basic_stats.rx_pkts = resp.u.basic_stats.rx_pkts;
|
||||
result->basic_stats.rx_drops = resp.u.basic_stats.rx_drops;
|
||||
bs = &resp.u.basic_stats;
|
||||
result->basic_stats.tx_bytes = bs->tx_bytes;
|
||||
result->basic_stats.tx_pkts = bs->tx_pkts;
|
||||
result->basic_stats.rx_bytes = bs->rx_bytes;
|
||||
result->basic_stats.rx_pkts = bs->rx_pkts;
|
||||
result->basic_stats.rx_drops = bs->rx_drops;
|
||||
break;
|
||||
case EFA_ADMIN_GET_STATS_TYPE_MESSAGES:
|
||||
result->messages_stats.send_bytes = resp.u.messages_stats.send_bytes;
|
||||
result->messages_stats.send_wrs = resp.u.messages_stats.send_wrs;
|
||||
result->messages_stats.recv_bytes = resp.u.messages_stats.recv_bytes;
|
||||
result->messages_stats.recv_wrs = resp.u.messages_stats.recv_wrs;
|
||||
ms = &resp.u.messages_stats;
|
||||
result->messages_stats.send_bytes = ms->send_bytes;
|
||||
result->messages_stats.send_wrs = ms->send_wrs;
|
||||
result->messages_stats.recv_bytes = ms->recv_bytes;
|
||||
result->messages_stats.recv_wrs = ms->recv_wrs;
|
||||
break;
|
||||
case EFA_ADMIN_GET_STATS_TYPE_RDMA_READ:
|
||||
result->rdma_read_stats.read_wrs = resp.u.rdma_read_stats.read_wrs;
|
||||
result->rdma_read_stats.read_bytes = resp.u.rdma_read_stats.read_bytes;
|
||||
result->rdma_read_stats.read_wr_err = resp.u.rdma_read_stats.read_wr_err;
|
||||
result->rdma_read_stats.read_resp_bytes = resp.u.rdma_read_stats.read_resp_bytes;
|
||||
rrs = &resp.u.rdma_read_stats;
|
||||
result->rdma_read_stats.read_wrs = rrs->read_wrs;
|
||||
result->rdma_read_stats.read_bytes = rrs->read_bytes;
|
||||
result->rdma_read_stats.read_wr_err = rrs->read_wr_err;
|
||||
result->rdma_read_stats.read_resp_bytes = rrs->read_resp_bytes;
|
||||
break;
|
||||
case EFA_ADMIN_GET_STATS_TYPE_RDMA_WRITE:
|
||||
result->rdma_write_stats.write_wrs = resp.u.rdma_write_stats.write_wrs;
|
||||
result->rdma_write_stats.write_bytes = resp.u.rdma_write_stats.write_bytes;
|
||||
result->rdma_write_stats.write_wr_err = resp.u.rdma_write_stats.write_wr_err;
|
||||
result->rdma_write_stats.write_recv_bytes = resp.u.rdma_write_stats.write_recv_bytes;
|
||||
rws = &resp.u.rdma_write_stats;
|
||||
result->rdma_write_stats.write_wrs = rws->write_wrs;
|
||||
result->rdma_write_stats.write_bytes = rws->write_bytes;
|
||||
result->rdma_write_stats.write_wr_err = rws->write_wr_err;
|
||||
result->rdma_write_stats.write_recv_bytes = rws->write_recv_bytes;
|
||||
break;
|
||||
case EFA_ADMIN_GET_STATS_TYPE_NETWORK:
|
||||
ns = &resp.u.network_stats;
|
||||
result->network_stats.retrans_bytes = ns->retrans_bytes;
|
||||
result->network_stats.retrans_pkts = ns->retrans_pkts;
|
||||
result->network_stats.retrans_timeout_events = ns->retrans_timeout_events;
|
||||
result->network_stats.unresponsive_remote_events = ns->unresponsive_remote_events;
|
||||
result->network_stats.impaired_remote_conn_events = ns->impaired_remote_conn_events;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
|
||||
/*
|
||||
* Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
* Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _EFA_COM_CMD_H_
|
||||
@ -283,11 +283,20 @@ struct efa_com_rdma_write_stats {
|
||||
u64 write_recv_bytes;
|
||||
};
|
||||
|
||||
struct efa_com_network_stats {
|
||||
u64 retrans_bytes;
|
||||
u64 retrans_pkts;
|
||||
u64 retrans_timeout_events;
|
||||
u64 unresponsive_remote_events;
|
||||
u64 impaired_remote_conn_events;
|
||||
};
|
||||
|
||||
union efa_com_get_stats_result {
|
||||
struct efa_com_basic_stats basic_stats;
|
||||
struct efa_com_messages_stats messages_stats;
|
||||
struct efa_com_rdma_read_stats rdma_read_stats;
|
||||
struct efa_com_rdma_write_stats rdma_write_stats;
|
||||
struct efa_com_network_stats network_stats;
|
||||
};
|
||||
|
||||
int efa_com_create_qp(struct efa_com_dev *edev,
|
||||
|
||||
@ -64,6 +64,11 @@ struct efa_user_mmap_entry {
|
||||
op(EFA_RDMA_WRITE_BYTES, "rdma_write_bytes") \
|
||||
op(EFA_RDMA_WRITE_WR_ERR, "rdma_write_wr_err") \
|
||||
op(EFA_RDMA_WRITE_RECV_BYTES, "rdma_write_recv_bytes") \
|
||||
op(EFA_RETRANS_BYTES, "retrans_bytes") \
|
||||
op(EFA_RETRANS_PKTS, "retrans_pkts") \
|
||||
op(EFA_RETRANS_TIMEOUT_EVENS, "retrans_timeout_events") \
|
||||
op(EFA_UNRESPONSIVE_REMOTE_EVENTS, "unresponsive_remote_events") \
|
||||
op(EFA_IMPAIRED_REMOTE_CONN_EVENTS, "impaired_remote_conn_events") \
|
||||
|
||||
#define EFA_STATS_ENUM(ename, name) ename,
|
||||
#define EFA_STATS_STR(ename, nam) \
|
||||
@ -2186,6 +2191,7 @@ static int efa_fill_port_stats(struct efa_dev *dev, struct rdma_hw_stats *stats,
|
||||
struct efa_com_rdma_write_stats *rws;
|
||||
struct efa_com_rdma_read_stats *rrs;
|
||||
struct efa_com_messages_stats *ms;
|
||||
struct efa_com_network_stats *ns;
|
||||
struct efa_com_basic_stats *bs;
|
||||
int err;
|
||||
|
||||
@ -2238,6 +2244,18 @@ static int efa_fill_port_stats(struct efa_dev *dev, struct rdma_hw_stats *stats,
|
||||
stats->value[EFA_RDMA_WRITE_RECV_BYTES] = rws->write_recv_bytes;
|
||||
}
|
||||
|
||||
params.type = EFA_ADMIN_GET_STATS_TYPE_NETWORK;
|
||||
err = efa_com_get_stats(&dev->edev, ¶ms, &result);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ns = &result.network_stats;
|
||||
stats->value[EFA_RETRANS_BYTES] = ns->retrans_bytes;
|
||||
stats->value[EFA_RETRANS_PKTS] = ns->retrans_pkts;
|
||||
stats->value[EFA_RETRANS_TIMEOUT_EVENS] = ns->retrans_timeout_events;
|
||||
stats->value[EFA_UNRESPONSIVE_REMOTE_EVENTS] = ns->unresponsive_remote_events;
|
||||
stats->value[EFA_IMPAIRED_REMOTE_CONN_EVENTS] = ns->impaired_remote_conn_events;
|
||||
|
||||
return ARRAY_SIZE(efa_port_stats_descs);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user