^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Copyright (c) 2006 Oracle. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * This software is available to you under a choice of one of two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * licenses. You may choose to be licensed under the terms of the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * General Public License (GPL) Version 2, available from the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * COPYING in the main directory of this source tree, or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * OpenIB.org BSD license below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Redistribution and use in source and binary forms, with or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * without modification, are permitted provided that the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * - Redistributions of source code must retain the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * - Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * disclaimer in the documentation and/or other materials
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include <linux/percpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include "rds.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include "ib.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static const char *const rds_ib_stat_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) "ib_connect_raced",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) "ib_listen_closed_stale",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) "ib_evt_handler_call",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) "ib_tasklet_call",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) "ib_tx_cq_event",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) "ib_tx_ring_full",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) "ib_tx_throttle",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) "ib_tx_sg_mapping_failure",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) "ib_tx_stalled",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) "ib_tx_credit_updates",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) "ib_rx_cq_event",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) "ib_rx_ring_empty",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) "ib_rx_refill_from_cq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) "ib_rx_refill_from_thread",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) "ib_rx_alloc_limit",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) "ib_rx_total_frags",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) "ib_rx_total_incs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) "ib_rx_credit_updates",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) "ib_ack_sent",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) "ib_ack_send_failure",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) "ib_ack_send_delayed",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) "ib_ack_send_piggybacked",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) "ib_ack_received",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) "ib_rdma_mr_8k_alloc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) "ib_rdma_mr_8k_free",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) "ib_rdma_mr_8k_used",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) "ib_rdma_mr_8k_pool_flush",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) "ib_rdma_mr_8k_pool_wait",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) "ib_rdma_mr_8k_pool_depleted",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) "ib_rdma_mr_1m_alloc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) "ib_rdma_mr_1m_free",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) "ib_rdma_mr_1m_used",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) "ib_rdma_mr_1m_pool_flush",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) "ib_rdma_mr_1m_pool_wait",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) "ib_rdma_mr_1m_pool_depleted",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) "ib_rdma_mr_8k_reused",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) "ib_rdma_mr_1m_reused",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) "ib_atomic_cswp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) "ib_atomic_fadd",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) unsigned int rds_ib_stats_info_copy(struct rds_info_iterator *iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) unsigned int avail)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct rds_ib_statistics stats = {0, };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) uint64_t *src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) uint64_t *sum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) size_t i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) int cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) if (avail < ARRAY_SIZE(rds_ib_stat_names))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) for_each_online_cpu(cpu) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) src = (uint64_t *)&(per_cpu(rds_ib_stats, cpu));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) sum = (uint64_t *)&stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) for (i = 0; i < sizeof(stats) / sizeof(uint64_t); i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) *(sum++) += *(src++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) rds_stats_info_copy(iter, (uint64_t *)&stats, rds_ib_stat_names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) ARRAY_SIZE(rds_ib_stat_names));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) return ARRAY_SIZE(rds_ib_stat_names);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }