All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Hefty,
	Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH v2 rdma-next 18/18] IB/core: Define 'opa' rdma_ah_attr type
Date: Fri, 14 Apr 2017 19:28:58 -0400	[thread overview]
Message-ID: <1492212538-32459-19-git-send-email-dasaratharaman.chandramouli@intel.com> (raw)
In-Reply-To: <1492212538-32459-1-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

OPA ah_attr types allows core components to specify
attributes that may be specific to opa devices.
For instance, opa type ah_attr provides 32 bit lids
enabling larger OPA fabric sizes.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 include/rdma/ib_verbs.h | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 59b600a..bbe33df 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -840,6 +840,7 @@ struct ib_mr_status {
 enum rdma_ah_attr_type {
 	RDMA_AH_ATTR_TYPE_IB,
 	RDMA_AH_ATTR_TYPE_ROCE,
+	RDMA_AH_ATTR_TYPE_OPA,
 };
 
 struct ib_ah_attr {
@@ -851,6 +852,11 @@ struct roce_ah_attr {
 	u8			dmac[ETH_ALEN];
 };
 
+struct opa_ah_attr {
+	u32			dlid;
+	u8			src_path_bits;
+};
+
 struct rdma_ah_attr {
 	struct ib_global_route	grh;
 	u8			sl;
@@ -861,6 +867,7 @@ struct rdma_ah_attr {
 	union {
 		struct ib_ah_attr ib;
 		struct roce_ah_attr roce;
+		struct opa_ah_attr opa;
 	};
 };
 
@@ -3433,16 +3440,20 @@ static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr)
 	return NULL;
 }
 
-static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u16 dlid)
+static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u32 dlid)
 {
 	if (attr->type == RDMA_AH_ATTR_TYPE_IB)
-		attr->ib.dlid = dlid;
+		attr->ib.dlid = (u16)dlid;
+	else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+		attr->opa.dlid = dlid;
 }
 
-static inline u16 rdma_ah_get_dlid(const struct rdma_ah_attr *attr)
+static inline u32 rdma_ah_get_dlid(const struct rdma_ah_attr *attr)
 {
 	if (attr->type == RDMA_AH_ATTR_TYPE_IB)
 		return attr->ib.dlid;
+	else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+		return attr->opa.dlid;
 	return 0;
 }
 
@@ -3461,12 +3472,16 @@ static inline void rdma_ah_set_path_bits(struct rdma_ah_attr *attr,
 {
 	if (attr->type == RDMA_AH_ATTR_TYPE_IB)
 		attr->ib.src_path_bits = src_path_bits;
+	else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+		attr->opa.src_path_bits = src_path_bits;
 }
 
 static inline u8 rdma_ah_get_path_bits(const struct rdma_ah_attr *attr)
 {
 	if (attr->type == RDMA_AH_ATTR_TYPE_IB)
 		return attr->ib.src_path_bits;
+	else if (attr->type == RDMA_AH_ATTR_TYPE_OPA)
+		return attr->opa.src_path_bits;
 	return 0;
 }
 
@@ -3562,6 +3577,9 @@ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev,
 	if ((rdma_protocol_roce(dev, port_num)) ||
 	    (rdma_protocol_iwarp(dev, port_num)))
 		return RDMA_AH_ATTR_TYPE_ROCE;
+	else if ((rdma_protocol_ib(dev, port_num)) &&
+		 (rdma_cap_opa_ah(dev, port_num)))
+		return RDMA_AH_ATTR_TYPE_OPA;
 	else
 		return RDMA_AH_ATTR_TYPE_IB;
 }
-- 
1.8.3.1

--
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:[~2017-04-14 23:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 23:28 [PATCH v2 rdma-next 00/18] Enhance ib_ah_attr to specify types Dasaratharaman Chandramouli
     [not found] ` <1492212538-32459-1-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-14 23:28   ` [PATCH v2 rdma-next 01/18] IB/ocrdma: Add identifier names to function definitions Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 02/18] IB/IPoIB: Remove 'else' when the 'if' has a return Dasaratharaman Chandramouli
     [not found]     ` <1492212538-32459-3-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-19 16:43       ` Leon Romanovsky
2017-04-14 23:28   ` [PATCH v2 rdma-next 03/18] IB/core: Add braces when using sizeof Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 04/18] IB/core: Check for global flag when using ah_attr Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 05/18] IB/rxe: Initialize ib_ah_attr during query_ah Dasaratharaman Chandramouli
     [not found]     ` <1492212538-32459-6-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-15 14:34       ` Leon Romanovsky
2017-04-14 23:28   ` [PATCH v2 rdma-next 06/18] IB/core: Rename struct ib_ah_attr to rdma_ah_attr Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 07/18] IB/core: Rename ib_create_ah to rdma_create_ah Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 08/18] IB/core: Rename ib_modify_ah to rdma_modify_ah Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 09/18] IB/core: Rename ib_query_ah to rdma_query_ah Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 10/18] IB/core: Rename ib_destroy_ah to rdma_destroy_ah Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 11/18] IB/mlx4: Rename to_ib_ah_attr to to_rdma_ah_attr Dasaratharaman Chandramouli
     [not found]     ` <1492212538-32459-12-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-19 16:42       ` Leon Romanovsky
2017-04-14 23:28   ` [PATCH v2 rdma-next 12/18] IB/mlx5: " Dasaratharaman Chandramouli
     [not found]     ` <1492212538-32459-13-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-19 16:42       ` Leon Romanovsky
2017-04-14 23:28   ` [PATCH v2 rdma-next 13/18] IB/mthca: " Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 14/18] IB/PVRDMA: Rename ib_ah_attr related functions Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 15/18] IB/core: Add accessor functions for rdma_ah_attr fields Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 16/18] IB/core: Use rdma_ah_attr accessor functions Dasaratharaman Chandramouli
2017-04-14 23:28   ` [PATCH v2 rdma-next 17/18] IB/core: Define 'ib' and 'roce' rdma_ah_attr types Dasaratharaman Chandramouli
2017-04-14 23:28   ` Dasaratharaman Chandramouli [this message]

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=1492212538-32459-19-git-send-email-dasaratharaman.chandramouli@intel.com \
    --to=dasaratharaman.chandramouli-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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.