aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/rdma/ib_sa.h
diff options
context:
space:
mode:
authorDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>2017-04-27 19:05:59 -0400
committerDoug Ledford <dledford@redhat.com>2017-05-01 14:37:28 -0400
commitdfa834e1d97e24c7d6b7c5b102728d69d6361501 (patch)
tree9e713bef0935093568dad32ca96c1c92f19fff10 /include/rdma/ib_sa.h
parentIB/SA: Rename ib_sa_path_rec to sa_path_rec (diff)
downloadwireguard-linux-dfa834e1d97e24c7d6b7c5b102728d69d6361501.tar.xz
wireguard-linux-dfa834e1d97e24c7d6b7c5b102728d69d6361501.zip
IB/SA: Introduce path record specific types
struct sa_path_rec has a gid_type field. This patch introduces a more generic path record specific type 'rec_type' which is either IB, ROCE v1 or ROCE v2. The patch also provides conversion functions to get a gid type from a path record type and vice versa Reviewed-by: Don Hiatt <don.hiatt@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma/ib_sa.h')
-rw-r--r--include/rdma/ib_sa.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 7efdfb16ee83..c00914783e12 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -147,6 +147,11 @@ enum ib_sa_mc_join_states {
#define IB_SA_PATH_REC_PACKET_LIFE_TIME_SELECTOR IB_SA_COMP_MASK(20)
#define IB_SA_PATH_REC_PACKET_LIFE_TIME IB_SA_COMP_MASK(21)
#define IB_SA_PATH_REC_PREFERENCE IB_SA_COMP_MASK(22)
+enum sa_path_rec_type {
+ SA_PATH_REC_TYPE_IB,
+ SA_PATH_REC_TYPE_ROCE_V1,
+ SA_PATH_REC_TYPE_ROCE_V2
+};
struct sa_path_rec {
__be64 service_id;
@@ -176,7 +181,7 @@ struct sa_path_rec {
int ifindex;
/* ignored in IB */
struct net *net;
- enum ib_gid_type gid_type;
+ enum sa_path_rec_type rec_type;
};
static inline struct net_device *ib_get_ndev_from_path(struct sa_path_rec *rec)
@@ -184,6 +189,32 @@ static inline struct net_device *ib_get_ndev_from_path(struct sa_path_rec *rec)
return rec->net ? dev_get_by_index(rec->net, rec->ifindex) : NULL;
}
+static inline enum ib_gid_type
+ sa_conv_pathrec_to_gid_type(struct sa_path_rec *rec)
+{
+ switch (rec->rec_type) {
+ case SA_PATH_REC_TYPE_ROCE_V1:
+ return IB_GID_TYPE_ROCE;
+ case SA_PATH_REC_TYPE_ROCE_V2:
+ return IB_GID_TYPE_ROCE_UDP_ENCAP;
+ default:
+ return IB_GID_TYPE_IB;
+ }
+}
+
+static inline enum sa_path_rec_type
+ sa_conv_gid_to_pathrec_type(enum ib_gid_type type)
+{
+ switch (type) {
+ case IB_GID_TYPE_ROCE:
+ return SA_PATH_REC_TYPE_ROCE_V1;
+ case IB_GID_TYPE_ROCE_UDP_ENCAP:
+ return SA_PATH_REC_TYPE_ROCE_V2;
+ default:
+ return SA_PATH_REC_TYPE_IB;
+ }
+}
+
#define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0)
#define IB_SA_MCMEMBER_REC_PORT_GID IB_SA_COMP_MASK( 1)
#define IB_SA_MCMEMBER_REC_QKEY IB_SA_COMP_MASK( 2)