linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nir Muchtar <nirm-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	monis-smomgflXvOZWk0Htik3J/w@public.gmane.org,
	ogerlitz-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org
Subject: [PATCH 3/3] IB Netlink RDMA CM Plugin
Date: Sun, 14 Nov 2010 18:12:56 +0200	[thread overview]
Message-ID: <4CE00A88.4070009@voltaire.com> (raw)

A new module that is an RDMA CM plugin for the Netlink infrastructure.
It depends on both ib_netlink and rdma_cm.
It registers the rdma cm to ib_netlink and 
forwards requests to the proper cma callbacks.

Signed-off-by: Nir Muchtar <nirm-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/netlink_cma.c |   73 +++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/core/netlink_cma.c

diff --git a/drivers/infiniband/core/netlink_cma.c b/drivers/infiniband/core/netlink_cma.c
new file mode 100644
index 0000000..dcf585c
--- /dev/null
+++ b/drivers/infiniband/core/netlink_cma.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010 Voltaire Inc.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__
+
+#include <linux/module.h>
+#include <linux/netlink.h>
+#include <rdma/rdma_cm.h>
+
+#include <net/ib_netlink.h>
+
+MODULE_AUTHOR("Nir Muchtar");
+MODULE_DESCRIPTION("RDMA CM Netlink module");
+MODULE_LICENSE("Dual BSD/GPL");
+
+static int netlink_cma_get_data(int op, char *buf, int len)
+{
+	if (op == IBNL_RDMA_CM_STATS)
+		return cma_get_stats(buf, len);
+	pr_warn("Invalid operation (%d)\n", op);
+	return -EINVAL;
+}
+
+static int netlink_cma_get_size(int op, int *size)
+{
+	if (op == IBNL_RDMA_CM_STATS)
+		return cma_get_stats_size(size);
+	pr_warn("Invalid operation (%d)\n", op);
+	return -EINVAL;
+}
+
+static int __init netlink_cma_init(void)
+{
+	return ibnl_add_cb(IBNL_RDMA_CM, netlink_cma_get_size,
+		netlink_cma_get_data);
+}
+
+static void __exit netlink_cma_cleanup(void)
+{
+	ibnl_remove_cb(IBNL_RDMA_CM);
+}
+
+module_init(netlink_cma_init);
+module_exit(netlink_cma_cleanup);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2010-11-14 16:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CE00A88.4070009@voltaire.com \
    --to=nirm-smomgflxvozwk0htik3j/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=monis-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    --cc=ogerlitz-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org \
    --cc=rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).