All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: [PATCH rdma-next V2 5/5] IB/core: Integrate IB address resolution module into core
Date: Fri,  6 May 2016 22:45:28 +0300	[thread overview]
Message-ID: <1462563928-29164-6-git-send-email-leon@kernel.org> (raw)
In-Reply-To: <1462563928-29164-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

IB address resolution is declared as a module (ib_addr.ko) which loads
itself before IB core module (ib_core.ko).

It causes to the scenario where IB netlink which is initialized by IB
core can't be used by ib_addr.ko.

In order to solve it, we are converting ib_addr.ko to be part of
IB core module.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/core/Makefile |  6 ++----
 drivers/infiniband/core/addr.c   | 11 ++---------
 drivers/infiniband/core/device.c | 11 ++++++++++-
 include/rdma/ib_addr.h           |  3 +++
 4 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index f818538..2c6dc6b 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -2,7 +2,7 @@ infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS)	:= rdma_cm.o
 user_access-$(CONFIG_INFINIBAND_ADDR_TRANS)	:= rdma_ucm.o
 
 obj-$(CONFIG_INFINIBAND) +=		ib_core.o ib_mad.o ib_sa.o \
-					ib_cm.o iw_cm.o ib_addr.o \
+					ib_cm.o iw_cm.o \
 					$(infiniband-y)
 obj-$(CONFIG_INFINIBAND_USER_MAD) +=	ib_umad.o
 obj-$(CONFIG_INFINIBAND_USER_ACCESS) +=	ib_uverbs.o ib_ucm.o \
@@ -10,7 +10,7 @@ obj-$(CONFIG_INFINIBAND_USER_ACCESS) +=	ib_uverbs.o ib_ucm.o \
 
 ib_core-y :=			packer.o ud_header.o verbs.o cq.o sysfs.o \
 				device.o fmr_pool.o cache.o netlink.o \
-				roce_gid_mgmt.o
+				roce_gid_mgmt.o addr.o
 ib_core-$(CONFIG_INFINIBAND_USER_MEM) += umem.o
 ib_core-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += umem_odp.o umem_rbtree.o
 
@@ -28,8 +28,6 @@ rdma_cm-$(CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS) += cma_configfs.o
 
 rdma_ucm-y :=			ucma.o
 
-ib_addr-y :=			addr.o
-
 ib_umad-y :=			user_mad.o
 
 ib_ucm-y :=			ucm.o
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 337353d..3a203ee 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -47,10 +47,6 @@
 #include <rdma/ib_addr.h>
 #include <rdma/ib.h>
 
-MODULE_AUTHOR("Sean Hefty");
-MODULE_DESCRIPTION("IB Address Translation");
-MODULE_LICENSE("Dual BSD/GPL");
-
 struct addr_req {
 	struct list_head list;
 	struct sockaddr_storage src_addr;
@@ -634,7 +630,7 @@ static struct notifier_block nb = {
 	.notifier_call = netevent_callback
 };
 
-static int __init addr_init(void)
+int addr_init(void)
 {
 	addr_wq = create_singlethread_workqueue("ib_addr");
 	if (!addr_wq)
@@ -645,12 +641,9 @@ static int __init addr_init(void)
 	return 0;
 }
 
-static void __exit addr_cleanup(void)
+void addr_cleanup(void)
 {
 	rdma_addr_unregister_client(&self);
 	unregister_netevent_notifier(&nb);
 	destroy_workqueue(addr_wq);
 }
-
-module_init(addr_init);
-module_exit(addr_cleanup);
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 1097984..8894ad0 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -977,16 +977,24 @@ static int __init ib_core_init(void)
 		goto err_comp;
 	}
 
+	ret = addr_init();
+	if (ret) {
+		pr_warn("Could't init IB address resolution\n");
+		goto err_sysfs;
+	}
+
 	ret = ibnl_init();
 	if (ret) {
 		pr_warn("Couldn't init IB netlink interface\n");
-		goto err_sysfs;
+		goto err_addr;
 	}
 
 	ib_cache_setup();
 
 	return 0;
 
+err_addr:
+	addr_cleanup();
 err_sysfs:
 	class_unregister(&ib_class);
 err_comp:
