diff options
author | Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> | 2017-04-29 14:41:30 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-05-01 14:32:43 -0400 |
commit | 64b4646eaf3dab4cc7b3040d10d565a83654446f (patch) | |
tree | dc04ccefd69c916d547bcf34d7aa8cf477fccea1 | |
parent | 44c58487d51a0dc43d96f1dc864f0461ec6a346a (diff) |
IB/core: Define 'opa' rdma_ah_attr type
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@intel.com>
Reviewed-by: Don Hiatt <don.hiatt@intel.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | include/rdma/ib_verbs.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 803927b31742..f0cb4906478a 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -843,6 +843,7 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int mult); | |||
843 | enum rdma_ah_attr_type { | 843 | enum rdma_ah_attr_type { |
844 | RDMA_AH_ATTR_TYPE_IB, | 844 | RDMA_AH_ATTR_TYPE_IB, |
845 | RDMA_AH_ATTR_TYPE_ROCE, | 845 | RDMA_AH_ATTR_TYPE_ROCE, |
846 | RDMA_AH_ATTR_TYPE_OPA, | ||
846 | }; | 847 | }; |
847 | 848 | ||
848 | struct ib_ah_attr { | 849 | struct ib_ah_attr { |
@@ -854,6 +855,11 @@ struct roce_ah_attr { | |||
854 | u8 dmac[ETH_ALEN]; | 855 | u8 dmac[ETH_ALEN]; |
855 | }; | 856 | }; |
856 | 857 | ||
858 | struct opa_ah_attr { | ||
859 | u32 dlid; | ||
860 | u8 src_path_bits; | ||
861 | }; | ||
862 | |||
857 | struct rdma_ah_attr { | 863 | struct rdma_ah_attr { |
858 | struct ib_global_route grh; | 864 | struct ib_global_route grh; |
859 | u8 sl; | 865 | u8 sl; |
@@ -864,6 +870,7 @@ struct rdma_ah_attr { | |||
864 | union { | 870 | union { |
865 | struct ib_ah_attr ib; | 871 | struct ib_ah_attr ib; |
866 | struct roce_ah_attr roce; | 872 | struct roce_ah_attr roce; |
873 | struct opa_ah_attr opa; | ||
867 | }; | 874 | }; |
868 | }; | 875 | }; |
869 | 876 | ||
@@ -3490,16 +3497,20 @@ static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr) | |||
3490 | return NULL; | 3497 | return NULL; |
3491 | } | 3498 | } |
3492 | 3499 | ||
3493 | static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u16 dlid) | 3500 | static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u32 dlid) |
3494 | { | 3501 | { |
3495 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) | 3502 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) |
3496 | attr->ib.dlid = dlid; | 3503 | attr->ib.dlid = (u16)dlid; |
3504 | else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) | ||
3505 | attr->opa.dlid = dlid; | ||
3497 | } | 3506 | } |
3498 | 3507 | ||
3499 | static inline u16 rdma_ah_get_dlid(const struct rdma_ah_attr *attr) | 3508 | static inline u32 rdma_ah_get_dlid(const struct rdma_ah_attr *attr) |
3500 | { | 3509 | { |
3501 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) | 3510 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) |
3502 | return attr->ib.dlid; | 3511 | return attr->ib.dlid; |
3512 | else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) | ||
3513 | return attr->opa.dlid; | ||
3503 | return 0; | 3514 | return 0; |
3504 | } | 3515 | } |
3505 | 3516 | ||
@@ -3518,12 +3529,16 @@ static inline void rdma_ah_set_path_bits(struct rdma_ah_attr *attr, | |||
3518 | { | 3529 | { |
3519 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) | 3530 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) |
3520 | attr->ib.src_path_bits = src_path_bits; | 3531 | attr->ib.src_path_bits = src_path_bits; |
3532 | else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) | ||
3533 | attr->opa.src_path_bits = src_path_bits; | ||
3521 | } | 3534 | } |
3522 | 3535 | ||
3523 | static inline u8 rdma_ah_get_path_bits(const struct rdma_ah_attr *attr) | 3536 | static inline u8 rdma_ah_get_path_bits(const struct rdma_ah_attr *attr) |
3524 | { | 3537 | { |
3525 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) | 3538 | if (attr->type == RDMA_AH_ATTR_TYPE_IB) |
3526 | return attr->ib.src_path_bits; | 3539 | return attr->ib.src_path_bits; |
3540 | else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) | ||
3541 | return attr->opa.src_path_bits; | ||
3527 | return 0; | 3542 | return 0; |
3528 | } | 3543 | } |
3529 | 3544 | ||
@@ -3619,6 +3634,9 @@ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev, | |||
3619 | if ((rdma_protocol_roce(dev, port_num)) || | 3634 | if ((rdma_protocol_roce(dev, port_num)) || |
3620 | (rdma_protocol_iwarp(dev, port_num))) | 3635 | (rdma_protocol_iwarp(dev, port_num))) |
3621 | return RDMA_AH_ATTR_TYPE_ROCE; | 3636 | return RDMA_AH_ATTR_TYPE_ROCE; |
3637 | else if ((rdma_protocol_ib(dev, port_num)) && | ||
3638 | (rdma_cap_opa_ah(dev, port_num))) | ||
3639 | return RDMA_AH_ATTR_TYPE_OPA; | ||
3622 | else | 3640 | else |
3623 | return RDMA_AH_ATTR_TYPE_IB; | 3641 | return RDMA_AH_ATTR_TYPE_IB; |
3624 | } | 3642 | } |