IB/cma: Add support for network namespaces
Add support for network namespaces in the ib_cma module. This is accomplished by: 1. Adding network namespace parameter for rdma_create_id. This parameter is used to populate the network namespace field in rdma_id_private. rdma_create_id keeps a reference on the network namespace. 2. Using the network namespace from the rdma_id instead of init_net inside of ib_cma, when listening on an ID and when looking for an ID for an incoming request. 3. Decrementing the reference count for the appropriate network namespace when calling rdma_destroy_id. In order to preserve the current behavior init_net is passed when calling from other modules. Signed-off-by: Guy Shapiro <guysh@mellanox.com> Signed-off-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Yotam Kenneth <yotamke@mellanox.com> Signed-off-by: Shachar Raindel <raindel@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

parent
4be74b42a6
commit
fa20105e09
@@ -317,7 +317,7 @@ static int rds_ib_laddr_check(struct net *net, __be32 addr)
|
||||
/* Create a CMA ID and try to bind it. This catches both
|
||||
* IB and iWARP capable NICs.
|
||||
*/
|
||||
cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
|
||||
cm_id = rdma_create_id(&init_net, NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
|
||||
if (IS_ERR(cm_id))
|
||||
return PTR_ERR(cm_id);
|
||||
|
||||
|
@@ -565,7 +565,7 @@ int rds_ib_conn_connect(struct rds_connection *conn)
|
||||
|
||||
/* XXX I wonder what affect the port space has */
|
||||
/* delegate cm event handler to rdma_transport */
|
||||
ic->i_cm_id = rdma_create_id(rds_rdma_cm_event_handler, conn,
|
||||
ic->i_cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler, conn,
|
||||
RDMA_PS_TCP, IB_QPT_RC);
|
||||
if (IS_ERR(ic->i_cm_id)) {
|
||||
ret = PTR_ERR(ic->i_cm_id);
|
||||
|
@@ -223,7 +223,7 @@ static int rds_iw_laddr_check(struct net *net, __be32 addr)
|
||||
/* Create a CMA ID and try to bind it. This catches both
|
||||
* IB and iWARP capable NICs.
|
||||
*/
|
||||
cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
|
||||
cm_id = rdma_create_id(&init_net, NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
|
||||
if (IS_ERR(cm_id))
|
||||
return PTR_ERR(cm_id);
|
||||
|
||||
|
@@ -524,7 +524,7 @@ int rds_iw_conn_connect(struct rds_connection *conn)
|
||||
|
||||
/* XXX I wonder what affect the port space has */
|
||||
/* delegate cm event handler to rdma_transport */
|
||||
ic->i_cm_id = rdma_create_id(rds_rdma_cm_event_handler, conn,
|
||||
ic->i_cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler, conn,
|
||||
RDMA_PS_TCP, IB_QPT_RC);
|
||||
if (IS_ERR(ic->i_cm_id)) {
|
||||
ret = PTR_ERR(ic->i_cm_id);
|
||||
|
@@ -142,8 +142,8 @@ static int rds_rdma_listen_init(void)
|
||||
struct rdma_cm_id *cm_id;
|
||||
int ret;
|
||||
|
||||
cm_id = rdma_create_id(rds_rdma_cm_event_handler, NULL, RDMA_PS_TCP,
|
||||
IB_QPT_RC);
|
||||
cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler, NULL,
|
||||
RDMA_PS_TCP, IB_QPT_RC);
|
||||
if (IS_ERR(cm_id)) {
|
||||
ret = PTR_ERR(cm_id);
|
||||
printk(KERN_ERR "RDS/RDMA: failed to setup listener, "
|
||||
|
Reference in New Issue
Block a user