From 87a408ade3ac4341f7102616b7dde8300d8edd5e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 17 Oct 2026 16:31:31 -0700 Subject: [PATCH] Turn on GCC's -Wredundant-tags, and drop the struct and enum keywords GCC's -Wredundant-tags is on. It reports a struct, union, or enum keyword in front of a type's name where C++ doesn't need it, as in struct ibv_pd *pd. Without the keyword, naming a type that hasn't been declared is a compile error. With it, the name quietly declares a new type in the enclosing namespace (hipObj::ibv_pd, not libibverbs' ::ibv_pd). Clang has no equivalent, so only GCC builds check it. - The keywords GCC reported are gone from the library, the tests, the test server, and the s3_curl_ops example, including ibv-core.h. The layout test still checks ibv-core.h against . Where a keyword is the type's first mention, as for ibv_device in ibv_device_ops, it stays. - ibv-layout-list.h is also included by the C file ibv-layout-real.c, and C needs the keyword, so each entry now passes it as its own argument: HIPOBJ_IBV_MEMBER(struct, ibv_gid_entry, gid). ibv-layout-real.c puts it in front of the name, and test-ibv-layout.cpp only uses it in its failure messages. - AGENTS.md's IWYU notes are updated. Without the keywords, IWYU suggests replacing ibv-core.h with forward declarations of the verbs types in src/buffer.h and src/common/ibv-wrapper.h. The include stays, since ibv-core.h declares the types in the global namespace, as libibverbs does. Co-Authored-By: Claude --- AGENTS.md | 12 +- cmake/HIPOBJGNUCompilerOptions.cmake | 2 +- examples/s3_curl_ops.cpp | 6 +- src/buffer.cpp | 8 +- src/buffer.h | 6 +- src/common/ibv-core.h | 400 +++++------ src/common/ibv-ptr.h | 26 +- src/common/ibv-wrapper.cpp | 66 +- src/common/ibv-wrapper.h | 132 ++-- src/rdma/bnxt/bnxt-backend.cpp | 2 +- src/rdma/ionic/ionic-backend.cpp | 2 +- src/rdma/transport.cpp | 10 +- src/rdma/transport.h | 14 +- src/rdma/vendor-ops.h | 4 +- .../rdma-test-server/rdma_server.cpp | 6 +- test/unit/fake-device.cpp | 79 ++- test/unit/fake-device.h | 48 +- test/unit/ibv-layout-list.h | 623 +++++++++--------- test/unit/ibv-layout-real.c | 6 +- test/unit/test-api-exceptions.cpp | 6 +- test/unit/test-buffer-registration.cpp | 6 +- test/unit/test-connection-pool.cpp | 4 +- test/unit/test-ibv-dmabuf.cpp | 10 +- test/unit/test-ibv-layout.cpp | 13 +- test/unit/test-loaded-verbs.cpp | 101 ++- test/unit/test-s3-curl-ops.cpp | 4 +- test/unit/test-seams.cpp | 26 +- test/unit/test-span.cpp | 2 +- test/unit/test-transport.cpp | 10 +- 29 files changed, 815 insertions(+), 819 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d4b9a331..b1a80d8f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -552,10 +552,14 @@ configuration files. libstdc++ implements those comparisons with `operator<=>`, but `` already includes ``, as the standard requires. Other wrong suggestions IWYU makes here: - - Removing `ibv-core.h` from a header that names the verbs types only as - `struct ibv_pd *` and the like. Without a prior declaration, that - declares a new `struct` in the enclosing namespace (`hipObj::ibv_pd`, - not libibverbs' `::ibv_pd`), so keep the include. + - Replacing `ibv-core.h` with forward declarations of the verbs types + (`struct ibv_pd;` and the like) in a header that uses them only through + pointers, such as [`src/buffer.h`](src/buffer.h) and + [`src/common/ibv-wrapper.h`](src/common/ibv-wrapper.h). `ibv-core.h` + declares them in the global namespace, as libibverbs does. A copy of + the declaration only repeats it, and one inside `namespace hipObj` + declares a different type (`hipObj::ibv_pd`, not `::ibv_pd`), so keep + the include. - Removing `` from `src/hipobj.cpp` because the public header includes ``. C++ code includes `` (see [C++ code](#c-code)). diff --git a/cmake/HIPOBJGNUCompilerOptions.cmake b/cmake/HIPOBJGNUCompilerOptions.cmake index 4d059ced..d3476307 100644 --- a/cmake/HIPOBJGNUCompilerOptions.cmake +++ b/cmake/HIPOBJGNUCompilerOptions.cmake @@ -121,7 +121,7 @@ function(hipobj_get_gnu_warning_flags outvar compiler_version) # Misc warnings -Warith-conversion -Wmismatched-tags - #-Wredundant-tags # TODO: Fix issues + -Wredundant-tags ${flags} ) endif() diff --git a/examples/s3_curl_ops.cpp b/examples/s3_curl_ops.cpp index 46e9f561..d975c14d 100644 --- a/examples/s3_curl_ops.cpp +++ b/examples/s3_curl_ops.cpp @@ -28,14 +28,14 @@ struct CurlEasyDeleter { }; struct CurlSlistDeleter { - void operator()(struct curl_slist *list) const noexcept + void operator()(curl_slist *list) const noexcept { curl_slist_free_all(list); } }; using CurlEasyPtr = std::unique_ptr; -using CurlSlistPtr = std::unique_ptr; +using CurlSlistPtr = std::unique_ptr; // curl_slist_append() returns the head of the list, which is a new node // only when the list was empty, or NULL on failure without freeing the @@ -43,7 +43,7 @@ using CurlSlistPtr = std::unique_ptr; bool appendHeader(CurlSlistPtr &list, const char *header) { - struct curl_slist *head = curl_slist_append(list.get(), header); + curl_slist *head = curl_slist_append(list.get(), header); if (head == nullptr) { return false; } diff --git a/src/buffer.cpp b/src/buffer.cpp index 64cbab78..5f192886 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -75,8 +75,8 @@ namespace { } // namespace IbvMrPtr -registerDeviceMemory(const Verbs &verbs, const HipRuntime &runtime, struct ibv_pd *pd, void *addr, - size_t length, int access, const DmabufPolicy &policy) +registerDeviceMemory(const Verbs &verbs, const HipRuntime &runtime, ibv_pd *pd, void *addr, size_t length, + int access, const DmabufPolicy &policy) { /* Whether a given GPU can export a dma-buf and a given NIC can register * it is answered by trying: both calls report their own failure and @@ -180,7 +180,7 @@ BufferMap::insert(uintptr_t key, std::shared_ptr entry) } BufferMap::RegisterResult -BufferMap::registerBuffer(void *devPtr, size_t size, struct ibv_pd *pd) +BufferMap::registerBuffer(void *devPtr, size_t size, ibv_pd *pd) { if (size > MAX_MR_SIZE) { return RegisterResult::Failed; @@ -236,7 +236,7 @@ BufferMap::registerBuffer(void *devPtr, size_t size, struct ibv_pd *pd) } BufferMap::RegisterResult -BufferMap::registerHostBuffer(void *hostPtr, size_t size, struct ibv_pd *pd) +BufferMap::registerHostBuffer(void *hostPtr, size_t size, ibv_pd *pd) { if (size > MAX_MR_SIZE) { return RegisterResult::Failed; diff --git a/src/buffer.h b/src/buffer.h index 12319c99..ae0251bf 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -38,7 +38,7 @@ struct DmabufPolicy { * GPU memory. Otherwise, or when either step fails, it registers the * memory as host memory, which fails for GPU memory. Null when nothing * registers. */ -IbvMrPtr registerDeviceMemory(const Verbs &verbs, const HipRuntime &runtime, struct ibv_pd *pd, void *addr, +IbvMrPtr registerDeviceMemory(const Verbs &verbs, const HipRuntime &runtime, ibv_pd *pd, void *addr, size_t length, int access, const DmabufPolicy &policy); /* Frees a host staging buffer through the runtime whose hostMalloc() @@ -146,9 +146,9 @@ class BufferMap { * holding the map's lock. When two threads register the same address * at once, one gets Registered, and the other AlreadyRegistered, and * its registration is released. */ - [[nodiscard]] RegisterResult registerBuffer(void *devPtr, size_t size, struct ibv_pd *pd) + [[nodiscard]] RegisterResult registerBuffer(void *devPtr, size_t size, ibv_pd *pd) HIPOBJ_REQUIRES(!mutex_); - [[nodiscard]] RegisterResult registerHostBuffer(void *hostPtr, size_t size, struct ibv_pd *pd) + [[nodiscard]] RegisterResult registerHostBuffer(void *hostPtr, size_t size, ibv_pd *pd) HIPOBJ_REQUIRES(!mutex_); /* Removes the entry, and releases its registration and any staging * buffer without holding the map's lock */ diff --git a/src/common/ibv-core.h b/src/common/ibv-core.h index e26f688c..3f6a9104 100644 --- a/src/common/ibv-core.h +++ b/src/common/ibv-core.h @@ -100,11 +100,11 @@ enum ibv_gid_type { * ------------------------------------------------------------------------- */ struct ibv_gid_entry { - union ibv_gid gid; - uint32_t gid_index; - uint32_t port_num; - uint32_t gid_type; - uint32_t ndev_ifindex; + ibv_gid gid; + uint32_t gid_index; + uint32_t port_num; + uint32_t gid_type; + uint32_t ndev_ifindex; }; /* ------------------------------------------------------------------------- @@ -138,46 +138,46 @@ enum ibv_atomic_cap { IBV_ATOMIC_NONE, IBV_ATOMIC_HCA, IBV_ATOMIC_GLOB }; * ------------------------------------------------------------------------- */ struct ibv_device_attr { - char fw_ver[64]; - __be64 node_guid; - __be64 sys_image_guid; - uint64_t max_mr_size; - uint64_t page_size_cap; - uint32_t vendor_id; - uint32_t vendor_part_id; - uint32_t hw_ver; - int max_qp; - int max_qp_wr; - unsigned int device_cap_flags; - int max_sge; - int max_sge_rd; - int max_cq; - int max_cqe; - int max_mr; - int max_pd; - int max_qp_rd_atom; - int max_ee_rd_atom; - int max_res_rd_atom; - int max_qp_init_rd_atom; - int max_ee_init_rd_atom; - enum ibv_atomic_cap atomic_cap; - int max_ee; - int max_rdd; - int max_mw; - int max_raw_ipv6_qp; - int max_raw_ethy_qp; - int max_mcast_grp; - int max_mcast_qp_attach; - int max_total_mcast_qp_attach; - int max_ah; - int max_fmr; - int max_map_per_fmr; - int max_srq; - int max_srq_wr; - int max_srq_sge; - uint16_t max_pkeys; - uint8_t local_ca_ack_delay; - uint8_t phys_port_cnt; + char fw_ver[64]; + __be64 node_guid; + __be64 sys_image_guid; + uint64_t max_mr_size; + uint64_t page_size_cap; + uint32_t vendor_id; + uint32_t vendor_part_id; + uint32_t hw_ver; + int max_qp; + int max_qp_wr; + unsigned int device_cap_flags; + int max_sge; + int max_sge_rd; + int max_cq; + int max_cqe; + int max_mr; + int max_pd; + int max_qp_rd_atom; + int max_ee_rd_atom; + int max_res_rd_atom; + int max_qp_init_rd_atom; + int max_ee_init_rd_atom; + ibv_atomic_cap atomic_cap; + int max_ee; + int max_rdd; + int max_mw; + int max_raw_ipv6_qp; + int max_raw_ethy_qp; + int max_mcast_grp; + int max_mcast_qp_attach; + int max_total_mcast_qp_attach; + int max_ah; + int max_fmr; + int max_map_per_fmr; + int max_srq; + int max_srq_wr; + int max_srq_sge; + uint16_t max_pkeys; + uint8_t local_ca_ack_delay; + uint8_t phys_port_cnt; }; /* ------------------------------------------------------------------------- @@ -206,29 +206,29 @@ enum { * ------------------------------------------------------------------------- */ struct ibv_port_attr { - enum ibv_port_state state; - enum ibv_mtu max_mtu; - enum ibv_mtu active_mtu; - int gid_tbl_len; - uint32_t port_cap_flags; - uint32_t max_msg_sz; - uint32_t bad_pkey_cntr; - uint32_t qkey_viol_cntr; - uint16_t pkey_tbl_len; - uint16_t lid; - uint16_t sm_lid; - uint8_t lmc; - uint8_t max_vl_num; - uint8_t sm_sl; - uint8_t subnet_timeout; - uint8_t init_type_reply; - uint8_t active_width; - uint8_t active_speed; - uint8_t phys_state; - uint8_t link_layer; - uint8_t flags; - uint16_t port_cap_flags2; - uint32_t active_speed_ex; + ibv_port_state state; + ibv_mtu max_mtu; + ibv_mtu active_mtu; + int gid_tbl_len; + uint32_t port_cap_flags; + uint32_t max_msg_sz; + uint32_t bad_pkey_cntr; + uint32_t qkey_viol_cntr; + uint16_t pkey_tbl_len; + uint16_t lid; + uint16_t sm_lid; + uint8_t lmc; + uint8_t max_vl_num; + uint8_t sm_sl; + uint8_t subnet_timeout; + uint8_t init_type_reply; + uint8_t active_width; + uint8_t active_speed; + uint8_t phys_state; + uint8_t link_layer; + uint8_t flags; + uint16_t port_cap_flags2; + uint32_t active_speed_ex; }; /* ------------------------------------------------------------------------- @@ -289,11 +289,11 @@ enum ibv_wc_status { }; struct ibv_wc { - uint64_t wr_id; - enum ibv_wc_status status; - enum ibv_wc_opcode opcode; - uint32_t vendor_err; - uint32_t byte_len; + uint64_t wr_id; + ibv_wc_status status; + ibv_wc_opcode opcode; + uint32_t vendor_err; + uint32_t byte_len; union { __be32 imm_data; uint32_t invalidated_rkey; @@ -332,18 +332,18 @@ enum ibv_access_flags { struct ibv_context; struct ibv_pd { - struct ibv_context *context; - uint32_t handle; + ibv_context *context; + uint32_t handle; }; struct ibv_mr { - struct ibv_context *context; - struct ibv_pd *pd; - void *addr; - size_t length; - uint32_t handle; - uint32_t lkey; - uint32_t rkey; + ibv_context *context; + ibv_pd *pd; + void *addr; + size_t length; + uint32_t handle; + uint32_t lkey; + uint32_t rkey; }; /* ------------------------------------------------------------------------- @@ -351,21 +351,21 @@ struct ibv_mr { * ------------------------------------------------------------------------- */ struct ibv_global_route { - union ibv_gid dgid; - uint32_t flow_label; - uint8_t sgid_index; - uint8_t hop_limit; - uint8_t traffic_class; + ibv_gid dgid; + uint32_t flow_label; + uint8_t sgid_index; + uint8_t hop_limit; + uint8_t traffic_class; }; struct ibv_ah_attr { - struct ibv_global_route grh; - uint16_t dlid; - uint8_t sl; - uint8_t src_path_bits; - uint8_t static_rate; - uint8_t is_global; - uint8_t port_num; + ibv_global_route grh; + uint16_t dlid; + uint8_t sl; + uint8_t src_path_bits; + uint8_t static_rate; + uint8_t is_global; + uint8_t port_num; }; /* ------------------------------------------------------------------------- @@ -400,13 +400,13 @@ struct ibv_comp_channel; struct ibv_srq; struct ibv_qp_init_attr { - void *qp_context; - struct ibv_cq *send_cq; - struct ibv_cq *recv_cq; - struct ibv_srq *srq; - struct ibv_qp_cap cap; - enum ibv_qp_type qp_type; - int sq_sig_all; + void *qp_context; + ibv_cq *send_cq; + ibv_cq *recv_cq; + ibv_srq *srq; + ibv_qp_cap cap; + ibv_qp_type qp_type; + int sq_sig_all; }; /* ------------------------------------------------------------------------- @@ -460,32 +460,32 @@ enum ibv_mig_state { IBV_MIG_MIGRATED, IBV_MIG_REARM, IBV_MIG_ARMED }; * ------------------------------------------------------------------------- */ struct ibv_qp_attr { - enum ibv_qp_state qp_state; - enum ibv_qp_state cur_qp_state; - enum ibv_mtu path_mtu; - enum ibv_mig_state path_mig_state; - uint32_t qkey; - uint32_t rq_psn; - uint32_t sq_psn; - uint32_t dest_qp_num; - unsigned int qp_access_flags; - struct ibv_qp_cap cap; - struct ibv_ah_attr ah_attr; - struct ibv_ah_attr alt_ah_attr; - uint16_t pkey_index; - uint16_t alt_pkey_index; - uint8_t en_sqd_async_notify; - uint8_t sq_draining; - uint8_t max_rd_atomic; - uint8_t max_dest_rd_atomic; - uint8_t min_rnr_timer; - uint8_t port_num; - uint8_t timeout; - uint8_t retry_cnt; - uint8_t rnr_retry; - uint8_t alt_port_num; - uint8_t alt_timeout; - uint32_t rate_limit; + ibv_qp_state qp_state; + ibv_qp_state cur_qp_state; + ibv_mtu path_mtu; + ibv_mig_state path_mig_state; + uint32_t qkey; + uint32_t rq_psn; + uint32_t sq_psn; + uint32_t dest_qp_num; + unsigned int qp_access_flags; + ibv_qp_cap cap; + ibv_ah_attr ah_attr; + ibv_ah_attr alt_ah_attr; + uint16_t pkey_index; + uint16_t alt_pkey_index; + uint8_t en_sqd_async_notify; + uint8_t sq_draining; + uint8_t max_rd_atomic; + uint8_t max_dest_rd_atomic; + uint8_t min_rnr_timer; + uint8_t port_num; + uint8_t timeout; + uint8_t retry_cnt; + uint8_t rnr_retry; + uint8_t alt_port_num; + uint8_t alt_timeout; + uint32_t rate_limit; }; /* ------------------------------------------------------------------------- @@ -493,19 +493,19 @@ struct ibv_qp_attr { * ------------------------------------------------------------------------- */ struct ibv_qp { - struct ibv_context *context; - void *qp_context; - struct ibv_pd *pd; - struct ibv_cq *send_cq; - struct ibv_cq *recv_cq; - struct ibv_srq *srq; - uint32_t handle; - uint32_t qp_num; - enum ibv_qp_state state; - enum ibv_qp_type qp_type; - pthread_mutex_t mutex; - pthread_cond_t cond; - uint32_t events_completed; + ibv_context *context; + void *qp_context; + ibv_pd *pd; + ibv_cq *send_cq; + ibv_cq *recv_cq; + ibv_srq *srq; + uint32_t handle; + uint32_t qp_num; + ibv_qp_state state; + ibv_qp_type qp_type; + pthread_mutex_t mutex; + pthread_cond_t cond; + uint32_t events_completed; }; /* ------------------------------------------------------------------------- @@ -559,10 +559,10 @@ struct ibv_ah; struct ibv_mw; struct ibv_mw_bind_info { - struct ibv_mr *mr; - uint64_t addr; - uint64_t length; - unsigned int mw_access_flags; + ibv_mr *mr; + uint64_t addr; + uint64_t length; + unsigned int mw_access_flags; }; /* The types of ibv_send_wr's bind_mw and tso members. rdma-core leaves @@ -570,9 +570,9 @@ struct ibv_mw_bind_info { * anonymous union that holds the members. The names aren't part of the * ABI, so the layout still matches. */ struct ibv_send_wr_bind_mw { - struct ibv_mw *mw; - uint32_t rkey; - struct ibv_mw_bind_info bind_info; + ibv_mw *mw; + uint32_t rkey; + ibv_mw_bind_info bind_info; }; struct ibv_send_wr_tso { @@ -582,12 +582,12 @@ struct ibv_send_wr_tso { }; struct ibv_send_wr { - uint64_t wr_id; - struct ibv_send_wr *next; - struct ibv_sge *sg_list; - int num_sge; - enum ibv_wr_opcode opcode; - unsigned int send_flags; + uint64_t wr_id; + ibv_send_wr *next; + ibv_sge *sg_list; + int num_sge; + ibv_wr_opcode opcode; + unsigned int send_flags; union { __be32 imm_data; uint32_t invalidate_rkey; @@ -604,9 +604,9 @@ struct ibv_send_wr { uint32_t rkey; } atomic; struct { - struct ibv_ah *ah; - uint32_t remote_qpn; - uint32_t remote_qkey; + ibv_ah *ah; + uint32_t remote_qpn; + uint32_t remote_qkey; } ud; } wr; union { @@ -615,8 +615,8 @@ struct ibv_send_wr { } xrc; } qp_type; union { - struct ibv_send_wr_bind_mw bind_mw; - struct ibv_send_wr_tso tso; + ibv_send_wr_bind_mw bind_mw; + ibv_send_wr_tso tso; }; }; @@ -625,10 +625,10 @@ struct ibv_send_wr { * ------------------------------------------------------------------------- */ struct ibv_recv_wr { - uint64_t wr_id; - struct ibv_recv_wr *next; - struct ibv_sge *sg_list; - int num_sge; + uint64_t wr_id; + ibv_recv_wr *next; + ibv_sge *sg_list; + int num_sge; }; /* ------------------------------------------------------------------------- @@ -646,18 +646,18 @@ struct ibv_recv_wr { * global scope (leading underscore). The tag name is not part of * the ABI, so the layout still matches. */ struct ibv_device_ops { - struct ibv_context *(*_dummy1)(struct ibv_device *device, int cmd_fd); - void (*_dummy2)(struct ibv_context *context); + ibv_context *(*_dummy1)(struct ibv_device *device, int cmd_fd); + void (*_dummy2)(ibv_context *context); }; struct ibv_device { - struct ibv_device_ops _ops; - enum ibv_node_type node_type; - enum ibv_transport_type transport_type; - char name[IBV_SYSFS_NAME_MAX]; - char dev_name[IBV_SYSFS_NAME_MAX]; - char dev_path[IBV_SYSFS_PATH_MAX]; - char ibdev_path[IBV_SYSFS_PATH_MAX]; + ibv_device_ops _ops; + ibv_node_type node_type; + ibv_transport_type transport_type; + char name[IBV_SYSFS_NAME_MAX]; + char dev_name[IBV_SYSFS_NAME_MAX]; + char dev_path[IBV_SYSFS_PATH_MAX]; + char ibdev_path[IBV_SYSFS_PATH_MAX]; }; /* ------------------------------------------------------------------------- @@ -665,19 +665,19 @@ struct ibv_device { * ------------------------------------------------------------------------- */ struct ibv_comp_channel { - struct ibv_context *context; - int fd; - int refcnt; + ibv_context *context; + int fd; + int refcnt; }; struct ibv_srq { - struct ibv_context *context; - void *srq_context; - struct ibv_pd *pd; - uint32_t handle; - pthread_mutex_t mutex; - pthread_cond_t cond; - uint32_t events_completed; + ibv_context *context; + void *srq_context; + ibv_pd *pd; + uint32_t handle; + pthread_mutex_t mutex; + pthread_cond_t cond; + uint32_t events_completed; }; /* ------------------------------------------------------------------------- @@ -685,15 +685,15 @@ struct ibv_srq { * ------------------------------------------------------------------------- */ struct ibv_cq { - struct ibv_context *context; - struct ibv_comp_channel *channel; - void *cq_context; - uint32_t handle; - int cqe; - pthread_mutex_t mutex; - pthread_cond_t cond; - uint32_t comp_events_completed; - uint32_t async_events_completed; + ibv_context *context; + ibv_comp_channel *channel; + void *cq_context; + uint32_t handle; + int cqe; + pthread_mutex_t mutex; + pthread_cond_t cond; + uint32_t comp_events_completed; + uint32_t async_events_completed; }; /* ------------------------------------------------------------------------- @@ -716,7 +716,7 @@ struct ibv_context_ops { void *bind_mw; void *dealloc_mw; void *_compat_create_cq; - int (*poll_cq)(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc); + int (*poll_cq)(ibv_cq *cq, int num_entries, ibv_wc *wc); void *req_notify_cq; void *_compat_cq_event; void *_compat_resize_cq; @@ -730,8 +730,8 @@ struct ibv_context_ops { void *_compat_query_qp; void *_compat_modify_qp; void *_compat_destroy_qp; - int (*post_send)(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr); - int (*post_recv)(struct ibv_qp *qp, struct ibv_recv_wr *wr, struct ibv_recv_wr **bad_wr); + int (*post_send)(ibv_qp *qp, ibv_send_wr *wr, ibv_send_wr **bad_wr); + int (*post_recv)(ibv_qp *qp, ibv_recv_wr *wr, ibv_recv_wr **bad_wr); void *_compat_create_ah; void *_compat_destroy_ah; void *_compat_attach_mcast; @@ -743,11 +743,11 @@ struct ibv_context_ops { * ------------------------------------------------------------------------- */ struct ibv_context { - struct ibv_device *device; - struct ibv_context_ops ops; - int cmd_fd; - int async_fd; - int num_comp_vectors; - pthread_mutex_t mutex; - void *abi_compat; + ibv_device *device; + ibv_context_ops ops; + int cmd_fd; + int async_fd; + int num_comp_vectors; + pthread_mutex_t mutex; + void *abi_compat; }; diff --git a/src/common/ibv-ptr.h b/src/common/ibv-ptr.h index a0eeb7cf..24d8acbe 100644 --- a/src/common/ibv-ptr.h +++ b/src/common/ibv-ptr.h @@ -43,7 +43,7 @@ class IbvContextDeleter { explicit IbvContextDeleter(const Verbs &deleterVerbs) noexcept : verbs_(&deleterVerbs) { } - void operator()(struct ibv_context *ctx) const noexcept; + void operator()(ibv_context *ctx) const noexcept; private: const Verbs *verbs_; @@ -54,7 +54,7 @@ class IbvPdDeleter { explicit IbvPdDeleter(const Verbs &deleterVerbs) noexcept : verbs_(&deleterVerbs) { } - void operator()(struct ibv_pd *pd) const noexcept; + void operator()(ibv_pd *pd) const noexcept; private: const Verbs *verbs_; @@ -65,7 +65,7 @@ class IbvCqDeleter { explicit IbvCqDeleter(const Verbs &deleterVerbs) noexcept : verbs_(&deleterVerbs) { } - void operator()(struct ibv_cq *cq) const noexcept; + void operator()(ibv_cq *cq) const noexcept; private: const Verbs *verbs_; @@ -76,7 +76,7 @@ class IbvQpDeleter { explicit IbvQpDeleter(const Verbs &deleterVerbs) noexcept : verbs_(&deleterVerbs) { } - void operator()(struct ibv_qp *qp) const noexcept; + void operator()(ibv_qp *qp) const noexcept; private: const Verbs *verbs_; @@ -87,7 +87,7 @@ class IbvMrDeleter { explicit IbvMrDeleter(const Verbs &deleterVerbs) noexcept : verbs_(&deleterVerbs) { } - void operator()(struct ibv_mr *mr) const noexcept; + void operator()(ibv_mr *mr) const noexcept; private: const Verbs *verbs_; @@ -98,27 +98,27 @@ class IbvDeviceListDeleter { explicit IbvDeviceListDeleter(const Verbs &deleterVerbs) noexcept : verbs_(&deleterVerbs) { } - void operator()(struct ibv_device **list) const noexcept; + void operator()(ibv_device **list) const noexcept; private: const Verbs *verbs_; }; -using IbvContextPtr = std::unique_ptr; -using IbvPdPtr = std::unique_ptr; -using IbvCqPtr = std::unique_ptr; -using IbvQpPtr = std::unique_ptr; -using IbvMrPtr = std::unique_ptr; +using IbvContextPtr = std::unique_ptr; +using IbvPdPtr = std::unique_ptr; +using IbvCqPtr = std::unique_ptr; +using IbvQpPtr = std::unique_ptr; +using IbvMrPtr = std::unique_ptr; /* The NULL-terminated array returned by ibv_get_device_list(). The [] * is std::unique_ptr's form for an array allocated at run time, which * std::array can't replace, not a C array. */ // NOLINTNEXTLINE(modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays) -using IbvDeviceListPtr = std::unique_ptr; +using IbvDeviceListPtr = std::unique_ptr; /* Views the devices in list, given the count ibv_get_device_list() * returned with it. Empty when list is null or count isn't positive. */ -inline std::span +inline std::span deviceSpan(const IbvDeviceListPtr &list, int count) noexcept { if (!list || count <= 0) { diff --git a/src/common/ibv-wrapper.cpp b/src/common/ibv-wrapper.cpp index 4cf9af6e..b20cb014 100644 --- a/src/common/ibv-wrapper.cpp +++ b/src/common/ibv-wrapper.cpp @@ -125,68 +125,68 @@ LoadedVerbs::LoadedVerbs(const Funcs &funcs, DlHandle library) : library_(std::m { } -struct ibv_device ** +ibv_device ** LoadedVerbs::get_device_list(int *num_devices) const { return funcs_.get_device_list(num_devices); } void -LoadedVerbs::free_device_list(struct ibv_device **list) const +LoadedVerbs::free_device_list(ibv_device **list) const { funcs_.free_device_list(list); } -struct ibv_context * -LoadedVerbs::open_device(struct ibv_device *device) const +ibv_context * +LoadedVerbs::open_device(ibv_device *device) const { return funcs_.open_device(device); } int -LoadedVerbs::close_device(struct ibv_context *context) const +LoadedVerbs::close_device(ibv_context *context) const { return funcs_.close_device(context); } const char * -LoadedVerbs::get_device_name(struct ibv_device *device) const +LoadedVerbs::get_device_name(ibv_device *device) const { return funcs_.get_device_name(device); } int -LoadedVerbs::query_device(struct ibv_context *context, struct ibv_device_attr *device_attr) const +LoadedVerbs::query_device(ibv_context *context, ibv_device_attr *device_attr) const { return funcs_.query_device(context, device_attr); } int -LoadedVerbs::query_port(struct ibv_context *context, uint8_t port_num, struct ibv_port_attr *port_attr) const +LoadedVerbs::query_port(ibv_context *context, uint8_t port_num, ibv_port_attr *port_attr) const { return funcs_.query_port(context, port_num, port_attr); } int -LoadedVerbs::query_gid(struct ibv_context *context, uint8_t port_num, int index, union ibv_gid *gid) const +LoadedVerbs::query_gid(ibv_context *context, uint8_t port_num, int index, ibv_gid *gid) const { return funcs_.query_gid(context, port_num, index, gid); } -struct ibv_pd * -LoadedVerbs::alloc_pd(struct ibv_context *context) const +ibv_pd * +LoadedVerbs::alloc_pd(ibv_context *context) const { return funcs_.alloc_pd(context); } int -LoadedVerbs::dealloc_pd(struct ibv_pd *pd) const +LoadedVerbs::dealloc_pd(ibv_pd *pd) const { return funcs_.dealloc_pd(pd); } -struct ibv_mr * -LoadedVerbs::reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) const +ibv_mr * +LoadedVerbs::reg_mr(ibv_pd *pd, void *addr, size_t length, int access) const { /* What the ibv_reg_mr() macro in verbs.h does with an access value that * isn't a compile-time constant. ibv_reg_mr_iova2() with the address as @@ -201,8 +201,8 @@ LoadedVerbs::supportsDmabuf() const return funcs_.reg_dmabuf_mr != nullptr; } -struct ibv_mr * -LoadedVerbs::reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, +ibv_mr * +LoadedVerbs::reg_dmabuf_mr(ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, int access) const { if (funcs_.reg_dmabuf_mr == nullptr) { @@ -213,44 +213,44 @@ LoadedVerbs::reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, ui } int -LoadedVerbs::dereg_mr(struct ibv_mr *mr) const +LoadedVerbs::dereg_mr(ibv_mr *mr) const { return funcs_.dereg_mr(mr); } -struct ibv_cq * -LoadedVerbs::create_cq(struct ibv_context *context, int cqe, void *cq_context, - struct ibv_comp_channel *channel, int comp_vector) const +ibv_cq * +LoadedVerbs::create_cq(ibv_context *context, int cqe, void *cq_context, ibv_comp_channel *channel, + int comp_vector) const { return funcs_.create_cq(context, cqe, cq_context, channel, comp_vector); } int -LoadedVerbs::destroy_cq(struct ibv_cq *cq) const +LoadedVerbs::destroy_cq(ibv_cq *cq) const { return funcs_.destroy_cq(cq); } -struct ibv_qp * -LoadedVerbs::create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) const +ibv_qp * +LoadedVerbs::create_qp(ibv_pd *pd, ibv_qp_init_attr *qp_init_attr) const { return funcs_.create_qp(pd, qp_init_attr); } int -LoadedVerbs::modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) const +LoadedVerbs::modify_qp(ibv_qp *qp, ibv_qp_attr *attr, int attr_mask) const { return funcs_.modify_qp(qp, attr, attr_mask); } int -LoadedVerbs::destroy_qp(struct ibv_qp *qp) const +LoadedVerbs::destroy_qp(ibv_qp *qp) const { return funcs_.destroy_qp(qp); } int -LoadedVerbs::poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc) const +LoadedVerbs::poll_cq(ibv_cq *cq, int num_entries, ibv_wc *wc) const { if (funcs_.poll_cq != nullptr) { return funcs_.poll_cq(cq, num_entries, wc); @@ -260,7 +260,7 @@ LoadedVerbs::poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc) cons } int -LoadedVerbs::post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr) const +LoadedVerbs::post_send(ibv_qp *qp, ibv_send_wr *wr, ibv_send_wr **bad_wr) const { if (funcs_.post_send != nullptr) { return funcs_.post_send(qp, wr, bad_wr); @@ -271,37 +271,37 @@ LoadedVerbs::post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_sen // ---- Smart pointer deleters (ibv-ptr.h) ----------------------------- void -IbvContextDeleter::operator()(struct ibv_context *ctx) const noexcept +IbvContextDeleter::operator()(ibv_context *ctx) const noexcept { (void)verbs_->close_device(ctx); } void -IbvPdDeleter::operator()(struct ibv_pd *pd) const noexcept +IbvPdDeleter::operator()(ibv_pd *pd) const noexcept { (void)verbs_->dealloc_pd(pd); } void -IbvCqDeleter::operator()(struct ibv_cq *cq) const noexcept +IbvCqDeleter::operator()(ibv_cq *cq) const noexcept { (void)verbs_->destroy_cq(cq); } void -IbvQpDeleter::operator()(struct ibv_qp *qp) const noexcept +IbvQpDeleter::operator()(ibv_qp *qp) const noexcept { (void)verbs_->destroy_qp(qp); } void -IbvMrDeleter::operator()(struct ibv_mr *mr) const noexcept +IbvMrDeleter::operator()(ibv_mr *mr) const noexcept { (void)verbs_->dereg_mr(mr); } void -IbvDeviceListDeleter::operator()(struct ibv_device **list) const noexcept +IbvDeviceListDeleter::operator()(ibv_device **list) const noexcept { verbs_->free_device_list(list); } diff --git a/src/common/ibv-wrapper.h b/src/common/ibv-wrapper.h index 4453f951..009f130c 100644 --- a/src/common/ibv-wrapper.h +++ b/src/common/ibv-wrapper.h @@ -38,37 +38,35 @@ class Verbs { Verbs(Verbs &&) = delete; Verbs &operator=(Verbs &&) = delete; - virtual struct ibv_device **get_device_list(int *num_devices) const = 0; - virtual void free_device_list(struct ibv_device **list) const = 0; - virtual struct ibv_context *open_device(struct ibv_device *device) const = 0; - virtual int close_device(struct ibv_context *context) const = 0; - virtual const char *get_device_name(struct ibv_device *device) const = 0; - virtual int query_device(struct ibv_context *context, struct ibv_device_attr *device_attr) const = 0; - virtual int query_port(struct ibv_context *context, uint8_t port_num, - struct ibv_port_attr *port_attr) const = 0; - virtual int query_gid(struct ibv_context *context, uint8_t port_num, int index, - union ibv_gid *gid) const = 0; - virtual struct ibv_pd *alloc_pd(struct ibv_context *context) const = 0; - virtual int dealloc_pd(struct ibv_pd *pd) const = 0; + virtual ibv_device **get_device_list(int *num_devices) const = 0; + virtual void free_device_list(ibv_device **list) const = 0; + virtual ibv_context *open_device(ibv_device *device) const = 0; + virtual int close_device(ibv_context *context) const = 0; + virtual const char *get_device_name(ibv_device *device) const = 0; + virtual int query_device(ibv_context *context, ibv_device_attr *device_attr) const = 0; + virtual int query_port(ibv_context *context, uint8_t port_num, ibv_port_attr *port_attr) const = 0; + virtual int query_gid(ibv_context *context, uint8_t port_num, int index, ibv_gid *gid) const = 0; + virtual ibv_pd *alloc_pd(ibv_context *context) const = 0; + virtual int dealloc_pd(ibv_pd *pd) const = 0; /* Registers memory the NIC reaches through the CPU's page tables, with * its address as the IOVA */ - virtual struct ibv_mr *reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) const = 0; + virtual ibv_mr *reg_mr(ibv_pd *pd, void *addr, size_t length, int access) const = 0; /* True when libibverbs has ibv_reg_dmabuf_mr(), which rdma-core 34 * added. Without it, reg_dmabuf_mr() fails with EOPNOTSUPP. */ - [[nodiscard]] virtual bool supportsDmabuf() const = 0; - virtual struct ibv_mr *reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, - int fd, int access) const = 0; - virtual int dereg_mr(struct ibv_mr *mr) const = 0; - virtual struct ibv_cq *create_cq(struct ibv_context *context, int cqe, void *cq_context, - struct ibv_comp_channel *channel, int comp_vector) const = 0; - virtual int destroy_cq(struct ibv_cq *cq) const = 0; - virtual struct ibv_qp *create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) const = 0; - virtual int modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) const = 0; - virtual int destroy_qp(struct ibv_qp *qp) const = 0; - virtual int poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc) const = 0; - virtual int post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr) const = 0; + [[nodiscard]] virtual bool supportsDmabuf() const = 0; + virtual ibv_mr *reg_dmabuf_mr(ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, + int access) const = 0; + virtual int dereg_mr(ibv_mr *mr) const = 0; + virtual ibv_cq *create_cq(ibv_context *context, int cqe, void *cq_context, ibv_comp_channel *channel, + int comp_vector) const = 0; + virtual int destroy_cq(ibv_cq *cq) const = 0; + virtual ibv_qp *create_qp(ibv_pd *pd, ibv_qp_init_attr *qp_init_attr) const = 0; + virtual int modify_qp(ibv_qp *qp, ibv_qp_attr *attr, int attr_mask) const = 0; + virtual int destroy_qp(ibv_qp *qp) const = 0; + virtual int poll_cq(ibv_cq *cq, int num_entries, ibv_wc *wc) const = 0; + virtual int post_send(ibv_qp *qp, ibv_send_wr *wr, ibv_send_wr **bad_wr) const = 0; }; /* libibverbs, through the functions loadLibibverbs() loads from it */ @@ -76,26 +74,26 @@ class LoadedVerbs final : public Verbs { public: /* The libibverbs functions it calls */ struct Funcs { - struct ibv_device **(*get_device_list)(int *); - void (*free_device_list)(struct ibv_device **); - struct ibv_context *(*open_device)(struct ibv_device *); - int (*close_device)(struct ibv_context *); - const char *(*get_device_name)(struct ibv_device *); - int (*query_device)(struct ibv_context *, struct ibv_device_attr *); - int (*query_port)(struct ibv_context *, uint8_t, struct ibv_port_attr *); - int (*query_gid)(struct ibv_context *, uint8_t, int, union ibv_gid *); - struct ibv_pd *(*alloc_pd)(struct ibv_context *); - int (*dealloc_pd)(struct ibv_pd *); - struct ibv_mr *(*reg_dmabuf_mr)(struct ibv_pd *, uint64_t, size_t, uint64_t, int, int); - struct ibv_mr *(*reg_mr_iova2)(struct ibv_pd *, void *, size_t, uintptr_t, int); - int (*dereg_mr)(struct ibv_mr *); - struct ibv_cq *(*create_cq)(struct ibv_context *, int, void *, struct ibv_comp_channel *, int); - int (*destroy_cq)(struct ibv_cq *); - struct ibv_qp *(*create_qp)(struct ibv_pd *, struct ibv_qp_init_attr *); - int (*modify_qp)(struct ibv_qp *, struct ibv_qp_attr *, int); - int (*destroy_qp)(struct ibv_qp *); - int (*poll_cq)(struct ibv_cq *, int, struct ibv_wc *); - int (*post_send)(struct ibv_qp *, struct ibv_send_wr *, struct ibv_send_wr **); + ibv_device **(*get_device_list)(int *); + void (*free_device_list)(ibv_device **); + ibv_context *(*open_device)(ibv_device *); + int (*close_device)(ibv_context *); + const char *(*get_device_name)(ibv_device *); + int (*query_device)(ibv_context *, ibv_device_attr *); + int (*query_port)(ibv_context *, uint8_t, ibv_port_attr *); + int (*query_gid)(ibv_context *, uint8_t, int, ibv_gid *); + ibv_pd *(*alloc_pd)(ibv_context *); + int (*dealloc_pd)(ibv_pd *); + ibv_mr *(*reg_dmabuf_mr)(ibv_pd *, uint64_t, size_t, uint64_t, int, int); + ibv_mr *(*reg_mr_iova2)(ibv_pd *, void *, size_t, uintptr_t, int); + int (*dereg_mr)(ibv_mr *); + ibv_cq *(*create_cq)(ibv_context *, int, void *, ibv_comp_channel *, int); + int (*destroy_cq)(ibv_cq *); + ibv_qp *(*create_qp)(ibv_pd *, ibv_qp_init_attr *); + int (*modify_qp)(ibv_qp *, ibv_qp_attr *, int); + int (*destroy_qp)(ibv_qp *); + int (*poll_cq)(ibv_cq *, int, ibv_wc *); + int (*post_send)(ibv_qp *, ibv_send_wr *, ibv_send_wr **); }; /* Calls funcs, which came from library, and keeps library loaded for @@ -105,31 +103,29 @@ class LoadedVerbs final : public Verbs { * do. */ explicit LoadedVerbs(const Funcs &funcs, DlHandle library = DlHandle{}); - struct ibv_device **get_device_list(int *num_devices) const override; - void free_device_list(struct ibv_device **list) const override; - struct ibv_context *open_device(struct ibv_device *device) const override; - int close_device(struct ibv_context *context) const override; - const char *get_device_name(struct ibv_device *device) const override; - int query_device(struct ibv_context *context, struct ibv_device_attr *device_attr) const override; - int query_port(struct ibv_context *context, uint8_t port_num, - struct ibv_port_attr *port_attr) const override; - int query_gid(struct ibv_context *context, uint8_t port_num, int index, - union ibv_gid *gid) const override; - struct ibv_pd *alloc_pd(struct ibv_context *context) const override; - int dealloc_pd(struct ibv_pd *pd) const override; - struct ibv_mr *reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) const override; + ibv_device **get_device_list(int *num_devices) const override; + void free_device_list(ibv_device **list) const override; + ibv_context *open_device(ibv_device *device) const override; + int close_device(ibv_context *context) const override; + const char *get_device_name(ibv_device *device) const override; + int query_device(ibv_context *context, ibv_device_attr *device_attr) const override; + int query_port(ibv_context *context, uint8_t port_num, ibv_port_attr *port_attr) const override; + int query_gid(ibv_context *context, uint8_t port_num, int index, ibv_gid *gid) const override; + ibv_pd *alloc_pd(ibv_context *context) const override; + int dealloc_pd(ibv_pd *pd) const override; + ibv_mr *reg_mr(ibv_pd *pd, void *addr, size_t length, int access) const override; [[nodiscard]] bool supportsDmabuf() const override; - struct ibv_mr *reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, + ibv_mr *reg_dmabuf_mr(ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, int access) const override; - int dereg_mr(struct ibv_mr *mr) const override; - struct ibv_cq *create_cq(struct ibv_context *context, int cqe, void *cq_context, - struct ibv_comp_channel *channel, int comp_vector) const override; - int destroy_cq(struct ibv_cq *cq) const override; - struct ibv_qp *create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) const override; - int modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) const override; - int destroy_qp(struct ibv_qp *qp) const override; - int poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc) const override; - int post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr) const override; + int dereg_mr(ibv_mr *mr) const override; + ibv_cq *create_cq(ibv_context *context, int cqe, void *cq_context, ibv_comp_channel *channel, + int comp_vector) const override; + int destroy_cq(ibv_cq *cq) const override; + ibv_qp *create_qp(ibv_pd *pd, ibv_qp_init_attr *qp_init_attr) const override; + int modify_qp(ibv_qp *qp, ibv_qp_attr *attr, int attr_mask) const override; + int destroy_qp(ibv_qp *qp) const override; + int poll_cq(ibv_cq *cq, int num_entries, ibv_wc *wc) const override; + int post_send(ibv_qp *qp, ibv_send_wr *wr, ibv_send_wr **bad_wr) const override; private: DlHandle library_; diff --git a/src/rdma/bnxt/bnxt-backend.cpp b/src/rdma/bnxt/bnxt-backend.cpp index 2d93ecc9..138bd881 100644 --- a/src/rdma/bnxt/bnxt-backend.cpp +++ b/src/rdma/bnxt/bnxt-backend.cpp @@ -17,7 +17,7 @@ isBnxtDevice(uint32_t vendorId) } void -configureBnxtQp(struct ibv_qp_attr &attr) +configureBnxtQp(ibv_qp_attr &attr) { attr.path_mtu = IBV_MTU_4096; attr.timeout = kQpTimeout; diff --git a/src/rdma/ionic/ionic-backend.cpp b/src/rdma/ionic/ionic-backend.cpp index c9d310bf..950cf590 100644 --- a/src/rdma/ionic/ionic-backend.cpp +++ b/src/rdma/ionic/ionic-backend.cpp @@ -17,7 +17,7 @@ isIonicDevice(uint32_t vendorId) } void -configureIonicQp(struct ibv_qp_attr &attr) +configureIonicQp(ibv_qp_attr &attr) { attr.path_mtu = IBV_MTU_4096; attr.timeout = kQpTimeout; diff --git a/src/rdma/transport.cpp b/src/rdma/transport.cpp index 20a4365f..3df5be8d 100644 --- a/src/rdma/transport.cpp +++ b/src/rdma/transport.cpp @@ -39,7 +39,7 @@ openRdmaDevice(const Verbs &verbs, const NicTopology &topology, int nicIndex) if (!devList || numDevs <= 0 || nicIndex < 0 || nicIndex >= numDevs) { return std::nullopt; } - struct ibv_device *dev = deviceSpan(devList, numDevs)[static_cast(nicIndex)]; + ibv_device *dev = deviceSpan(devList, numDevs)[static_cast(nicIndex)]; if (dev == nullptr) { return std::nullopt; } @@ -84,8 +84,8 @@ openRdmaDeviceByName(const Verbs &verbs, const NicTopology &topology, std::strin if (!devList || numDevs <= 0) { return std::nullopt; } - const std::span devices = deviceSpan(devList, numDevs); - int nicIndex = -1; + const std::span devices = deviceSpan(devList, numDevs); + int nicIndex = -1; for (size_t i = 0; i < devices.size(); ++i) { const char *name = verbs.get_device_name(devices[i]); if (name != nullptr && std::string_view(name) == devName) { @@ -120,7 +120,7 @@ namespace { return conn.device().verbs().modify_qp(conn.qp(), &attr, mask) == 0; } - void applyVendorQpAttrs(const RdmaDevice &device, struct ibv_qp_attr &attr) + void applyVendorQpAttrs(const RdmaDevice &device, ibv_qp_attr &attr) { const std::optional vendorId = device.vendorId(); if (!vendorId) { @@ -170,7 +170,7 @@ createRcConnection(const RdmaDevice &device, int cqSize, uint32_t maxSendWr, uin } bool -transitionQpToRtr(RcConnection &conn, uint32_t destQpNum, uint16_t destLid, union ibv_gid destGid) +transitionQpToRtr(RcConnection &conn, uint32_t destQpNum, uint16_t destLid, ibv_gid destGid) { // The address handle stores the GID index in a uint8_t, so an index // outside [0, 255] can't be used and must not be truncated into a diff --git a/src/rdma/transport.h b/src/rdma/transport.h index 377fa4a7..ad525b8a 100644 --- a/src/rdma/transport.h +++ b/src/rdma/transport.h @@ -47,12 +47,12 @@ class RdmaDevice final { return *verbs_; } - [[nodiscard]] struct ibv_context *context() const noexcept + [[nodiscard]] ibv_context *context() const noexcept { return ctx_.get(); } - [[nodiscard]] struct ibv_pd *pd() const noexcept + [[nodiscard]] ibv_pd *pd() const noexcept { return pd_.get(); } @@ -122,22 +122,22 @@ class RcConnection final { /* Only a non-const connection hands out the CQ and QP that libibverbs * can change, so a function that changes them takes a non-const * connection */ - [[nodiscard]] struct ibv_cq *cq() noexcept + [[nodiscard]] ibv_cq *cq() noexcept { return cq_.get(); } - [[nodiscard]] const struct ibv_cq *cq() const noexcept + [[nodiscard]] const ibv_cq *cq() const noexcept { return cq_.get(); } - [[nodiscard]] struct ibv_qp *qp() noexcept + [[nodiscard]] ibv_qp *qp() noexcept { return qp_.get(); } - [[nodiscard]] const struct ibv_qp *qp() const noexcept + [[nodiscard]] const ibv_qp *qp() const noexcept { return qp_.get(); } @@ -168,7 +168,7 @@ std::optional createRcConnection(const RdmaDevice &&, int, uint32_ /* Each of these returns true on success and false on failure */ [[nodiscard]] bool transitionQpToRtr(RcConnection &conn, uint32_t destQpNum, uint16_t destLid, - union ibv_gid destGid); + ibv_gid destGid); [[nodiscard]] bool transitionQpToRts(RcConnection &conn); [[nodiscard]] bool connectRcPeer(RcConnection &conn, const RdmaToken &peerToken); /* Moves conn's QP back to INIT, through RESET, so it can connect to diff --git a/src/rdma/vendor-ops.h b/src/rdma/vendor-ops.h index 06935c4c..f73db9eb 100644 --- a/src/rdma/vendor-ops.h +++ b/src/rdma/vendor-ops.h @@ -29,7 +29,7 @@ constexpr uint8_t kQpRnrRetry = 7; bool isBnxtDevice(uint32_t vendorId); bool isIonicDevice(uint32_t vendorId); -void configureBnxtQp(struct ibv_qp_attr &attr); -void configureIonicQp(struct ibv_qp_attr &attr); +void configureBnxtQp(ibv_qp_attr &attr); +void configureIonicQp(ibv_qp_attr &attr); } // namespace hipObj diff --git a/test/integration/rdma-test-server/rdma_server.cpp b/test/integration/rdma-test-server/rdma_server.cpp index dbcae2fe..3f59018c 100644 --- a/test/integration/rdma-test-server/rdma_server.cpp +++ b/test/integration/rdma-test-server/rdma_server.cpp @@ -55,7 +55,7 @@ namespace { /* The size of the buffer each transfer is staged through */ constexpr size_t kStagingSize = size_t{64} * 1024 * 1024; - hipObj::RdmaToken buildServerToken(const hipObj::RcConnection &conn, const struct ibv_mr *mr, size_t size) + hipObj::RdmaToken buildServerToken(const hipObj::RcConnection &conn, const ibv_mr *mr, size_t size) { return hipObj::RdmaToken{ .qpNum = conn.qp()->qp_num, @@ -69,7 +69,7 @@ namespace { }; } - [[nodiscard]] bool postRdmaWrite(hipObj::RcConnection &conn, const struct ibv_mr *localMr, size_t size, + [[nodiscard]] bool postRdmaWrite(hipObj::RcConnection &conn, const ibv_mr *localMr, size_t size, const hipObj::RdmaToken &clientToken) { ibv_sge sge{}; @@ -96,7 +96,7 @@ namespace { return hipObj::pollCompletion(conn, IBV_WC_RDMA_WRITE, kCompletionTimeout); } - [[nodiscard]] bool postRdmaRead(hipObj::RcConnection &conn, const struct ibv_mr *localMr, size_t size, + [[nodiscard]] bool postRdmaRead(hipObj::RcConnection &conn, const ibv_mr *localMr, size_t size, const hipObj::RdmaToken &clientToken) { ibv_sge sge{}; diff --git a/test/unit/fake-device.cpp b/test/unit/fake-device.cpp index b481906a..0558533c 100644 --- a/test/unit/fake-device.cpp +++ b/test/unit/fake-device.cpp @@ -86,7 +86,7 @@ namespace { /* Whether a QP can move from one state to another, for the states * hipObject uses. Any state can move to RESET or ERR. */ - bool isValidTransition(enum ibv_qp_state from, enum ibv_qp_state to) + bool isValidTransition(ibv_qp_state from, ibv_qp_state to) { if (to == IBV_QPS_RESET || to == IBV_QPS_ERR) { return true; @@ -105,7 +105,7 @@ namespace { } // namespace -struct ibv_device ** +ibv_device ** FakeVerbs::get_device_list(int *num_devices) const { if (device_->fail.getDeviceList) { @@ -116,43 +116,43 @@ FakeVerbs::get_device_list(int *num_devices) const } /* Local, so it's initialized on first use rather than by a global * constructor */ - static std::array devices = { - {hipObj::addressToPointer(0x1), nullptr}, + static std::array devices = { + {hipObj::addressToPointer(0x1), nullptr}, }; return devices.data(); } void -FakeVerbs::free_device_list(struct ibv_device ** /*list*/) const +FakeVerbs::free_device_list(ibv_device ** /*list*/) const { ++device_->log.freeDeviceList; } -struct ibv_context * -FakeVerbs::open_device(struct ibv_device * /*device*/) const +ibv_context * +FakeVerbs::open_device(ibv_device * /*device*/) const { if (device_->fail.openDevice) { return nullptr; } ++device_->log.openDevice; - return hipObj::addressToPointer(0x2); + return hipObj::addressToPointer(0x2); } int -FakeVerbs::close_device(struct ibv_context * /*context*/) const +FakeVerbs::close_device(ibv_context * /*context*/) const { ++device_->log.closeDevice; return 0; } const char * -FakeVerbs::get_device_name(struct ibv_device * /*device*/) const +FakeVerbs::get_device_name(ibv_device * /*device*/) const { return "mlx5_0"; } int -FakeVerbs::query_device(struct ibv_context * /*context*/, struct ibv_device_attr *attr) const +FakeVerbs::query_device(ibv_context * /*context*/, ibv_device_attr *attr) const { ++device_->log.queryDevice; if (device_->fail.queryDevice) { @@ -165,8 +165,7 @@ FakeVerbs::query_device(struct ibv_context * /*context*/, struct ibv_device_attr /* An empty GID table, so GID selection never looks at the device */ int -FakeVerbs::query_port(struct ibv_context * /*context*/, uint8_t /*port_num*/, - struct ibv_port_attr *attr) const +FakeVerbs::query_port(ibv_context * /*context*/, uint8_t /*port_num*/, ibv_port_attr *attr) const { if (device_->fail.queryPort) { return -1; @@ -178,8 +177,7 @@ FakeVerbs::query_port(struct ibv_context * /*context*/, uint8_t /*port_num*/, } int -FakeVerbs::query_gid(struct ibv_context * /*context*/, uint8_t /*port_num*/, int /*index*/, - union ibv_gid *gid) const +FakeVerbs::query_gid(ibv_context * /*context*/, uint8_t /*port_num*/, int /*index*/, ibv_gid *gid) const { if (device_->fail.queryGid) { return -1; @@ -190,25 +188,25 @@ FakeVerbs::query_gid(struct ibv_context * /*context*/, uint8_t /*port_num*/, int return 0; } -struct ibv_pd * -FakeVerbs::alloc_pd(struct ibv_context * /*context*/) const +ibv_pd * +FakeVerbs::alloc_pd(ibv_context * /*context*/) const { if (device_->fail.allocPd) { return nullptr; } ++device_->log.allocPd; - return hipObj::addressToPointer(0x3); + return hipObj::addressToPointer(0x3); } int -FakeVerbs::dealloc_pd(struct ibv_pd * /*pd*/) const +FakeVerbs::dealloc_pd(ibv_pd * /*pd*/) const { ++device_->log.deallocPd; return 0; } -struct ibv_mr * -FakeVerbs::reg_mr(struct ibv_pd * /*pd*/, void *addr, size_t /*length*/, int access) const +ibv_mr * +FakeVerbs::reg_mr(ibv_pd * /*pd*/, void *addr, size_t /*length*/, int access) const { ++device_->log.registerMr; device_->log.mrAccess = access; @@ -216,7 +214,7 @@ FakeVerbs::reg_mr(struct ibv_pd * /*pd*/, void *addr, size_t /*length*/, int acc return nullptr; } /* Released by dereg_mr() */ - auto mr = std::make_unique(); + auto mr = std::make_unique(); mr->addr = addr; mr->rkey = 0x1234; return mr.release(); @@ -228,8 +226,8 @@ FakeVerbs::supportsDmabuf() const return false; } -struct ibv_mr * -FakeVerbs::reg_dmabuf_mr(struct ibv_pd * /*pd*/, uint64_t /*offset*/, size_t /*length*/, uint64_t /*iova*/, +ibv_mr * +FakeVerbs::reg_dmabuf_mr(ibv_pd * /*pd*/, uint64_t /*offset*/, size_t /*length*/, uint64_t /*iova*/, int /*fd*/, int /*access*/) const { errno = EOPNOTSUPP; @@ -237,52 +235,52 @@ FakeVerbs::reg_dmabuf_mr(struct ibv_pd * /*pd*/, uint64_t /*offset*/, size_t /*l } int -FakeVerbs::dereg_mr(struct ibv_mr *mr) const +FakeVerbs::dereg_mr(ibv_mr *mr) const { ++device_->log.deregMr; /* From reg_mr(), or a test's fake reg_dmabuf_mr() */ - const std::unique_ptr owned(mr); + const std::unique_ptr owned(mr); return 0; } -struct ibv_cq * -FakeVerbs::create_cq(struct ibv_context * /*context*/, int cqe, void * /*cq_context*/, - struct ibv_comp_channel * /*channel*/, int /*comp_vector*/) const +ibv_cq * +FakeVerbs::create_cq(ibv_context * /*context*/, int cqe, void * /*cq_context*/, + ibv_comp_channel * /*channel*/, int /*comp_vector*/) const { if (device_->fail.createCq) { return nullptr; } /* Released by destroy_cq() */ - auto cq = std::make_unique(); + auto cq = std::make_unique(); ++device_->log.createCq; cq->cqe = cqe; return cq.release(); } int -FakeVerbs::destroy_cq(struct ibv_cq *cq) const +FakeVerbs::destroy_cq(ibv_cq *cq) const { ++device_->log.destroyCq; - const std::unique_ptr owned(cq); + const std::unique_ptr owned(cq); return 0; } -struct ibv_qp * -FakeVerbs::create_qp(struct ibv_pd * /*pd*/, struct ibv_qp_init_attr * /*qp_init_attr*/) const +ibv_qp * +FakeVerbs::create_qp(ibv_pd * /*pd*/, ibv_qp_init_attr * /*qp_init_attr*/) const { if (device_->fail.createQp || (device_->fail.qpLimit >= 0 && device_->log.createQp >= device_->fail.qpLimit)) { return nullptr; } /* Zeroed, so its state is IBV_QPS_RESET. Released by destroy_qp(). */ - auto qp = std::make_unique(); + auto qp = std::make_unique(); ++device_->log.createQp; qp->qp_num = device_->nextQpNum++; return qp.release(); } int -FakeVerbs::modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int mask) const +FakeVerbs::modify_qp(ibv_qp *qp, ibv_qp_attr *attr, int mask) const { /* Each call records into its own element */ const size_t call = device_->modifyQpCount++; @@ -304,15 +302,15 @@ FakeVerbs::modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int mask) cons } int -FakeVerbs::destroy_qp(struct ibv_qp *qp) const +FakeVerbs::destroy_qp(ibv_qp *qp) const { ++device_->log.destroyQp; - const std::unique_ptr owned(qp); + const std::unique_ptr owned(qp); return 0; } int -FakeVerbs::poll_cq(struct ibv_cq * /*cq*/, int /*num_entries*/, struct ibv_wc *wc) const +FakeVerbs::poll_cq(ibv_cq * /*cq*/, int /*num_entries*/, ibv_wc *wc) const { ++device_->log.pollCq; if (device_->pollResult <= 0) { @@ -325,8 +323,7 @@ FakeVerbs::poll_cq(struct ibv_cq * /*cq*/, int /*num_entries*/, struct ibv_wc *w } int -FakeVerbs::post_send(struct ibv_qp * /*qp*/, struct ibv_send_wr * /*wr*/, - struct ibv_send_wr ** /*bad_wr*/) const +FakeVerbs::post_send(ibv_qp * /*qp*/, ibv_send_wr * /*wr*/, ibv_send_wr ** /*bad_wr*/) const { ++device_->log.postSend; return 0; diff --git a/test/unit/fake-device.h b/test/unit/fake-device.h index ec961bb4..76b3e585 100644 --- a/test/unit/fake-device.h +++ b/test/unit/fake-device.h @@ -155,8 +155,8 @@ struct FakeDevice { * nextQpNum value. */ uint32_t vendorId = 0; int pollResult = 1; - enum ibv_wc_status pollStatus = IBV_WC_SUCCESS; - enum ibv_wc_opcode pollOpcode = IBV_WC_SEND; + ibv_wc_status pollStatus = IBV_WC_SUCCESS; + ibv_wc_opcode pollOpcode = IBV_WC_SEND; std::array modifyQp{}; std::atomic modifyQpCount{0}; std::atomic nextQpNum{0x55}; @@ -254,31 +254,29 @@ class FakeVerbs : public hipObj::Verbs { FakeVerbs(FakeVerbs &&) = delete; FakeVerbs &operator=(FakeVerbs &&) = delete; - struct ibv_device **get_device_list(int *num_devices) const override; - void free_device_list(struct ibv_device **list) const override; - struct ibv_context *open_device(struct ibv_device *device) const override; - int close_device(struct ibv_context *context) const override; - const char *get_device_name(struct ibv_device *device) const override; - int query_device(struct ibv_context *context, struct ibv_device_attr *device_attr) const override; - int query_port(struct ibv_context *context, uint8_t port_num, - struct ibv_port_attr *port_attr) const override; - int query_gid(struct ibv_context *context, uint8_t port_num, int index, - union ibv_gid *gid) const override; - struct ibv_pd *alloc_pd(struct ibv_context *context) const override; - int dealloc_pd(struct ibv_pd *pd) const override; - struct ibv_mr *reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) const override; + ibv_device **get_device_list(int *num_devices) const override; + void free_device_list(ibv_device **list) const override; + ibv_context *open_device(ibv_device *device) const override; + int close_device(ibv_context *context) const override; + const char *get_device_name(ibv_device *device) const override; + int query_device(ibv_context *context, ibv_device_attr *device_attr) const override; + int query_port(ibv_context *context, uint8_t port_num, ibv_port_attr *port_attr) const override; + int query_gid(ibv_context *context, uint8_t port_num, int index, ibv_gid *gid) const override; + ibv_pd *alloc_pd(ibv_context *context) const override; + int dealloc_pd(ibv_pd *pd) const override; + ibv_mr *reg_mr(ibv_pd *pd, void *addr, size_t length, int access) const override; [[nodiscard]] bool supportsDmabuf() const override; - struct ibv_mr *reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, + ibv_mr *reg_dmabuf_mr(ibv_pd *pd, uint64_t offset, size_t length, uint64_t iova, int fd, int access) const override; - int dereg_mr(struct ibv_mr *mr) const override; - struct ibv_cq *create_cq(struct ibv_context *context, int cqe, void *cq_context, - struct ibv_comp_channel *channel, int comp_vector) const override; - int destroy_cq(struct ibv_cq *cq) const override; - struct ibv_qp *create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) const override; - int modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) const override; - int destroy_qp(struct ibv_qp *qp) const override; - int poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc) const override; - int post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr) const override; + int dereg_mr(ibv_mr *mr) const override; + ibv_cq *create_cq(ibv_context *context, int cqe, void *cq_context, ibv_comp_channel *channel, + int comp_vector) const override; + int destroy_cq(ibv_cq *cq) const override; + ibv_qp *create_qp(ibv_pd *pd, ibv_qp_init_attr *qp_init_attr) const override; + int modify_qp(ibv_qp *qp, ibv_qp_attr *attr, int attr_mask) const override; + int destroy_qp(ibv_qp *qp) const override; + int poll_cq(ibv_cq *cq, int num_entries, ibv_wc *wc) const override; + int post_send(ibv_qp *qp, ibv_send_wr *wr, ibv_send_wr **bad_wr) const override; private: /* A pointer, so the const methods can change what it points to */ diff --git a/test/unit/ibv-layout-list.h b/test/unit/ibv-layout-list.h index debe1986..32b19909 100644 --- a/test/unit/ibv-layout-list.h +++ b/test/unit/ibv-layout-list.h @@ -10,12 +10,17 @@ * * Each file that includes this one defines the macros first: * - * HIPOBJ_IBV_TYPE(type) A struct's or union's size and - * alignment - * HIPOBJ_IBV_MEMBER(type, member) A member's offset and size. A - * nested member is named with dots, - * as in offsetof(). - * HIPOBJ_IBV_VALUE(name) An enumerator's or macro's value + * HIPOBJ_IBV_TYPE(key, type) A struct's or union's size + * and alignment + * HIPOBJ_IBV_MEMBER(key, type, member) A member's offset and size. + * A nested member is named + * with dots, as in offsetof(). + * HIPOBJ_IBV_VALUE(name) An enumerator's or macro's + * value + * + * key is the type's keyword, struct or union. C needs it before the + * type's name, but C++ doesn't, and GCC's -Wredundant-tags warns about it + * there, so test-ibv-layout.cpp leaves it out. * * This file is included once per list, so it has no include guard. * @@ -49,25 +54,25 @@ HIPOBJ_IBV_VALUE(IB_UVERBS_ACCESS_RELAXED_ORDERING) HIPOBJ_IBV_VALUE(IBV_ACCESS_OPTIONAL_FIRST) HIPOBJ_IBV_VALUE(IBV_ACCESS_OPTIONAL_RANGE) -HIPOBJ_IBV_TYPE(union ibv_gid) +HIPOBJ_IBV_TYPE(union, ibv_gid) /* Checking a union's members means naming them */ // NOLINTBEGIN(cppcoreguidelines-pro-type-union-access) -HIPOBJ_IBV_MEMBER(union ibv_gid, raw) -HIPOBJ_IBV_MEMBER(union ibv_gid, global) -HIPOBJ_IBV_MEMBER(union ibv_gid, global.subnet_prefix) -HIPOBJ_IBV_MEMBER(union ibv_gid, global.interface_id) +HIPOBJ_IBV_MEMBER(union, ibv_gid, raw) +HIPOBJ_IBV_MEMBER(union, ibv_gid, global) +HIPOBJ_IBV_MEMBER(union, ibv_gid, global.subnet_prefix) +HIPOBJ_IBV_MEMBER(union, ibv_gid, global.interface_id) // NOLINTEND(cppcoreguidelines-pro-type-union-access) HIPOBJ_IBV_VALUE(IBV_GID_TYPE_IB) HIPOBJ_IBV_VALUE(IBV_GID_TYPE_ROCE_V1) HIPOBJ_IBV_VALUE(IBV_GID_TYPE_ROCE_V2) -HIPOBJ_IBV_TYPE(struct ibv_gid_entry) -HIPOBJ_IBV_MEMBER(struct ibv_gid_entry, gid) -HIPOBJ_IBV_MEMBER(struct ibv_gid_entry, gid_index) -HIPOBJ_IBV_MEMBER(struct ibv_gid_entry, port_num) -HIPOBJ_IBV_MEMBER(struct ibv_gid_entry, gid_type) -HIPOBJ_IBV_MEMBER(struct ibv_gid_entry, ndev_ifindex) +HIPOBJ_IBV_TYPE(struct, ibv_gid_entry) +HIPOBJ_IBV_MEMBER(struct, ibv_gid_entry, gid) +HIPOBJ_IBV_MEMBER(struct, ibv_gid_entry, gid_index) +HIPOBJ_IBV_MEMBER(struct, ibv_gid_entry, port_num) +HIPOBJ_IBV_MEMBER(struct, ibv_gid_entry, gid_type) +HIPOBJ_IBV_MEMBER(struct, ibv_gid_entry, ndev_ifindex) HIPOBJ_IBV_VALUE(IBV_NODE_UNKNOWN) HIPOBJ_IBV_VALUE(IBV_NODE_CA) @@ -89,47 +94,47 @@ HIPOBJ_IBV_VALUE(IBV_ATOMIC_NONE) HIPOBJ_IBV_VALUE(IBV_ATOMIC_HCA) HIPOBJ_IBV_VALUE(IBV_ATOMIC_GLOB) -HIPOBJ_IBV_TYPE(struct ibv_device_attr) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, fw_ver) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, node_guid) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, sys_image_guid) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_mr_size) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, page_size_cap) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, vendor_id) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, vendor_part_id) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, hw_ver) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_qp) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_qp_wr) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, device_cap_flags) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_sge) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_sge_rd) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_cq) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_cqe) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_mr) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_pd) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_qp_rd_atom) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_ee_rd_atom) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_res_rd_atom) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_qp_init_rd_atom) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_ee_init_rd_atom) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, atomic_cap) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_ee) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_rdd) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_mw) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_raw_ipv6_qp) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_raw_ethy_qp) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_mcast_grp) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_mcast_qp_attach) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_total_mcast_qp_attach) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_ah) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_fmr) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_map_per_fmr) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_srq) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_srq_wr) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_srq_sge) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, max_pkeys) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, local_ca_ack_delay) -HIPOBJ_IBV_MEMBER(struct ibv_device_attr, phys_port_cnt) +HIPOBJ_IBV_TYPE(struct, ibv_device_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, fw_ver) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, node_guid) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, sys_image_guid) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_mr_size) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, page_size_cap) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, vendor_id) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, vendor_part_id) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, hw_ver) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_qp_wr) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, device_cap_flags) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_sge) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_sge_rd) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_cqe) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_mr) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_pd) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_qp_rd_atom) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_ee_rd_atom) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_res_rd_atom) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_qp_init_rd_atom) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_ee_init_rd_atom) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, atomic_cap) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_ee) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_rdd) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_mw) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_raw_ipv6_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_raw_ethy_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_mcast_grp) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_mcast_qp_attach) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_total_mcast_qp_attach) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_ah) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_fmr) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_map_per_fmr) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_srq) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_srq_wr) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_srq_sge) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, max_pkeys) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, local_ca_ack_delay) +HIPOBJ_IBV_MEMBER(struct, ibv_device_attr, phys_port_cnt) HIPOBJ_IBV_VALUE(IBV_MTU_256) HIPOBJ_IBV_VALUE(IBV_MTU_512) @@ -148,30 +153,30 @@ HIPOBJ_IBV_VALUE(IBV_LINK_LAYER_UNSPECIFIED) HIPOBJ_IBV_VALUE(IBV_LINK_LAYER_INFINIBAND) HIPOBJ_IBV_VALUE(IBV_LINK_LAYER_ETHERNET) -HIPOBJ_IBV_TYPE(struct ibv_port_attr) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, state) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, max_mtu) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, active_mtu) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, gid_tbl_len) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, port_cap_flags) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, max_msg_sz) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, bad_pkey_cntr) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, qkey_viol_cntr) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, pkey_tbl_len) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, lid) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, sm_lid) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, lmc) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, max_vl_num) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, sm_sl) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, subnet_timeout) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, init_type_reply) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, active_width) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, active_speed) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, phys_state) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, link_layer) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, flags) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, port_cap_flags2) -HIPOBJ_IBV_MEMBER(struct ibv_port_attr, active_speed_ex) +HIPOBJ_IBV_TYPE(struct, ibv_port_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, state) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, max_mtu) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, active_mtu) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, gid_tbl_len) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, port_cap_flags) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, max_msg_sz) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, bad_pkey_cntr) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, qkey_viol_cntr) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, pkey_tbl_len) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, lid) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, sm_lid) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, lmc) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, max_vl_num) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, sm_sl) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, subnet_timeout) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, init_type_reply) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, active_width) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, active_speed) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, phys_state) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, link_layer) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, flags) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, port_cap_flags2) +HIPOBJ_IBV_MEMBER(struct, ibv_port_attr, active_speed_ex) HIPOBJ_IBV_VALUE(IBV_WC_GRH) HIPOBJ_IBV_VALUE(IBV_WC_WITH_IMM) @@ -219,24 +224,24 @@ HIPOBJ_IBV_VALUE(IBV_WC_GENERAL_ERR) HIPOBJ_IBV_VALUE(IBV_WC_TM_ERR) HIPOBJ_IBV_VALUE(IBV_WC_TM_RNDV_INCOMPLETE) -HIPOBJ_IBV_TYPE(struct ibv_wc) -HIPOBJ_IBV_MEMBER(struct ibv_wc, wr_id) -HIPOBJ_IBV_MEMBER(struct ibv_wc, status) -HIPOBJ_IBV_MEMBER(struct ibv_wc, opcode) -HIPOBJ_IBV_MEMBER(struct ibv_wc, vendor_err) -HIPOBJ_IBV_MEMBER(struct ibv_wc, byte_len) +HIPOBJ_IBV_TYPE(struct, ibv_wc) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, wr_id) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, status) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, opcode) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, vendor_err) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, byte_len) /* In an anonymous union */ // NOLINTBEGIN(cppcoreguidelines-pro-type-union-access) -HIPOBJ_IBV_MEMBER(struct ibv_wc, imm_data) -HIPOBJ_IBV_MEMBER(struct ibv_wc, invalidated_rkey) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, imm_data) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, invalidated_rkey) // NOLINTEND(cppcoreguidelines-pro-type-union-access) -HIPOBJ_IBV_MEMBER(struct ibv_wc, qp_num) -HIPOBJ_IBV_MEMBER(struct ibv_wc, src_qp) -HIPOBJ_IBV_MEMBER(struct ibv_wc, wc_flags) -HIPOBJ_IBV_MEMBER(struct ibv_wc, pkey_index) -HIPOBJ_IBV_MEMBER(struct ibv_wc, slid) -HIPOBJ_IBV_MEMBER(struct ibv_wc, sl) -HIPOBJ_IBV_MEMBER(struct ibv_wc, dlid_path_bits) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, qp_num) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, src_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, wc_flags) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, pkey_index) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, slid) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, sl) +HIPOBJ_IBV_MEMBER(struct, ibv_wc, dlid_path_bits) HIPOBJ_IBV_VALUE(IBV_ACCESS_LOCAL_WRITE) HIPOBJ_IBV_VALUE(IBV_ACCESS_REMOTE_WRITE) @@ -250,34 +255,34 @@ HIPOBJ_IBV_VALUE(IBV_ACCESS_FLUSH_GLOBAL) HIPOBJ_IBV_VALUE(IBV_ACCESS_FLUSH_PERSISTENT) HIPOBJ_IBV_VALUE(IBV_ACCESS_RELAXED_ORDERING) -HIPOBJ_IBV_TYPE(struct ibv_pd) -HIPOBJ_IBV_MEMBER(struct ibv_pd, context) -HIPOBJ_IBV_MEMBER(struct ibv_pd, handle) - -HIPOBJ_IBV_TYPE(struct ibv_mr) -HIPOBJ_IBV_MEMBER(struct ibv_mr, context) -HIPOBJ_IBV_MEMBER(struct ibv_mr, pd) -HIPOBJ_IBV_MEMBER(struct ibv_mr, addr) -HIPOBJ_IBV_MEMBER(struct ibv_mr, length) -HIPOBJ_IBV_MEMBER(struct ibv_mr, handle) -HIPOBJ_IBV_MEMBER(struct ibv_mr, lkey) -HIPOBJ_IBV_MEMBER(struct ibv_mr, rkey) - -HIPOBJ_IBV_TYPE(struct ibv_global_route) -HIPOBJ_IBV_MEMBER(struct ibv_global_route, dgid) -HIPOBJ_IBV_MEMBER(struct ibv_global_route, flow_label) -HIPOBJ_IBV_MEMBER(struct ibv_global_route, sgid_index) -HIPOBJ_IBV_MEMBER(struct ibv_global_route, hop_limit) -HIPOBJ_IBV_MEMBER(struct ibv_global_route, traffic_class) - -HIPOBJ_IBV_TYPE(struct ibv_ah_attr) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, grh) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, dlid) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, sl) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, src_path_bits) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, static_rate) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, is_global) -HIPOBJ_IBV_MEMBER(struct ibv_ah_attr, port_num) +HIPOBJ_IBV_TYPE(struct, ibv_pd) +HIPOBJ_IBV_MEMBER(struct, ibv_pd, context) +HIPOBJ_IBV_MEMBER(struct, ibv_pd, handle) + +HIPOBJ_IBV_TYPE(struct, ibv_mr) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, context) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, pd) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, addr) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, length) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, handle) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, lkey) +HIPOBJ_IBV_MEMBER(struct, ibv_mr, rkey) + +HIPOBJ_IBV_TYPE(struct, ibv_global_route) +HIPOBJ_IBV_MEMBER(struct, ibv_global_route, dgid) +HIPOBJ_IBV_MEMBER(struct, ibv_global_route, flow_label) +HIPOBJ_IBV_MEMBER(struct, ibv_global_route, sgid_index) +HIPOBJ_IBV_MEMBER(struct, ibv_global_route, hop_limit) +HIPOBJ_IBV_MEMBER(struct, ibv_global_route, traffic_class) + +HIPOBJ_IBV_TYPE(struct, ibv_ah_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, grh) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, dlid) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, sl) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, src_path_bits) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, static_rate) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, is_global) +HIPOBJ_IBV_MEMBER(struct, ibv_ah_attr, port_num) HIPOBJ_IBV_VALUE(IBV_QPT_RC) HIPOBJ_IBV_VALUE(IBV_QPT_UC) @@ -287,21 +292,21 @@ HIPOBJ_IBV_VALUE(IBV_QPT_XRC_SEND) HIPOBJ_IBV_VALUE(IBV_QPT_XRC_RECV) HIPOBJ_IBV_VALUE(IBV_QPT_DRIVER) -HIPOBJ_IBV_TYPE(struct ibv_qp_cap) -HIPOBJ_IBV_MEMBER(struct ibv_qp_cap, max_send_wr) -HIPOBJ_IBV_MEMBER(struct ibv_qp_cap, max_recv_wr) -HIPOBJ_IBV_MEMBER(struct ibv_qp_cap, max_send_sge) -HIPOBJ_IBV_MEMBER(struct ibv_qp_cap, max_recv_sge) -HIPOBJ_IBV_MEMBER(struct ibv_qp_cap, max_inline_data) - -HIPOBJ_IBV_TYPE(struct ibv_qp_init_attr) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, qp_context) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, send_cq) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, recv_cq) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, srq) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, cap) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, qp_type) -HIPOBJ_IBV_MEMBER(struct ibv_qp_init_attr, sq_sig_all) +HIPOBJ_IBV_TYPE(struct, ibv_qp_cap) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_cap, max_send_wr) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_cap, max_recv_wr) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_cap, max_send_sge) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_cap, max_recv_sge) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_cap, max_inline_data) + +HIPOBJ_IBV_TYPE(struct, ibv_qp_init_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, qp_context) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, send_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, recv_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, srq) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, cap) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, qp_type) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_init_attr, sq_sig_all) HIPOBJ_IBV_VALUE(IBV_QP_STATE) HIPOBJ_IBV_VALUE(IBV_QP_CUR_STATE) @@ -339,48 +344,48 @@ HIPOBJ_IBV_VALUE(IBV_MIG_MIGRATED) HIPOBJ_IBV_VALUE(IBV_MIG_REARM) HIPOBJ_IBV_VALUE(IBV_MIG_ARMED) -HIPOBJ_IBV_TYPE(struct ibv_qp_attr) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, qp_state) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, cur_qp_state) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, path_mtu) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, path_mig_state) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, qkey) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, rq_psn) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, sq_psn) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, dest_qp_num) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, qp_access_flags) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, cap) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, ah_attr) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, alt_ah_attr) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, pkey_index) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, alt_pkey_index) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, en_sqd_async_notify) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, sq_draining) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, max_rd_atomic) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, max_dest_rd_atomic) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, min_rnr_timer) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, port_num) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, timeout) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, retry_cnt) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, rnr_retry) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, alt_port_num) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, alt_timeout) -HIPOBJ_IBV_MEMBER(struct ibv_qp_attr, rate_limit) - -HIPOBJ_IBV_TYPE(struct ibv_qp) -HIPOBJ_IBV_MEMBER(struct ibv_qp, context) -HIPOBJ_IBV_MEMBER(struct ibv_qp, qp_context) -HIPOBJ_IBV_MEMBER(struct ibv_qp, pd) -HIPOBJ_IBV_MEMBER(struct ibv_qp, send_cq) -HIPOBJ_IBV_MEMBER(struct ibv_qp, recv_cq) -HIPOBJ_IBV_MEMBER(struct ibv_qp, srq) -HIPOBJ_IBV_MEMBER(struct ibv_qp, handle) -HIPOBJ_IBV_MEMBER(struct ibv_qp, qp_num) -HIPOBJ_IBV_MEMBER(struct ibv_qp, state) -HIPOBJ_IBV_MEMBER(struct ibv_qp, qp_type) -HIPOBJ_IBV_MEMBER(struct ibv_qp, mutex) -HIPOBJ_IBV_MEMBER(struct ibv_qp, cond) -HIPOBJ_IBV_MEMBER(struct ibv_qp, events_completed) +HIPOBJ_IBV_TYPE(struct, ibv_qp_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, qp_state) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, cur_qp_state) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, path_mtu) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, path_mig_state) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, qkey) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, rq_psn) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, sq_psn) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, dest_qp_num) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, qp_access_flags) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, cap) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, ah_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, alt_ah_attr) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, pkey_index) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, alt_pkey_index) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, en_sqd_async_notify) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, sq_draining) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, max_rd_atomic) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, max_dest_rd_atomic) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, min_rnr_timer) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, port_num) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, timeout) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, retry_cnt) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, rnr_retry) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, alt_port_num) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, alt_timeout) +HIPOBJ_IBV_MEMBER(struct, ibv_qp_attr, rate_limit) + +HIPOBJ_IBV_TYPE(struct, ibv_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, context) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, qp_context) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, pd) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, send_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, recv_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, srq) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, handle) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, qp_num) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, state) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, qp_type) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, mutex) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, cond) +HIPOBJ_IBV_MEMBER(struct, ibv_qp, events_completed) HIPOBJ_IBV_VALUE(IBV_WR_RDMA_WRITE) HIPOBJ_IBV_VALUE(IBV_WR_RDMA_WRITE_WITH_IMM) @@ -402,139 +407,139 @@ HIPOBJ_IBV_VALUE(IBV_SEND_SIGNALED) HIPOBJ_IBV_VALUE(IBV_SEND_SOLICITED) HIPOBJ_IBV_VALUE(IBV_SEND_INLINE) -HIPOBJ_IBV_TYPE(struct ibv_sge) -HIPOBJ_IBV_MEMBER(struct ibv_sge, addr) -HIPOBJ_IBV_MEMBER(struct ibv_sge, length) -HIPOBJ_IBV_MEMBER(struct ibv_sge, lkey) - -HIPOBJ_IBV_TYPE(struct ibv_mw_bind_info) -HIPOBJ_IBV_MEMBER(struct ibv_mw_bind_info, mr) -HIPOBJ_IBV_MEMBER(struct ibv_mw_bind_info, addr) -HIPOBJ_IBV_MEMBER(struct ibv_mw_bind_info, length) -HIPOBJ_IBV_MEMBER(struct ibv_mw_bind_info, mw_access_flags) - -HIPOBJ_IBV_TYPE(struct ibv_send_wr) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr_id) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, next) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, sg_list) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, num_sge) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, opcode) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, send_flags) +HIPOBJ_IBV_TYPE(struct, ibv_sge) +HIPOBJ_IBV_MEMBER(struct, ibv_sge, addr) +HIPOBJ_IBV_MEMBER(struct, ibv_sge, length) +HIPOBJ_IBV_MEMBER(struct, ibv_sge, lkey) + +HIPOBJ_IBV_TYPE(struct, ibv_mw_bind_info) +HIPOBJ_IBV_MEMBER(struct, ibv_mw_bind_info, mr) +HIPOBJ_IBV_MEMBER(struct, ibv_mw_bind_info, addr) +HIPOBJ_IBV_MEMBER(struct, ibv_mw_bind_info, length) +HIPOBJ_IBV_MEMBER(struct, ibv_mw_bind_info, mw_access_flags) + +HIPOBJ_IBV_TYPE(struct, ibv_send_wr) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr_id) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, next) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, sg_list) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, num_sge) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, opcode) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, send_flags) /* imm_data through tso.mss are in unions */ // NOLINTBEGIN(cppcoreguidelines-pro-type-union-access) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, imm_data) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, invalidate_rkey) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.rdma) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.rdma.remote_addr) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.rdma.rkey) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.atomic) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.atomic.remote_addr) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.atomic.compare_add) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.atomic.swap) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.atomic.rkey) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.ud) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.ud.ah) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.ud.remote_qpn) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, wr.ud.remote_qkey) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, qp_type) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, qp_type.xrc) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, qp_type.xrc.remote_srqn) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, bind_mw) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, bind_mw.mw) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, bind_mw.rkey) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, bind_mw.bind_info) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, tso) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, tso.hdr) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, tso.hdr_sz) -HIPOBJ_IBV_MEMBER(struct ibv_send_wr, tso.mss) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, imm_data) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, invalidate_rkey) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.rdma) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.rdma.remote_addr) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.rdma.rkey) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.atomic) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.atomic.remote_addr) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.atomic.compare_add) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.atomic.swap) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.atomic.rkey) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.ud) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.ud.ah) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.ud.remote_qpn) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, wr.ud.remote_qkey) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, qp_type) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, qp_type.xrc) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, qp_type.xrc.remote_srqn) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, bind_mw) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, bind_mw.mw) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, bind_mw.rkey) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, bind_mw.bind_info) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, tso) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, tso.hdr) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, tso.hdr_sz) +HIPOBJ_IBV_MEMBER(struct, ibv_send_wr, tso.mss) // NOLINTEND(cppcoreguidelines-pro-type-union-access) -HIPOBJ_IBV_TYPE(struct ibv_recv_wr) -HIPOBJ_IBV_MEMBER(struct ibv_recv_wr, wr_id) -HIPOBJ_IBV_MEMBER(struct ibv_recv_wr, next) -HIPOBJ_IBV_MEMBER(struct ibv_recv_wr, sg_list) -HIPOBJ_IBV_MEMBER(struct ibv_recv_wr, num_sge) +HIPOBJ_IBV_TYPE(struct, ibv_recv_wr) +HIPOBJ_IBV_MEMBER(struct, ibv_recv_wr, wr_id) +HIPOBJ_IBV_MEMBER(struct, ibv_recv_wr, next) +HIPOBJ_IBV_MEMBER(struct, ibv_recv_wr, sg_list) +HIPOBJ_IBV_MEMBER(struct, ibv_recv_wr, num_sge) HIPOBJ_IBV_VALUE(IBV_SYSFS_NAME_MAX) HIPOBJ_IBV_VALUE(IBV_SYSFS_PATH_MAX) -HIPOBJ_IBV_TYPE(struct ibv_device) -HIPOBJ_IBV_MEMBER(struct ibv_device, _ops) -HIPOBJ_IBV_MEMBER(struct ibv_device, _ops._dummy1) -HIPOBJ_IBV_MEMBER(struct ibv_device, _ops._dummy2) -HIPOBJ_IBV_MEMBER(struct ibv_device, node_type) -HIPOBJ_IBV_MEMBER(struct ibv_device, transport_type) -HIPOBJ_IBV_MEMBER(struct ibv_device, name) -HIPOBJ_IBV_MEMBER(struct ibv_device, dev_name) -HIPOBJ_IBV_MEMBER(struct ibv_device, dev_path) -HIPOBJ_IBV_MEMBER(struct ibv_device, ibdev_path) - -HIPOBJ_IBV_TYPE(struct ibv_comp_channel) -HIPOBJ_IBV_MEMBER(struct ibv_comp_channel, context) -HIPOBJ_IBV_MEMBER(struct ibv_comp_channel, fd) -HIPOBJ_IBV_MEMBER(struct ibv_comp_channel, refcnt) - -HIPOBJ_IBV_TYPE(struct ibv_srq) -HIPOBJ_IBV_MEMBER(struct ibv_srq, context) -HIPOBJ_IBV_MEMBER(struct ibv_srq, srq_context) -HIPOBJ_IBV_MEMBER(struct ibv_srq, pd) -HIPOBJ_IBV_MEMBER(struct ibv_srq, handle) -HIPOBJ_IBV_MEMBER(struct ibv_srq, mutex) -HIPOBJ_IBV_MEMBER(struct ibv_srq, cond) -HIPOBJ_IBV_MEMBER(struct ibv_srq, events_completed) - -HIPOBJ_IBV_TYPE(struct ibv_cq) -HIPOBJ_IBV_MEMBER(struct ibv_cq, context) -HIPOBJ_IBV_MEMBER(struct ibv_cq, channel) -HIPOBJ_IBV_MEMBER(struct ibv_cq, cq_context) -HIPOBJ_IBV_MEMBER(struct ibv_cq, handle) -HIPOBJ_IBV_MEMBER(struct ibv_cq, cqe) -HIPOBJ_IBV_MEMBER(struct ibv_cq, mutex) -HIPOBJ_IBV_MEMBER(struct ibv_cq, cond) -HIPOBJ_IBV_MEMBER(struct ibv_cq, comp_events_completed) -HIPOBJ_IBV_MEMBER(struct ibv_cq, async_events_completed) - -HIPOBJ_IBV_TYPE(struct ibv_context_ops) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_query_device) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_query_port) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_alloc_pd) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_dealloc_pd) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_reg_mr) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_rereg_mr) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_dereg_mr) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, alloc_mw) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, bind_mw) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, dealloc_mw) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_create_cq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, poll_cq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, req_notify_cq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_cq_event) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_resize_cq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_destroy_cq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_create_srq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_modify_srq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_query_srq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_destroy_srq) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, post_srq_recv) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_create_qp) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_query_qp) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_modify_qp) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_destroy_qp) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, post_send) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, post_recv) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_create_ah) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_destroy_ah) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_attach_mcast) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_detach_mcast) -HIPOBJ_IBV_MEMBER(struct ibv_context_ops, _compat_async_event) - -HIPOBJ_IBV_TYPE(struct ibv_context) -HIPOBJ_IBV_MEMBER(struct ibv_context, device) -HIPOBJ_IBV_MEMBER(struct ibv_context, ops) -HIPOBJ_IBV_MEMBER(struct ibv_context, cmd_fd) -HIPOBJ_IBV_MEMBER(struct ibv_context, async_fd) -HIPOBJ_IBV_MEMBER(struct ibv_context, num_comp_vectors) -HIPOBJ_IBV_MEMBER(struct ibv_context, mutex) -HIPOBJ_IBV_MEMBER(struct ibv_context, abi_compat) +HIPOBJ_IBV_TYPE(struct, ibv_device) +HIPOBJ_IBV_MEMBER(struct, ibv_device, _ops) +HIPOBJ_IBV_MEMBER(struct, ibv_device, _ops._dummy1) +HIPOBJ_IBV_MEMBER(struct, ibv_device, _ops._dummy2) +HIPOBJ_IBV_MEMBER(struct, ibv_device, node_type) +HIPOBJ_IBV_MEMBER(struct, ibv_device, transport_type) +HIPOBJ_IBV_MEMBER(struct, ibv_device, name) +HIPOBJ_IBV_MEMBER(struct, ibv_device, dev_name) +HIPOBJ_IBV_MEMBER(struct, ibv_device, dev_path) +HIPOBJ_IBV_MEMBER(struct, ibv_device, ibdev_path) + +HIPOBJ_IBV_TYPE(struct, ibv_comp_channel) +HIPOBJ_IBV_MEMBER(struct, ibv_comp_channel, context) +HIPOBJ_IBV_MEMBER(struct, ibv_comp_channel, fd) +HIPOBJ_IBV_MEMBER(struct, ibv_comp_channel, refcnt) + +HIPOBJ_IBV_TYPE(struct, ibv_srq) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, context) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, srq_context) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, pd) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, handle) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, mutex) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, cond) +HIPOBJ_IBV_MEMBER(struct, ibv_srq, events_completed) + +HIPOBJ_IBV_TYPE(struct, ibv_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, context) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, channel) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, cq_context) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, handle) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, cqe) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, mutex) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, cond) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, comp_events_completed) +HIPOBJ_IBV_MEMBER(struct, ibv_cq, async_events_completed) + +HIPOBJ_IBV_TYPE(struct, ibv_context_ops) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_query_device) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_query_port) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_alloc_pd) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_dealloc_pd) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_reg_mr) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_rereg_mr) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_dereg_mr) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, alloc_mw) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, bind_mw) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, dealloc_mw) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_create_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, poll_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, req_notify_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_cq_event) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_resize_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_destroy_cq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_create_srq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_modify_srq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_query_srq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_destroy_srq) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, post_srq_recv) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_create_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_query_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_modify_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_destroy_qp) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, post_send) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, post_recv) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_create_ah) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_destroy_ah) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_attach_mcast) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_detach_mcast) +HIPOBJ_IBV_MEMBER(struct, ibv_context_ops, _compat_async_event) + +HIPOBJ_IBV_TYPE(struct, ibv_context) +HIPOBJ_IBV_MEMBER(struct, ibv_context, device) +HIPOBJ_IBV_MEMBER(struct, ibv_context, ops) +HIPOBJ_IBV_MEMBER(struct, ibv_context, cmd_fd) +HIPOBJ_IBV_MEMBER(struct, ibv_context, async_fd) +HIPOBJ_IBV_MEMBER(struct, ibv_context, num_comp_vectors) +HIPOBJ_IBV_MEMBER(struct, ibv_context, mutex) +HIPOBJ_IBV_MEMBER(struct, ibv_context, abi_compat) // NOLINTEND(bugprone-sizeof-expression) diff --git a/test/unit/ibv-layout-real.c b/test/unit/ibv-layout-real.c index afc695b5..3ed1e884 100644 --- a/test/unit/ibv-layout-real.c +++ b/test/unit/ibv-layout-real.c @@ -20,9 +20,9 @@ #include "ibv-layout.h" -#define HIPOBJ_IBV_TYPE(type) (int64_t)sizeof(type), (int64_t) _Alignof(type), -#define HIPOBJ_IBV_MEMBER(type, member) \ - (int64_t) offsetof(type, member), (int64_t)sizeof(((type *)0)->member), +#define HIPOBJ_IBV_TYPE(key, type) (int64_t)sizeof(key type), (int64_t) _Alignof(key type), +#define HIPOBJ_IBV_MEMBER(key, type, member) \ + (int64_t) offsetof(key type, member), (int64_t)sizeof(((key type *)0)->member), #define HIPOBJ_IBV_VALUE(name) (int64_t)(name), static const int64_t real_layout[] = { diff --git a/test/unit/test-api-exceptions.cpp b/test/unit/test-api-exceptions.cpp index 9d4cb7e4..658f6627 100644 --- a/test/unit/test-api-exceptions.cpp +++ b/test/unit/test-api-exceptions.cpp @@ -87,8 +87,7 @@ class ThrowingCreateQpVerbs : public hipObjTest::FakeVerbs { public: using FakeVerbs::FakeVerbs; - struct ibv_qp *create_qp(struct ibv_pd * /*pd*/, - struct ibv_qp_init_attr * /*qp_init_attr*/) const override + ibv_qp *create_qp(ibv_pd * /*pd*/, ibv_qp_init_attr * /*qp_init_attr*/) const override { throwIt(); } @@ -99,8 +98,7 @@ class ThrowingRegMrVerbs : public hipObjTest::FakeVerbs { public: using FakeVerbs::FakeVerbs; - struct ibv_mr *reg_mr(struct ibv_pd * /*pd*/, void * /*addr*/, size_t /*length*/, - int /*access*/) const override + ibv_mr *reg_mr(ibv_pd * /*pd*/, void * /*addr*/, size_t /*length*/, int /*access*/) const override { throwIt(); } diff --git a/test/unit/test-buffer-registration.cpp b/test/unit/test-buffer-registration.cpp index 58db78b7..7dad14c2 100644 --- a/test/unit/test-buffer-registration.cpp +++ b/test/unit/test-buffer-registration.cpp @@ -37,10 +37,10 @@ using DeregisterResult = hipObj::BufferMap::DeregisterResult; constexpr int kThreads = 8; constexpr int kIterations = 50; -struct ibv_pd * +ibv_pd * fakePd() { - return hipObj::addressToPointer(1); + return hipObj::addressToPointer(1); } /* Fake address number index, for registrations that are faked, so @@ -75,7 +75,7 @@ class RacingVerbs final : public hipObjTest::FakeVerbs { public: using FakeVerbs::FakeVerbs; - struct ibv_mr *reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) const override + ibv_mr *reg_mr(ibv_pd *pd, void *addr, size_t length, int access) const override { if (onRegister_) { /* Cleared first, so registering from the hook doesn't call it diff --git a/test/unit/test-connection-pool.cpp b/test/unit/test-connection-pool.cpp index d68efa86..f0e57292 100644 --- a/test/unit/test-connection-pool.cpp +++ b/test/unit/test-connection-pool.cpp @@ -75,7 +75,7 @@ class ThrowingCreateQpVerbs : public hipObjTest::FakeVerbs { public: using FakeVerbs::FakeVerbs; - struct ibv_qp *create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) const override + ibv_qp *create_qp(ibv_pd *pd, ibv_qp_init_attr *qp_init_attr) const override { if (throws) { throw std::runtime_error("thrown by a fake"); @@ -211,7 +211,7 @@ TEST_F(ConnectionPoolTest, MovingALeaseHandsOverTheConnection) const auto pool = makePool(1); std::optional first = leaseFrom(*pool); ASSERT_TRUE(first); - struct ibv_qp *const qp = first->connection().qp(); + ibv_qp *const qp = first->connection().qp(); std::optional second; second.emplace(std::move(*first)); diff --git a/test/unit/test-ibv-dmabuf.cpp b/test/unit/test-ibv-dmabuf.cpp index ad89d1bd..c4d5677b 100644 --- a/test/unit/test-ibv-dmabuf.cpp +++ b/test/unit/test-ibv-dmabuf.cpp @@ -52,10 +52,10 @@ struct DmabufLog { DmabufLog g_log; -struct ibv_pd * +ibv_pd * fakePd() { - return hipObj::addressToPointer(1); + return hipObj::addressToPointer(1); } /* A libibverbs with ibv_reg_dmabuf_mr() */ @@ -70,8 +70,8 @@ class DmabufVerbs : public hipObjTest::FakeVerbs { /* Leaves the MR's addr NULL, as the real ibv_reg_dmabuf_mr() does, * which also tells the tests which path registered it */ - struct ibv_mr *reg_dmabuf_mr(struct ibv_pd * /*pd*/, uint64_t offset, size_t /*length*/, uint64_t iova, - int fd, int /*access*/) const override + ibv_mr *reg_dmabuf_mr(ibv_pd * /*pd*/, uint64_t offset, size_t /*length*/, uint64_t iova, int fd, + int /*access*/) const override { ++g_log.dmabufRegisterCalls; g_log.registeredFd = fd; @@ -83,7 +83,7 @@ class DmabufVerbs : public hipObjTest::FakeVerbs { return nullptr; } /* Released by FakeVerbs::dereg_mr() */ - return std::make_unique().release(); + return std::make_unique().release(); } }; diff --git a/test/unit/test-ibv-layout.cpp b/test/unit/test-ibv-layout.cpp index 896d9970..b0713a0d 100644 --- a/test/unit/test-ibv-layout.cpp +++ b/test/unit/test-ibv-layout.cpp @@ -35,12 +35,13 @@ struct LayoutEntry { int64_t value; }; -#define HIPOBJ_IBV_TYPE(type) \ - {"size of " #type, static_cast(sizeof(type))}, \ - {"alignment of " #type, static_cast(alignof(type))}, -#define HIPOBJ_IBV_MEMBER(type, member) \ - {"offset of " #type "." #member, static_cast(offsetof(type, member))}, \ - {"size of " #type "." #member, static_cast(sizeof(std::declval().member))}, +/* C++ doesn't need the struct or union keyword (key) before a type's name */ +#define HIPOBJ_IBV_TYPE(key, type) \ + {"size of " #key " " #type, static_cast(sizeof(type))}, \ + {"alignment of " #key " " #type, static_cast(alignof(type))}, +#define HIPOBJ_IBV_MEMBER(key, type, member) \ + {"offset of " #key " " #type "." #member, static_cast(offsetof(type, member))}, \ + {"size of " #key " " #type "." #member, static_cast(sizeof(std::declval().member))}, #define HIPOBJ_IBV_VALUE(name) {"value of " #name, static_cast(name)}, /* The entries in ibv-layout-list.h, from ibv-core.h */ diff --git a/test/unit/test-loaded-verbs.cpp b/test/unit/test-loaded-verbs.cpp index cfadfe4d..1f61f04c 100644 --- a/test/unit/test-loaded-verbs.cpp +++ b/test/unit/test-loaded-verbs.cpp @@ -56,80 +56,80 @@ makeFuncs() funcs.get_device_list = [](int *num) { g_call = {.name = "get_device_list", .object = num, .value = 0}; *num = 1; - return fakeObject(0x10); + return fakeObject(0x10); }; - funcs.free_device_list = [](struct ibv_device **list) { + funcs.free_device_list = [](ibv_device **list) { g_call = {.name = "free_device_list", .object = static_cast(list), .value = 0}; }; - funcs.open_device = [](struct ibv_device *device) { + funcs.open_device = [](ibv_device *device) { g_call = {.name = "open_device", .object = device, .value = 0}; - return fakeObject(0x20); + return fakeObject(0x20); }; - funcs.close_device = [](struct ibv_context *context) { + funcs.close_device = [](ibv_context *context) { g_call = {.name = "close_device", .object = context, .value = 0}; return kResult; }; - funcs.get_device_name = [](struct ibv_device *device) { + funcs.get_device_name = [](ibv_device *device) { g_call = {.name = "get_device_name", .object = device, .value = 0}; return "fake0"; }; - funcs.query_device = [](struct ibv_context *context, struct ibv_device_attr *attr) { + funcs.query_device = [](ibv_context *context, ibv_device_attr *attr) { g_call = {.name = "query_device", .object = context, .value = hipObj::pointerToAddress(attr)}; return kResult; }; - funcs.query_port = [](struct ibv_context *context, uint8_t port, struct ibv_port_attr *) { + funcs.query_port = [](ibv_context *context, uint8_t port, ibv_port_attr *) { g_call = {.name = "query_port", .object = context, .value = port}; return kResult; }; - funcs.query_gid = [](struct ibv_context *context, uint8_t, int index, union ibv_gid *) { + funcs.query_gid = [](ibv_context *context, uint8_t, int index, ibv_gid *) { g_call = {.name = "query_gid", .object = context, .value = static_cast(index)}; return kResult; }; - funcs.alloc_pd = [](struct ibv_context *context) { + funcs.alloc_pd = [](ibv_context *context) { g_call = {.name = "alloc_pd", .object = context, .value = 0}; - return fakeObject(0x30); + return fakeObject(0x30); }; - funcs.dealloc_pd = [](struct ibv_pd *pd) { + funcs.dealloc_pd = [](ibv_pd *pd) { g_call = {.name = "dealloc_pd", .object = pd, .value = 0}; return kResult; }; - funcs.reg_dmabuf_mr = [](struct ibv_pd *pd, uint64_t, size_t, uint64_t iova, int, int) { + funcs.reg_dmabuf_mr = [](ibv_pd *pd, uint64_t, size_t, uint64_t iova, int, int) { g_call = {.name = "reg_dmabuf_mr", .object = pd, .value = iova}; - return fakeObject(0x40); + return fakeObject(0x40); }; - funcs.reg_mr_iova2 = [](struct ibv_pd *pd, void *, size_t, uintptr_t iova, int) { + funcs.reg_mr_iova2 = [](ibv_pd *pd, void *, size_t, uintptr_t iova, int) { g_call = {.name = "reg_mr_iova2", .object = pd, .value = iova}; - return fakeObject(0x50); + return fakeObject(0x50); }; - funcs.dereg_mr = [](struct ibv_mr *mr) { + funcs.dereg_mr = [](ibv_mr *mr) { g_call = {.name = "dereg_mr", .object = mr, .value = 0}; return kResult; }; - funcs.create_cq = [](struct ibv_context *context, int cqe, void *, struct ibv_comp_channel *, int) { + funcs.create_cq = [](ibv_context *context, int cqe, void *, ibv_comp_channel *, int) { g_call = {.name = "create_cq", .object = context, .value = static_cast(cqe)}; - return fakeObject(0x60); + return fakeObject(0x60); }; - funcs.destroy_cq = [](struct ibv_cq *cq) { + funcs.destroy_cq = [](ibv_cq *cq) { g_call = {.name = "destroy_cq", .object = cq, .value = 0}; return kResult; }; - funcs.create_qp = [](struct ibv_pd *pd, struct ibv_qp_init_attr *) { + funcs.create_qp = [](ibv_pd *pd, ibv_qp_init_attr *) { g_call = {.name = "create_qp", .object = pd, .value = 0}; - return fakeObject(0x70); + return fakeObject(0x70); }; - funcs.modify_qp = [](struct ibv_qp *qp, struct ibv_qp_attr *, int mask) { + funcs.modify_qp = [](ibv_qp *qp, ibv_qp_attr *, int mask) { g_call = {.name = "modify_qp", .object = qp, .value = static_cast(mask)}; return kResult; }; - funcs.destroy_qp = [](struct ibv_qp *qp) { + funcs.destroy_qp = [](ibv_qp *qp) { g_call = {.name = "destroy_qp", .object = qp, .value = 0}; return kResult; }; - funcs.poll_cq = [](struct ibv_cq *cq, int count, struct ibv_wc *) { + funcs.poll_cq = [](ibv_cq *cq, int count, ibv_wc *) { g_call = {.name = "poll_cq", .object = cq, .value = static_cast(count)}; return kResult; }; - funcs.post_send = [](struct ibv_qp *qp, struct ibv_send_wr *, struct ibv_send_wr **) { + funcs.post_send = [](ibv_qp *qp, ibv_send_wr *, ibv_send_wr **) { g_call = {.name = "post_send", .object = qp, .value = 0}; return kResult; }; @@ -156,20 +156,20 @@ TEST_F(LoadedVerbsTest, ForwardsEachCall) const hipObj::LoadedVerbs verbs(makeFuncs()); int num = 0; - EXPECT_EQ(verbs.get_device_list(&num), fakeObject(0x10)); + EXPECT_EQ(verbs.get_device_list(&num), fakeObject(0x10)); expectCall("get_device_list", &num); EXPECT_EQ(num, 1); - auto *const devices = fakeObject(0x11); + auto *const devices = fakeObject(0x11); verbs.free_device_list(devices); expectCall("free_device_list", static_cast(devices)); - auto *const device = fakeObject(0x12); - EXPECT_EQ(verbs.open_device(device), fakeObject(0x20)); + auto *const device = fakeObject(0x12); + EXPECT_EQ(verbs.open_device(device), fakeObject(0x20)); expectCall("open_device", device); EXPECT_EQ(std::string_view(verbs.get_device_name(device)), "fake0"); expectCall("get_device_name", device); - auto *const context = fakeObject(0x21); + auto *const context = fakeObject(0x21); ibv_device_attr deviceAttr{}; EXPECT_EQ(verbs.query_device(context, &deviceAttr), kResult); expectCall("query_device", context); @@ -182,26 +182,26 @@ TEST_F(LoadedVerbsTest, ForwardsEachCall) EXPECT_EQ(verbs.query_gid(context, 1, 5, &gid), kResult); expectCall("query_gid", context); EXPECT_EQ(g_call.value, 5U); - EXPECT_EQ(verbs.alloc_pd(context), fakeObject(0x30)); + EXPECT_EQ(verbs.alloc_pd(context), fakeObject(0x30)); expectCall("alloc_pd", context); - EXPECT_EQ(verbs.create_cq(context, 16, nullptr, nullptr, 0), fakeObject(0x60)); + EXPECT_EQ(verbs.create_cq(context, 16, nullptr, nullptr, 0), fakeObject(0x60)); expectCall("create_cq", context); EXPECT_EQ(g_call.value, 16U); EXPECT_EQ(verbs.close_device(context), kResult); expectCall("close_device", context); - auto *const pd = fakeObject(0x31); + auto *const pd = fakeObject(0x31); ibv_qp_init_attr initAttr{}; - EXPECT_EQ(verbs.create_qp(pd, &initAttr), fakeObject(0x70)); + EXPECT_EQ(verbs.create_qp(pd, &initAttr), fakeObject(0x70)); expectCall("create_qp", pd); EXPECT_EQ(verbs.dealloc_pd(pd), kResult); expectCall("dealloc_pd", pd); - auto *const mr = fakeObject(0x41); + auto *const mr = fakeObject(0x41); EXPECT_EQ(verbs.dereg_mr(mr), kResult); expectCall("dereg_mr", mr); - auto *const cq = fakeObject(0x61); + auto *const cq = fakeObject(0x61); ibv_wc wc{}; EXPECT_EQ(verbs.poll_cq(cq, 1, &wc), kResult); expectCall("poll_cq", cq); @@ -209,7 +209,7 @@ TEST_F(LoadedVerbsTest, ForwardsEachCall) EXPECT_EQ(verbs.destroy_cq(cq), kResult); expectCall("destroy_cq", cq); - auto *const qp = fakeObject(0x71); + auto *const qp = fakeObject(0x71); ibv_qp_attr qpAttr{}; ibv_send_wr sendWr{}; ibv_send_wr *badSend = nullptr; @@ -226,10 +226,10 @@ TEST_F(LoadedVerbsTest, ForwardsEachCall) TEST_F(LoadedVerbsTest, RegMrUsesAddressAsIova) { const hipObj::LoadedVerbs verbs(makeFuncs()); - auto *const pd = fakeObject(0x31); + auto *const pd = fakeObject(0x31); void *const addr = fakeObject(0x1000); - EXPECT_EQ(verbs.reg_mr(pd, addr, 64, IBV_ACCESS_LOCAL_WRITE), fakeObject(0x50)); + EXPECT_EQ(verbs.reg_mr(pd, addr, 64, IBV_ACCESS_LOCAL_WRITE), fakeObject(0x50)); expectCall("reg_mr_iova2", pd); EXPECT_EQ(g_call.value, 0x1000U); } @@ -237,11 +237,10 @@ TEST_F(LoadedVerbsTest, RegMrUsesAddressAsIova) TEST_F(LoadedVerbsTest, RegistersDmabufWhenLibibverbsCan) { const hipObj::LoadedVerbs verbs(makeFuncs()); - auto *const pd = fakeObject(0x31); + auto *const pd = fakeObject(0x31); EXPECT_TRUE(verbs.supportsDmabuf()); - EXPECT_EQ(verbs.reg_dmabuf_mr(pd, 0, 64, 0x2000, 7, IBV_ACCESS_LOCAL_WRITE), - fakeObject(0x40)); + EXPECT_EQ(verbs.reg_dmabuf_mr(pd, 0, 64, 0x2000, 7, IBV_ACCESS_LOCAL_WRITE), fakeObject(0x40)); expectCall("reg_dmabuf_mr", pd); EXPECT_EQ(g_call.value, 0x2000U); } @@ -255,7 +254,7 @@ TEST_F(LoadedVerbsTest, NoDmabufWithoutTheSymbol) EXPECT_FALSE(verbs.supportsDmabuf()); errno = 0; - EXPECT_EQ(verbs.reg_dmabuf_mr(fakeObject(0x31), 0, 64, 0x2000, 7, IBV_ACCESS_LOCAL_WRITE), + EXPECT_EQ(verbs.reg_dmabuf_mr(fakeObject(0x31), 0, 64, 0x2000, 7, IBV_ACCESS_LOCAL_WRITE), nullptr); EXPECT_EQ(errno, EOPNOTSUPP); EXPECT_EQ(g_call.name, ""); @@ -271,18 +270,18 @@ TEST_F(LoadedVerbsTest, FallsBackToContextOps) funcs.post_send = nullptr; const hipObj::LoadedVerbs verbs(funcs); - struct ibv_context context {}; - context.ops.poll_cq = [](struct ibv_cq *cq, int count, struct ibv_wc *) { + ibv_context context{}; + context.ops.poll_cq = [](ibv_cq *cq, int count, ibv_wc *) { g_call = {.name = "ops.poll_cq", .object = cq, .value = static_cast(count)}; return kResult; }; - context.ops.post_send = [](struct ibv_qp *qp, struct ibv_send_wr *, struct ibv_send_wr **) { + context.ops.post_send = [](ibv_qp *qp, ibv_send_wr *, ibv_send_wr **) { g_call = {.name = "ops.post_send", .object = qp, .value = 0}; return kResult; }; - struct ibv_cq cq {}; + ibv_cq cq{}; cq.context = &context; - struct ibv_qp qp {}; + ibv_qp qp{}; qp.context = &context; ibv_wc wc{}; @@ -306,8 +305,8 @@ TEST(LoadLibibverbsTest, LoadsWhatTheLibraryNeeds) GTEST_SKIP() << "libibverbs couldn't be loaded"; } - int num = -1; - struct ibv_device **list = verbs->get_device_list(&num); + int num = -1; + ibv_device **list = verbs->get_device_list(&num); if (list != nullptr) { EXPECT_GE(num, 0); verbs->free_device_list(list); diff --git a/test/unit/test-s3-curl-ops.cpp b/test/unit/test-s3-curl-ops.cpp index 6b1eed21..6c40eabb 100644 --- a/test/unit/test-s3-curl-ops.cpp +++ b/test/unit/test-s3-curl-ops.cpp @@ -78,7 +78,7 @@ class StubHttpServer { int one = 1; setsockopt(listenFd_.get(), SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); - struct sockaddr_in addr {}; + sockaddr_in addr{}; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); addr.sin_port = 0; @@ -435,7 +435,7 @@ TEST(S3CurlOps, ConnectionRefusedFails) // are refused deterministically. const hipObj::UniqueFd fd(socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0)); ASSERT_TRUE(fd); - struct sockaddr_in addr {}; + sockaddr_in addr{}; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); addr.sin_port = 0; diff --git a/test/unit/test-seams.cpp b/test/unit/test-seams.cpp index eb9fd642..77bbbdeb 100644 --- a/test/unit/test-seams.cpp +++ b/test/unit/test-seams.cpp @@ -306,12 +306,12 @@ class TopologyVerbs : public hipObjTest::FakeVerbs { public: using FakeVerbs::FakeVerbs; - const char *get_device_name(struct ibv_device * /*device*/) const override + const char *get_device_name(ibv_device * /*device*/) const override { return kFakeDevName.data(); } - int query_device(struct ibv_context *context, struct ibv_device_attr *attr) const override + int query_device(ibv_context *context, ibv_device_attr *attr) const override { const int result = FakeVerbs::query_device(context, attr); if (result == 0) { @@ -320,7 +320,7 @@ class TopologyVerbs : public hipObjTest::FakeVerbs { return result; } - int query_port(struct ibv_context *context, uint8_t portNum, struct ibv_port_attr *attr) const override + int query_port(ibv_context *context, uint8_t portNum, ibv_port_attr *attr) const override { const int result = FakeVerbs::query_port(context, portNum, attr); if (result == 0) { @@ -330,7 +330,7 @@ class TopologyVerbs : public hipObjTest::FakeVerbs { return result; } - int query_gid(struct ibv_context *context, uint8_t portNum, int index, union ibv_gid *gid) const override + int query_gid(ibv_context *context, uint8_t portNum, int index, ibv_gid *gid) const override { const int result = FakeVerbs::query_gid(context, portNum, index, gid); if (result != 0) { @@ -358,7 +358,7 @@ class TopologyVerbs : public hipObjTest::FakeVerbs { * reads */ class OpenableTopologyVerbs : public TopologyVerbs { public: - OpenableTopologyVerbs(hipObjTest::FakeDevice &device, struct ibv_context &context) noexcept + OpenableTopologyVerbs(hipObjTest::FakeDevice &device, ibv_context &context) noexcept : TopologyVerbs(device), context_(&context) { } @@ -369,13 +369,13 @@ class OpenableTopologyVerbs : public TopologyVerbs { OpenableTopologyVerbs(OpenableTopologyVerbs &&) = delete; OpenableTopologyVerbs &operator=(OpenableTopologyVerbs &&) = delete; - struct ibv_context *open_device(struct ibv_device *device) const override + ibv_context *open_device(ibv_device *device) const override { return TopologyVerbs::open_device(device) != nullptr ? context_ : nullptr; } private: - struct ibv_context *context_; + ibv_context *context_; }; /* The fake verbs, and a context for the device they have, whose name @@ -393,8 +393,8 @@ class GidSeamTest : public ::testing::Test { return hipObj::SelectBestGid(verbs_, topology_, &context_, portNum); } - struct ibv_device device_ {}; - struct ibv_context context_ {}; + ibv_device device_{}; + ibv_context context_{}; TopologyState state_{}; FakeNicTopology topology_{state_}; hipObjTest::FakeDevice fakeDevice_{}; @@ -447,8 +447,7 @@ TEST_F(GidSeamTest, OpenedDeviceHasTheGidTheTopologyPrefers) EXPECT_EQ(state_.lastPortNum, 1); EXPECT_EQ(rdma->gidIndex(), 1); - union ibv_gid expected { - }; + ibv_gid expected{}; ASSERT_EQ(verbs_.query_gid(&context_, 1, 1, &expected), 0); EXPECT_EQ(hipObj::toGid(rdma->localGid()), hipObj::toGid(expected)); } @@ -607,9 +606,8 @@ class FakeVerbsSeamTest : public ::testing::Test { [[nodiscard]] hipObj::RdmaDevice makeDevice() const { return {verbs_, - hipObj::own(verbs_, - hipObj::addressToPointer(0x1234)), - hipObj::own(verbs_, hipObj::addressToPointer(0x5678)), + hipObj::own(verbs_, hipObj::addressToPointer(0x1234)), + hipObj::own(verbs_, hipObj::addressToPointer(0x5678)), 1, 0, {}, diff --git a/test/unit/test-span.cpp b/test/unit/test-span.cpp index 7673a632..a45a868d 100644 --- a/test/unit/test-span.cpp +++ b/test/unit/test-span.cpp @@ -126,7 +126,7 @@ TEST(Span, DeviceSpanViewsTheList) { /* Two devices and the NULL that ends the list, as from * ibv_get_device_list(). The devices' values don't matter here. */ - std::array devices{}; + std::array devices{}; /* The list is borrowed, so it's released rather than freed with * verbs */ diff --git a/test/unit/test-transport.cpp b/test/unit/test-transport.cpp index ccc8a256..890c432f 100644 --- a/test/unit/test-transport.cpp +++ b/test/unit/test-transport.cpp @@ -137,7 +137,7 @@ class TransportTest : public hipObjTest::FakeDeviceTest { EXPECT_EQ(log.createQp, log.destroyQp); } - static void expectPeerGid(const struct ibv_qp_attr &attr) + static void expectPeerGid(const ibv_qp_attr &attr) { const hipObj::RdmaToken token = peerToken(); EXPECT_EQ(hipObj::toGid(attr.ah_attr.grh.dgid), token.gid); @@ -266,7 +266,7 @@ TEST_F(TransportTest, CreateReleasesQpAndCqWhenInitTransitionFails) TEST_F(TransportTest, MovingKeepsTheQpAndDevice) { ASSERT_NO_FATAL_FAILURE(open()); - struct ibv_qp *const qp = conn_->qp(); + ibv_qp *const qp = conn_->qp(); std::optional moved; moved.emplace(std::move(*conn_)); conn_.reset(); @@ -320,7 +320,7 @@ TEST_F(TransportTest, ConnectMovesQpToRtrThenRts) std::vector calls = modifyQpCalls(); ASSERT_EQ(calls.size(), 2U); - const struct ibv_qp_attr &rtr = calls[0].attr; + const ibv_qp_attr &rtr = calls[0].attr; EXPECT_EQ(calls[0].mask, kRtrMask); EXPECT_EQ(rtr.qp_state, IBV_QPS_RTR); EXPECT_EQ(rtr.path_mtu, IBV_MTU_4096); @@ -335,7 +335,7 @@ TEST_F(TransportTest, ConnectMovesQpToRtrThenRts) EXPECT_EQ(rtr.ah_attr.grh.hop_limit, 64); expectPeerGid(rtr); - const struct ibv_qp_attr &rts = calls[1].attr; + const ibv_qp_attr &rts = calls[1].attr; EXPECT_EQ(calls[1].mask, kRtsMask); EXPECT_EQ(rts.qp_state, IBV_QPS_RTS); EXPECT_EQ(rts.timeout, 14); @@ -486,7 +486,7 @@ TEST_P(VendorQpTest, RtrHasVendorAttributes) ASSERT_NO_FATAL_FAILURE(open()); ASSERT_TRUE(hipObj::connectRcPeer(*conn_, peerToken())); - const struct ibv_qp_attr rtr = modifyQpCalls().at(0).attr; + const ibv_qp_attr rtr = modifyQpCalls().at(0).attr; if (GetParam().configured) { EXPECT_EQ(rtr.path_mtu, IBV_MTU_4096); EXPECT_EQ(rtr.timeout, 14);