diff mbox

[v5,13/27] IB/Verbs: Reserve legacy transport type in 'dev_addr'

Message ID 5534BAE8.9010805@profitbricks.com (mailing list archive)
State Rejected
Headers show

Commit Message

Michael Wang April 20, 2015, 8:38 a.m. UTC
Reserve the legacy transport type for the 'transport' member
of 'struct rdma_dev_addr' until we make sure this is no
longer needed.

Cc: Hal Rosenstock <hal@dev.mellanox.co.il>
Cc: Steve Wise <swise@opengridcomputing.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Michael Wang <yun.wang@profitbricks.com>
---
 drivers/infiniband/core/cma.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

Comments

Devesh Sharma April 21, 2015, 5:58 a.m. UTC | #1
> -----Original Message-----

> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-

> owner@vger.kernel.org] On Behalf Of Michael Wang

> Sent: Monday, April 20, 2015 2:08 PM

> To: Roland Dreier; Sean Hefty; linux-rdma@vger.kernel.org; linux-

> kernel@vger.kernel.org; hal@dev.mellanox.co.il

> Cc: Michael Wang; Tom Tucker; Steve Wise; Hoang-Nam Nguyen; Christoph

> Raisch; Mike Marciniszyn; Eli Cohen; Faisal Latif; Jack Morgenstein; Or Gerlitz;

> Haggai Eran; Ira Weiny; Tom Talpey; Jason Gunthorpe; Doug Ledford

> Subject: [PATCH v5 13/27] IB/Verbs: Reserve legacy transport type in

> 'dev_addr'

> 

> 

> Reserve the legacy transport type for the 'transport' member of 'struct

> rdma_dev_addr' until we make sure this is no longer needed.

> 

> Cc: Hal Rosenstock <hal@dev.mellanox.co.il>

> Cc: Steve Wise <swise@opengridcomputing.com>

> Cc: Tom Talpey <tom@talpey.com>

> Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

> Cc: Doug Ledford <dledford@redhat.com>

> Cc: Ira Weiny <ira.weiny@intel.com>

> Cc: Sean Hefty <sean.hefty@intel.com>

> Signed-off-by: Michael Wang <yun.wang@profitbricks.com>

> ---

>  drivers/infiniband/core/cma.c | 25 +++++++++++++++++++++++--

>  1 file changed, 23 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c

> index ebac646..6195bf6 100644

> --- a/drivers/infiniband/core/cma.c

> +++ b/drivers/infiniband/core/cma.c

> @@ -244,14 +244,35 @@ static inline void cma_set_ip_ver(struct cma_hdr

> *hdr, u8 ip_ver)

>  	hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF);  }

> 

> +static inline void cma_set_legacy_transport(struct rdma_cm_id *id) {

> +	switch (id->device->node_type) {

> +	case RDMA_NODE_IB_CA:

> +	case RDMA_NODE_IB_SWITCH:

> +	case RDMA_NODE_IB_ROUTER:

> +		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IB;


What about IBOE transport, am I missing something here? As of today ocrdma exports node_type  as RDMA_NODE_IB_CA, here transport will be set to RDMA_TRANSPORT_IB,
Should it be RDMA_TRANPORT_IBOE?

> +		break;

> +	case RDMA_NODE_RNIC:

> +		id->route.addr.dev_addr.transport =

> RDMA_TRANSPORT_IWARP;

> +		break;

> +	case RDMA_NODE_USNIC:

> +		id->route.addr.dev_addr.transport =

> RDMA_TRANSPORT_USNIC;

> +		break;

> +	case RDMA_NODE_USNIC_UDP:

> +		id->route.addr.dev_addr.transport =

> RDMA_TRANSPORT_USNIC_UDP;

> +		break;

> +	default:

> +		BUG();

> +	}

> +}

> +

>  static void cma_attach_to_dev(struct rdma_id_private *id_priv,

>  			      struct cma_device *cma_dev)

>  {

>  	atomic_inc(&cma_dev->refcount);

>  	id_priv->cma_dev = cma_dev;

>  	id_priv->id.device = cma_dev->device;

> -	id_priv->id.route.addr.dev_addr.transport =

> -		rdma_node_get_transport(cma_dev->device->node_type);

> +	cma_set_legacy_transport(&id_priv->id);

>  	list_add_tail(&id_priv->list, &cma_dev->id_list);  }

> 

> --

> 2.1.0

> --

> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body

> of a message to majordomo@vger.kernel.org More majordomo info at

