aboutsummaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/cache.c
diff options
context:
space:
mode:
authorGravatar Matan Barak <matanb@mellanox.com> 2015-12-23 14:56:55 +0200
committerGravatar Doug Ledford <dledford@redhat.com> 2015-12-23 10:39:52 -0500
commit045959db65c67d7189dc89ecddb5fa10aafa449d (patch)
tree6b29c2d20fa2a8eb119f90221c04762c7ef75f2d /drivers/infiniband/core/cache.c
parentIB/rdma_cm: Add wrapper for cma reference count (diff)
downloadlinux-045959db65c67d7189dc89ecddb5fa10aafa449d.tar.gz
linux-045959db65c67d7189dc89ecddb5fa10aafa449d.tar.bz2
linux-045959db65c67d7189dc89ecddb5fa10aafa449d.zip
IB/cma: Add configfs for rdma_cm
Users would like to control the behaviour of rdma_cm. For example, old applications which don't set the required RoCE gid type could be executed on RoCE V2 network types. In order to support this configuration, we implement a configfs for rdma_cm. In order to use the configfs, one needs to mount it and mkdir <IB device name> inside rdma_cm directory. The patch adds support for a single configuration file, default_roce_mode. The mode can either be "IB/RoCE v1" or "RoCE v2". Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/cache.c')
-rw-r--r--drivers/infiniband/core/cache.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 4a2968b1cf56..92cadbddbe49 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -140,6 +140,30 @@ const char *ib_cache_gid_type_str(enum ib_gid_type gid_type)
}
EXPORT_SYMBOL(ib_cache_gid_type_str);
+int ib_cache_gid_parse_type_str(const char *buf)
+{
+ unsigned int i;
+ size_t len;
+ int err = -EINVAL;
+
+ len = strlen(buf);
+ if (len == 0)
+ return -EINVAL;
+
+ if (buf[len - 1] == '\n')
+ len--;
+
+ for (i = 0; i < ARRAY_SIZE(gid_type_str); ++i)
+ if (gid_type_str[i] && !strncmp(buf, gid_type_str[i], len) &&
+ len == strlen(gid_type_str[i])) {
+ err = i;
+ break;
+ }
+
+ return err;
+}
+EXPORT_SYMBOL(ib_cache_gid_parse_type_str);
+
/* This function expects that rwlock will be write locked in all
* scenarios and that lock will be locked in sleep-able (RoCE)
* scenarios.