RDMA/rtrs-clt: Rename rtrs_clt to rtrs_clt_sess

Structure rtrs_clt is used for sessions. So to avoid confusions rename it
to rtrs_clt_sess.

Transformations are done with the help of following coccinelle script.

@@
@@
struct
- rtrs_clt
+ rtrs_clt_sess

Link: https://lore.kernel.org/r/20220105180708.7774-6-jinpu.wang@ionos.com
Signed-off-by: Vaishali Thakkar <vaishali.thakkar@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Vaishali Thakkar 2022-01-05 19:07:08 +01:00 committed by Jason Gunthorpe
parent f7ecac6a09
commit f3433d79cd
6 changed files with 77 additions and 71 deletions

View File

@ -433,7 +433,7 @@ static void msg_conf(void *priv, int errno)
schedule_work(&iu->work); schedule_work(&iu->work);
} }
static int send_usr_msg(struct rtrs_clt *rtrs, int dir, static int send_usr_msg(struct rtrs_clt_sess *rtrs, int dir,
struct rnbd_iu *iu, struct kvec *vec, struct rnbd_iu *iu, struct kvec *vec,
size_t len, struct scatterlist *sg, unsigned int sg_len, size_t len, struct scatterlist *sg, unsigned int sg_len,
void (*conf)(struct work_struct *work), void (*conf)(struct work_struct *work),
@ -1010,7 +1010,7 @@ static int rnbd_client_xfer_request(struct rnbd_clt_dev *dev,
struct request *rq, struct request *rq,
struct rnbd_iu *iu) struct rnbd_iu *iu)
{ {
struct rtrs_clt *rtrs = dev->sess->rtrs; struct rtrs_clt_sess *rtrs = dev->sess->rtrs;
struct rtrs_permit *permit = iu->permit; struct rtrs_permit *permit = iu->permit;
struct rnbd_msg_io msg; struct rnbd_msg_io msg;
struct rtrs_clt_req_ops req_ops; struct rtrs_clt_req_ops req_ops;

View File

@ -75,7 +75,7 @@ struct rnbd_cpu_qlist {
struct rnbd_clt_session { struct rnbd_clt_session {
struct list_head list; struct list_head list;
struct rtrs_clt *rtrs; struct rtrs_clt_sess *rtrs;
wait_queue_head_t rtrs_waitq; wait_queue_head_t rtrs_waitq;
bool rtrs_ready; bool rtrs_ready;
struct rnbd_cpu_qlist __percpu struct rnbd_cpu_qlist __percpu

View File

@ -50,7 +50,8 @@ static ssize_t max_reconnect_attempts_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
return sysfs_emit(page, "%d\n", return sysfs_emit(page, "%d\n",
rtrs_clt_get_max_reconnect_attempts(clt)); rtrs_clt_get_max_reconnect_attempts(clt));
@ -63,7 +64,8 @@ static ssize_t max_reconnect_attempts_store(struct device *dev,
{ {
int value; int value;
int ret; int ret;
struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
ret = kstrtoint(buf, 10, &value); ret = kstrtoint(buf, 10, &value);
if (ret) { if (ret) {
@ -90,9 +92,9 @@ static ssize_t mpath_policy_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
clt = container_of(dev, struct rtrs_clt, dev); clt = container_of(dev, struct rtrs_clt_sess, dev);
switch (clt->mp_policy) { switch (clt->mp_policy) {
case MP_POLICY_RR: case MP_POLICY_RR:
@ -114,12 +116,12 @@ static ssize_t mpath_policy_store(struct device *dev,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
int value; int value;
int ret; int ret;
size_t len = 0; size_t len = 0;
clt = container_of(dev, struct rtrs_clt, dev); clt = container_of(dev, struct rtrs_clt_sess, dev);
ret = kstrtoint(buf, 10, &value); ret = kstrtoint(buf, 10, &value);
if (!ret && (value == MP_POLICY_RR || if (!ret && (value == MP_POLICY_RR ||
@ -169,12 +171,12 @@ static ssize_t add_path_store(struct device *dev,
.src = &srcaddr, .src = &srcaddr,
.dst = &dstaddr .dst = &dstaddr
}; };
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
const char *nl; const char *nl;
size_t len; size_t len;
int err; int err;
clt = container_of(dev, struct rtrs_clt, dev); clt = container_of(dev, struct rtrs_clt_sess, dev);
nl = strchr(buf, '\n'); nl = strchr(buf, '\n');
if (nl) if (nl)
@ -425,7 +427,7 @@ static const struct attribute_group rtrs_clt_path_attr_group = {
int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path) int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
char str[NAME_MAX]; char str[NAME_MAX];
int err; int err;
struct rtrs_addr path = { struct rtrs_addr path = {
@ -497,12 +499,12 @@ static const struct attribute_group rtrs_clt_attr_group = {
.attrs = rtrs_clt_attrs, .attrs = rtrs_clt_attrs,
}; };
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt) int rtrs_clt_create_sysfs_root_files(struct rtrs_clt_sess *clt)
{ {
return sysfs_create_group(&clt->dev.kobj, &rtrs_clt_attr_group); return sysfs_create_group(&clt->dev.kobj, &rtrs_clt_attr_group);
} }
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt) void rtrs_clt_destroy_sysfs_root(struct rtrs_clt_sess *clt)
{ {
sysfs_remove_group(&clt->dev.kobj, &rtrs_clt_attr_group); sysfs_remove_group(&clt->dev.kobj, &rtrs_clt_attr_group);

View File

@ -46,7 +46,7 @@ static struct rtrs_rdma_dev_pd dev_pd = {
static struct workqueue_struct *rtrs_wq; static struct workqueue_struct *rtrs_wq;
static struct class *rtrs_clt_dev_class; static struct class *rtrs_clt_dev_class;
static inline bool rtrs_clt_is_connected(const struct rtrs_clt *clt) static inline bool rtrs_clt_is_connected(const struct rtrs_clt_sess *clt)
{ {
struct rtrs_clt_path *clt_path; struct rtrs_clt_path *clt_path;
bool connected = false; bool connected = false;
@ -60,7 +60,7 @@ static inline bool rtrs_clt_is_connected(const struct rtrs_clt *clt)
} }
static struct rtrs_permit * static struct rtrs_permit *
__rtrs_get_permit(struct rtrs_clt *clt, enum rtrs_clt_con_type con_type) __rtrs_get_permit(struct rtrs_clt_sess *clt, enum rtrs_clt_con_type con_type)
{ {
size_t max_depth = clt->queue_depth; size_t max_depth = clt->queue_depth;
struct rtrs_permit *permit; struct rtrs_permit *permit;
@ -87,7 +87,7 @@ __rtrs_get_permit(struct rtrs_clt *clt, enum rtrs_clt_con_type con_type)
return permit; return permit;
} }
static inline void __rtrs_put_permit(struct rtrs_clt *clt, static inline void __rtrs_put_permit(struct rtrs_clt_sess *clt,
struct rtrs_permit *permit) struct rtrs_permit *permit)
{ {
clear_bit_unlock(permit->mem_id, clt->permits_map); clear_bit_unlock(permit->mem_id, clt->permits_map);
@ -107,7 +107,7 @@ static inline void __rtrs_put_permit(struct rtrs_clt *clt,
* Context: * Context:
* Can sleep if @wait == RTRS_PERMIT_WAIT * Can sleep if @wait == RTRS_PERMIT_WAIT
*/ */
struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt *clt, struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt_sess *clt,
enum rtrs_clt_con_type con_type, enum rtrs_clt_con_type con_type,
enum wait_type can_wait) enum wait_type can_wait)
{ {
@ -142,7 +142,8 @@ EXPORT_SYMBOL(rtrs_clt_get_permit);
* Context: * Context:
* Does not matter * Does not matter
*/ */
void rtrs_clt_put_permit(struct rtrs_clt *clt, struct rtrs_permit *permit) void rtrs_clt_put_permit(struct rtrs_clt_sess *clt,
struct rtrs_permit *permit)
{ {
if (WARN_ON(!test_bit(permit->mem_id, clt->permits_map))) if (WARN_ON(!test_bit(permit->mem_id, clt->permits_map)))
return; return;
@ -303,7 +304,7 @@ static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con)
if (rtrs_clt_change_state_from_to(clt_path, if (rtrs_clt_change_state_from_to(clt_path,
RTRS_CLT_CONNECTED, RTRS_CLT_CONNECTED,
RTRS_CLT_RECONNECTING)) { RTRS_CLT_RECONNECTING)) {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
unsigned int delay_ms; unsigned int delay_ms;
/* /*
@ -743,7 +744,7 @@ static int post_recv_path(struct rtrs_clt_path *clt_path)
struct path_it { struct path_it {
int i; int i;
struct list_head skip_list; struct list_head skip_list;
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
struct rtrs_clt_path *(*next_path)(struct path_it *it); struct rtrs_clt_path *(*next_path)(struct path_it *it);
}; };
@ -780,7 +781,7 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
{ {
struct rtrs_clt_path __rcu **ppcpu_path; struct rtrs_clt_path __rcu **ppcpu_path;
struct rtrs_clt_path *path; struct rtrs_clt_path *path;
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
clt = it->clt; clt = it->clt;
@ -817,7 +818,7 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
static struct rtrs_clt_path *get_next_path_min_inflight(struct path_it *it) static struct rtrs_clt_path *get_next_path_min_inflight(struct path_it *it)
{ {
struct rtrs_clt_path *min_path = NULL; struct rtrs_clt_path *min_path = NULL;
struct rtrs_clt *clt = it->clt; struct rtrs_clt_sess *clt = it->clt;
struct rtrs_clt_path *clt_path; struct rtrs_clt_path *clt_path;
int min_inflight = INT_MAX; int min_inflight = INT_MAX;
int inflight; int inflight;
@ -868,7 +869,7 @@ static struct rtrs_clt_path *get_next_path_min_inflight(struct path_it *it)
static struct rtrs_clt_path *get_next_path_min_latency(struct path_it *it) static struct rtrs_clt_path *get_next_path_min_latency(struct path_it *it)
{ {
struct rtrs_clt_path *min_path = NULL; struct rtrs_clt_path *min_path = NULL;
struct rtrs_clt *clt = it->clt; struct rtrs_clt_sess *clt = it->clt;
struct rtrs_clt_path *clt_path; struct rtrs_clt_path *clt_path;
ktime_t min_latency = KTIME_MAX; ktime_t min_latency = KTIME_MAX;
ktime_t latency; ktime_t latency;
@ -898,7 +899,7 @@ static struct rtrs_clt_path *get_next_path_min_latency(struct path_it *it)
return min_path; return min_path;
} }
static inline void path_it_init(struct path_it *it, struct rtrs_clt *clt) static inline void path_it_init(struct path_it *it, struct rtrs_clt_sess *clt)
{ {
INIT_LIST_HEAD(&it->skip_list); INIT_LIST_HEAD(&it->skip_list);
it->clt = clt; it->clt = clt;
@ -1281,7 +1282,7 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req *req)
* @clt: clt context * @clt: clt context
* @fail_req: a failed io request. * @fail_req: a failed io request.
*/ */
static int rtrs_clt_failover_req(struct rtrs_clt *clt, static int rtrs_clt_failover_req(struct rtrs_clt_sess *clt,
struct rtrs_clt_io_req *fail_req) struct rtrs_clt_io_req *fail_req)
{ {
struct rtrs_clt_path *alive_path; struct rtrs_clt_path *alive_path;
@ -1316,7 +1317,7 @@ static int rtrs_clt_failover_req(struct rtrs_clt *clt,
static void fail_all_outstanding_reqs(struct rtrs_clt_path *clt_path) static void fail_all_outstanding_reqs(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
struct rtrs_clt_io_req *req; struct rtrs_clt_io_req *req;
int i, err; int i, err;
@ -1405,7 +1406,7 @@ out:
return err; return err;
} }
static int alloc_permits(struct rtrs_clt *clt) static int alloc_permits(struct rtrs_clt_sess *clt)
{ {
unsigned int chunk_bits; unsigned int chunk_bits;
int err, i; int err, i;
@ -1439,7 +1440,7 @@ out_err:
return err; return err;
} }
static void free_permits(struct rtrs_clt *clt) static void free_permits(struct rtrs_clt_sess *clt)
{ {
if (clt->permits_map) { if (clt->permits_map) {
size_t sz = clt->queue_depth; size_t sz = clt->queue_depth;
@ -1510,7 +1511,7 @@ static void rtrs_clt_init_hb(struct rtrs_clt_path *clt_path)
static void rtrs_clt_reconnect_work(struct work_struct *work); static void rtrs_clt_reconnect_work(struct work_struct *work);
static void rtrs_clt_close_work(struct work_struct *work); static void rtrs_clt_close_work(struct work_struct *work);
static struct rtrs_clt_path *alloc_path(struct rtrs_clt *clt, static struct rtrs_clt_path *alloc_path(struct rtrs_clt_sess *clt,
const struct rtrs_addr *path, const struct rtrs_addr *path,
size_t con_num, u32 nr_poll_queues) size_t con_num, u32 nr_poll_queues)
{ {
@ -1775,7 +1776,7 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con)
static int rtrs_rdma_route_resolved(struct rtrs_clt_con *con) static int rtrs_rdma_route_resolved(struct rtrs_clt_con *con)
{ {
struct rtrs_clt_path *clt_path = to_clt_path(con->c.path); struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
struct rtrs_msg_conn_req msg; struct rtrs_msg_conn_req msg;
struct rdma_conn_param param; struct rdma_conn_param param;
@ -1810,7 +1811,7 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con,
struct rdma_cm_event *ev) struct rdma_cm_event *ev)
{ {
struct rtrs_clt_path *clt_path = to_clt_path(con->c.path); struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
const struct rtrs_msg_conn_rsp *msg; const struct rtrs_msg_conn_rsp *msg;
u16 version, queue_depth; u16 version, queue_depth;
int errno; int errno;
@ -2100,7 +2101,7 @@ destroy_cm:
static void rtrs_clt_path_up(struct rtrs_clt_path *clt_path) static void rtrs_clt_path_up(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
int up; int up;
/* /*
@ -2131,7 +2132,7 @@ static void rtrs_clt_path_up(struct rtrs_clt_path *clt_path)
static void rtrs_clt_path_down(struct rtrs_clt_path *clt_path) static void rtrs_clt_path_down(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
if (!clt_path->established) if (!clt_path->established)
return; return;
@ -2220,7 +2221,7 @@ static inline bool xchg_paths(struct rtrs_clt_path __rcu **rcu_ppcpu_path,
static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path) static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
struct rtrs_clt_path *next; struct rtrs_clt_path *next;
bool wait_for_grace = false; bool wait_for_grace = false;
int cpu; int cpu;
@ -2310,7 +2311,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
static void rtrs_clt_add_path_to_arr(struct rtrs_clt_path *clt_path) static void rtrs_clt_add_path_to_arr(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
mutex_lock(&clt->paths_mutex); mutex_lock(&clt->paths_mutex);
clt->paths_num++; clt->paths_num++;
@ -2636,7 +2637,7 @@ out:
static void rtrs_clt_reconnect_work(struct work_struct *work) static void rtrs_clt_reconnect_work(struct work_struct *work)
{ {
struct rtrs_clt_path *clt_path; struct rtrs_clt_path *clt_path;
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
unsigned int delay_ms; unsigned int delay_ms;
int err; int err;
@ -2678,19 +2679,20 @@ reconnect_again:
static void rtrs_clt_dev_release(struct device *dev) static void rtrs_clt_dev_release(struct device *dev)
{ {
struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
kfree(clt); kfree(clt);
} }
static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num, static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num,
u16 port, size_t pdu_sz, void *priv, u16 port, size_t pdu_sz, void *priv,
void (*link_ev)(void *priv, void (*link_ev)(void *priv,
enum rtrs_clt_link_ev ev), enum rtrs_clt_link_ev ev),
unsigned int reconnect_delay_sec, unsigned int reconnect_delay_sec,
unsigned int max_reconnect_attempts) unsigned int max_reconnect_attempts)
{ {
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
int err; int err;
if (!paths_num || paths_num > MAX_PATHS_NUM) if (!paths_num || paths_num > MAX_PATHS_NUM)
@ -2765,7 +2767,7 @@ err:
return ERR_PTR(err); return ERR_PTR(err);
} }
static void free_clt(struct rtrs_clt *clt) static void free_clt(struct rtrs_clt_sess *clt)
{ {
free_permits(clt); free_permits(clt);
free_percpu(clt->pcpu_path); free_percpu(clt->pcpu_path);
@ -2793,7 +2795,7 @@ static void free_clt(struct rtrs_clt *clt)
* *
* Return a valid pointer on success otherwise PTR_ERR. * Return a valid pointer on success otherwise PTR_ERR.
*/ */
struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops, struct rtrs_clt_sess *rtrs_clt_open(struct rtrs_clt_ops *ops,
const char *pathname, const char *pathname,
const struct rtrs_addr *paths, const struct rtrs_addr *paths,
size_t paths_num, u16 port, size_t paths_num, u16 port,
@ -2801,7 +2803,7 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops,
s16 max_reconnect_attempts, u32 nr_poll_queues) s16 max_reconnect_attempts, u32 nr_poll_queues)
{ {
struct rtrs_clt_path *clt_path, *tmp; struct rtrs_clt_path *clt_path, *tmp;
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
int err, i; int err, i;
if (strchr(pathname, '/') || strchr(pathname, '.')) { if (strchr(pathname, '/') || strchr(pathname, '.')) {
@ -2875,7 +2877,7 @@ EXPORT_SYMBOL(rtrs_clt_open);
* rtrs_clt_close() - Close a path * rtrs_clt_close() - Close a path
* @clt: Session handle. Session is freed upon return. * @clt: Session handle. Session is freed upon return.
*/ */
void rtrs_clt_close(struct rtrs_clt *clt) void rtrs_clt_close(struct rtrs_clt_sess *clt)
{ {
struct rtrs_clt_path *clt_path, *tmp; struct rtrs_clt_path *clt_path, *tmp;
@ -2950,12 +2952,12 @@ int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *clt_path,
return 0; return 0;
} }
void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt *clt, int value) void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt_sess *clt, int value)
{ {
clt->max_reconnect_attempts = (unsigned int)value; clt->max_reconnect_attempts = (unsigned int)value;
} }
int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt *clt) int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt_sess *clt)
{ {
return (int)clt->max_reconnect_attempts; return (int)clt->max_reconnect_attempts;
} }
@ -2985,9 +2987,9 @@ int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt *clt)
* On dir=WRITE rtrs client will rdma write data in sg to server side. * On dir=WRITE rtrs client will rdma write data in sg to server side.
*/ */
int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops, int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
struct rtrs_clt *clt, struct rtrs_permit *permit, struct rtrs_clt_sess *clt, struct rtrs_permit *permit,
const struct kvec *vec, size_t nr, size_t data_len, const struct kvec *vec, size_t nr, size_t data_len,
struct scatterlist *sg, unsigned int sg_cnt) struct scatterlist *sg, unsigned int sg_cnt)
{ {
struct rtrs_clt_io_req *req; struct rtrs_clt_io_req *req;
struct rtrs_clt_path *clt_path; struct rtrs_clt_path *clt_path;
@ -3045,7 +3047,7 @@ int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
} }
EXPORT_SYMBOL(rtrs_clt_request); EXPORT_SYMBOL(rtrs_clt_request);
int rtrs_clt_rdma_cq_direct(struct rtrs_clt *clt, unsigned int index) int rtrs_clt_rdma_cq_direct(struct rtrs_clt_sess *clt, unsigned int index)
{ {
/* If no path, return -1 for block layer not to try again */ /* If no path, return -1 for block layer not to try again */
int cnt = -1; int cnt = -1;
@ -3079,7 +3081,7 @@ EXPORT_SYMBOL(rtrs_clt_rdma_cq_direct);
* 0 on success * 0 on success
* -ECOMM no connection to the server * -ECOMM no connection to the server
*/ */
int rtrs_clt_query(struct rtrs_clt *clt, struct rtrs_attrs *attr) int rtrs_clt_query(struct rtrs_clt_sess *clt, struct rtrs_attrs *attr)
{ {
if (!rtrs_clt_is_connected(clt)) if (!rtrs_clt_is_connected(clt))
return -ECOMM; return -ECOMM;
@ -3094,7 +3096,7 @@ int rtrs_clt_query(struct rtrs_clt *clt, struct rtrs_attrs *attr)
} }
EXPORT_SYMBOL(rtrs_clt_query); EXPORT_SYMBOL(rtrs_clt_query);
int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, int rtrs_clt_create_path_from_sysfs(struct rtrs_clt_sess *clt,
struct rtrs_addr *addr) struct rtrs_addr *addr)
{ {
struct rtrs_clt_path *clt_path; struct rtrs_clt_path *clt_path;

View File

@ -126,7 +126,7 @@ struct rtrs_rbuf {
struct rtrs_clt_path { struct rtrs_clt_path {
struct rtrs_path s; struct rtrs_path s;
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
wait_queue_head_t state_wq; wait_queue_head_t state_wq;
enum rtrs_clt_state state; enum rtrs_clt_state state;
atomic_t connected_cnt; atomic_t connected_cnt;
@ -153,7 +153,7 @@ struct rtrs_clt_path {
*mp_skip_entry; *mp_skip_entry;
}; };
struct rtrs_clt { struct rtrs_clt_sess {
struct list_head paths_list; /* rcu protected list */ struct list_head paths_list; /* rcu protected list */
size_t paths_num; size_t paths_num;
struct rtrs_clt_path struct rtrs_clt_path
@ -191,25 +191,26 @@ static inline struct rtrs_clt_path *to_clt_path(struct rtrs_path *s)
return container_of(s, struct rtrs_clt_path, s); return container_of(s, struct rtrs_clt_path, s);
} }
static inline int permit_size(struct rtrs_clt *clt) static inline int permit_size(struct rtrs_clt_sess *clt)
{ {
return sizeof(struct rtrs_permit) + clt->pdu_sz; return sizeof(struct rtrs_permit) + clt->pdu_sz;
} }
static inline struct rtrs_permit *get_permit(struct rtrs_clt *clt, int idx) static inline struct rtrs_permit *get_permit(struct rtrs_clt_sess *clt,
int idx)
{ {
return (struct rtrs_permit *)(clt->permits + permit_size(clt) * idx); return (struct rtrs_permit *)(clt->permits + permit_size(clt) * idx);
} }
int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *path); int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *path);
void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait); void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait);
int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, int rtrs_clt_create_path_from_sysfs(struct rtrs_clt_sess *clt,
struct rtrs_addr *addr); struct rtrs_addr *addr);
int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *path, int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *path,
const struct attribute *sysfs_self); const struct attribute *sysfs_self);
void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt *clt, int value); 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 *clt); int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt_sess *clt);
void free_path(struct rtrs_clt_path *clt_path); void free_path(struct rtrs_clt_path *clt_path);
/* rtrs-clt-stats.c */ /* rtrs-clt-stats.c */
@ -239,8 +240,8 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats,
/* rtrs-clt-sysfs.c */ /* rtrs-clt-sysfs.c */
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt); int rtrs_clt_create_sysfs_root_files(struct rtrs_clt_sess *clt);
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt); void rtrs_clt_destroy_sysfs_root(struct rtrs_clt_sess *clt);
int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path); int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path);
void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path, void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path,

View File

@ -13,7 +13,7 @@
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
struct rtrs_permit; struct rtrs_permit;
struct rtrs_clt; struct rtrs_clt_sess;
struct rtrs_srv_ctx; struct rtrs_srv_ctx;
struct rtrs_srv_sess; struct rtrs_srv_sess;
struct rtrs_srv_op; struct rtrs_srv_op;
@ -52,14 +52,14 @@ struct rtrs_clt_ops {
void (*link_ev)(void *priv, enum rtrs_clt_link_ev ev); void (*link_ev)(void *priv, enum rtrs_clt_link_ev ev);
}; };
struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops, struct rtrs_clt_sess *rtrs_clt_open(struct rtrs_clt_ops *ops,
const char *pathname, const char *pathname,
const struct rtrs_addr *paths, const struct rtrs_addr *paths,
size_t path_cnt, u16 port, size_t path_cnt, u16 port,
size_t pdu_sz, u8 reconnect_delay_sec, size_t pdu_sz, u8 reconnect_delay_sec,
s16 max_reconnect_attempts, u32 nr_poll_queues); s16 max_reconnect_attempts, u32 nr_poll_queues);
void rtrs_clt_close(struct rtrs_clt *clt_path); void rtrs_clt_close(struct rtrs_clt_sess *clt);
enum wait_type { enum wait_type {
RTRS_PERMIT_NOWAIT = 0, RTRS_PERMIT_NOWAIT = 0,
@ -77,11 +77,12 @@ enum rtrs_clt_con_type {
RTRS_IO_CON RTRS_IO_CON
}; };
struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt *sess, struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt_sess *sess,
enum rtrs_clt_con_type con_type, enum rtrs_clt_con_type con_type,
enum wait_type wait); enum wait_type wait);
void rtrs_clt_put_permit(struct rtrs_clt *sess, struct rtrs_permit *permit); void rtrs_clt_put_permit(struct rtrs_clt_sess *sess,
struct rtrs_permit *permit);
/** /**
* rtrs_clt_req_ops - it holds the request confirmation callback * rtrs_clt_req_ops - it holds the request confirmation callback
@ -98,10 +99,10 @@ struct rtrs_clt_req_ops {
}; };
int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops, int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
struct rtrs_clt *sess, struct rtrs_permit *permit, struct rtrs_clt_sess *sess, struct rtrs_permit *permit,
const struct kvec *vec, size_t nr, size_t len, const struct kvec *vec, size_t nr, size_t len,
struct scatterlist *sg, unsigned int sg_cnt); struct scatterlist *sg, unsigned int sg_cnt);
int rtrs_clt_rdma_cq_direct(struct rtrs_clt *clt, unsigned int index); int rtrs_clt_rdma_cq_direct(struct rtrs_clt_sess *clt, unsigned int index);
/** /**
* rtrs_attrs - RTRS session attributes * rtrs_attrs - RTRS session attributes
@ -112,7 +113,7 @@ struct rtrs_attrs {
u32 max_segments; u32 max_segments;
}; };
int rtrs_clt_query(struct rtrs_clt *sess, struct rtrs_attrs *attr); int rtrs_clt_query(struct rtrs_clt_sess *sess, struct rtrs_attrs *attr);
/* /*
* Here goes RTRS server API * Here goes RTRS server API