Re: [PATCH 01/11] IB/Verbs: Use helpers to check transport and link layer

2015-03-30 Thread Doug Ledford
On Mon, 2015-03-30 at 18:14 +0200, Michael Wang wrote:
 Hi, Doug
 
 Thanks for the comments :-)
 
 On 03/30/2015 05:56 PM, Doug Ledford wrote:
  On Fri, 2015-03-27 at 16:40 +0100, Michael Wang wrote:
  We have so much places to check transport type and link layer type, it's 
  now
  make sense to introduce some helpers in order to refine the lengthy code.
 
  This patch will introduce helpers:
  rdma_transport_is_ib()
  rdma_transport_is_iwarp()
  rdma_port_ll_is_ib()
  rdma_port_ll_is_eth()
  and use them to save some code for us.
  If the end result is to do something like I proposed, then why take this
  intermediate step that just has to be backed out later?
 
 The problem is that I found there are still many places our new
 mechanism may could not take care, especially inside device driver,
 this is just try to collect the issues together as a basement so we can
 gradually eliminate them.

There is no gradually eliminate them to the suggestion I made.
Remember, my suggestion was to remove the transport and link_layer items
from the port settings and replace it with just one transport item that
is a bitmask of the possible transport types.  This can not be done
gradually, it must be a complete change all at once as the two methods
of setting things are incompatible.  As there is only one out of tree
driver that I know of, lustre, we can give them the information they
need to make their driver work both before and after the change.

 Sure if finally we do capture all the cases, we can just get rid of
 this one, but I guess it won't be that easy to directly jump into
 next stage :-P
 
 As I could imaging, after this reform, next stage could be introducing
 the new mechanism without changing device driver, and the last
 stage is to asking vendor adapt their code into the new mechanism.
 
 
  In other words, if our end goal is to have
 
  rdma_transport_is_ib()
  rdma_transport_is_iwarp()
  rdma_transport_is_roce()
  rdma_transport_is_opa()
 
  Then we should skip doing rdma_port_ll_is_*() as the answers to these
  items would be implied by rdma_transport_is_roce() and such.
 
 Great if we achieved that ;-) but currently I just wondering maybe
 these helpers can only cover part of the cases where we check
 transport and link layer, there are still some cases we'll need the
 very rough helper to save some code and make things clean~
 
 Regards,
 Michael Wang
 
 
 
  Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
  Cc: Doug Ledford dledf...@redhat.com
  Cc: Ira Weiny ira.we...@intel.com
  Cc: Sean Hefty sean.he...@intel.com
  Signed-off-by: Michael Wang yun.w...@profitbricks.com
  ---
   drivers/infiniband/core/agent.c   |  2 +-
   drivers/infiniband/core/cm.c  |  2 +-
   drivers/infiniband/core/cma.c | 27 ---
   drivers/infiniband/core/mad.c |  6 +++---
   drivers/infiniband/core/multicast.c   | 11 ---
   drivers/infiniband/core/sa_query.c| 14 +++---
   drivers/infiniband/core/ucm.c |  3 +--
   drivers/infiniband/core/user_mad.c|  2 +-
   drivers/infiniband/core/verbs.c   |  5 ++---
   drivers/infiniband/hw/mlx4/ah.c   |  2 +-
   drivers/infiniband/hw/mlx4/cq.c   |  4 +---
   drivers/infiniband/hw/mlx4/mad.c  | 14 --
   drivers/infiniband/hw/mlx4/main.c |  8 +++-
   drivers/infiniband/hw/mlx4/mlx4_ib.h  |  2 +-
   drivers/infiniband/hw/mlx4/qp.c   | 21 +++--
   drivers/infiniband/hw/mlx4/sysfs.c|  6 ++
   drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
   include/rdma/ib_verbs.h   | 24 
   net/sunrpc/xprtrdma/svc_rdma_recvfrom.c   |  3 +--
   19 files changed, 79 insertions(+), 83 deletions(-)
 
  diff --git a/drivers/infiniband/core/agent.c 
  b/drivers/infiniband/core/agent.c
  index f6d2961..27f1bec 100644
  --- a/drivers/infiniband/core/agent.c
  +++ b/drivers/infiniband/core/agent.c
  @@ -156,7 +156,7 @@ int ib_agent_port_open(struct ib_device *device, int 
  port_num)
   goto error1;
   }
   
  -if (rdma_port_get_link_layer(device, port_num) == 
  IB_LINK_LAYER_INFINIBAND) {
  +if (rdma_port_ll_is_ib(device, port_num)) {
   /* Obtain send only MAD agent for SMI QP */
   port_priv-agent[0] = ib_register_mad_agent(device, port_num,
   IB_QPT_SMI, NULL, 0,
  diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
  index e28a494..2c72e9e 100644
  --- a/drivers/infiniband/core/cm.c
  +++ b/drivers/infiniband/core/cm.c
  @@ -3762,7 +3762,7 @@ static void cm_add_one(struct ib_device *ib_device)
   int ret;
   u8 i;
   
  -if (rdma_node_get_transport(ib_device-node_type) != 
  RDMA_TRANSPORT_IB)
  +if (!rdma_transport_is_ib(ib_device))
   return;
   
   cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) *
  diff --git 

Re: [PATCH 01/11] IB/Verbs: Use helpers to check transport and link layer

2015-03-30 Thread Michael Wang
On 03/30/2015 06:22 PM, Doug Ledford wrote:
 On Mon, 2015-03-30 at 18:14 +0200, Michael Wang wrote:
 [snip]
 There is no gradually eliminate them to the suggestion I made.
 Remember, my suggestion was to remove the transport and link_layer items
 from the port settings and replace it with just one transport item that
 is a bitmask of the possible transport types.  This can not be done
 gradually, it must be a complete change all at once as the two methods
 of setting things are incompatible.  As there is only one out of tree
 driver that I know of, lustre, we can give them the information they
 need to make their driver work both before and after the change.

Actually there is something confused me on transport and link
layer here, basically we have defined:

transport type
RDMA_TRANSPORT_IB,
RDMA_TRANSPORT_IWARP,
RDMA_TRANSPORT_USNIC,
RDMA_TRANSPORT_USNIC_UDP
link layer
IB_LINK_LAYER_INFINIBAND,
IB_LINK_LAYER_ETHERNET,

So we could have a table:

LL_INFINIBANDLL_ETHERNET
UNCARE
TRANSPORT_IB12  
  3
TRANSPORT_IWARP,
4
UNCARE   56 
 

In current implementation I've found all these combination
in core or driver, and I could see:

rdma_transport_is_ib()  1
rdma_transport_is_iwarp()   4   
rdma_transport_is_roce()2

Just confusing how to take care the combination 3,5,6?

Regards,
Michael Wang


 Sure if finally we do capture all the cases, we can just get rid of
 this one, but I guess it won't be that easy to directly jump into
 next stage :-P

 As I could imaging, after this reform, next stage could be introducing
 the new mechanism without changing device driver, and the last
 stage is to asking vendor adapt their code into the new mechanism.

 In other words, if our end goal is to have

 rdma_transport_is_ib()
 rdma_transport_is_iwarp()
 rdma_transport_is_roce()
 rdma_transport_is_opa()

 Then we should skip doing rdma_port_ll_is_*() as the answers to these
 items would be implied by rdma_transport_is_roce() and such.
 Great if we achieved that ;-) but currently I just wondering maybe
 these helpers can only cover part of the cases where we check
 transport and link layer, there are still some cases we'll need the
 very rough helper to save some code and make things clean~

 Regards,
 Michael Wang


 Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
 Cc: Doug Ledford dledf...@redhat.com
 Cc: Ira Weiny ira.we...@intel.com
 Cc: Sean Hefty sean.he...@intel.com
 Signed-off-by: Michael Wang yun.w...@profitbricks.com
 ---
  drivers/infiniband/core/agent.c   |  2 +-
  drivers/infiniband/core/cm.c  |  2 +-
  drivers/infiniband/core/cma.c | 27 ---
  drivers/infiniband/core/mad.c |  6 +++---
  drivers/infiniband/core/multicast.c   | 11 ---
  drivers/infiniband/core/sa_query.c| 14 +++---
  drivers/infiniband/core/ucm.c |  3 +--
  drivers/infiniband/core/user_mad.c|  2 +-
  drivers/infiniband/core/verbs.c   |  5 ++---
  drivers/infiniband/hw/mlx4/ah.c   |  2 +-
  drivers/infiniband/hw/mlx4/cq.c   |  4 +---
  drivers/infiniband/hw/mlx4/mad.c  | 14 --
  drivers/infiniband/hw/mlx4/main.c |  8 +++-
  drivers/infiniband/hw/mlx4/mlx4_ib.h  |  2 +-
  drivers/infiniband/hw/mlx4/qp.c   | 21 +++--
  drivers/infiniband/hw/mlx4/sysfs.c|  6 ++
  drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
  include/rdma/ib_verbs.h   | 24 
  net/sunrpc/xprtrdma/svc_rdma_recvfrom.c   |  3 +--
  19 files changed, 79 insertions(+), 83 deletions(-)

 diff --git a/drivers/infiniband/core/agent.c 
 b/drivers/infiniband/core/agent.c
 index f6d2961..27f1bec 100644
 --- a/drivers/infiniband/core/agent.c
 +++ b/drivers/infiniband/core/agent.c
 @@ -156,7 +156,7 @@ int ib_agent_port_open(struct ib_device *device, int 
 port_num)
  goto error1;
  }
  
 -if (rdma_port_get_link_layer(device, port_num) == 
 IB_LINK_LAYER_INFINIBAND) {
 +if (rdma_port_ll_is_ib(device, port_num)) {
  /* Obtain send only MAD agent for SMI QP */
  port_priv-agent[0] = ib_register_mad_agent(device, port_num,
  IB_QPT_SMI, NULL, 0,
 diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
 index e28a494..2c72e9e 100644
 --- a/drivers/infiniband/core/cm.c
 +++ b/drivers/infiniband/core/cm.c
 @@ -3762,7 +3762,7 @@ static void cm_add_one(struct ib_device *ib_device)
  int ret;
  u8 i;
  
 -if (rdma_node_get_transport(ib_device-node_type) != 
 RDMA_TRANSPORT_IB)
 +if (!rdma_transport_is_ib(ib_device))
   

Re: [PATCH 01/11] IB/Verbs: Use helpers to check transport and link layer

2015-03-30 Thread Doug Ledford
On Fri, 2015-03-27 at 16:40 +0100, Michael Wang wrote:
 We have so much places to check transport type and link layer type, it's now
 make sense to introduce some helpers in order to refine the lengthy code.
 
 This patch will introduce helpers:
 rdma_transport_is_ib()
 rdma_transport_is_iwarp()
 rdma_port_ll_is_ib()
 rdma_port_ll_is_eth()
 and use them to save some code for us.

If the end result is to do something like I proposed, then why take this
intermediate step that just has to be backed out later?

In other words, if our end goal is to have

rdma_transport_is_ib()
rdma_transport_is_iwarp()
rdma_transport_is_roce()
rdma_transport_is_opa()

Then we should skip doing rdma_port_ll_is_*() as the answers to these
items would be implied by rdma_transport_is_roce() and such.

 Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
 Cc: Doug Ledford dledf...@redhat.com
 Cc: Ira Weiny ira.we...@intel.com
 Cc: Sean Hefty sean.he...@intel.com
 Signed-off-by: Michael Wang yun.w...@profitbricks.com
 ---
  drivers/infiniband/core/agent.c   |  2 +-
  drivers/infiniband/core/cm.c  |  2 +-
  drivers/infiniband/core/cma.c | 27 ---
  drivers/infiniband/core/mad.c |  6 +++---
  drivers/infiniband/core/multicast.c   | 11 ---
  drivers/infiniband/core/sa_query.c| 14 +++---
  drivers/infiniband/core/ucm.c |  3 +--
  drivers/infiniband/core/user_mad.c|  2 +-
  drivers/infiniband/core/verbs.c   |  5 ++---
  drivers/infiniband/hw/mlx4/ah.c   |  2 +-
  drivers/infiniband/hw/mlx4/cq.c   |  4 +---
  drivers/infiniband/hw/mlx4/mad.c  | 14 --
  drivers/infiniband/hw/mlx4/main.c |  8 +++-
  drivers/infiniband/hw/mlx4/mlx4_ib.h  |  2 +-
  drivers/infiniband/hw/mlx4/qp.c   | 21 +++--
  drivers/infiniband/hw/mlx4/sysfs.c|  6 ++
  drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
  include/rdma/ib_verbs.h   | 24 
  net/sunrpc/xprtrdma/svc_rdma_recvfrom.c   |  3 +--
  19 files changed, 79 insertions(+), 83 deletions(-)
 
 diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
 index f6d2961..27f1bec 100644
 --- a/drivers/infiniband/core/agent.c
 +++ b/drivers/infiniband/core/agent.c
 @@ -156,7 +156,7 @@ int ib_agent_port_open(struct ib_device *device, int 
 port_num)
  goto error1;
  }
  
 -if (rdma_port_get_link_layer(device, port_num) == 
 IB_LINK_LAYER_INFINIBAND) {
 +if (rdma_port_ll_is_ib(device, port_num)) {
  /* Obtain send only MAD agent for SMI QP */
  port_priv-agent[0] = ib_register_mad_agent(device, port_num,
  IB_QPT_SMI, NULL, 0,
 diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
 index e28a494..2c72e9e 100644
 --- a/drivers/infiniband/core/cm.c
 +++ b/drivers/infiniband/core/cm.c
 @@ -3762,7 +3762,7 @@ static void cm_add_one(struct ib_device *ib_device)
  int ret;
  u8 i;
  
 -if (rdma_node_get_transport(ib_device-node_type) != RDMA_TRANSPORT_IB)
 +if (!rdma_transport_is_ib(ib_device))
  return;
  
  cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) *
 diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
 index d570030..668e955 100644
 --- a/drivers/infiniband/core/cma.c
 +++ b/drivers/infiniband/core/cma.c
 @@ -375,8 +375,8 @@ static int cma_acquire_dev(struct rdma_id_private 
 *id_priv,
   listen_id_priv-id.port_num) == dev_ll) {
  cma_dev = listen_id_priv-cma_dev;
  port = listen_id_priv-id.port_num;
 -if (rdma_node_get_transport(cma_dev-device-node_type) == 
 RDMA_TRANSPORT_IB 
 -rdma_port_get_link_layer(cma_dev-device, port) == 
 IB_LINK_LAYER_ETHERNET)
 +if (rdma_transport_is_ib(cma_dev-device) 
 +rdma_port_ll_is_eth(cma_dev-device, port))
  ret = ib_find_cached_gid(cma_dev-device, iboe_gid,
   found_port, NULL);
  else
 @@ -395,8 +395,8 @@ static int cma_acquire_dev(struct rdma_id_private 
 *id_priv,
  listen_id_priv-id.port_num == port)
  continue;
  if (rdma_port_get_link_layer(cma_dev-device, port) == dev_ll) {
 -if (rdma_node_get_transport(cma_dev-device-node_type) == 
 RDMA_TRANSPORT_IB 
 -rdma_port_get_link_layer(cma_dev-device, port) == 
 IB_LINK_LAYER_ETHERNET)
 +if (rdma_transport_is_ib(cma_dev-device) 
 +rdma_port_ll_is_eth(cma_dev-device, port))
  ret = ib_find_cached_gid(cma_dev-device, iboe_gid, 
 found_port, NULL);
  else
  ret = ib_find_cached_gid(cma_dev-device, gid, 
 found_port, NULL);
 @@ -435,7 +435,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private 
 *id_priv)
  pkey = 

Re: [PATCH 01/11] IB/Verbs: Use helpers to check transport and link layer

2015-03-30 Thread Michael Wang
Hi, Doug

Thanks for the comments :-)

On 03/30/2015 05:56 PM, Doug Ledford wrote:
 On Fri, 2015-03-27 at 16:40 +0100, Michael Wang wrote:
 We have so much places to check transport type and link layer type, it's now
 make sense to introduce some helpers in order to refine the lengthy code.

 This patch will introduce helpers:
 rdma_transport_is_ib()
 rdma_transport_is_iwarp()
 rdma_port_ll_is_ib()
 rdma_port_ll_is_eth()
 and use them to save some code for us.
 If the end result is to do something like I proposed, then why take this
 intermediate step that just has to be backed out later?

The problem is that I found there are still many places our new
mechanism may could not take care, especially inside device driver,
this is just try to collect the issues together as a basement so we can
gradually eliminate them.

Sure if finally we do capture all the cases, we can just get rid of
this one, but I guess it won't be that easy to directly jump into
next stage :-P

As I could imaging, after this reform, next stage could be introducing
the new mechanism without changing device driver, and the last
stage is to asking vendor adapt their code into the new mechanism.


 In other words, if our end goal is to have

 rdma_transport_is_ib()
 rdma_transport_is_iwarp()
 rdma_transport_is_roce()
 rdma_transport_is_opa()

 Then we should skip doing rdma_port_ll_is_*() as the answers to these
 items would be implied by rdma_transport_is_roce() and such.

Great if we achieved that ;-) but currently I just wondering maybe
these helpers can only cover part of the cases where we check
transport and link layer, there are still some cases we'll need the
very rough helper to save some code and make things clean~

Regards,
Michael Wang



 Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
 Cc: Doug Ledford dledf...@redhat.com
 Cc: Ira Weiny ira.we...@intel.com
 Cc: Sean Hefty sean.he...@intel.com
 Signed-off-by: Michael Wang yun.w...@profitbricks.com
 ---
  drivers/infiniband/core/agent.c   |  2 +-
  drivers/infiniband/core/cm.c  |  2 +-
  drivers/infiniband/core/cma.c | 27 ---
  drivers/infiniband/core/mad.c |  6 +++---
  drivers/infiniband/core/multicast.c   | 11 ---
  drivers/infiniband/core/sa_query.c| 14 +++---
  drivers/infiniband/core/ucm.c |  3 +--
  drivers/infiniband/core/user_mad.c|  2 +-
  drivers/infiniband/core/verbs.c   |  5 ++---
  drivers/infiniband/hw/mlx4/ah.c   |  2 +-
  drivers/infiniband/hw/mlx4/cq.c   |  4 +---
  drivers/infiniband/hw/mlx4/mad.c  | 14 --
  drivers/infiniband/hw/mlx4/main.c |  8 +++-
  drivers/infiniband/hw/mlx4/mlx4_ib.h  |  2 +-
  drivers/infiniband/hw/mlx4/qp.c   | 21 +++--
  drivers/infiniband/hw/mlx4/sysfs.c|  6 ++
  drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
  include/rdma/ib_verbs.h   | 24 
  net/sunrpc/xprtrdma/svc_rdma_recvfrom.c   |  3 +--
  19 files changed, 79 insertions(+), 83 deletions(-)

 diff --git a/drivers/infiniband/core/agent.c 
 b/drivers/infiniband/core/agent.c
 index f6d2961..27f1bec 100644
 --- a/drivers/infiniband/core/agent.c
 +++ b/drivers/infiniband/core/agent.c
 @@ -156,7 +156,7 @@ int ib_agent_port_open(struct ib_device *device, int 
 port_num)
  goto error1;
  }
  
 -if (rdma_port_get_link_layer(device, port_num) == 
 IB_LINK_LAYER_INFINIBAND) {
 +if (rdma_port_ll_is_ib(device, port_num)) {
  /* Obtain send only MAD agent for SMI QP */
  port_priv-agent[0] = ib_register_mad_agent(device, port_num,
  IB_QPT_SMI, NULL, 0,
 diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
 index e28a494..2c72e9e 100644
 --- a/drivers/infiniband/core/cm.c
 +++ b/drivers/infiniband/core/cm.c
 @@ -3762,7 +3762,7 @@ static void cm_add_one(struct ib_device *ib_device)
  int ret;
  u8 i;
  
 -if (rdma_node_get_transport(ib_device-node_type) != RDMA_TRANSPORT_IB)
 +if (!rdma_transport_is_ib(ib_device))
  return;
  
  cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) *
 diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
 index d570030..668e955 100644
 --- a/drivers/infiniband/core/cma.c
 +++ b/drivers/infiniband/core/cma.c
 @@ -375,8 +375,8 @@ static int cma_acquire_dev(struct rdma_id_private 
 *id_priv,
   listen_id_priv-id.port_num) == dev_ll) {
  cma_dev = listen_id_priv-cma_dev;
  port = listen_id_priv-id.port_num;
 -if (rdma_node_get_transport(cma_dev-device-node_type) == 
 RDMA_TRANSPORT_IB 
 -rdma_port_get_link_layer(cma_dev-device, port) == 
 IB_LINK_LAYER_ETHERNET)
 +if (rdma_transport_is_ib(cma_dev-device) 
 +rdma_port_ll_is_eth(cma_dev-device, port))
  ret = 

[PATCH 01/11] IB/Verbs: Use helpers to check transport and link layer

2015-03-27 Thread Michael Wang

We have so much places to check transport type and link layer type, it's now
make sense to introduce some helpers in order to refine the lengthy code.

This patch will introduce helpers:
rdma_transport_is_ib()
rdma_transport_is_iwarp()
rdma_port_ll_is_ib()
rdma_port_ll_is_eth()
and use them to save some code for us.

Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
Cc: Doug Ledford dledf...@redhat.com
Cc: Ira Weiny ira.we...@intel.com
Cc: Sean Hefty sean.he...@intel.com
Signed-off-by: Michael Wang yun.w...@profitbricks.com
---
 drivers/infiniband/core/agent.c   |  2 +-
 drivers/infiniband/core/cm.c  |  2 +-
 drivers/infiniband/core/cma.c | 27 ---
 drivers/infiniband/core/mad.c |  6 +++---
 drivers/infiniband/core/multicast.c   | 11 ---
 drivers/infiniband/core/sa_query.c| 14 +++---
 drivers/infiniband/core/ucm.c |  3 +--
 drivers/infiniband/core/user_mad.c|  2 +-
 drivers/infiniband/core/verbs.c   |  5 ++---
 drivers/infiniband/hw/mlx4/ah.c   |  2 +-
 drivers/infiniband/hw/mlx4/cq.c   |  4 +---
 drivers/infiniband/hw/mlx4/mad.c  | 14 --
 drivers/infiniband/hw/mlx4/main.c |  8 +++-
 drivers/infiniband/hw/mlx4/mlx4_ib.h  |  2 +-
 drivers/infiniband/hw/mlx4/qp.c   | 21 +++--
 drivers/infiniband/hw/mlx4/sysfs.c|  6 ++
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
 include/rdma/ib_verbs.h   | 24 
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c   |  3 +--
 19 files changed, 79 insertions(+), 83 deletions(-)

diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
index f6d2961..27f1bec 100644
--- a/drivers/infiniband/core/agent.c
+++ b/drivers/infiniband/core/agent.c
@@ -156,7 +156,7 @@ int ib_agent_port_open(struct ib_device *device, int 
port_num)
 goto error1;
 }
 
-if (rdma_port_get_link_layer(device, port_num) == 
IB_LINK_LAYER_INFINIBAND) {
+if (rdma_port_ll_is_ib(device, port_num)) {
 /* Obtain send only MAD agent for SMI QP */
 port_priv-agent[0] = ib_register_mad_agent(device, port_num,
 IB_QPT_SMI, NULL, 0,
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index e28a494..2c72e9e 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3762,7 +3762,7 @@ static void cm_add_one(struct ib_device *ib_device)
 int ret;
 u8 i;
 
-if (rdma_node_get_transport(ib_device-node_type) != RDMA_TRANSPORT_IB)
+if (!rdma_transport_is_ib(ib_device))
 return;
 
 cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) *
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d570030..668e955 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -375,8 +375,8 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv,
  listen_id_priv-id.port_num) == dev_ll) {
 cma_dev = listen_id_priv-cma_dev;
 port = listen_id_priv-id.port_num;
-if (rdma_node_get_transport(cma_dev-device-node_type) == 
RDMA_TRANSPORT_IB 
-rdma_port_get_link_layer(cma_dev-device, port) == 
IB_LINK_LAYER_ETHERNET)
+if (rdma_transport_is_ib(cma_dev-device) 
+rdma_port_ll_is_eth(cma_dev-device, port))
 ret = ib_find_cached_gid(cma_dev-device, iboe_gid,
  found_port, NULL);
 else
@@ -395,8 +395,8 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv,
 listen_id_priv-id.port_num == port)
 continue;
 if (rdma_port_get_link_layer(cma_dev-device, port) == dev_ll) {
-if (rdma_node_get_transport(cma_dev-device-node_type) == 
RDMA_TRANSPORT_IB 
-rdma_port_get_link_layer(cma_dev-device, port) == 
IB_LINK_LAYER_ETHERNET)
+if (rdma_transport_is_ib(cma_dev-device) 
+rdma_port_ll_is_eth(cma_dev-device, port))
 ret = ib_find_cached_gid(cma_dev-device, iboe_gid, 
found_port, NULL);
 else
 ret = ib_find_cached_gid(cma_dev-device, gid, 
found_port, NULL);
@@ -435,7 +435,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private 
*id_priv)
 pkey = ntohs(addr-sib_pkey);
 
 list_for_each_entry(cur_dev, dev_list, list) {
-if (rdma_node_get_transport(cur_dev-device-node_type) != 
RDMA_TRANSPORT_IB)
+if (!rdma_transport_is_ib(cur_dev-device))
 continue;
 
 for (p = 1; p = cur_dev-device-phys_port_cnt; ++p) {
@@ -633,10 +633,8 @@ static int cma_modify_qp_rtr(struct rdma_id_private 
*id_priv,
 if (ret)
 goto out;
 
-if (rdma_node_get_transport(id_priv-cma_dev-device-node_type)
-== RDMA_TRANSPORT_IB 
-