@@ -1000,6 +1008,7 @@ static void __exit ib_core_cleanup(void)
 {
 	ib_cache_cleanup();
 	ibnl_cleanup();
+	addr_cleanup();
 	class_unregister(&ib_class);
 	destroy_workqueue(ib_comp_wq);
 	/* Make sure that any pending umem accounting work is done. */
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 931a47b..e276a07 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -54,6 +54,9 @@ struct rdma_addr_client {
 	struct completion comp;
 };
 
+int addr_init(void);
+void addr_cleanup(void);
+
 /**
  * rdma_addr_register_client - Register an address client.
  */
-- 
2.1.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

  parent reply	other threads:[~2016-05-06 19:45 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 19:45 [PATCH rdma-next V2 0/5] Trivial fixes for 4.7 Leon Romanovsky
     [not found] ` <1462563928-29164-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-05-06 19:45   ` [PATCH rdma-next V2 1/5] IB/IWPM: Fix a potential skb leak Leon Romanovsky
2016-05-06 19:45   ` [PATCH rdma-next V2 2/5] IB/core: Remove unnecessary check in ibnl_rcv_msg Leon Romanovsky
2016-05-06 19:45   ` [PATCH rdma-next V2 3/5] IB/core: Fix a potential array overrun in CMA and SA agent Leon Romanovsky
2016-05-06 19:45   ` [PATCH rdma-next V2 4/5] IB/SA: Use correct free function Leon Romanovsky
2016-05-06 19:45   ` Leon Romanovsky [this message]
     [not found]     ` <1462563928-29164-6-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-05-13 19:34       ` [PATCH rdma-next V2 5/5] IB/core: Integrate IB address resolution module into core Doug Ledford
     [not found]         ` <ea50f1d2-6f05-66f7-18f7-0a569fd9cea5-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-15 10:51           ` Mark Bloch
     [not found]             ` <VI1PR05MB1391AD099C536541E79A09F9D2760-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-16 15:09               ` Doug Ledford
     [not found]                 ` <db369e8e-7993-dfb8-d459-2c4f3d6e5b14-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 16:30                   ` Leon Romanovsky
     [not found]                     ` <20160516163048.GB4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-16 17:42                       ` Doug Ledford
     [not found]                         ` <298657b0-6e57-745b-5eb3-001984bffbc3-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 18:27                           ` Jason Gunthorpe
     [not found]                             ` <20160516182743.GF7248-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-16 18:39                               ` Doug Ledford
     [not found]                                 ` <5045d314-e2f5-bda6-5583-2212335593fd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18  4:41                                   ` Leon Romanovsky
     [not found]                                     ` <20160518044119.GH4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-18 14:20                                       ` Doug Ledford
2016-05-16 18:54                           ` Leon Romanovsky
     [not found]                             ` <20160516185434.GC4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-16 20:27                               ` Doug Ledford
     [not found]                                 ` <82b21da8-8bec-a7ed-fc48-b7570c0aa4ce-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 21:03                                   ` Jason Gunthorpe
     [not found]                                     ` <20160516210327.GB10945-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-17  5:00                                       ` Mark Bloch
     [not found]                                         ` <VI1PR05MB1391FBF91190C84744581DB8D2480-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-17 16:56                                           ` Jason Gunthorpe
     [not found]                                             ` <20160517165647.GB19976-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-18 15:09                                               ` Mark Bloch
2016-05-17  5:46                                       ` Christoph Hellwig
     [not found]                                         ` <20160517054652.GA17101-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-05-17  5:51                                           ` Leon Romanovsky
2016-05-17 14:52                                           ` Doug Ledford
2016-05-17  5:48                                   ` Leon Romanovsky
     [not found]                                     ` <20160517054834.GD4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-17 14:58                                       ` Doug Ledford
     [not found]                                         ` <910c3e4c-2427-34c4-cc42-f8e951c7d157-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18  4:47                                           ` Leon Romanovsky
     [not found]                                             ` <20160518044709.GI4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-18 14:20                                               ` Doug Ledford
2016-05-17  8:29                           ` Mark Bloch
     [not found]                             ` <VI1PR05MB13915036338162B126E55CC2D2480-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-17 15:48                               ` Doug Ledford
     [not found]                                 ` <eea7049c-5a27-1498-8e8b-674d69468fbb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18  6:43                                   ` Mark Bloch
     [not found]                                     ` <VI1PR05MB13910C6D09E0B6B9D477B1EAD2490-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-18 14:17                                       ` Doug Ledford
     [not found]                                         ` <d54c2884-c2e9-8952-75f8-43147943640c-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 14:26                                           ` Mark Bloch
     [not found]                                             ` <VI1PR05MB1391C3E551DDAEA3ABFE71FFD2490-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-18 14:51                                               ` Doug Ledford
     [not found]                                                 ` <0558d12b-2646-63b4-89f8-9bf4aba689db-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 17:15                                                   ` Jason Gunthorpe
     [not found]                                                     ` <20160518171536.GB15170-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-18 17:58                                                       ` Doug Ledford
     [not found]                                                         ` <fe88d9cc-3d03-030d-c4c9-360ef0ce7067-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 18:28                                                           ` Mark Bloch
     [not found]                                                             ` <VI1PR05MB1391B1C6DFE620C31A6474A0D2490-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-18 18:42                                                               ` Doug Ledford
     [not found]                                                                 ` <561a675d-89d2-e675-cf83-e86ecb7519b6-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 19:36                                                                   ` Weiny, Ira
     [not found]                                                                     ` <2807E5FD2F6FDA4886F6618EAC48510E22EDE332-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-23  8:58                                                                       ` Leon Romanovsky
     [not found]                                                                         ` <20160523085809.GF25500-2ukJVAZIZ/Y@public.gmane.org>
2016-05-23 14:05                                                                           ` Doug Ledford
     [not found]                                                                             ` <57430E34.3090501-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-23 14:09                                                                               ` Mark Bloch
     [not found]                                                                                 ` <VI1PR05MB13910E30E227D4DCDBC19033D24E0-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-30  5:33                                                                                   ` Knut Omang
     [not found]                                                                                     ` <1464586394.13055.426.camel-6miFZF/5cTBuMpJDpNschA@public.gmane.org>
2016-05-30  6:33                                                                                       ` Leon Romanovsky
     [not found]                                                                                         ` <20160530063349.GA7477-2ukJVAZIZ/Y@public.gmane.org>
2016-05-30 11:37                                                                                           ` Knut Omang
     [not found]                                                                                             ` <1464608255.20967.27.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-05-30 12:51                                                                                               ` Leon Romanovsky
2016-05-13 19:22   ` [PATCH rdma-next V2 0/5] Trivial fixes for 4.7 Doug Ledford

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=1462563928-29164-6-git-send-email-leon@kernel.org \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.