From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Wang Subject: [PATCH 2/2] IB/Verbs: Use helpers to check IBoE technology Date: Wed, 25 Mar 2015 12:16:09 +0100 Message-ID: <551298F9.8030306@profitbricks.com> References: <55129832.2070707@profitbricks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55129832.2070707-EIkl63zCoXaH+58JC4qpiA@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ira Weiny Cc: "J. Bruce Fields" , Trond Myklebust , "David S. Miller" , Moni Shoua , PJ Waskiewicz , Steve Wise , Tatyana Nikolova , Yan Burman , Jack Morgenstein , Yann Droneaud , Bart Van Assche , Colin Ian King , Mel Gorman , Majd Dibbiny , Jiri Kosina , Matan Barak , Dan Carpenter , Eugenia Emantayev , Doug Ledford , Alex Estrin , Erez Shitrit , Eric Dumazet List-Id: linux-rdma@vger.kernel.org This patch will introduce rdma_tech_is_iboe() and use it to save some code. Cc: Ira Weiny Cc: Sean Hefty Signed-off-by: Michael Wang --- drivers/infiniband/core/cma.c | 6 ++---- include/rdma/ib_verbs.h | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 668e955..d354857 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -375,8 +375,7 @@ 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_transport_is_ib(cma_dev->device) && - rdma_port_ll_is_eth(cma_dev->device, port)) + if (rdma_tech_is_iboe(cma_dev->device, port)) ret = ib_find_cached_gid(cma_dev->device, &iboe_gid, &found_port, NULL); else @@ -395,8 +394,7 @@ 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_transport_is_ib(cma_dev->device) && - rdma_port_ll_is_eth(cma_dev->device, port)) + if (rdma_tech_is_iboe(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); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 2bf9094..9a811f8 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1767,6 +1767,12 @@ static inline int rdma_port_ll_is_eth(struct ib_device *device, u8 port_num) == IB_LINK_LAYER_ETHERNET; } +static inline int rdma_tech_is_iboe(struct ib_device *device, u8 port_num) +{ + return rdma_transport_is_ib(device) && + rdma_port_ll_is_eth(device, port_num); +} + int ib_query_gid(struct ib_device *device, u8 port_num, int index, union ib_gid *gid); -- 2.1.0 -- 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