mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-23 14:13:58 +08:00
RDMA/rtrs-clt: Rename rtrs_clt_sess to rtrs_clt_path
rtrs_clt_sess is used for paths and not sessions on the client side. This creates confusion so let's rename it to rtrs_clt_path. Also, rename related variables and functions. Coccinelle is used to do the transformations for most of the occurrences and remaining ones were handled manually. Link: https://lore.kernel.org/r/20220105180708.7774-4-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:
parent
ae4c81644e
commit
caa84d95c7
@ -13,8 +13,8 @@
|
||||
|
||||
void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con)
|
||||
{
|
||||
struct rtrs_clt_sess *sess = to_clt_sess(con->c.path);
|
||||
struct rtrs_clt_stats *stats = sess->stats;
|
||||
struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
|
||||
struct rtrs_clt_stats *stats = clt_path->stats;
|
||||
struct rtrs_clt_stats_pcpu *s;
|
||||
int cpu;
|
||||
|
||||
@ -180,8 +180,8 @@ static inline void rtrs_clt_update_rdma_stats(struct rtrs_clt_stats *stats,
|
||||
void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir)
|
||||
{
|
||||
struct rtrs_clt_con *con = req->con;
|
||||
struct rtrs_clt_sess *sess = to_clt_sess(con->c.path);
|
||||
struct rtrs_clt_stats *stats = sess->stats;
|
||||
struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
|
||||
struct rtrs_clt_stats *stats = clt_path->stats;
|
||||
unsigned int len;
|
||||
|
||||
len = req->usr_len + req->data_len;
|
||||
|
@ -16,21 +16,21 @@
|
||||
#define MIN_MAX_RECONN_ATT -1
|
||||
#define MAX_MAX_RECONN_ATT 9999
|
||||
|
||||
static void rtrs_clt_sess_release(struct kobject *kobj)
|
||||
static void rtrs_clt_path_release(struct kobject *kobj)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
|
||||
free_sess(sess);
|
||||
free_path(clt_path);
|
||||
}
|
||||
|
||||
static struct kobj_type ktype_sess = {
|
||||
.sysfs_ops = &kobj_sysfs_ops,
|
||||
.release = rtrs_clt_sess_release
|
||||
.release = rtrs_clt_path_release
|
||||
};
|
||||
|
||||
static void rtrs_clt_sess_stats_release(struct kobject *kobj)
|
||||
static void rtrs_clt_path_stats_release(struct kobject *kobj)
|
||||
{
|
||||
struct rtrs_clt_stats *stats;
|
||||
|
||||
@ -43,7 +43,7 @@ static void rtrs_clt_sess_stats_release(struct kobject *kobj)
|
||||
|
||||
static struct kobj_type ktype_stats = {
|
||||
.sysfs_ops = &kobj_sysfs_ops,
|
||||
.release = rtrs_clt_sess_stats_release,
|
||||
.release = rtrs_clt_path_stats_release,
|
||||
};
|
||||
|
||||
static ssize_t max_reconnect_attempts_show(struct device *dev,
|
||||
@ -197,10 +197,10 @@ static DEVICE_ATTR_RW(add_path);
|
||||
static ssize_t rtrs_clt_state_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *page)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
if (sess->state == RTRS_CLT_CONNECTED)
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
if (clt_path->state == RTRS_CLT_CONNECTED)
|
||||
return sysfs_emit(page, "connected\n");
|
||||
|
||||
return sysfs_emit(page, "disconnected\n");
|
||||
@ -219,16 +219,16 @@ static ssize_t rtrs_clt_reconnect_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
int ret;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
if (!sysfs_streq(buf, "1")) {
|
||||
rtrs_err(sess->clt, "%s: unknown value: '%s'\n",
|
||||
rtrs_err(clt_path->clt, "%s: unknown value: '%s'\n",
|
||||
attr->attr.name, buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = rtrs_clt_reconnect_from_sysfs(sess);
|
||||
ret = rtrs_clt_reconnect_from_sysfs(clt_path);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -249,15 +249,15 @@ static ssize_t rtrs_clt_disconnect_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
if (!sysfs_streq(buf, "1")) {
|
||||
rtrs_err(sess->clt, "%s: unknown value: '%s'\n",
|
||||
rtrs_err(clt_path->clt, "%s: unknown value: '%s'\n",
|
||||
attr->attr.name, buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
rtrs_clt_close_conns(sess, true);
|
||||
rtrs_clt_close_conns(clt_path, true);
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -276,16 +276,16 @@ static ssize_t rtrs_clt_remove_path_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
int ret;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
if (!sysfs_streq(buf, "1")) {
|
||||
rtrs_err(sess->clt, "%s: unknown value: '%s'\n",
|
||||
rtrs_err(clt_path->clt, "%s: unknown value: '%s'\n",
|
||||
attr->attr.name, buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = rtrs_clt_remove_path_from_sysfs(sess, &attr->attr);
|
||||
ret = rtrs_clt_remove_path_from_sysfs(clt_path, &attr->attr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -333,11 +333,11 @@ static ssize_t rtrs_clt_hca_port_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *page)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
|
||||
sess = container_of(kobj, typeof(*sess), kobj);
|
||||
clt_path = container_of(kobj, typeof(*clt_path), kobj);
|
||||
|
||||
return sysfs_emit(page, "%u\n", sess->hca_port);
|
||||
return sysfs_emit(page, "%u\n", clt_path->hca_port);
|
||||
}
|
||||
|
||||
static struct kobj_attribute rtrs_clt_hca_port_attr =
|
||||
@ -347,11 +347,11 @@ static ssize_t rtrs_clt_hca_name_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *page)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
|
||||
return sysfs_emit(page, "%s\n", sess->hca_name);
|
||||
return sysfs_emit(page, "%s\n", clt_path->hca_name);
|
||||
}
|
||||
|
||||
static struct kobj_attribute rtrs_clt_hca_name_attr =
|
||||
@ -361,12 +361,12 @@ static ssize_t rtrs_clt_cur_latency_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *page)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
|
||||
return sysfs_emit(page, "%lld ns\n",
|
||||
ktime_to_ns(sess->s.hb_cur_latency));
|
||||
ktime_to_ns(clt_path->s.hb_cur_latency));
|
||||
}
|
||||
|
||||
static struct kobj_attribute rtrs_clt_cur_latency_attr =
|
||||
@ -376,11 +376,11 @@ static ssize_t rtrs_clt_src_addr_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *page)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
int len;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
len = sockaddr_to_str((struct sockaddr *)&sess->s.src_addr, page,
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
len = sockaddr_to_str((struct sockaddr *)&clt_path->s.src_addr, page,
|
||||
PAGE_SIZE);
|
||||
len += sysfs_emit_at(page, len, "\n");
|
||||
return len;
|
||||
@ -393,11 +393,11 @@ static ssize_t rtrs_clt_dst_addr_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *page)
|
||||
{
|
||||
struct rtrs_clt_sess *sess;
|
||||
struct rtrs_clt_path *clt_path;
|
||||
int len;
|
||||
|
||||
sess = container_of(kobj, struct rtrs_clt_sess, kobj);
|
||||
len = sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, page,
|
||||
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
|
||||
len = sockaddr_to_str((struct sockaddr *)&clt_path->s.dst_addr, page,
|
||||
PAGE_SIZE);
|
||||
len += sysfs_emit_at(page, len, "\n");
|
||||
return len;
|
||||
@ -406,7 +406,7 @@ static ssize_t rtrs_clt_dst_addr_show(struct kobject *kobj,
|
||||
static struct kobj_attribute rtrs_clt_dst_addr_attr =
|
||||
__ATTR(dst_addr, 0444, rtrs_clt_dst_addr_show, NULL);
|
||||
|
||||
static struct attribute *rtrs_clt_sess_attrs[] = {
|
||||
static struct attribute *rtrs_clt_path_attrs[] = {
|
||||
&rtrs_clt_hca_name_attr.attr,
|
||||
&rtrs_clt_hca_port_attr.attr,
|
||||
&rtrs_clt_src_addr_attr.attr,
|
||||
@ -419,42 +419,43 @@ static struct attribute *rtrs_clt_sess_attrs[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group rtrs_clt_sess_attr_group = {
|
||||
.attrs = rtrs_clt_sess_attrs,
|
||||
static const struct attribute_group rtrs_clt_path_attr_group = {
|
||||
.attrs = rtrs_clt_path_attrs,
|
||||
};
|
||||
|
||||
int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess)
|
||||
int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path)
|
||||
{
|
||||
struct rtrs_clt *clt = sess->clt;
|
||||
struct rtrs_clt *clt = clt_path->clt;
|
||||
char str[NAME_MAX];
|
||||
int err;
|
||||
struct rtrs_addr path = {
|
||||
.src = &sess->s.src_addr,
|
||||
.dst = &sess->s.dst_addr,
|
||||
.src = &clt_path->s.src_addr,
|
||||
.dst = &clt_path->s.dst_addr,
|
||||
};
|
||||
|
||||
rtrs_addr_to_str(&path, str, sizeof(str));
|
||||
err = kobject_init_and_add(&sess->kobj, &ktype_sess, clt->kobj_paths,
|
||||
err = kobject_init_and_add(&clt_path->kobj, &ktype_sess,
|
||||
clt->kobj_paths,
|
||||
"%s", str);
|
||||
if (err) {
|
||||
pr_err("kobject_init_and_add: %d\n", err);
|
||||
kobject_put(&sess->kobj);
|
||||
kobject_put(&clt_path->kobj);
|
||||
return err;
|
||||
}
|
||||
err = sysfs_create_group(&sess->kobj, &rtrs_clt_sess_attr_group);
|
||||
err = sysfs_create_group(&clt_path->kobj, &rtrs_clt_path_attr_group);
|
||||
if (err) {
|
||||
pr_err("sysfs_create_group(): %d\n", err);
|
||||
goto put_kobj;
|
||||
}
|
||||
err = kobject_init_and_add(&sess->stats->kobj_stats, &ktype_stats,
|
||||
&sess->kobj, "stats");
|
||||
err = kobject_init_and_add(&clt_path->stats->kobj_stats, &ktype_stats,
|
||||
&clt_path->kobj, "stats");
|
||||
if (err) {
|
||||
pr_err("kobject_init_and_add: %d\n", err);
|
||||
kobject_put(&sess->stats->kobj_stats);
|
||||
kobject_put(&clt_path->stats->kobj_stats);
|
||||
goto remove_group;
|
||||
}
|
||||
|
||||
err = sysfs_create_group(&sess->stats->kobj_stats,
|
||||
err = sysfs_create_group(&clt_path->stats->kobj_stats,
|
||||
&rtrs_clt_stats_attr_group);
|
||||
if (err) {
|
||||
pr_err("failed to create stats sysfs group, err: %d\n", err);
|
||||
@ -464,25 +465,25 @@ int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess)
|
||||
return 0;
|
||||
|
||||
put_kobj_stats:
|
||||
kobject_del(&sess->stats->kobj_stats);
|
||||
kobject_put(&sess->stats->kobj_stats);
|
||||
kobject_del(&clt_path->stats->kobj_stats);
|
||||
kobject_put(&clt_path->stats->kobj_stats);
|
||||
remove_group:
|
||||
sysfs_remove_group(&sess->kobj, &rtrs_clt_sess_attr_group);
|
||||
sysfs_remove_group(&clt_path->kobj, &rtrs_clt_path_attr_group);
|
||||
put_kobj:
|
||||
kobject_del(&sess->kobj);
|
||||
kobject_put(&sess->kobj);
|
||||
kobject_del(&clt_path->kobj);
|
||||
kobject_put(&clt_path->kobj);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess,
|
||||
void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path,
|
||||
const struct attribute *sysfs_self)
|
||||
{
|
||||
kobject_del(&sess->stats->kobj_stats);
|
||||
kobject_put(&sess->stats->kobj_stats);
|
||||
kobject_del(&clt_path->stats->kobj_stats);
|
||||
kobject_put(&clt_path->stats->kobj_stats);
|
||||
if (sysfs_self)
|
||||
sysfs_remove_file_self(&sess->kobj, sysfs_self);
|
||||
kobject_del(&sess->kobj);
|
||||
sysfs_remove_file_self(&clt_path->kobj, sysfs_self);
|
||||
kobject_del(&clt_path->kobj);
|
||||
}
|
||||
|
||||
static struct attribute *rtrs_clt_attrs[] = {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -124,7 +124,7 @@ struct rtrs_rbuf {
|
||||
u32 rkey;
|
||||
};
|
||||
|
||||
struct rtrs_clt_sess {
|
||||
struct rtrs_clt_path {
|
||||
struct rtrs_path s;
|
||||
struct rtrs_clt *clt;
|
||||
wait_queue_head_t state_wq;
|
||||
@ -156,7 +156,7 @@ struct rtrs_clt_sess {
|
||||
struct rtrs_clt {
|
||||
struct list_head paths_list; /* rcu protected list */
|
||||
size_t paths_num;
|
||||
struct rtrs_clt_sess
|
||||
struct rtrs_clt_path
|
||||
__rcu * __percpu *pcpu_path;
|
||||
uuid_t paths_uuid;
|
||||
int paths_up;
|
||||
@ -186,9 +186,9 @@ static inline struct rtrs_clt_con *to_clt_con(struct rtrs_con *c)
|
||||
return container_of(c, struct rtrs_clt_con, c);
|
||||
}
|
||||
|
||||
static inline struct rtrs_clt_sess *to_clt_sess(struct rtrs_path *s)
|
||||
static inline struct rtrs_clt_path *to_clt_path(struct rtrs_path *s)
|
||||
{
|
||||
return container_of(s, struct rtrs_clt_sess, s);
|
||||
return container_of(s, struct rtrs_clt_path, s);
|
||||
}
|
||||
|
||||
static inline int permit_size(struct rtrs_clt *clt)
|
||||
@ -201,16 +201,16 @@ static inline struct rtrs_permit *get_permit(struct rtrs_clt *clt, int idx)
|
||||
return (struct rtrs_permit *)(clt->permits + permit_size(clt) * idx);
|
||||
}
|
||||
|
||||
int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_sess *sess);
|
||||
void rtrs_clt_close_conns(struct rtrs_clt_sess *sess, bool wait);
|
||||
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 *clt,
|
||||
struct rtrs_addr *addr);
|
||||
int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_sess *sess,
|
||||
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 *clt, int value);
|
||||
int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt *clt);
|
||||
void free_sess(struct rtrs_clt_sess *sess);
|
||||
void free_path(struct rtrs_clt_path *clt_path);
|
||||
|
||||
/* rtrs-clt-stats.c */
|
||||
|
||||
@ -242,8 +242,8 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats,
|
||||
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt);
|
||||
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt);
|
||||
|
||||
int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess);
|
||||
void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess,
|
||||
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 */
|
||||
|
@ -229,7 +229,7 @@ struct rtrs_msg_conn_rsp {
|
||||
/**
|
||||
* struct rtrs_msg_info_req
|
||||
* @type: @RTRS_MSG_INFO_REQ
|
||||
* @sessname: Session name chosen by client
|
||||
* @pathname: Path name chosen by client
|
||||
*/
|
||||
struct rtrs_msg_info_req {
|
||||
__le16 type;
|
||||
|
@ -53,13 +53,13 @@ struct rtrs_clt_ops {
|
||||
};
|
||||
|
||||
struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops,
|
||||
const char *sessname,
|
||||
const char *pathname,
|
||||
const struct rtrs_addr *paths,
|
||||
size_t path_cnt, u16 port,
|
||||
size_t pdu_sz, u8 reconnect_delay_sec,
|
||||
s16 max_reconnect_attempts, u32 nr_poll_queues);
|
||||
|
||||
void rtrs_clt_close(struct rtrs_clt *sess);
|
||||
void rtrs_clt_close(struct rtrs_clt *clt_path);
|
||||
|
||||
enum wait_type {
|
||||
RTRS_PERMIT_NOWAIT = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user