From: Moni Shoua <monis@xxxxxxxxxxxx> ODP support is described by per-transport bit array, an array for XRC transport is added. In addition, ibv_devinfo was updated to report this capability. Signed-off-by: Moni Shoua <monis@xxxxxxxxxxxx> Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> --- libibverbs/cmd.c | 9 +++++++++ libibverbs/examples/devinfo.c | 7 +++++-- libibverbs/man/ibv_query_device_ex.3 | 1 + libibverbs/verbs.h | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 34c71e5..ec551e2 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -265,6 +265,15 @@ int ibv_cmd_query_device_ex(struct ibv_context *context, } } + if (attr_size >= offsetof(struct ibv_device_attr_ex, xrc_odp_caps) + + sizeof(attr->xrc_odp_caps)) { + if (resp->response_length >= + offsetof(struct ib_uverbs_ex_query_device_resp, xrc_odp_caps) + + sizeof(resp->xrc_odp_caps)) { + attr->xrc_odp_caps = resp->xrc_odp_caps; + } + } + return 0; } diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index 735adb1..75bdd8c 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -309,9 +309,10 @@ static void print_odp_trans_caps(uint32_t trans) } } -static void print_odp_caps(const struct ibv_odp_caps *caps) +static void print_odp_caps(const struct ibv_device_attr_ex *device_attr) { uint64_t unknown_general_caps = ~(IBV_ODP_SUPPORT); + const struct ibv_odp_caps *caps = &device_attr->odp_caps; /* general odp caps */ printf("\tgeneral_odp_caps:\n"); @@ -328,6 +329,8 @@ static void print_odp_caps(const struct ibv_odp_caps *caps) print_odp_trans_caps(caps->per_transport_caps.uc_odp_caps); printf("\tud_odp_caps:\n"); print_odp_trans_caps(caps->per_transport_caps.ud_odp_caps); + printf("\txrc_odp_caps:\n"); + print_odp_trans_caps(device_attr->xrc_odp_caps); } static void print_device_cap_flags_ex(uint64_t device_cap_flags_ex) @@ -531,7 +534,7 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port) printf("\tmax_pkeys:\t\t\t%d\n", device_attr.orig_attr.max_pkeys); printf("\tlocal_ca_ack_delay:\t\t%d\n", device_attr.orig_attr.local_ca_ack_delay); - print_odp_caps(&device_attr.odp_caps); + print_odp_caps(&device_attr); if (device_attr.completion_timestamp_mask) printf("\tcompletion timestamp_mask:\t\t\t0x%016" PRIx64 "\n", device_attr.completion_timestamp_mask); diff --git a/libibverbs/man/ibv_query_device_ex.3 b/libibverbs/man/ibv_query_device_ex.3 index 15a430d..3ad9eec 100644 --- a/libibverbs/man/ibv_query_device_ex.3 +++ b/libibverbs/man/ibv_query_device_ex.3 @@ -37,6 +37,7 @@ struct ibv_tm_caps tm_caps; /* Tag matching capabilities struct ibv_cq_moderation_caps cq_mod_caps; /* CQ moderation max capabilities */ uint64_t max_dm_size; /* Max Device Memory size (in bytes) available for allocation */ struct ibv_pci_atomic_caps atomic_caps; /* PCI atomic operations capabilities, use enum ibv_pci_atomic_op_size */ +uint32_t xrc_odp_caps; /* Mask with enum ibv_odp_transport_cap_bits to know which operations are supported. */ .in -8 }; diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 4cc8720..94e4916 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -325,6 +325,7 @@ struct ibv_device_attr_ex { struct ibv_cq_moderation_caps cq_mod_caps; uint64_t max_dm_size; struct ibv_pci_atomic_caps pci_atomic_caps; + uint32_t xrc_odp_caps; }; enum ibv_mtu { -- 1.8.3.1