linux/drivers/infiniband/ulp/rtrs/rtrs-clt.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * RDMA Transport Layer
 *
 * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
 * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
 * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
 */

#ifndef RTRS_CLT_H
#define RTRS_CLT_H

#include <linux/device.h>
#include "rtrs-pri.h"

/**
 * enum rtrs_clt_state - Client states.
 */
enum rtrs_clt_state {};

enum rtrs_mp_policy {};

/* see Documentation/ABI/testing/sysfs-class-rtrs-client for details */
struct rtrs_clt_stats_reconnects {};

/* see Documentation/ABI/testing/sysfs-class-rtrs-client for details */
struct rtrs_clt_stats_cpu_migr {};

/* stats for Read and write operation.
 * see Documentation/ABI/testing/sysfs-class-rtrs-client for details
 */
struct rtrs_clt_stats_rdma {};

struct rtrs_clt_stats_pcpu {};

struct rtrs_clt_stats {};

struct rtrs_clt_con {};

/**
 * rtrs_permit - permits the memory allocation for future RDMA operation.
 *		 Combine with irq pinning to keep IO on same CPU.
 */
struct rtrs_permit {};

/**
 * rtrs_clt_io_req - describes one inflight IO request
 */
struct rtrs_clt_io_req {};

struct rtrs_rbuf {};

struct rtrs_clt_path {};

struct rtrs_clt_sess {};

static inline struct rtrs_clt_con *to_clt_con(struct rtrs_con *c)
{}

static inline struct rtrs_clt_path *to_clt_path(struct rtrs_path *s)
{}

static inline int permit_size(struct rtrs_clt_sess *clt)
{}

static inline struct rtrs_permit *get_permit(struct rtrs_clt_sess *clt,
					     int idx)
{}

int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *path);
void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait);
int rtrs_clt_create_path_from_sysfs(struct rtrs_clt_sess *clt,
				     struct rtrs_addr *addr);
int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *path,
				     const struct attribute *sysfs_self);

void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt_sess *clt, int value);
int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt_sess *clt);
void free_path(struct rtrs_clt_path *clt_path);

/* rtrs-clt-stats.c */

int rtrs_clt_init_stats(struct rtrs_clt_stats *stats);

void rtrs_clt_inc_failover_cnt(struct rtrs_clt_stats *s);

void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con);
void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir);

int rtrs_clt_reset_rdma_lat_distr_stats(struct rtrs_clt_stats *stats,
					 bool enable);
ssize_t rtrs_clt_stats_rdma_lat_distr_to_str(struct rtrs_clt_stats *stats,
					      char *page);
int rtrs_clt_reset_cpu_migr_stats(struct rtrs_clt_stats *stats, bool enable);
int rtrs_clt_stats_migration_from_cnt_to_str(struct rtrs_clt_stats *stats, char *buf);
int rtrs_clt_stats_migration_to_cnt_to_str(struct rtrs_clt_stats *stats, char *buf);
int rtrs_clt_reset_reconnects_stat(struct rtrs_clt_stats *stats, bool enable);
int rtrs_clt_stats_reconnects_to_str(struct rtrs_clt_stats *stats, char *buf);
int rtrs_clt_reset_rdma_stats(struct rtrs_clt_stats *stats, bool enable);
ssize_t rtrs_clt_stats_rdma_to_str(struct rtrs_clt_stats *stats,
				    char *page);
int rtrs_clt_reset_all_stats(struct rtrs_clt_stats *stats, bool enable);
ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats,
				 char *page);

/* rtrs-clt-sysfs.c */

int rtrs_clt_create_sysfs_root_files(struct rtrs_clt_sess *clt);
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt_sess *clt);

int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path);
void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path,
				  const struct attribute *sysfs_self);

#endif /* RTRS_CLT_H */