> http://vger.kernel.org/majordomo-info.html
Michael Wang April 21, 2015, 8:05 a.m. UTC | #2
On 04/21/2015 07:58 AM, Devesh Sharma wrote:
[snip]
>>
>> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
>> index ebac646..6195bf6 100644
>> --- a/drivers/infiniband/core/cma.c
>> +++ b/drivers/infiniband/core/cma.c
>> @@ -244,14 +244,35 @@ static inline void cma_set_ip_ver(struct cma_hdr
>> *hdr, u8 ip_ver)
>>  	hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF);  }
>>
>> +static inline void cma_set_legacy_transport(struct rdma_cm_id *id) {
>> +	switch (id->device->node_type) {
>> +	case RDMA_NODE_IB_CA:
>> +	case RDMA_NODE_IB_SWITCH:
>> +	case RDMA_NODE_IB_ROUTER:
>> +		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IB;
> 
> What about IBOE transport, am I missing something here? As of today ocrdma exports node_type  as RDMA_NODE_IB_CA, here transport will be set to RDMA_TRANSPORT_IB,
> Should it be RDMA_TRANPORT_IBOE?

This part is actually just the old method we used to get transport type, I'm
not sure about the usage of this 'transport' so reserve the old way for it :-P

Actually I can't locate the place using this stuff in core layer, thus I guess it
may be used by user layer or the protocol, as long as these layer using the old
logical, we better don't touch anything ;-)

Regards,
Michael Wang

> 
>> +		break;
>> +	case RDMA_NODE_RNIC:
>> +		id->route.addr.dev_addr.transport =
>> RDMA_TRANSPORT_IWARP;
>> +		break;
>> +	case RDMA_NODE_USNIC:
>> +		id->route.addr.dev_addr.transport =
>> RDMA_TRANSPORT_USNIC;
>> +		break;
>> +	case RDMA_NODE_USNIC_UDP:
>> +		id->route.addr.dev_addr.transport =
>> RDMA_TRANSPORT_USNIC_UDP;
>> +		break;
>> +	default:
>> +		BUG();
>> +	}
>> +}
>> +
>>  static void cma_attach_to_dev(struct rdma_id_private *id_priv,
>>  			      struct cma_device *cma_dev)
>>  {
>>  	atomic_inc(&cma_dev->refcount);
>>  	id_priv->cma_dev = cma_dev;
>>  	id_priv->id.device = cma_dev->device;
>> -	id_priv->id.route.addr.dev_addr.transport =
>> -		rdma_node_get_transport(cma_dev->device->node_type);
>> +	cma_set_legacy_transport(&id_priv->id);
>>  	list_add_tail(&id_priv->list, &cma_dev->id_list);  }
>>
>> --
>> 2.1.0
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body
>> of a message to majordomo@vger.kernel.org More majordomo info at
>> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ira Weiny April 22, 2015, 12:08 a.m. UTC | #3
On Mon, Apr 20, 2015 at 10:38:00AM +0200, Michael Wang wrote:
> 
> Reserve the legacy transport type for the 'transport' member
> of 'struct rdma_dev_addr' until we make sure this is no
> longer needed.
> 
> Cc: Hal Rosenstock <hal@dev.mellanox.co.il>
> Cc: Steve Wise <swise@opengridcomputing.com>
> Cc: Tom Talpey <tom@talpey.com>
> Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Sean Hefty <sean.hefty@intel.com>
> Signed-off-by: Michael Wang <yun.wang@profitbricks.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  drivers/infiniband/core/cma.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index ebac646..6195bf6 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -244,14 +244,35 @@ static inline void cma_set_ip_ver(struct cma_hdr *hdr, u8 ip_ver)
>  	hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF);
>  }
>  
> +static inline void cma_set_legacy_transport(struct rdma_cm_id *id)
> +{
> +	switch (id->device->node_type) {
> +	case RDMA_NODE_IB_CA:
> +	case RDMA_NODE_IB_SWITCH:
> +	case RDMA_NODE_IB_ROUTER:
> +		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IB;
> +		break;
> +	case RDMA_NODE_RNIC:
> +		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IWARP;
> +		break;
> +	case RDMA_NODE_USNIC:
> +		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_USNIC;
> +		break;
> +	case RDMA_NODE_USNIC_UDP:
> +		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_USNIC_UDP;
> +		break;
> +	default:
> +		BUG();
> +	}
> +}
> +
>  static void cma_attach_to_dev(struct rdma_id_private *id_priv,
>  			      struct cma_device *cma_dev)
>  {
>  	atomic_inc(&cma_dev->refcount);
>  	id_priv->cma_dev = cma_dev;
>  	id_priv->id.device = cma_dev->device;
> -	id_priv->id.route.addr.dev_addr.transport =
> -		rdma_node_get_transport(cma_dev->device->node_type);
> +	cma_set_legacy_transport(&id_priv->id);
>  	list_add_tail(&id_priv->list, &cma_dev->id_list);
>  }
>  
> -- 
> 2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index ebac646..6195bf6 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -244,14 +244,35 @@  static inline void cma_set_ip_ver(struct cma_hdr *hdr, u8 ip_ver)
 	hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF);
 }
 
+static inline void cma_set_legacy_transport(struct rdma_cm_id *id)
+{
+	switch (id->device->node_type) {
+	case RDMA_NODE_IB_CA:
+	case RDMA_NODE_IB_SWITCH:
+	case RDMA_NODE_IB_ROUTER:
+		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IB;
+		break;
+	case RDMA_NODE_RNIC:
+		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IWARP;
+		break;
+	case RDMA_NODE_USNIC:
+		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_USNIC;
+		break;
+	case RDMA_NODE_USNIC_UDP:
+		id->route.addr.dev_addr.transport = RDMA_TRANSPORT_USNIC_UDP;
+		break;
+	default:
+		BUG();
+	}
+}
+
 static void cma_attach_to_dev(struct rdma_id_private *id_priv,
 			      struct cma_device *cma_dev)
 {
 	atomic_inc(&cma_dev->refcount);
 	id_priv->cma_dev = cma_dev;
 	id_priv->id.device = cma_dev->device;
-	id_priv->id.route.addr.dev_addr.transport =
-		rdma_node_get_transport(cma_dev->device->node_type);
+	cma_set_legacy_transport(&id_priv->id);
 	list_add_tail(&id_priv->list, &cma_dev->id_list);
 }