Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * RDMA Transport Layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #undef pr_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define pr_fmt(fmt) KBUILD_MODNAME " L" __stringify(__LINE__) ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "rtrs-srv.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) int rtrs_srv_reset_rdma_stats(struct rtrs_srv_stats *stats, bool enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	if (enable) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		struct rtrs_srv_stats_rdma_stats *r = &stats->rdma_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		memset(r, 0, sizeof(*r));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ssize_t rtrs_srv_stats_rdma_to_str(struct rtrs_srv_stats *stats,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 				    char *page, size_t len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	struct rtrs_srv_stats_rdma_stats *r = &stats->rdma_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	struct rtrs_srv_sess *sess = stats->sess;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	return scnprintf(page, len, "%lld %lld %lld %lld %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 			 (s64)atomic64_read(&r->dir[READ].cnt),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 			 (s64)atomic64_read(&r->dir[READ].size_total),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 			 (s64)atomic64_read(&r->dir[WRITE].cnt),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 			 (s64)atomic64_read(&r->dir[WRITE].size_total),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 			 atomic_read(&sess->ids_inflight));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }