diff options
author | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
commit | b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch) | |
tree | 2a23209faf0fea5586a6d4b9cee60d1b318d29fe /contrib/libs/ibdrv | |
parent | 559174a9144de40d6bb3997ea4073c82289b4974 (diff) | |
download | ydb-b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806.tar.gz |
remove kikimr/driver DEPENDS
Diffstat (limited to 'contrib/libs/ibdrv')
-rw-r--r-- | contrib/libs/ibdrv/impl.cpp | 630 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/ib_user_ioctl_verbs.h | 267 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/mlx5_api.h | 71 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/mlx5_user_ioctl_verbs.h | 102 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/mlx5dv.h | 1700 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/sa.h | 136 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/tm_types.h | 66 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/infiniband/verbs_api.h | 99 | ||||
-rw-r--r-- | contrib/libs/ibdrv/include/rdma/rdma_verbs.h | 317 | ||||
-rw-r--r-- | contrib/libs/ibdrv/symbols.cpp | 51 | ||||
-rw-r--r-- | contrib/libs/ibdrv/symbols.h | 187 |
11 files changed, 0 insertions, 3626 deletions
diff --git a/contrib/libs/ibdrv/impl.cpp b/contrib/libs/ibdrv/impl.cpp deleted file mode 100644 index 82660fae82..0000000000 --- a/contrib/libs/ibdrv/impl.cpp +++ /dev/null @@ -1,630 +0,0 @@ -#include "symbols.h" - -#include <util/generic/yexception.h> - -template <typename Method, typename... Args> -static auto Call(Method* m, Args&&... args) { - Y_ENSURE(m); - return m(std::forward<Args>(args)...); -} - -// verbs - -Y_HIDDEN -int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) { - return Call(IBSym()->ibv_modify_qp, qp, attr, attr_mask); -} - -Y_HIDDEN -struct ibv_ah *ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) { - return Call(IBSym()->ibv_create_ah, pd, attr); -} - -Y_HIDDEN -struct ibv_cq *ibv_create_cq(struct ibv_context *context, int cqe, void *cq_context, struct ibv_comp_channel *channel, int comp_vector) { - return Call(IBSym()->ibv_create_cq, context, cqe, cq_context, channel, comp_vector); -} - -Y_HIDDEN -int ibv_destroy_ah(struct ibv_ah *ah) { - return Call(IBSym()->ibv_destroy_ah, ah); -} - -Y_HIDDEN -struct ibv_qp *ibv_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) { - return Call(IBSym()->ibv_create_qp, pd, qp_init_attr); -} - -Y_HIDDEN -int ibv_fork_init() { - return Call(IBSym()->ibv_fork_init); -} - -Y_HIDDEN -struct ibv_context *ibv_open_device(struct ibv_device *device) { - return Call(IBSym()->ibv_open_device, device); -} - -Y_HIDDEN -int ibv_close_device(struct ibv_context *context) { - return Call(IBSym()->ibv_close_device, context); -} - -Y_HIDDEN -struct ibv_pd *ibv_alloc_pd(struct ibv_context *context) { - return Call(IBSym()->ibv_alloc_pd, context); -} - -Y_HIDDEN -int ibv_dealloc_pd(struct ibv_pd *pd) { - return Call(IBSym()->ibv_dealloc_pd, pd); -} - -Y_HIDDEN -void ibv_free_device_list(struct ibv_device **list) { - return Call(IBSym()->ibv_free_device_list, list); -} - -Y_HIDDEN -int ibv_query_device(struct ibv_context *context, struct ibv_device_attr *device_attr) { - return Call(IBSym()->ibv_query_device, context, device_attr); -} - -Y_HIDDEN -struct ibv_device **ibv_get_device_list(int *num_devices) { - return Call(IBSym()->ibv_get_device_list, num_devices); -} - -Y_HIDDEN -int ibv_destroy_qp(struct ibv_qp *qp) { - return Call(IBSym()->ibv_destroy_qp, qp); -} - -Y_HIDDEN -struct ibv_srq *ibv_create_srq(struct ibv_pd *pd, struct ibv_srq_init_attr *srq_init_attr) { - return Call(IBSym()->ibv_create_srq, pd, srq_init_attr); -} - -Y_HIDDEN -int ibv_destroy_srq(struct ibv_srq *srq) { - return Call(IBSym()->ibv_destroy_srq, srq); -} - -Y_HIDDEN -int ibv_init_ah_from_wc(struct ibv_context *context, uint8_t port_num, struct ibv_wc *wc, struct ibv_grh *grh, struct ibv_ah_attr *ah_attr) { - return Call(IBSym()->ibv_init_ah_from_wc, context, port_num, wc, grh, ah_attr); -} - -Y_HIDDEN -struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) { - return Call(IBSym()->ibv_reg_mr, pd, addr, length, access); -} - -Y_HIDDEN -struct ibv_mr *ibv_reg_mr_iova2(struct ibv_pd *pd, void *addr, size_t length, uint64_t iova, unsigned int access) { - return Call(IBSym()->ibv_reg_mr_iova2, pd, addr, length, iova, access); -} - -Y_HIDDEN -int ibv_dereg_mr(struct ibv_mr *mr) { - return Call(IBSym()->ibv_dereg_mr, mr); -} - -Y_HIDDEN -int ibv_destroy_cq(struct ibv_cq *cq) { - return Call(IBSym()->ibv_destroy_cq, cq); -} - -Y_HIDDEN -int ibv_query_gid(struct ibv_context *context, uint8_t port_num, int index, union ibv_gid *gid) { - return Call(IBSym()->ibv_query_gid, context, port_num, index, gid); -} - -Y_HIDDEN -int ibv_query_port(struct ibv_context *context, uint8_t port_num, struct _compat_ibv_port_attr *port_attr) { - return Call(IBSym()->ibv_query_port, context, port_num, port_attr); -} - -Y_HIDDEN -const char *ibv_wc_status_str(enum ibv_wc_status status) { - return Call(IBSym()->ibv_wc_status_str, status); -} - -Y_HIDDEN -const char *ibv_get_device_name(struct ibv_device *device) { - return Call(IBSym()->ibv_get_device_name, device); -} - -Y_HIDDEN -int ibv_get_async_event(struct ibv_context *context, struct ibv_async_event *event) { - return Call(IBSym()->ibv_get_async_event, context, event); -} - -Y_HIDDEN -const char *ibv_event_type_str(enum ibv_event_type event) { - return Call(IBSym()->ibv_event_type_str, event); -} - -Y_HIDDEN -int ibv_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask, struct ibv_qp_init_attr *init_attr) { - return Call(IBSym()->ibv_query_qp, qp, attr, attr_mask, init_attr); -} - -Y_HIDDEN -int ibv_resize_cq(struct ibv_cq *cq, int cqe) { - return Call(IBSym()->ibv_resize_cq, cq, cqe); -} - -Y_HIDDEN -void ibv_ack_async_event(struct ibv_async_event *event) { - return Call(IBSym()->ibv_ack_async_event, event); -} - -Y_HIDDEN -struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context) { - return Call(IBSym()->ibv_create_comp_channel, context); -} - -Y_HIDDEN -int ibv_destroy_comp_channel(struct ibv_comp_channel *channel) { - return Call(IBSym()->ibv_destroy_comp_channel, channel); -} - -Y_HIDDEN -int ibv_get_cq_event(struct ibv_comp_channel *channel, struct ibv_cq **cq, void **cq_context) { - return Call(IBSym()->ibv_get_cq_event, channel, cq, cq_context); -} - -Y_HIDDEN -void ibv_ack_cq_events(struct ibv_cq *cq, unsigned int nevents) { - return Call(IBSym()->ibv_ack_cq_events, cq, nevents); -} - -Y_HIDDEN -const char *ibv_port_state_str(enum ibv_port_state port_state) { - return Call(IBSym()->ibv_port_state_str, port_state); -} - -// rdma - -Y_HIDDEN -int rdma_ack_cm_event(struct rdma_cm_event *event) { - return Call(RDSym()->rdma_ack_cm_event, event); -} - -Y_HIDDEN -int rdma_get_cm_event(struct rdma_event_channel *channel, struct rdma_cm_event **event) { - return Call(RDSym()->rdma_get_cm_event, channel, event); -} - -Y_HIDDEN -int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) { - return Call(RDSym()->rdma_create_qp, id, pd, qp_init_attr); -} - -Y_HIDDEN -struct rdma_event_channel *rdma_create_event_channel() { - return Call(RDSym()->rdma_create_event_channel); -} - -Y_HIDDEN -int rdma_create_id(struct rdma_event_channel *channel, struct rdma_cm_id **id, void *context, enum rdma_port_space ps) { - return Call(RDSym()->rdma_create_id, channel, id, context, ps); -} - -Y_HIDDEN -int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, struct sockaddr *dst_addr, int timeout_ms) { - return Call(RDSym()->rdma_resolve_addr, id, src_addr, dst_addr, timeout_ms); -} - -Y_HIDDEN -int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms) { - return Call(RDSym()->rdma_resolve_route, id, timeout_ms); -} - -Y_HIDDEN -int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr) { - return Call(RDSym()->rdma_bind_addr, id, addr); -} - -Y_HIDDEN -int rdma_listen(struct rdma_cm_id *id, int backlog) { - return Call(RDSym()->rdma_listen, id, backlog); -} - -Y_HIDDEN -int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) { - return Call(RDSym()->rdma_accept, id, conn_param); -} - -Y_HIDDEN -int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) { - return Call(RDSym()->rdma_connect, id, conn_param); -} - -Y_HIDDEN -int rdma_disconnect(struct rdma_cm_id *id) { - return Call(RDSym()->rdma_disconnect, id); -} - -Y_HIDDEN -int rdma_set_option(struct rdma_cm_id *id, int level, int optname, void *optval, size_t optlen) { - return Call(RDSym()->rdma_set_option, id, level, optname, optval, optlen); -} - -Y_HIDDEN -int rdma_destroy_id(struct rdma_cm_id *id) { - return Call(RDSym()->rdma_destroy_id, id); -} - -Y_HIDDEN -void rdma_destroy_qp(struct rdma_cm_id *id) { - return Call(RDSym()->rdma_destroy_qp, id); -} - -Y_HIDDEN -struct ibv_context **rdma_get_devices(int *num_devices) { - return Call(RDSym()->rdma_get_devices, num_devices); -} - -Y_HIDDEN -void rdma_free_devices(struct ibv_context **list) { - return Call(RDSym()->rdma_free_devices, list); -} - -Y_HIDDEN -void rdma_destroy_event_channel(struct rdma_event_channel *channel) { - return Call(RDSym()->rdma_destroy_event_channel, channel); -} - -Y_HIDDEN -int rdma_reject(struct rdma_cm_id *id, const void *private_data, uint8_t private_data_len) { - return Call(RDSym()->rdma_reject, id, private_data, private_data_len); -} - -Y_HIDDEN -uint16_t rdma_get_dst_port(struct rdma_cm_id *id) { - return Call(RDSym()->rdma_get_dst_port, id); -} - -Y_HIDDEN -uint16_t rdma_get_src_port(struct rdma_cm_id *id) { - return Call(RDSym()->rdma_get_src_port, id); -} - -Y_HIDDEN -int rdma_getaddrinfo(const char *node, const char *service, const struct rdma_addrinfo *hints, struct rdma_addrinfo **res) { - return Call(RDSym()->rdma_getaddrinfo, node, service, hints, res); -} - -Y_HIDDEN -void rdma_freeaddrinfo(struct rdma_addrinfo *res) { - return Call(RDSym()->rdma_freeaddrinfo, res); -} - -// mlx5 - -Y_HIDDEN -struct mlx5dv_var *mlx5dv_alloc_var(struct ibv_context *context, uint32_t flags) { - return Call(M5Sym()->mlx5dv_alloc_var, context, flags); -} - -Y_HIDDEN -struct ibv_cq_ex *mlx5dv_create_cq(struct ibv_context *context, struct ibv_cq_init_attr_ex *cq_attr, struct mlx5dv_cq_init_attr *mlx5_cq_attr) { - return Call(M5Sym()->mlx5dv_create_cq, context, cq_attr, mlx5_cq_attr); -} - -Y_HIDDEN -struct ibv_flow *mlx5dv_create_flow(struct mlx5dv_flow_matcher *matcher, struct mlx5dv_flow_match_parameters *match_value, size_t num_actions, struct mlx5dv_flow_action_attr actions_attr[]) { - return Call(M5Sym()->mlx5dv_create_flow, matcher, match_value, num_actions, actions_attr); -} - -Y_HIDDEN -struct mlx5dv_flow_matcher *mlx5dv_create_flow_matcher(struct ibv_context *context, struct mlx5dv_flow_matcher_attr *matcher_attr) { - return Call(M5Sym()->mlx5dv_create_flow_matcher, context, matcher_attr); -} - -Y_HIDDEN -struct ibv_qp *mlx5dv_create_qp(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_attr, struct mlx5dv_qp_init_attr *mlx5_qp_attr) { - return Call(M5Sym()->mlx5dv_create_qp, context, qp_attr, mlx5_qp_attr); -} - -Y_HIDDEN -struct ibv_wq *mlx5dv_create_wq(struct ibv_context *context, struct ibv_wq_init_attr *wq_init_attr, struct mlx5dv_wq_init_attr *mlx5_wq_attr) { - return Call(M5Sym()->mlx5dv_create_wq, context, wq_init_attr, mlx5_wq_attr); -} - -Y_HIDDEN -int mlx5dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *matcher) { - return Call(M5Sym()->mlx5dv_destroy_flow_matcher, matcher); -} - -Y_HIDDEN -struct mlx5dv_devx_uar *mlx5dv_devx_alloc_uar(struct ibv_context *context, uint32_t flags) { - return Call(M5Sym()->mlx5dv_devx_alloc_uar, context, flags); -} - -Y_HIDDEN -struct mlx5dv_devx_cmd_comp *mlx5dv_devx_create_cmd_comp(struct ibv_context *context) { - return Call(M5Sym()->mlx5dv_devx_create_cmd_comp, context); -} - -Y_HIDDEN -struct mlx5dv_devx_event_channel *mlx5dv_devx_create_event_channel(struct ibv_context *context, enum mlx5dv_devx_create_event_channel_flags flags) { - return Call(M5Sym()->mlx5dv_devx_create_event_channel, context, flags); -} - -Y_HIDDEN -void mlx5dv_devx_destroy_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp) { - return Call(M5Sym()->mlx5dv_devx_destroy_cmd_comp, cmd_comp); -} - -Y_HIDDEN -void mlx5dv_devx_destroy_event_channel(struct mlx5dv_devx_event_channel *event_channel) { - return Call(M5Sym()->mlx5dv_devx_destroy_event_channel, event_channel); -} - -Y_HIDDEN -void mlx5dv_devx_free_uar(struct mlx5dv_devx_uar *devx_uar) { - return Call(M5Sym()->mlx5dv_devx_free_uar, devx_uar); -} - -Y_HIDDEN -int mlx5dv_devx_general_cmd(struct ibv_context *context, const void *in, size_t inlen, void *out, size_t outlen) { - return Call(M5Sym()->mlx5dv_devx_general_cmd, context, in, inlen, out, outlen); -} - -Y_HIDDEN -int mlx5dv_devx_get_async_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp, struct mlx5dv_devx_async_cmd_hdr *cmd_resp, size_t cmd_resp_len) { - return Call(M5Sym()->mlx5dv_devx_get_async_cmd_comp, cmd_comp, cmd_resp, cmd_resp_len); -} - -Y_HIDDEN -ssize_t mlx5dv_devx_get_event(struct mlx5dv_devx_event_channel *event_channel, struct mlx5dv_devx_async_event_hdr *event_data, size_t event_resp_len) { - return Call(M5Sym()->mlx5dv_devx_get_event, event_channel, event_data, event_resp_len); -} - -Y_HIDDEN -struct mlx5dv_devx_obj *mlx5dv_devx_obj_create(struct ibv_context *context, const void *in, size_t inlen, void *out, size_t outlen) { - return Call(M5Sym()->mlx5dv_devx_obj_create, context, in, inlen, out, outlen); -} - -Y_HIDDEN -int mlx5dv_devx_obj_destroy(struct mlx5dv_devx_obj *obj) { - return Call(M5Sym()->mlx5dv_devx_obj_destroy, obj); -} - -Y_HIDDEN -int mlx5dv_devx_obj_modify(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, void *out, size_t outlen) { - return Call(M5Sym()->mlx5dv_devx_obj_modify, obj, in, inlen, out, outlen); -} - -Y_HIDDEN -int mlx5dv_devx_obj_query(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, void *out, size_t outlen) { - return Call(M5Sym()->mlx5dv_devx_obj_query, obj, in, inlen, out, outlen); -} - -Y_HIDDEN -int mlx5dv_devx_obj_query_async(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, size_t outlen, uint64_t wr_id, struct mlx5dv_devx_cmd_comp *cmd_comp) { - return Call(M5Sym()->mlx5dv_devx_obj_query_async, obj, in, inlen, outlen, wr_id, cmd_comp); -} - -Y_HIDDEN -int mlx5dv_devx_qp_query(struct ibv_qp *qp, const void *in, size_t inlen, void *out, size_t outlen) { - return Call(M5Sym()->mlx5dv_devx_qp_query, qp, in, inlen, out, outlen); -} - -Y_HIDDEN -int mlx5dv_devx_query_eqn(struct ibv_context *context, uint32_t vector, uint32_t *eqn) { - return Call(M5Sym()->mlx5dv_devx_query_eqn, context, vector, eqn); -} - -Y_HIDDEN -int mlx5dv_devx_subscribe_devx_event(struct mlx5dv_devx_event_channel *event_channel, struct mlx5dv_devx_obj *obj, uint16_t events_sz, uint16_t events_num[], uint64_t cookie) { - return Call(M5Sym()->mlx5dv_devx_subscribe_devx_event, event_channel, obj, events_sz, events_num, cookie); -} - -Y_HIDDEN -int mlx5dv_devx_subscribe_devx_event_fd(struct mlx5dv_devx_event_channel *event_channel, int fd, struct mlx5dv_devx_obj *obj, uint16_t event_num) { - return Call(M5Sym()->mlx5dv_devx_subscribe_devx_event_fd, event_channel, fd, obj, event_num); -} - -Y_HIDDEN -int mlx5dv_devx_umem_dereg(struct mlx5dv_devx_umem *umem) { - return Call(M5Sym()->mlx5dv_devx_umem_dereg, umem); -} - -Y_HIDDEN -struct mlx5dv_devx_umem *mlx5dv_devx_umem_reg(struct ibv_context *ctx, void *addr, size_t size, uint32_t access) { - return Call(M5Sym()->mlx5dv_devx_umem_reg, ctx, addr, size, access); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_aso(struct mlx5dv_dr_domain *domain, struct mlx5dv_devx_obj *devx_obj, uint32_t offset, uint32_t flags, uint8_t return_reg_c) { - return Call(M5Sym()->mlx5dv_dr_action_create_aso, domain, devx_obj, offset, flags, return_reg_c); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_default_miss(void) { - return Call(M5Sym()->mlx5dv_dr_action_create_default_miss); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_array(struct mlx5dv_dr_domain *domain, size_t num_dest, struct mlx5dv_dr_action_dest_attr *dests[]) { - return Call(M5Sym()->mlx5dv_dr_action_create_dest_array, domain, num_dest, dests); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_devx_tir(struct mlx5dv_devx_obj *devx_obj) { - return Call(M5Sym()->mlx5dv_dr_action_create_dest_devx_tir, devx_obj); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_ib_port(struct mlx5dv_dr_domain *domain, uint32_t ib_port) { - return Call(M5Sym()->mlx5dv_dr_action_create_dest_ib_port, domain, ib_port); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_ibv_qp(struct ibv_qp *ibqp) { - return Call(M5Sym()->mlx5dv_dr_action_create_dest_ibv_qp, ibqp); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_table(struct mlx5dv_dr_table *table) { - return Call(M5Sym()->mlx5dv_dr_action_create_dest_table, table); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_vport(struct mlx5dv_dr_domain *domain, uint32_t vport) { - return Call(M5Sym()->mlx5dv_dr_action_create_dest_vport, domain, vport); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_drop(void) { - return Call(M5Sym()->mlx5dv_dr_action_create_drop); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_flow_counter(struct mlx5dv_devx_obj *devx_obj, uint32_t offset) { - return Call(M5Sym()->mlx5dv_dr_action_create_flow_counter, devx_obj, offset); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_flow_meter(struct mlx5dv_dr_flow_meter_attr *attr) { - return Call(M5Sym()->mlx5dv_dr_action_create_flow_meter, attr); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_flow_sampler(struct mlx5dv_dr_flow_sampler_attr *attr) { - return Call(M5Sym()->mlx5dv_dr_action_create_flow_sampler, attr); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_modify_header(struct mlx5dv_dr_domain *domain, uint32_t flags, size_t actions_sz, __be64 actions[]) { - return Call(M5Sym()->mlx5dv_dr_action_create_modify_header, domain, flags, actions_sz, actions); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_packet_reformat(struct mlx5dv_dr_domain *domain, uint32_t flags, enum mlx5dv_flow_action_packet_reformat_type reformat_type, size_t data_sz, void *data) { - return Call(M5Sym()->mlx5dv_dr_action_create_packet_reformat, domain, flags, reformat_type, data_sz, data); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_pop_vlan(void) { - return Call(M5Sym()->mlx5dv_dr_action_create_pop_vlan); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_push_vlan(struct mlx5dv_dr_domain *domain, __be32 vlan_hdr) { - return Call(M5Sym()->mlx5dv_dr_action_create_push_vlan, domain, vlan_hdr); -} - -Y_HIDDEN -struct mlx5dv_dr_action *mlx5dv_dr_action_create_tag(uint32_t tag_value) { - return Call(M5Sym()->mlx5dv_dr_action_create_tag, tag_value); -} - -Y_HIDDEN -int mlx5dv_dr_action_destroy(struct mlx5dv_dr_action *action) { - return Call(M5Sym()->mlx5dv_dr_action_destroy, action); -} - -Y_HIDDEN -int mlx5dv_dr_action_modify_flow_meter(struct mlx5dv_dr_action *action, struct mlx5dv_dr_flow_meter_attr *attr, __be64 modify_field_select) { - return Call(M5Sym()->mlx5dv_dr_action_modify_flow_meter, action, attr, modify_field_select); -} - -Y_HIDDEN -struct mlx5dv_dr_domain *mlx5dv_dr_domain_create(struct ibv_context *ctx, enum mlx5dv_dr_domain_type type) { - return Call(M5Sym()->mlx5dv_dr_domain_create, ctx, type); -} - -Y_HIDDEN -int mlx5dv_dr_domain_destroy(struct mlx5dv_dr_domain *domain) { - return Call(M5Sym()->mlx5dv_dr_domain_destroy, domain); -} - -Y_HIDDEN -void mlx5dv_dr_domain_set_reclaim_device_memory(struct mlx5dv_dr_domain *dmn, bool enable) { - return Call(M5Sym()->mlx5dv_dr_domain_set_reclaim_device_memory, dmn, enable); -} - -Y_HIDDEN -int mlx5dv_dr_domain_sync(struct mlx5dv_dr_domain *domain, uint32_t flags) { - return Call(M5Sym()->mlx5dv_dr_domain_sync, domain, flags); -} - -Y_HIDDEN -struct mlx5dv_dr_matcher *mlx5dv_dr_matcher_create(struct mlx5dv_dr_table *table, uint16_t priority, uint8_t match_criteria_enable, struct mlx5dv_flow_match_parameters *mask) { - return Call(M5Sym()->mlx5dv_dr_matcher_create, table, priority, match_criteria_enable, mask); -} - -Y_HIDDEN -int mlx5dv_dr_matcher_destroy(struct mlx5dv_dr_matcher *matcher) { - return Call(M5Sym()->mlx5dv_dr_matcher_destroy, matcher); -} - -Y_HIDDEN -struct mlx5dv_dr_rule *mlx5dv_dr_rule_create(struct mlx5dv_dr_matcher *matcher, struct mlx5dv_flow_match_parameters *value, size_t num_actions, struct mlx5dv_dr_action *actions[]) { - return Call(M5Sym()->mlx5dv_dr_rule_create, matcher, value, num_actions, actions); -} - -Y_HIDDEN -int mlx5dv_dr_rule_destroy(struct mlx5dv_dr_rule *rule) { - return Call(M5Sym()->mlx5dv_dr_rule_destroy, rule); -} - -Y_HIDDEN -struct mlx5dv_dr_table *mlx5dv_dr_table_create(struct mlx5dv_dr_domain *domain, uint32_t level) { - return Call(M5Sym()->mlx5dv_dr_table_create, domain, level); -} - -Y_HIDDEN -int mlx5dv_dr_table_destroy(struct mlx5dv_dr_table *table) { - return Call(M5Sym()->mlx5dv_dr_table_destroy, table); -} - -Y_HIDDEN -int mlx5dv_dump_dr_domain(FILE *fout, struct mlx5dv_dr_domain *domain) { - return Call(M5Sym()->mlx5dv_dump_dr_domain, fout, domain); -} - -Y_HIDDEN -void mlx5dv_free_var(struct mlx5dv_var *dv_var) { - return Call(M5Sym()->mlx5dv_free_var, dv_var); -} - -Y_HIDDEN -int mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type) { - return Call(M5Sym()->mlx5dv_init_obj, obj, obj_type); -} - -Y_HIDDEN -struct ibv_context *mlx5dv_open_device(struct ibv_device *device, struct mlx5dv_context_attr *attr) { - return Call(M5Sym()->mlx5dv_open_device, device, attr); -} - -Y_HIDDEN -struct mlx5dv_pp *mlx5dv_pp_alloc(struct ibv_context *context, size_t pp_context_sz, const void *pp_context, uint32_t flags) { - return Call(M5Sym()->mlx5dv_pp_alloc, context, pp_context_sz, pp_context, flags); -} - -Y_HIDDEN -void mlx5dv_pp_free(struct mlx5dv_pp *pp) { - return Call(M5Sym()->mlx5dv_pp_free, pp); -} - -Y_HIDDEN -int mlx5dv_query_device(struct ibv_context *ctx_in, struct mlx5dv_context *attrs_out) { - return Call(M5Sym()->mlx5dv_query_device, ctx_in, attrs_out); -} - -Y_HIDDEN -int mlx5dv_query_devx_port(struct ibv_context *ctx, uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port) { - return Call(M5Sym()->mlx5dv_query_devx_port, ctx, port_num, mlx5_devx_port); -} - -Y_HIDDEN -int mlx5dv_set_context_attr(struct ibv_context *context, enum mlx5dv_set_ctx_attr_type type, void *attr) { - return Call(M5Sym()->mlx5dv_set_context_attr, context, type, attr); -} diff --git a/contrib/libs/ibdrv/include/infiniband/ib_user_ioctl_verbs.h b/contrib/libs/ibdrv/include/infiniband/ib_user_ioctl_verbs.h deleted file mode 100644 index cfea82acfe..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/ib_user_ioctl_verbs.h +++ /dev/null @@ -1,267 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ -/* - * Copyright (c) 2017-2018, Mellanox Technologies inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef IB_USER_IOCTL_VERBS_H -#define IB_USER_IOCTL_VERBS_H - -#include <linux/types.h> -#include <rdma/ib_user_verbs.h> - -#ifndef RDMA_UAPI_PTR -#define RDMA_UAPI_PTR(_type, _name) __aligned_u64 _name -#endif - -#define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20) -#define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29) - -enum ib_uverbs_core_support { - IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0, -}; - -enum ib_uverbs_access_flags { - IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0, - IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1, - IB_UVERBS_ACCESS_REMOTE_READ = 1 << 2, - IB_UVERBS_ACCESS_REMOTE_ATOMIC = 1 << 3, - IB_UVERBS_ACCESS_MW_BIND = 1 << 4, - IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5, - IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6, - IB_UVERBS_ACCESS_HUGETLB = 1 << 7, - - IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST, - IB_UVERBS_ACCESS_OPTIONAL_RANGE = - ((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) & - ~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1) -}; - -enum ib_uverbs_srq_type { - IB_UVERBS_SRQT_BASIC, - IB_UVERBS_SRQT_XRC, - IB_UVERBS_SRQT_TM, -}; - -enum ib_uverbs_wq_type { - IB_UVERBS_WQT_RQ, -}; - -enum ib_uverbs_wq_flags { - IB_UVERBS_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0, - IB_UVERBS_WQ_FLAGS_SCATTER_FCS = 1 << 1, - IB_UVERBS_WQ_FLAGS_DELAY_DROP = 1 << 2, - IB_UVERBS_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3, -}; - -enum ib_uverbs_qp_type { - IB_UVERBS_QPT_RC = 2, - IB_UVERBS_QPT_UC, - IB_UVERBS_QPT_UD, - IB_UVERBS_QPT_RAW_PACKET = 8, - IB_UVERBS_QPT_XRC_INI, - IB_UVERBS_QPT_XRC_TGT, - IB_UVERBS_QPT_DRIVER = 0xFF, -}; - -enum ib_uverbs_qp_create_flags { - IB_UVERBS_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, - IB_UVERBS_QP_CREATE_SCATTER_FCS = 1 << 8, - IB_UVERBS_QP_CREATE_CVLAN_STRIPPING = 1 << 9, - IB_UVERBS_QP_CREATE_PCI_WRITE_END_PADDING = 1 << 11, - IB_UVERBS_QP_CREATE_SQ_SIG_ALL = 1 << 12, -}; - -enum ib_uverbs_query_port_cap_flags { - IB_UVERBS_PCF_SM = 1 << 1, - IB_UVERBS_PCF_NOTICE_SUP = 1 << 2, - IB_UVERBS_PCF_TRAP_SUP = 1 << 3, - IB_UVERBS_PCF_OPT_IPD_SUP = 1 << 4, - IB_UVERBS_PCF_AUTO_MIGR_SUP = 1 << 5, - IB_UVERBS_PCF_SL_MAP_SUP = 1 << 6, - IB_UVERBS_PCF_MKEY_NVRAM = 1 << 7, - IB_UVERBS_PCF_PKEY_NVRAM = 1 << 8, - IB_UVERBS_PCF_LED_INFO_SUP = 1 << 9, - IB_UVERBS_PCF_SM_DISABLED = 1 << 10, - IB_UVERBS_PCF_SYS_IMAGE_GUID_SUP = 1 << 11, - IB_UVERBS_PCF_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12, - IB_UVERBS_PCF_EXTENDED_SPEEDS_SUP = 1 << 14, - IB_UVERBS_PCF_CM_SUP = 1 << 16, - IB_UVERBS_PCF_SNMP_TUNNEL_SUP = 1 << 17, - IB_UVERBS_PCF_REINIT_SUP = 1 << 18, - IB_UVERBS_PCF_DEVICE_MGMT_SUP = 1 << 19, - IB_UVERBS_PCF_VENDOR_CLASS_SUP = 1 << 20, - IB_UVERBS_PCF_DR_NOTICE_SUP = 1 << 21, - IB_UVERBS_PCF_CAP_MASK_NOTICE_SUP = 1 << 22, - IB_UVERBS_PCF_BOOT_MGMT_SUP = 1 << 23, - IB_UVERBS_PCF_LINK_LATENCY_SUP = 1 << 24, - IB_UVERBS_PCF_CLIENT_REG_SUP = 1 << 25, - /* - * IsOtherLocalChangesNoticeSupported is aliased by IP_BASED_GIDS and - * is inaccessible - */ - IB_UVERBS_PCF_LINK_SPEED_WIDTH_TABLE_SUP = 1 << 27, - IB_UVERBS_PCF_VENDOR_SPECIFIC_MADS_TABLE_SUP = 1 << 28, - IB_UVERBS_PCF_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29, - IB_UVERBS_PCF_MCAST_FDB_TOP_SUP = 1 << 30, - IB_UVERBS_PCF_HIERARCHY_INFO_SUP = 1ULL << 31, - - /* NOTE this is an internal flag, not an IBA flag */ - IB_UVERBS_PCF_IP_BASED_GIDS = 1 << 26, -}; - -enum ib_uverbs_query_port_flags { - IB_UVERBS_QPF_GRH_REQUIRED = 1 << 0, -}; - -enum ib_uverbs_flow_action_esp_keymat { - IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM, -}; - -enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo { - IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ, -}; - -struct ib_uverbs_flow_action_esp_keymat_aes_gcm { - __aligned_u64 iv; - __u32 iv_algo; /* Use enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo */ - - __u32 salt; - __u32 icv_len; - - __u32 key_len; - __u32 aes_key[256 / 32]; -}; - -enum ib_uverbs_flow_action_esp_replay { - IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE, - IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP, -}; - -struct ib_uverbs_flow_action_esp_replay_bmp { - __u32 size; -}; - -enum ib_uverbs_flow_action_esp_flags { - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO = 0UL << 0, /* Default */ - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD = 1UL << 0, - - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL = 0UL << 1, /* Default */ - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT = 1UL << 1, - - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT = 0UL << 2, /* Default */ - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT = 1UL << 2, - - IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW = 1UL << 3, -}; - -struct ib_uverbs_flow_action_esp_encap { - /* This struct represents a list of pointers to flow_xxxx_filter that - * encapsulates the payload in ESP tunnel mode. - */ - RDMA_UAPI_PTR(void *, val_ptr); /* pointer to a flow_xxxx_filter */ - RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr); - __u16 len; /* Len of the filter struct val_ptr points to */ - __u16 type; /* Use flow_spec_type enum */ -}; - -struct ib_uverbs_flow_action_esp { - __u32 spi; - __u32 seq; - __u32 tfc_pad; - __u32 flags; - __aligned_u64 hard_limit_pkts; -}; - -enum ib_uverbs_read_counters_flags { - /* prefer read values from driver cache */ - IB_UVERBS_READ_COUNTERS_PREFER_CACHED = 1 << 0, -}; - -enum ib_uverbs_advise_mr_advice { - IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH, - IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE, -}; - -enum ib_uverbs_advise_mr_flag { - IB_UVERBS_ADVISE_MR_FLAG_FLUSH = 1 << 0, -}; - -struct ib_uverbs_query_port_resp_ex { - struct ib_uverbs_query_port_resp legacy_resp; - __u16 port_cap_flags2; - __u8 reserved[6]; -}; - -struct ib_uverbs_qp_cap { - __u32 max_send_wr; - __u32 max_recv_wr; - __u32 max_send_sge; - __u32 max_recv_sge; - __u32 max_inline_data; -}; - -enum rdma_driver_id { - RDMA_DRIVER_UNKNOWN, - RDMA_DRIVER_MLX5, - RDMA_DRIVER_MLX4, - RDMA_DRIVER_CXGB3, - RDMA_DRIVER_CXGB4, - RDMA_DRIVER_MTHCA, - RDMA_DRIVER_BNXT_RE, - RDMA_DRIVER_OCRDMA, - RDMA_DRIVER_NES, - RDMA_DRIVER_I40IW, - RDMA_DRIVER_VMW_PVRDMA, - RDMA_DRIVER_QEDR, - RDMA_DRIVER_HNS, - RDMA_DRIVER_USNIC, - RDMA_DRIVER_RXE, - RDMA_DRIVER_HFI1, - RDMA_DRIVER_QIB, - RDMA_DRIVER_EFA, - RDMA_DRIVER_SIW, -}; - -enum ib_uverbs_gid_type { - IB_UVERBS_GID_TYPE_IB, - IB_UVERBS_GID_TYPE_ROCE_V1, - IB_UVERBS_GID_TYPE_ROCE_V2, -}; - -struct ib_uverbs_gid_entry { - __aligned_u64 gid[2]; - __u32 gid_index; - __u32 port_num; - __u32 gid_type; - __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */ -}; - -#endif diff --git a/contrib/libs/ibdrv/include/infiniband/mlx5_api.h b/contrib/libs/ibdrv/include/infiniband/mlx5_api.h deleted file mode 100644 index 7895591a7a..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/mlx5_api.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2017, Mellanox Technologies inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef MLX5_API_H -#define MLX5_API_H - -#include <infiniband/mlx5_user_ioctl_verbs.h> - -#define mlx5dv_flow_action_flags mlx5_ib_uapi_flow_action_flags -#define MLX5DV_FLOW_ACTION_FLAGS_REQUIRE_METADATA MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA -#define mlx5dv_flow_table_type mlx5_ib_uapi_flow_table_type -#define MLX5DV_FLOW_TABLE_TYPE_NIC_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX -#define MLX5DV_FLOW_TABLE_TYPE_NIC_TX MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX -#define MLX5DV_FLOW_TABLE_TYPE_FDB MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB -#define MLX5DV_FLOW_TABLE_TYPE_RDMA_RX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX -#define MLX5DV_FLOW_TABLE_TYPE_RDMA_TX MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX -#define mlx5dv_flow_action_packet_reformat_type mlx5_ib_uapi_flow_action_packet_reformat_type -#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 -#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL -#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 -#define MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL -#define mlx5dv_devx_async_cmd_hdr mlx5_ib_uapi_devx_async_cmd_hdr -#define mlx5dv_devx_async_event_hdr mlx5_ib_uapi_devx_async_event_hdr -#define mlx5dv_alloc_dm_type mlx5_ib_uapi_dm_type -#define MLX5DV_DM_TYPE_MEMIC MLX5_IB_UAPI_DM_TYPE_MEMIC -#define MLX5DV_DM_TYPE_STEERING_SW_ICM MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM -#define MLX5DV_DM_TYPE_HEADER_MODIFY_SW_ICM MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM -#define MLX5DV_DM_TYPE_HEADER_MODIFY_PATTERN_SW_ICM MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_PATTERN_SW_ICM -#define mlx5dv_devx_create_event_channel_flags mlx5_ib_uapi_devx_create_event_channel_flags -#define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA -#define MLX5DV_DEVX_PORT_VPORT MLX5_IB_UAPI_QUERY_PORT_VPORT -#define MLX5DV_DEVX_PORT_VPORT_VHCA_ID MLX5_IB_UAPI_QUERY_PORT_VPORT_VHCA_ID -#define MLX5DV_DEVX_PORT_ESW_OWNER_VHCA_ID MLX5_IB_UAPI_QUERY_PORT_ESW_OWNER_VHCA_ID -#define MLX5DV_DEVX_PORT_VPORT_ICM_RX MLX5_IB_UAPI_QUERY_PORT_VPORT_ICM_RX -#define MLX5DV_DEVX_PORT_VPORT_ICM_TX MLX5_IB_UAPI_QUERY_PORT_VPORT_ICM_TX -#define MLX5DV_DEVX_PORT_MATCH_REG_C_0 MLX5_IB_UAPI_QUERY_PORT_MATCH_REG_C_0 -#define mlx5dv_devx_reg_32 mlx5_ib_uapi_devx_reg_32 -#define MLX5DV_PP_ALLOC_FLAGS_DEDICATED_INDEX MLX5_IB_UAPI_PP_ALLOC_FLAGS_DEDICATED_INDEX -#define MLX5DV_UAR_ALLOC_TYPE_BF MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF -#define MLX5DV_UAR_ALLOC_TYPE_NC MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC - -#endif diff --git a/contrib/libs/ibdrv/include/infiniband/mlx5_user_ioctl_verbs.h b/contrib/libs/ibdrv/include/infiniband/mlx5_user_ioctl_verbs.h deleted file mode 100644 index a1aa36abad..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/mlx5_user_ioctl_verbs.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef MLX5_USER_IOCTL_VERBS_H -#define MLX5_USER_IOCTL_VERBS_H - -#include <linux/types.h> - -enum mlx5_ib_uapi_flow_action_flags { - MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA = 1 << 0, -}; - -enum mlx5_ib_uapi_flow_table_type { - MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX = 0x0, - MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX = 0x1, - MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB = 0x2, - MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX = 0x3, - MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX = 0x4, -}; - -enum mlx5_ib_uapi_flow_action_packet_reformat_type { - MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 = 0x0, - MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL = 0x1, - MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 = 0x2, - MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL = 0x3, -}; - -struct mlx5_ib_uapi_devx_async_cmd_hdr { - __aligned_u64 wr_id; - __u8 out_data[]; -}; - -enum mlx5_ib_uapi_devx_query_port_comp_mask { - MLX5_IB_UAPI_QUERY_PORT_VPORT = 1 << 0, - MLX5_IB_UAPI_QUERY_PORT_VPORT_VHCA_ID = 1 << 1, - MLX5_IB_UAPI_QUERY_PORT_ESW_OWNER_VHCA_ID = 1 << 2, - MLX5_IB_UAPI_QUERY_PORT_VPORT_ICM_RX = 1 << 3, - MLX5_IB_UAPI_QUERY_PORT_VPORT_ICM_TX = 1 << 4, - MLX5_IB_UAPI_QUERY_PORT_MATCH_REG_C_0 = 1 << 5, -}; - -struct mlx5_ib_uapi_devx_reg_32 { - __u32 value; - __u32 mask; -}; - -enum mlx5_ib_uapi_dm_type { - MLX5_IB_UAPI_DM_TYPE_MEMIC, - MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM, - MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM, - MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_PATTERN_SW_ICM, -}; - -enum mlx5_ib_uapi_devx_create_event_channel_flags { - MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0, -}; - -struct mlx5_ib_uapi_devx_async_event_hdr { - __aligned_u64 cookie; - __u8 out_data[]; -}; - -enum mlx5_ib_uapi_pp_alloc_flags { - MLX5_IB_UAPI_PP_ALLOC_FLAGS_DEDICATED_INDEX = 1 << 0, -}; - -enum mlx5_ib_uapi_uar_alloc_type { - MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF = 0x0, - MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC = 0x1, -}; - -#endif - diff --git a/contrib/libs/ibdrv/include/infiniband/mlx5dv.h b/contrib/libs/ibdrv/include/infiniband/mlx5dv.h deleted file mode 100644 index 3d69216782..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/mlx5dv.h +++ /dev/null @@ -1,1700 +0,0 @@ -/* - * Copyright (c) 2017 Mellanox Technologies, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef _MLX5DV_H_ -#define _MLX5DV_H_ - -#include <stdio.h> -#include <stdbool.h> -#include <linux/types.h> /* For the __be64 type */ -#include <sys/types.h> -#include <endian.h> -#if defined(__SSE3__) -#include <limits.h> -#include <emmintrin.h> -#include <tmmintrin.h> -#endif /* defined(__SSE3__) */ - -#include <infiniband/verbs.h> -#include <infiniband/tm_types.h> -#include <infiniband/mlx5_api.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Always inline the functions */ -#ifdef __GNUC__ -#define MLX5DV_ALWAYS_INLINE inline __attribute__((always_inline)) -#else -#define MLX5DV_ALWAYS_INLINE inline -#endif - - -#define MLX5DV_RES_TYPE_QP ((uint64_t)RDMA_DRIVER_MLX5 << 32 | 1) -#define MLX5DV_RES_TYPE_RWQ ((uint64_t)RDMA_DRIVER_MLX5 << 32 | 2) -#define MLX5DV_RES_TYPE_DBR ((uint64_t)RDMA_DRIVER_MLX5 << 32 | 3) -#define MLX5DV_RES_TYPE_SRQ ((uint64_t)RDMA_DRIVER_MLX5 << 32 | 4) -#define MLX5DV_RES_TYPE_CQ ((uint64_t)RDMA_DRIVER_MLX5 << 32 | 5) - -enum { - MLX5_RCV_DBR = 0, - MLX5_SND_DBR = 1, -}; - -enum mlx5dv_context_comp_mask { - MLX5DV_CONTEXT_MASK_CQE_COMPRESION = 1 << 0, - MLX5DV_CONTEXT_MASK_SWP = 1 << 1, - MLX5DV_CONTEXT_MASK_STRIDING_RQ = 1 << 2, - MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS = 1 << 3, - MLX5DV_CONTEXT_MASK_DYN_BFREGS = 1 << 4, - MLX5DV_CONTEXT_MASK_CLOCK_INFO_UPDATE = 1 << 5, - MLX5DV_CONTEXT_MASK_FLOW_ACTION_FLAGS = 1 << 6, - MLX5DV_CONTEXT_MASK_DC_ODP_CAPS = 1 << 7, - MLX5DV_CONTEXT_MASK_HCA_CORE_CLOCK = 1 << 8, - MLX5DV_CONTEXT_MASK_NUM_LAG_PORTS = 1 << 9, -}; - -struct mlx5dv_cqe_comp_caps { - uint32_t max_num; - uint32_t supported_format; /* enum mlx5dv_cqe_comp_res_format */ -}; - -struct mlx5dv_sw_parsing_caps { - uint32_t sw_parsing_offloads; /* Use enum mlx5dv_sw_parsing_offloads */ - uint32_t supported_qpts; -}; - -struct mlx5dv_striding_rq_caps { - uint32_t min_single_stride_log_num_of_bytes; - uint32_t max_single_stride_log_num_of_bytes; - uint32_t min_single_wqe_log_num_of_strides; - uint32_t max_single_wqe_log_num_of_strides; - uint32_t supported_qpts; -}; - -enum mlx5dv_tunnel_offloads { - MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_VXLAN = 1 << 0, - MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_GRE = 1 << 1, - MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_GENEVE = 1 << 2, - MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_CW_MPLS_OVER_GRE = 1 << 3, - MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_CW_MPLS_OVER_UDP = 1 << 4, -}; - -enum mlx5dv_flow_action_cap_flags { - MLX5DV_FLOW_ACTION_FLAGS_ESP_AES_GCM = 1 << 0, - MLX5DV_FLOW_ACTION_FLAGS_ESP_AES_GCM_REQ_METADATA = 1 << 1, - MLX5DV_FLOW_ACTION_FLAGS_ESP_AES_GCM_SPI_STEERING = 1 << 2, - MLX5DV_FLOW_ACTION_FLAGS_ESP_AES_GCM_FULL_OFFLOAD = 1 << 3, - MLX5DV_FLOW_ACTION_FLAGS_ESP_AES_GCM_TX_IV_IS_ESN = 1 << 4, -}; - -struct mlx5dv_devx_port { - uint64_t comp_mask; - uint16_t vport_num; - uint16_t vport_vhca_id; - uint16_t esw_owner_vhca_id; - uint64_t icm_addr_rx; - uint64_t icm_addr_tx; - struct mlx5dv_devx_reg_32 reg_c_0; -}; - -/* - * Direct verbs device-specific attributes - */ -struct mlx5dv_context { - uint8_t version; - uint64_t flags; - uint64_t comp_mask; - struct mlx5dv_cqe_comp_caps cqe_comp_caps; - struct mlx5dv_sw_parsing_caps sw_parsing_caps; - struct mlx5dv_striding_rq_caps striding_rq_caps; - uint32_t tunnel_offloads_caps; - uint32_t max_dynamic_bfregs; - uint64_t max_clock_info_update_nsec; - uint32_t flow_action_flags; /* use enum mlx5dv_flow_action_cap_flags */ - uint32_t dc_odp_caps; /* use enum ibv_odp_transport_cap_bits */ - void *hca_core_clock; - uint8_t num_lag_ports; -}; - -enum mlx5dv_context_flags { - /* - * This flag indicates if CQE version 0 or 1 is needed. - */ - MLX5DV_CONTEXT_FLAGS_CQE_V1 = (1 << 0), - MLX5DV_CONTEXT_FLAGS_OBSOLETE = (1 << 1), /* Obsoleted, don't use */ - MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED = (1 << 2), - MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW = (1 << 3), - MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP = (1 << 4), /* Support CQE 128B compression */ - MLX5DV_CONTEXT_FLAGS_CQE_128B_PAD = (1 << 5), /* Support CQE 128B padding */ - MLX5DV_CONTEXT_FLAGS_PACKET_BASED_CREDIT_MODE = (1 << 6), -}; - -enum mlx5dv_cq_init_attr_mask { - MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE = 1 << 0, - MLX5DV_CQ_INIT_ATTR_MASK_FLAGS = 1 << 1, - MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE = 1 << 2, -}; - -enum mlx5dv_cq_init_attr_flags { - MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD = 1 << 0, - MLX5DV_CQ_INIT_ATTR_FLAGS_RESERVED = 1 << 1, -}; - -struct mlx5dv_cq_init_attr { - uint64_t comp_mask; /* Use enum mlx5dv_cq_init_attr_mask */ - uint8_t cqe_comp_res_format; /* Use enum mlx5dv_cqe_comp_res_format */ - uint32_t flags; /* Use enum mlx5dv_cq_init_attr_flags */ - uint16_t cqe_size; /* when MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE set */ -}; - -struct ibv_cq_ex *mlx5dv_create_cq(struct ibv_context *context, - struct ibv_cq_init_attr_ex *cq_attr, - struct mlx5dv_cq_init_attr *mlx5_cq_attr); - -enum mlx5dv_qp_create_flags { - MLX5DV_QP_CREATE_TUNNEL_OFFLOADS = 1 << 0, - MLX5DV_QP_CREATE_TIR_ALLOW_SELF_LOOPBACK_UC = 1 << 1, - MLX5DV_QP_CREATE_TIR_ALLOW_SELF_LOOPBACK_MC = 1 << 2, - MLX5DV_QP_CREATE_DISABLE_SCATTER_TO_CQE = 1 << 3, - MLX5DV_QP_CREATE_ALLOW_SCATTER_TO_CQE = 1 << 4, - MLX5DV_QP_CREATE_PACKET_BASED_CREDIT_MODE = 1 << 5, -}; - -enum mlx5dv_mkey_init_attr_flags { - MLX5DV_MKEY_INIT_ATTR_FLAGS_INDIRECT = 1 << 0, -}; - -struct mlx5dv_mkey_init_attr { - struct ibv_pd *pd; - uint32_t create_flags; /* Use enum mlx5dv_mkey_init_attr_flags */ - uint16_t max_entries; /* Requested max number of pointed entries by this indirect mkey */ -}; - -struct mlx5dv_mkey { - uint32_t lkey; - uint32_t rkey; -}; - -struct mlx5dv_mkey *mlx5dv_create_mkey(struct mlx5dv_mkey_init_attr *mkey_init_attr); -int mlx5dv_destroy_mkey(struct mlx5dv_mkey *mkey); - -enum mlx5dv_qp_init_attr_mask { - MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS = 1 << 0, - MLX5DV_QP_INIT_ATTR_MASK_DC = 1 << 1, - MLX5DV_QP_INIT_ATTR_MASK_SEND_OPS_FLAGS = 1 << 2, -}; - -enum mlx5dv_dc_type { - MLX5DV_DCTYPE_DCT = 1, - MLX5DV_DCTYPE_DCI, -}; - -struct mlx5dv_dc_init_attr { - enum mlx5dv_dc_type dc_type; - uint64_t dct_access_key; -}; - -enum mlx5dv_qp_create_send_ops_flags { - MLX5DV_QP_EX_WITH_MR_INTERLEAVED = 1 << 0, - MLX5DV_QP_EX_WITH_MR_LIST = 1 << 1, -}; - -struct mlx5dv_qp_init_attr { - uint64_t comp_mask; /* Use enum mlx5dv_qp_init_attr_mask */ - uint32_t create_flags; /* Use enum mlx5dv_qp_create_flags */ - struct mlx5dv_dc_init_attr dc_init_attr; - uint64_t send_ops_flags; /* Use enum mlx5dv_qp_create_send_ops_flags */ -}; - -struct ibv_qp *mlx5dv_create_qp(struct ibv_context *context, - struct ibv_qp_init_attr_ex *qp_attr, - struct mlx5dv_qp_init_attr *mlx5_qp_attr); - -struct mlx5dv_mr_interleaved { - uint64_t addr; - uint32_t bytes_count; - uint32_t bytes_skip; - uint32_t lkey; -}; - -enum mlx5dv_wc_opcode { - MLX5DV_WC_UMR = IBV_WC_DRIVER1, -}; - -struct mlx5dv_qp_ex { - uint64_t comp_mask; - /* - * Available just for the MLX5 DC QP type with send opcodes of type: - * rdma, atomic and send. - */ - void (*wr_set_dc_addr)(struct mlx5dv_qp_ex *mqp, struct ibv_ah *ah, - uint32_t remote_dctn, uint64_t remote_dc_key); - void (*wr_mr_interleaved)(struct mlx5dv_qp_ex *mqp, - struct mlx5dv_mkey *mkey, - uint32_t access_flags, /* use enum ibv_access_flags */ - uint32_t repeat_count, - uint16_t num_interleaved, - struct mlx5dv_mr_interleaved *data); - void (*wr_mr_list)(struct mlx5dv_qp_ex *mqp, - struct mlx5dv_mkey *mkey, - uint32_t access_flags, /* use enum ibv_access_flags */ - uint16_t num_sges, - struct ibv_sge *sge); -}; - -struct mlx5dv_qp_ex *mlx5dv_qp_ex_from_ibv_qp_ex(struct ibv_qp_ex *qp); - -int mlx5dv_query_devx_port(struct ibv_context *ctx, - uint32_t port_num, - struct mlx5dv_devx_port *mlx5_devx_port); - -static inline void mlx5dv_wr_set_dc_addr(struct mlx5dv_qp_ex *mqp, - struct ibv_ah *ah, - uint32_t remote_dctn, - uint64_t remote_dc_key) -{ - mqp->wr_set_dc_addr(mqp, ah, remote_dctn, remote_dc_key); -} - -static inline void mlx5dv_wr_mr_interleaved(struct mlx5dv_qp_ex *mqp, - struct mlx5dv_mkey *mkey, - uint32_t access_flags, - uint32_t repeat_count, - uint16_t num_interleaved, - struct mlx5dv_mr_interleaved *data) -{ - mqp->wr_mr_interleaved(mqp, mkey, access_flags, repeat_count, - num_interleaved, data); -} - -static inline void mlx5dv_wr_mr_list(struct mlx5dv_qp_ex *mqp, - struct mlx5dv_mkey *mkey, - uint32_t access_flags, - uint16_t num_sges, - struct ibv_sge *sge) -{ - mqp->wr_mr_list(mqp, mkey, access_flags, num_sges, sge); -} - -enum mlx5dv_flow_action_esp_mask { - MLX5DV_FLOW_ACTION_ESP_MASK_FLAGS = 1 << 0, -}; - -struct mlx5dv_flow_action_esp { - uint64_t comp_mask; /* Use enum mlx5dv_flow_action_esp_mask */ - uint32_t action_flags; /* Use enum mlx5dv_flow_action_flags */ -}; - -struct mlx5dv_flow_match_parameters { - size_t match_sz; - uint64_t match_buf[]; /* Device spec format */ -}; - -enum mlx5dv_flow_matcher_attr_mask { - MLX5DV_FLOW_MATCHER_MASK_FT_TYPE = 1 << 0, -}; - -struct mlx5dv_flow_matcher_attr { - enum ibv_flow_attr_type type; - uint32_t flags; /* From enum ibv_flow_flags */ - uint16_t priority; - uint8_t match_criteria_enable; /* Device spec format */ - struct mlx5dv_flow_match_parameters *match_mask; - uint64_t comp_mask; /* use mlx5dv_flow_matcher_attr_mask */ - enum mlx5dv_flow_table_type ft_type; -}; - -struct mlx5dv_flow_matcher; - -struct mlx5dv_flow_matcher * -mlx5dv_create_flow_matcher(struct ibv_context *context, - struct mlx5dv_flow_matcher_attr *matcher_attr); - -int mlx5dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *matcher); - -enum mlx5dv_flow_action_type { - MLX5DV_FLOW_ACTION_DEST_IBV_QP, - MLX5DV_FLOW_ACTION_DROP, - MLX5DV_FLOW_ACTION_IBV_COUNTER, - MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION, - MLX5DV_FLOW_ACTION_TAG, - MLX5DV_FLOW_ACTION_DEST_DEVX, - MLX5DV_FLOW_ACTION_COUNTERS_DEVX, - MLX5DV_FLOW_ACTION_DEFAULT_MISS, -}; - -struct mlx5dv_flow_action_attr { - enum mlx5dv_flow_action_type type; - union { - struct ibv_qp *qp; - struct ibv_counters *counter; - struct ibv_flow_action *action; - uint32_t tag_value; - struct mlx5dv_devx_obj *obj; - }; -}; - -struct ibv_flow * -mlx5dv_create_flow(struct mlx5dv_flow_matcher *matcher, - struct mlx5dv_flow_match_parameters *match_value, - size_t num_actions, - struct mlx5dv_flow_action_attr actions_attr[]); - -struct ibv_flow_action *mlx5dv_create_flow_action_esp(struct ibv_context *ctx, - struct ibv_flow_action_esp_attr *esp, - struct mlx5dv_flow_action_esp *mlx5_attr); - -/* - * mlx5dv_create_flow_action_modify_header - Create a flow action which mutates - * a packet. The flow action can be attached to steering rules via - * ibv_create_flow(). - * - * @ctx: RDMA device context to create the action on. - * @actions_sz: The size of *actions* buffer in bytes. - * @actions: A buffer which contains modify actions provided in device spec - * format. - * @ft_type: Defines the flow table type to which the modify - * header action will be attached. - * - * Return a valid ibv_flow_action if successful, NULL otherwise. - */ -struct ibv_flow_action * -mlx5dv_create_flow_action_modify_header(struct ibv_context *ctx, - size_t actions_sz, - uint64_t actions[], - enum mlx5dv_flow_table_type ft_type); - -/* - * mlx5dv_create_flow_action_packet_reformat - Create flow action which can - * encap/decap packets. - */ -struct ibv_flow_action * -mlx5dv_create_flow_action_packet_reformat(struct ibv_context *ctx, - size_t data_sz, - void *data, - enum mlx5dv_flow_action_packet_reformat_type reformat_type, - enum mlx5dv_flow_table_type ft_type); -/* - * Most device capabilities are exported by ibv_query_device(...), - * but there is HW device-specific information which is important - * for data-path, but isn't provided. - * - * Return 0 on success. - */ -int mlx5dv_query_device(struct ibv_context *ctx_in, - struct mlx5dv_context *attrs_out); - -enum mlx5dv_qp_comp_mask { - MLX5DV_QP_MASK_UAR_MMAP_OFFSET = 1 << 0, - MLX5DV_QP_MASK_RAW_QP_HANDLES = 1 << 1, - MLX5DV_QP_MASK_RAW_QP_TIR_ADDR = 1 << 2, -}; - -struct mlx5dv_qp { - __be32 *dbrec; - struct { - void *buf; - uint32_t wqe_cnt; - uint32_t stride; - } sq; - struct { - void *buf; - uint32_t wqe_cnt; - uint32_t stride; - } rq; - struct { - void *reg; - uint32_t size; - } bf; - uint64_t comp_mask; - off_t uar_mmap_offset; - uint32_t tirn; - uint32_t tisn; - uint32_t rqn; - uint32_t sqn; - uint64_t tir_icm_addr; -}; - -struct mlx5dv_cq { - void *buf; - __be32 *dbrec; - uint32_t cqe_cnt; - uint32_t cqe_size; - void *cq_uar; - uint32_t cqn; - uint64_t comp_mask; -}; - -enum mlx5dv_srq_comp_mask { - MLX5DV_SRQ_MASK_SRQN = 1 << 0, -}; - -struct mlx5dv_srq { - void *buf; - __be32 *dbrec; - uint32_t stride; - uint32_t head; - uint32_t tail; - uint64_t comp_mask; - uint32_t srqn; -}; - -struct mlx5dv_rwq { - void *buf; - __be32 *dbrec; - uint32_t wqe_cnt; - uint32_t stride; - uint64_t comp_mask; -}; - -struct mlx5dv_alloc_dm_attr { - enum mlx5dv_alloc_dm_type type; - uint64_t comp_mask; -}; - -enum mlx5dv_dm_comp_mask { - MLX5DV_DM_MASK_REMOTE_VA = 1 << 0, -}; - -struct mlx5dv_dm { - void *buf; - uint64_t length; - uint64_t comp_mask; - uint64_t remote_va; -}; - -struct ibv_dm *mlx5dv_alloc_dm(struct ibv_context *context, - struct ibv_alloc_dm_attr *dm_attr, - struct mlx5dv_alloc_dm_attr *mlx5_dm_attr); - -struct mlx5_wqe_av; - -struct mlx5dv_ah { - struct mlx5_wqe_av *av; - uint64_t comp_mask; -}; - -struct mlx5dv_pd { - uint32_t pdn; - uint64_t comp_mask; -}; - -struct mlx5dv_obj { - struct { - struct ibv_qp *in; - struct mlx5dv_qp *out; - } qp; - struct { - struct ibv_cq *in; - struct mlx5dv_cq *out; - } cq; - struct { - struct ibv_srq *in; - struct mlx5dv_srq *out; - } srq; - struct { - struct ibv_wq *in; - struct mlx5dv_rwq *out; - } rwq; - struct { - struct ibv_dm *in; - struct mlx5dv_dm *out; - } dm; - struct { - struct ibv_ah *in; - struct mlx5dv_ah *out; - } ah; - struct { - struct ibv_pd *in; - struct mlx5dv_pd *out; - } pd; -}; - -enum mlx5dv_obj_type { - MLX5DV_OBJ_QP = 1 << 0, - MLX5DV_OBJ_CQ = 1 << 1, - MLX5DV_OBJ_SRQ = 1 << 2, - MLX5DV_OBJ_RWQ = 1 << 3, - MLX5DV_OBJ_DM = 1 << 4, - MLX5DV_OBJ_AH = 1 << 5, - MLX5DV_OBJ_PD = 1 << 6, -}; - -enum mlx5dv_wq_init_attr_mask { - MLX5DV_WQ_INIT_ATTR_MASK_STRIDING_RQ = 1 << 0, -}; - -struct mlx5dv_striding_rq_init_attr { - uint32_t single_stride_log_num_of_bytes; - uint32_t single_wqe_log_num_of_strides; - uint8_t two_byte_shift_en; -}; - -struct mlx5dv_wq_init_attr { - uint64_t comp_mask; /* Use enum mlx5dv_wq_init_attr_mask */ - struct mlx5dv_striding_rq_init_attr striding_rq_attrs; -}; - -/* - * This function creates a work queue object with extra properties - * defined by mlx5dv_wq_init_attr struct. - * - * For each bit in the comp_mask, a field in mlx5dv_wq_init_attr - * should follow. - * - * MLX5DV_WQ_INIT_ATTR_MASK_STRIDING_RQ: Create a work queue with - * striding RQ capabilities. - * - single_stride_log_num_of_bytes represents the size of each stride in the - * WQE and its value should be between min_single_stride_log_num_of_bytes - * and max_single_stride_log_num_of_bytes that are reported in - * mlx5dv_query_device. - * - single_wqe_log_num_of_strides represents the number of strides in each WQE. - * Its value should be between min_single_wqe_log_num_of_strides and - * max_single_wqe_log_num_of_strides that are reported in mlx5dv_query_device. - * - two_byte_shift_en: When enabled, hardware pads 2 bytes of zeroes - * before writing the message to memory (e.g. for IP alignment) - */ -struct ibv_wq *mlx5dv_create_wq(struct ibv_context *context, - struct ibv_wq_init_attr *wq_init_attr, - struct mlx5dv_wq_init_attr *mlx5_wq_attr); -/* - * This function will initialize mlx5dv_xxx structs based on supplied type. - * The information for initialization is taken from ibv_xx structs supplied - * as part of input. - * - * Request information of CQ marks its owned by DV for all consumer index - * related actions. - * - * The initialization type can be combination of several types together. - * - * Return: 0 in case of success. - */ -int mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type); - -enum { - MLX5_OPCODE_NOP = 0x00, - MLX5_OPCODE_SEND_INVAL = 0x01, - MLX5_OPCODE_RDMA_WRITE = 0x08, - MLX5_OPCODE_RDMA_WRITE_IMM = 0x09, - MLX5_OPCODE_SEND = 0x0a, - MLX5_OPCODE_SEND_IMM = 0x0b, - MLX5_OPCODE_TSO = 0x0e, - MLX5_OPCODE_RDMA_READ = 0x10, - MLX5_OPCODE_ATOMIC_CS = 0x11, - MLX5_OPCODE_ATOMIC_FA = 0x12, - MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14, - MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15, - MLX5_OPCODE_FMR = 0x19, - MLX5_OPCODE_LOCAL_INVAL = 0x1b, - MLX5_OPCODE_CONFIG_CMD = 0x1f, - MLX5_OPCODE_UMR = 0x25, - MLX5_OPCODE_TAG_MATCHING = 0x28, - MLX5_OPCODE_FLOW_TBL_ACCESS = 0x2c, -}; - -/* - * CQE related part - */ - -enum { - MLX5_INLINE_SCATTER_32 = 0x4, - MLX5_INLINE_SCATTER_64 = 0x8, -}; - -enum { - MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR = 0x01, - MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR = 0x02, - MLX5_CQE_SYNDROME_LOCAL_PROT_ERR = 0x04, - MLX5_CQE_SYNDROME_WR_FLUSH_ERR = 0x05, - MLX5_CQE_SYNDROME_MW_BIND_ERR = 0x06, - MLX5_CQE_SYNDROME_BAD_RESP_ERR = 0x10, - MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR = 0x11, - MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR = 0x12, - MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR = 0x13, - MLX5_CQE_SYNDROME_REMOTE_OP_ERR = 0x14, - MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR = 0x15, - MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR = 0x16, - MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22, -}; - -enum { - MLX5_CQE_VENDOR_SYNDROME_ODP_PFAULT = 0x93, -}; - -enum { - MLX5_CQE_L2_OK = 1 << 0, - MLX5_CQE_L3_OK = 1 << 1, - MLX5_CQE_L4_OK = 1 << 2, -}; - -enum { - MLX5_CQE_L3_HDR_TYPE_NONE = 0x0, - MLX5_CQE_L3_HDR_TYPE_IPV6 = 0x1, - MLX5_CQE_L3_HDR_TYPE_IPV4 = 0x2, -}; - -enum { - MLX5_CQE_OWNER_MASK = 1, - MLX5_CQE_REQ = 0, - MLX5_CQE_RESP_WR_IMM = 1, - MLX5_CQE_RESP_SEND = 2, - MLX5_CQE_RESP_SEND_IMM = 3, - MLX5_CQE_RESP_SEND_INV = 4, - MLX5_CQE_RESIZE_CQ = 5, - MLX5_CQE_NO_PACKET = 6, - MLX5_CQE_REQ_ERR = 13, - MLX5_CQE_RESP_ERR = 14, - MLX5_CQE_INVALID = 15, -}; - -enum { - MLX5_CQ_DOORBELL = 0x20 -}; - -enum { - MLX5_CQ_DB_REQ_NOT_SOL = 1 << 24, - MLX5_CQ_DB_REQ_NOT = 0 << 24, -}; - -struct mlx5_err_cqe { - uint8_t rsvd0[32]; - uint32_t srqn; - uint8_t rsvd1[18]; - uint8_t vendor_err_synd; - uint8_t syndrome; - uint32_t s_wqe_opcode_qpn; - uint16_t wqe_counter; - uint8_t signature; - uint8_t op_own; -}; - -struct mlx5_tm_cqe { - __be32 success; - __be16 hw_phase_cnt; - uint8_t rsvd0[12]; -}; - -struct mlx5_cqe64 { - union { - struct { - uint8_t rsvd0[2]; - __be16 wqe_id; - uint8_t rsvd4[13]; - uint8_t ml_path; - uint8_t rsvd20[4]; - __be16 slid; - __be32 flags_rqpn; - uint8_t hds_ip_ext; - uint8_t l4_hdr_type_etc; - __be16 vlan_info; - }; - struct mlx5_tm_cqe tm_cqe; - /* TMH is scattered to CQE upon match */ - struct ibv_tmh tmh; - }; - __be32 srqn_uidx; - __be32 imm_inval_pkey; - uint8_t app; - uint8_t app_op; - __be16 app_info; - __be32 byte_cnt; - __be64 timestamp; - __be32 sop_drop_qpn; - __be16 wqe_counter; - uint8_t signature; - uint8_t op_own; -}; - -enum { - MLX5_TMC_SUCCESS = 0x80000000U, -}; - -enum mlx5dv_cqe_comp_res_format { - MLX5DV_CQE_RES_FORMAT_HASH = 1 << 0, - MLX5DV_CQE_RES_FORMAT_CSUM = 1 << 1, - MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX = 1 << 2, -}; - -enum mlx5dv_sw_parsing_offloads { - MLX5DV_SW_PARSING = 1 << 0, - MLX5DV_SW_PARSING_CSUM = 1 << 1, - MLX5DV_SW_PARSING_LSO = 1 << 2, -}; - -static MLX5DV_ALWAYS_INLINE -uint8_t mlx5dv_get_cqe_owner(struct mlx5_cqe64 *cqe) -{ - return cqe->op_own & 0x1; -} - -static MLX5DV_ALWAYS_INLINE -void mlx5dv_set_cqe_owner(struct mlx5_cqe64 *cqe, uint8_t val) -{ - cqe->op_own = (val & 0x1) | (cqe->op_own & ~0x1); -} - -/* Solicited event */ -static MLX5DV_ALWAYS_INLINE -uint8_t mlx5dv_get_cqe_se(struct mlx5_cqe64 *cqe) -{ - return (cqe->op_own >> 1) & 0x1; -} - -static MLX5DV_ALWAYS_INLINE -uint8_t mlx5dv_get_cqe_format(struct mlx5_cqe64 *cqe) -{ - return (cqe->op_own >> 2) & 0x3; -} - -static MLX5DV_ALWAYS_INLINE -uint8_t mlx5dv_get_cqe_opcode(struct mlx5_cqe64 *cqe) -{ - return cqe->op_own >> 4; -} - -/* - * WQE related part - */ -enum { - MLX5_INVALID_LKEY = 0x100, -}; - -enum { - MLX5_EXTENDED_UD_AV = 0x80000000, -}; - -enum { - MLX5_WQE_CTRL_CQ_UPDATE = 2 << 2, - MLX5_WQE_CTRL_SOLICITED = 1 << 1, - MLX5_WQE_CTRL_FENCE = 4 << 5, - MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = 1 << 5, -}; - -enum { - MLX5_SEND_WQE_BB = 64, - MLX5_SEND_WQE_SHIFT = 6, -}; - -enum { - MLX5_INLINE_SEG = 0x80000000, -}; - -enum { - MLX5_ETH_WQE_L3_CSUM = (1 << 6), - MLX5_ETH_WQE_L4_CSUM = (1 << 7), -}; - -struct mlx5_wqe_srq_next_seg { - uint8_t rsvd0[2]; - __be16 next_wqe_index; - uint8_t signature; - uint8_t rsvd1[11]; -}; - -struct mlx5_wqe_data_seg { - __be32 byte_count; - __be32 lkey; - __be64 addr; -}; - -struct mlx5_wqe_ctrl_seg { - __be32 opmod_idx_opcode; - __be32 qpn_ds; - uint8_t signature; - uint8_t rsvd[2]; - uint8_t fm_ce_se; - __be32 imm; -}; - -struct mlx5_wqe_flow_update_ctrl_seg { - __be32 flow_idx_update; - __be32 dest_handle; - uint8_t reserved0[40]; -}; - -struct mlx5_wqe_header_modify_argument_update_seg { - uint8_t argument_list[64]; -}; - -struct mlx5_mprq_wqe { - struct mlx5_wqe_srq_next_seg nseg; - struct mlx5_wqe_data_seg dseg; -}; - -struct mlx5_wqe_av { - union { - struct { - __be32 qkey; - __be32 reserved; - } qkey; - __be64 dc_key; - } key; - __be32 dqp_dct; - uint8_t stat_rate_sl; - uint8_t fl_mlid; - __be16 rlid; - uint8_t reserved0[4]; - uint8_t rmac[6]; - uint8_t tclass; - uint8_t hop_limit; - __be32 grh_gid_fl; - uint8_t rgid[16]; -}; - -struct mlx5_wqe_datagram_seg { - struct mlx5_wqe_av av; -}; - -struct mlx5_wqe_raddr_seg { - __be64 raddr; - __be32 rkey; - __be32 reserved; -}; - -struct mlx5_wqe_atomic_seg { - __be64 swap_add; - __be64 compare; -}; - -struct mlx5_wqe_inl_data_seg { - uint32_t byte_count; -}; - -struct mlx5_wqe_eth_seg { - __be32 rsvd0; - uint8_t cs_flags; - uint8_t rsvd1; - __be16 mss; - __be32 rsvd2; - __be16 inline_hdr_sz; - uint8_t inline_hdr_start[2]; - uint8_t inline_hdr[16]; -}; - -struct mlx5_wqe_tm_seg { - uint8_t opcode; - uint8_t flags; - __be16 index; - uint8_t rsvd0[2]; - __be16 sw_cnt; - uint8_t rsvd1[8]; - __be64 append_tag; - __be64 append_mask; -}; - -enum { - MLX5_WQE_UMR_CTRL_FLAG_INLINE = 1 << 7, - MLX5_WQE_UMR_CTRL_FLAG_CHECK_FREE = 1 << 5, - MLX5_WQE_UMR_CTRL_FLAG_TRNSLATION_OFFSET = 1 << 4, - MLX5_WQE_UMR_CTRL_FLAG_CHECK_QPN = 1 << 3, -}; - -enum { - MLX5_WQE_UMR_CTRL_MKEY_MASK_LEN = 1 << 0, - MLX5_WQE_UMR_CTRL_MKEY_MASK_START_ADDR = 1 << 6, - MLX5_WQE_UMR_CTRL_MKEY_MASK_MKEY = 1 << 13, - MLX5_WQE_UMR_CTRL_MKEY_MASK_QPN = 1 << 14, - MLX5_WQE_UMR_CTRL_MKEY_MASK_ACCESS_LOCAL_WRITE = 1 << 18, - MLX5_WQE_UMR_CTRL_MKEY_MASK_ACCESS_REMOTE_READ = 1 << 19, - MLX5_WQE_UMR_CTRL_MKEY_MASK_ACCESS_REMOTE_WRITE = 1 << 20, - MLX5_WQE_UMR_CTRL_MKEY_MASK_ACCESS_ATOMIC = 1 << 21, - MLX5_WQE_UMR_CTRL_MKEY_MASK_FREE = 1 << 29, -}; - -struct mlx5_wqe_umr_ctrl_seg { - uint8_t flags; - uint8_t rsvd0[3]; - __be16 klm_octowords; - __be16 translation_offset; - __be64 mkey_mask; - uint8_t rsvd1[32]; -}; - -struct mlx5_wqe_umr_klm_seg { - /* up to 2GB */ - __be32 byte_count; - __be32 mkey; - __be64 address; -}; - -union mlx5_wqe_umr_inline_seg { - struct mlx5_wqe_umr_klm_seg klm; -}; - -struct mlx5_wqe_umr_repeat_ent_seg { - __be16 stride; - __be16 byte_count; - __be32 memkey; - __be64 va; -}; - -struct mlx5_wqe_umr_repeat_block_seg { - __be32 byte_count; - __be32 op; - __be32 repeat_count; - __be16 reserved; - __be16 num_ent; - struct mlx5_wqe_umr_repeat_ent_seg entries[0]; -}; - -enum { - MLX5_WQE_MKEY_CONTEXT_FREE = 1 << 6 -}; - -enum { - MLX5_WQE_MKEY_CONTEXT_ACCESS_FLAGS_ATOMIC = 1 << 6, - MLX5_WQE_MKEY_CONTEXT_ACCESS_FLAGS_REMOTE_WRITE = 1 << 5, - MLX5_WQE_MKEY_CONTEXT_ACCESS_FLAGS_REMOTE_READ = 1 << 4, - MLX5_WQE_MKEY_CONTEXT_ACCESS_FLAGS_LOCAL_WRITE = 1 << 3, - MLX5_WQE_MKEY_CONTEXT_ACCESS_FLAGS_LOCAL_READ = 1 << 2 -}; - -struct mlx5_wqe_mkey_context_seg { - uint8_t free; - uint8_t reserved1; - uint8_t access_flags; - uint8_t sf; - __be32 qpn_mkey; - __be32 reserved2; - __be32 flags_pd; - __be64 start_addr; - __be64 len; - __be32 bsf_octword_size; - __be32 reserved3[4]; - __be32 translations_octword_size; - uint8_t reserved4[3]; - uint8_t log_page_size; - __be32 reserved; - union mlx5_wqe_umr_inline_seg inseg[0]; -}; - -/* - * Control segment - contains some control information for the current WQE. - * - * Output: - * seg - control segment to be filled - * Input: - * pi - WQEBB number of the first block of this WQE. - * This number should wrap at 0xffff, regardless of - * size of the WQ. - * opcode - Opcode of this WQE. Encodes the type of operation - * to be executed on the QP. - * opmod - Opcode modifier. - * qp_num - QP/SQ number this WQE is posted to. - * fm_ce_se - FM (fence mode), CE (completion and event mode) - * and SE (solicited event). - * ds - WQE size in octowords (16-byte units). DS accounts for all - * the segments in the WQE as summarized in WQE construction. - * signature - WQE signature. - * imm - Immediate data/Invalidation key/UMR mkey. - */ -static MLX5DV_ALWAYS_INLINE -void mlx5dv_set_ctrl_seg(struct mlx5_wqe_ctrl_seg *seg, uint16_t pi, - uint8_t opcode, uint8_t opmod, uint32_t qp_num, - uint8_t fm_ce_se, uint8_t ds, - uint8_t signature, uint32_t imm) -{ - seg->opmod_idx_opcode = htobe32(((uint32_t)opmod << 24) | ((uint32_t)pi << 8) | opcode); - seg->qpn_ds = htobe32((qp_num << 8) | ds); - seg->fm_ce_se = fm_ce_se; - seg->signature = signature; - /* - * The caller should prepare "imm" in advance based on WR opcode. - * For IBV_WR_SEND_WITH_IMM and IBV_WR_RDMA_WRITE_WITH_IMM, - * the "imm" should be assigned as is. - * For the IBV_WR_SEND_WITH_INV, it should be htobe32(imm). - */ - seg->imm = imm; -} - -/* x86 optimized version of mlx5dv_set_ctrl_seg() - * - * This is useful when doing calculations on large data sets - * for parallel calculations. - * - * It doesn't suit for serialized algorithms. - */ -#if defined(__SSE3__) -static MLX5DV_ALWAYS_INLINE -void mlx5dv_x86_set_ctrl_seg(struct mlx5_wqe_ctrl_seg *seg, uint16_t pi, - uint8_t opcode, uint8_t opmod, uint32_t qp_num, - uint8_t fm_ce_se, uint8_t ds, - uint8_t signature, uint32_t imm) -{ - __m128i val = _mm_set_epi32(imm, qp_num, (ds << 16) | pi, - (signature << 24) | (opcode << 16) | (opmod << 8) | fm_ce_se); - __m128i mask = _mm_set_epi8(15, 14, 13, 12, /* immediate */ - 0, /* signal/fence_mode */ -#if CHAR_MIN - -128, -128, /* reserved */ -#else - 0x80, 0x80, /* reserved */ -#endif - 3, /* signature */ - 6, /* data size */ - 8, 9, 10, /* QP num */ - 2, /* opcode */ - 4, 5, /* sw_pi in BE */ - 1 /* opmod */ - ); - *(__m128i *) seg = _mm_shuffle_epi8(val, mask); -} -#endif /* defined(__SSE3__) */ - -/* - * Datagram Segment - contains address information required in order - * to form a datagram message. - * - * Output: - * seg - datagram segment to be filled. - * Input: - * key - Q_key/access key. - * dqp_dct - Destination QP number for UD and DCT for DC. - * ext - Address vector extension. - * stat_rate_sl - Maximum static rate control, SL/ethernet priority. - * fl_mlid - Force loopback and source LID for IB. - * rlid - Remote LID - * rmac - Remote MAC - * tclass - GRH tclass/IPv6 tclass/IPv4 ToS - * hop_limit - GRH hop limit/IPv6 hop limit/IPv4 TTL - * grh_gid_fi - GRH, source GID address and IPv6 flow label. - * rgid - Remote GID/IP address. - */ -static MLX5DV_ALWAYS_INLINE -void mlx5dv_set_dgram_seg(struct mlx5_wqe_datagram_seg *seg, - uint64_t key, uint32_t dqp_dct, - uint8_t ext, uint8_t stat_rate_sl, - uint8_t fl_mlid, uint16_t rlid, - uint8_t *rmac, uint8_t tclass, - uint8_t hop_limit, uint32_t grh_gid_fi, - uint8_t *rgid) -{ - - /* Always put 64 bits, in q_key, the reserved part will be 0 */ - seg->av.key.dc_key = htobe64(key); - seg->av.dqp_dct = htobe32(((uint32_t)ext << 31) | dqp_dct); - seg->av.stat_rate_sl = stat_rate_sl; - seg->av.fl_mlid = fl_mlid; - seg->av.rlid = htobe16(rlid); - memcpy(seg->av.rmac, rmac, 6); - seg->av.tclass = tclass; - seg->av.hop_limit = hop_limit; - seg->av.grh_gid_fl = htobe32(grh_gid_fi); - memcpy(seg->av.rgid, rgid, 16); -} - -/* - * Data Segments - contain pointers and a byte count for the scatter/gather list. - * They can optionally contain data, which will save a memory read access for - * gather Work Requests. - */ -static MLX5DV_ALWAYS_INLINE -void mlx5dv_set_data_seg(struct mlx5_wqe_data_seg *seg, - uint32_t length, uint32_t lkey, - uintptr_t address) -{ - seg->byte_count = htobe32(length); - seg->lkey = htobe32(lkey); - seg->addr = htobe64(address); -} -/* - * x86 optimized version of mlx5dv_set_data_seg() - * - * This is useful when doing calculations on large data sets - * for parallel calculations. - * - * It doesn't suit for serialized algorithms. - */ -#if defined(__SSE3__) -static MLX5DV_ALWAYS_INLINE -void mlx5dv_x86_set_data_seg(struct mlx5_wqe_data_seg *seg, - uint32_t length, uint32_t lkey, - uintptr_t address) -{ - - uint64_t address64 = address; - __m128i val = _mm_set_epi32((uint32_t)address64, (uint32_t)(address64 >> 32), lkey, length); - __m128i mask = _mm_set_epi8(12, 13, 14, 15, /* local address low */ - 8, 9, 10, 11, /* local address high */ - 4, 5, 6, 7, /* l_key */ - 0, 1, 2, 3 /* byte count */ - ); - *(__m128i *) seg = _mm_shuffle_epi8(val, mask); -} -#endif /* defined(__SSE3__) */ - -/* - * Eth Segment - contains packet headers and information for stateless L2, L3, L4 offloading. - * - * Output: - * seg - Eth segment to be filled. - * Input: - * cs_flags - l3cs/l3cs_inner/l4cs/l4cs_inner. - * mss - Maximum segment size. For TSO WQEs, the number of bytes - * in the TCP payload to be transmitted in each packet. Must - * be 0 on non TSO WQEs. - * inline_hdr_sz - Length of the inlined packet headers. - * inline_hdr_start - Inlined packet header. - */ -static MLX5DV_ALWAYS_INLINE -void mlx5dv_set_eth_seg(struct mlx5_wqe_eth_seg *seg, uint8_t cs_flags, - uint16_t mss, uint16_t inline_hdr_sz, - uint8_t *inline_hdr_start) -{ - seg->cs_flags = cs_flags; - seg->mss = htobe16(mss); - seg->inline_hdr_sz = htobe16(inline_hdr_sz); - memcpy(seg->inline_hdr_start, inline_hdr_start, inline_hdr_sz); -} - -enum mlx5dv_set_ctx_attr_type { - MLX5DV_CTX_ATTR_BUF_ALLOCATORS = 1, -}; - -enum { - MLX5_MMAP_GET_REGULAR_PAGES_CMD = 0, - MLX5_MMAP_GET_NC_PAGES_CMD = 3, -}; - -struct mlx5dv_ctx_allocators { - void *(*alloc)(size_t size, void *priv_data); - void (*free)(void *ptr, void *priv_data); - void *data; -}; - -/* - * Generic context attributes set API - * - * Returns 0 on success, or the value of errno on failure - * (which indicates the failure reason). - */ -int mlx5dv_set_context_attr(struct ibv_context *context, - enum mlx5dv_set_ctx_attr_type type, void *attr); - -struct mlx5dv_clock_info { - uint64_t nsec; - uint64_t last_cycles; - uint64_t frac; - uint32_t mult; - uint32_t shift; - uint64_t mask; -}; - -/* - * Get mlx5 core clock info - * - * Output: - * clock_info - clock info to be filled - * Input: - * context - device context - * - * Return: 0 on success, or the value of errno on failure - */ -int mlx5dv_get_clock_info(struct ibv_context *context, - struct mlx5dv_clock_info *clock_info); - -/* - * Translate device timestamp to nano-sec - * - * Input: - * clock_info - clock info to be filled - * device_timestamp - timestamp to translate - * - * Return: nano-sec - */ -static inline uint64_t mlx5dv_ts_to_ns(struct mlx5dv_clock_info *clock_info, - uint64_t device_timestamp) -{ - uint64_t delta, nsec; - - /* - * device_timestamp & cycles are the free running 'mask' bit counters - * from the hardware hca_core_clock clock. - */ - delta = (device_timestamp - clock_info->last_cycles) & clock_info->mask; - nsec = clock_info->nsec; - - /* - * Guess if the device_timestamp is more recent than - * clock_info->last_cycles, if not (too far in the future) treat - * it as old time stamp. This will break every max_clock_info_update_nsec. - */ - - if (delta > clock_info->mask / 2) { - delta = (clock_info->last_cycles - device_timestamp) & - clock_info->mask; - nsec -= ((delta * clock_info->mult) - clock_info->frac) >> - clock_info->shift; - } else { - nsec += ((delta * clock_info->mult) + clock_info->frac) >> - clock_info->shift; - } - - return nsec; -} - -enum mlx5dv_context_attr_flags { - MLX5DV_CONTEXT_FLAGS_DEVX = 1 << 0, -}; - -struct mlx5dv_context_attr { - uint32_t flags; /* Use enum mlx5dv_context_attr_flags */ - uint64_t comp_mask; -}; - -bool mlx5dv_is_supported(struct ibv_device *device); - -struct ibv_context * -mlx5dv_open_device(struct ibv_device *device, struct mlx5dv_context_attr *attr); - -struct mlx5dv_devx_obj; - -struct mlx5dv_devx_obj * -mlx5dv_devx_obj_create(struct ibv_context *context, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_obj_query(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_obj_modify(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_obj_destroy(struct mlx5dv_devx_obj *obj); -int mlx5dv_devx_general_cmd(struct ibv_context *context, const void *in, size_t inlen, - void *out, size_t outlen); - -struct mlx5dv_devx_umem { - uint32_t umem_id; -}; - -struct mlx5dv_devx_umem * -mlx5dv_devx_umem_reg(struct ibv_context *ctx, void *addr, size_t size, uint32_t access); -int mlx5dv_devx_umem_dereg(struct mlx5dv_devx_umem *umem); - -struct mlx5dv_devx_uar { - void *reg_addr; - void *base_addr; - uint32_t page_id; - off_t mmap_off; - uint64_t comp_mask; -}; - -struct mlx5dv_devx_uar *mlx5dv_devx_alloc_uar(struct ibv_context *context, - uint32_t flags); -void mlx5dv_devx_free_uar(struct mlx5dv_devx_uar *devx_uar); - - -struct mlx5dv_var { - uint32_t page_id; - uint32_t length; - off_t mmap_off; - uint64_t comp_mask; -}; - -struct mlx5dv_var * -mlx5dv_alloc_var(struct ibv_context *context, uint32_t flags); -void mlx5dv_free_var(struct mlx5dv_var *dv_var); - -int mlx5dv_devx_query_eqn(struct ibv_context *context, uint32_t vector, - uint32_t *eqn); - -int mlx5dv_devx_cq_query(struct ibv_cq *cq, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_cq_modify(struct ibv_cq *cq, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_qp_query(struct ibv_qp *qp, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_qp_modify(struct ibv_qp *qp, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_srq_query(struct ibv_srq *srq, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_srq_modify(struct ibv_srq *srq, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_wq_query(struct ibv_wq *wq, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_wq_modify(struct ibv_wq *wq, const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_ind_tbl_query(struct ibv_rwq_ind_table *ind_tbl, - const void *in, size_t inlen, - void *out, size_t outlen); -int mlx5dv_devx_ind_tbl_modify(struct ibv_rwq_ind_table *ind_tbl, - const void *in, size_t inlen, - void *out, size_t outlen); - -struct mlx5dv_devx_cmd_comp { - int fd; -}; - -struct mlx5dv_devx_cmd_comp * -mlx5dv_devx_create_cmd_comp(struct ibv_context *context); -void mlx5dv_devx_destroy_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp); -int mlx5dv_devx_obj_query_async(struct mlx5dv_devx_obj *obj, const void *in, - size_t inlen, size_t outlen, - uint64_t wr_id, - struct mlx5dv_devx_cmd_comp *cmd_comp); - -int mlx5dv_devx_get_async_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp, - struct mlx5dv_devx_async_cmd_hdr *cmd_resp, - size_t cmd_resp_len); - -struct mlx5dv_devx_event_channel { - int fd; -}; - -struct mlx5dv_devx_event_channel * -mlx5dv_devx_create_event_channel(struct ibv_context *context, - enum mlx5dv_devx_create_event_channel_flags flags); -void mlx5dv_devx_destroy_event_channel(struct mlx5dv_devx_event_channel *event_channel); - - -int mlx5dv_devx_subscribe_devx_event(struct mlx5dv_devx_event_channel *event_channel, - struct mlx5dv_devx_obj *obj, /* can be NULL for unaffiliated events */ - uint16_t events_sz, - uint16_t events_num[], - uint64_t cookie); - -int mlx5dv_devx_subscribe_devx_event_fd(struct mlx5dv_devx_event_channel *event_channel, - int fd, - struct mlx5dv_devx_obj *obj, /* can be NULL for unaffiliated events */ - uint16_t event_num); - -/* return code: upon success number of bytes read, otherwise -1 and errno was set */ -ssize_t mlx5dv_devx_get_event(struct mlx5dv_devx_event_channel *event_channel, - struct mlx5dv_devx_async_event_hdr *event_data, - size_t event_resp_len); - - -#define __devx_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)NULL) -#define __devx_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits) -#define __devx_bit_sz(typ, fld) sizeof(__devx_nullp(typ)->fld) -#define __devx_bit_off(typ, fld) offsetof(struct mlx5_ifc_##typ##_bits, fld) -#define __devx_dw_off(bit_off) ((bit_off) / 32) -#define __devx_64_off(bit_off) ((bit_off) / 64) -#define __devx_dw_bit_off(bit_sz, bit_off) (32 - (bit_sz) - ((bit_off) & 0x1f)) -#define __devx_mask(bit_sz) ((uint32_t)((1ull << (bit_sz)) - 1)) -#define __devx_dw_mask(bit_sz, bit_off) \ - (__devx_mask(bit_sz) << __devx_dw_bit_off(bit_sz, bit_off)) - -#define DEVX_FLD_SZ_BYTES(typ, fld) (__devx_bit_sz(typ, fld) / 8) -#define DEVX_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8) -#define DEVX_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32) -#define DEVX_ST_SZ_QW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 64) -#define DEVX_UN_SZ_BYTES(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 8) -#define DEVX_UN_SZ_DW(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 32) -#define DEVX_BYTE_OFF(typ, fld) (__devx_bit_off(typ, fld) / 8) -#define DEVX_ADDR_OF(typ, p, fld) \ - ((unsigned char *)(p) + DEVX_BYTE_OFF(typ, fld)) - -static inline void _devx_set(void *p, uint32_t value, size_t bit_off, - size_t bit_sz) -{ - __be32 *fld = (__be32 *)(p) + __devx_dw_off(bit_off); - uint32_t dw_mask = __devx_dw_mask(bit_sz, bit_off); - uint32_t mask = __devx_mask(bit_sz); - - *fld = htobe32((be32toh(*fld) & (~dw_mask)) | - ((value & mask) << __devx_dw_bit_off(bit_sz, bit_off))); -} - -#define DEVX_SET(typ, p, fld, v) \ - _devx_set(p, v, __devx_bit_off(typ, fld), __devx_bit_sz(typ, fld)) - -static inline uint32_t _devx_get(const void *p, size_t bit_off, size_t bit_sz) -{ - return ((be32toh(*((const __be32 *)(p) + __devx_dw_off(bit_off))) >> - __devx_dw_bit_off(bit_sz, bit_off)) & - __devx_mask(bit_sz)); -} - -#define DEVX_GET(typ, p, fld) \ - _devx_get(p, __devx_bit_off(typ, fld), __devx_bit_sz(typ, fld)) - -static inline void _devx_set64(void *p, uint64_t v, size_t bit_off) -{ - *((__be64 *)(p) + __devx_64_off(bit_off)) = htobe64(v); -} - -#define DEVX_SET64(typ, p, fld, v) _devx_set64(p, v, __devx_bit_off(typ, fld)) - -static inline uint64_t _devx_get64(const void *p, size_t bit_off) -{ - return be64toh(*((const __be64 *)(p) + __devx_64_off(bit_off))); -} - -#define DEVX_GET64(typ, p, fld) _devx_get64(p, __devx_bit_off(typ, fld)) - -struct mlx5dv_dr_domain; -struct mlx5dv_dr_table; -struct mlx5dv_dr_matcher; -struct mlx5dv_dr_rule; -struct mlx5dv_dr_action; - -enum mlx5dv_dr_domain_type { - MLX5DV_DR_DOMAIN_TYPE_NIC_RX, - MLX5DV_DR_DOMAIN_TYPE_NIC_TX, - MLX5DV_DR_DOMAIN_TYPE_FDB, -}; - -enum mlx5dv_dr_domain_sync_flags { - MLX5DV_DR_DOMAIN_SYNC_FLAGS_SW = 1 << 0, - MLX5DV_DR_DOMAIN_SYNC_FLAGS_HW = 1 << 1, - MLX5DV_DR_DOMAIN_SYNC_FLAGS_MEM = 1 << 2, -}; - -struct mlx5dv_dr_flow_meter_attr { - struct mlx5dv_dr_table *next_table; - uint8_t active; - uint8_t reg_c_index; - size_t flow_meter_parameter_sz; - void *flow_meter_parameter; -}; - -struct mlx5dv_dr_flow_sampler_attr { - uint32_t sample_ratio; - struct mlx5dv_dr_table *default_next_table; - uint32_t num_sample_actions; - struct mlx5dv_dr_action **sample_actions; - __be64 action; -}; - -struct mlx5dv_dr_domain * -mlx5dv_dr_domain_create(struct ibv_context *ctx, - enum mlx5dv_dr_domain_type type); - -int mlx5dv_dr_domain_destroy(struct mlx5dv_dr_domain *domain); - -int mlx5dv_dr_domain_sync(struct mlx5dv_dr_domain *domain, uint32_t flags); - -void mlx5dv_dr_domain_set_reclaim_device_memory(struct mlx5dv_dr_domain *dmn, - bool enable); - -struct mlx5dv_dr_table * -mlx5dv_dr_table_create(struct mlx5dv_dr_domain *domain, uint32_t level); - -int mlx5dv_dr_table_destroy(struct mlx5dv_dr_table *table); - -struct mlx5dv_dr_matcher * -mlx5dv_dr_matcher_create(struct mlx5dv_dr_table *table, - uint16_t priority, - uint8_t match_criteria_enable, - struct mlx5dv_flow_match_parameters *mask); - -int mlx5dv_dr_matcher_destroy(struct mlx5dv_dr_matcher *matcher); - -struct mlx5dv_dr_rule * -mlx5dv_dr_rule_create(struct mlx5dv_dr_matcher *matcher, - struct mlx5dv_flow_match_parameters *value, - size_t num_actions, - struct mlx5dv_dr_action *actions[]); - -int mlx5dv_dr_rule_destroy(struct mlx5dv_dr_rule *rule); - -enum mlx5dv_dr_action_flags { - MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL = 1 << 0, -}; - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_dest_ibv_qp(struct ibv_qp *ibqp); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_dest_table(struct mlx5dv_dr_table *table); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_dest_vport(struct mlx5dv_dr_domain *domain, - uint32_t vport); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_dest_devx_tir(struct mlx5dv_devx_obj *devx_obj); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_dest_ib_port(struct mlx5dv_dr_domain *domain, - uint32_t ib_port); - -enum mlx5dv_dr_action_dest_type { - MLX5DV_DR_ACTION_DEST, - MLX5DV_DR_ACTION_DEST_REFORMAT, -}; - -struct mlx5dv_dr_action_dest_reformat { - struct mlx5dv_dr_action *reformat; - struct mlx5dv_dr_action *dest; -}; - -struct mlx5dv_dr_action_dest_attr { - enum mlx5dv_dr_action_dest_type type; - union { - struct mlx5dv_dr_action *dest; - struct mlx5dv_dr_action_dest_reformat *dest_reformat; - }; -}; - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_dest_array(struct mlx5dv_dr_domain *domain, - size_t num_dest, - struct mlx5dv_dr_action_dest_attr *dests[]); - -struct mlx5dv_dr_action *mlx5dv_dr_action_create_drop(void); - -struct mlx5dv_dr_action *mlx5dv_dr_action_create_default_miss(void); - -struct mlx5dv_dr_action *mlx5dv_dr_action_create_tag(uint32_t tag_value); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_flow_counter(struct mlx5dv_devx_obj *devx_obj, - uint32_t offset); - -enum mlx5dv_dr_action_aso_first_hit_flags { - MLX5DV_DR_ACTION_FLAGS_ASO_FIRST_HIT_SET = 1 << 0, -}; - -enum mlx5dv_dr_action_aso_flow_meter_flags { - MLX5DV_DR_ACTION_FLAGS_ASO_FLOW_METER_RED = 1 << 0, - MLX5DV_DR_ACTION_FLAGS_ASO_FLOW_METER_YELLOW = 1 << 1, - MLX5DV_DR_ACTION_FLAGS_ASO_FLOW_METER_GREEN = 1 << 2, - MLX5DV_DR_ACTION_FLAGS_ASO_FLOW_METER_UNDEFINED = 1 << 3, -}; - -enum mlx5dv_dr_action_aso_ct_flags { - MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR = 1 << 0, - MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_RESPONDER = 1 << 1, -}; - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_aso(struct mlx5dv_dr_domain *domain, - struct mlx5dv_devx_obj *devx_obj, - uint32_t offset, - uint32_t flags, - uint8_t return_reg_c); - -int mlx5dv_dr_action_modify_aso(struct mlx5dv_dr_action *action, - uint32_t offset, - uint32_t flags, - uint8_t return_reg_c); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_packet_reformat(struct mlx5dv_dr_domain *domain, - uint32_t flags, - enum mlx5dv_flow_action_packet_reformat_type reformat_type, - size_t data_sz, void *data); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_modify_header(struct mlx5dv_dr_domain *domain, - uint32_t flags, - size_t actions_sz, - __be64 actions[]); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_flow_meter(struct mlx5dv_dr_flow_meter_attr *attr); - -int mlx5dv_dr_action_modify_flow_meter(struct mlx5dv_dr_action *action, - struct mlx5dv_dr_flow_meter_attr *attr, - __be64 modify_field_select); - -struct mlx5dv_dr_action * -mlx5dv_dr_action_create_flow_sampler(struct mlx5dv_dr_flow_sampler_attr *attr); - -struct mlx5dv_dr_action *mlx5dv_dr_action_create_pop_vlan(void); - -struct mlx5dv_dr_action -*mlx5dv_dr_action_create_push_vlan(struct mlx5dv_dr_domain *domain, - __be32 vlan_hdr); - -int mlx5dv_dr_action_destroy(struct mlx5dv_dr_action *action); - -int mlx5dv_dump_dr_domain(FILE *fout, struct mlx5dv_dr_domain *domain); -int mlx5dv_dump_dr_table(FILE *fout, struct mlx5dv_dr_table *table); -int mlx5dv_dump_dr_matcher(FILE *fout, struct mlx5dv_dr_matcher *matcher); -int mlx5dv_dump_dr_rule(FILE *fout, struct mlx5dv_dr_rule *rule); - -struct mlx5dv_pp { - uint16_t index; -}; - -struct mlx5dv_pp *mlx5dv_pp_alloc(struct ibv_context *context, - size_t pp_context_sz, - const void *pp_context, - uint32_t flags); - -void mlx5dv_pp_free(struct mlx5dv_pp *pp); - -int mlx5dv_query_qp_lag_port(struct ibv_qp *qp, - uint8_t *port_num, - uint8_t *active_port_num); - -int mlx5dv_modify_qp_lag_port(struct ibv_qp *qp, uint8_t port_num); - -int mlx5dv_modify_qp_udp_sport(struct ibv_qp *qp, uint16_t udp_sport); - -enum mlx5dv_sched_elem_attr_flags { - MLX5DV_SCHED_ELEM_ATTR_FLAGS_BW_SHARE = 1 << 0, - MLX5DV_SCHED_ELEM_ATTR_FLAGS_MAX_AVG_BW = 1 << 1, -}; - -struct mlx5dv_sched_attr { - struct mlx5dv_sched_node *parent; - uint32_t flags; /* Use mlx5dv_sched_elem_attr_flags */ - uint32_t bw_share; - uint32_t max_avg_bw; - uint64_t comp_mask; -}; - -struct mlx5dv_sched_node; -struct mlx5dv_sched_leaf; - -struct mlx5dv_sched_node * -mlx5dv_sched_node_create(struct ibv_context *context, - const struct mlx5dv_sched_attr *sched_attr); -struct mlx5dv_sched_leaf * -mlx5dv_sched_leaf_create(struct ibv_context *context, - const struct mlx5dv_sched_attr *sched_attr); - -int mlx5dv_sched_node_modify(struct mlx5dv_sched_node *node, - const struct mlx5dv_sched_attr *sched_attr); - -int mlx5dv_sched_leaf_modify(struct mlx5dv_sched_leaf *leaf, - const struct mlx5dv_sched_attr *sched_attr); - -int mlx5dv_sched_node_destroy(struct mlx5dv_sched_node *node); - -int mlx5dv_sched_leaf_destroy(struct mlx5dv_sched_leaf *leaf); - -int mlx5dv_modify_qp_sched_elem(struct ibv_qp *qp, - const struct mlx5dv_sched_leaf *requestor, - const struct mlx5dv_sched_leaf *responder); - -int mlx5dv_reserved_qpn_alloc(struct ibv_context *ctx, uint32_t *qpn); -int mlx5dv_reserved_qpn_dealloc(struct ibv_context *ctx, uint32_t qpn); - -#ifdef __cplusplus -} -#endif - -#endif /* _MLX5DV_H_ */ diff --git a/contrib/libs/ibdrv/include/infiniband/sa.h b/contrib/libs/ibdrv/include/infiniband/sa.h deleted file mode 100644 index e7f96dd5ed..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/sa.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2004 Topspin Communications. All rights reserved. - * Copyright (c) 2005 Voltaire, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef INFINIBAND_SA_H -#define INFINIBAND_SA_H - -#include <infiniband/verbs.h> -#include <linux/types.h> - -struct ibv_sa_path_rec { - /* reserved */ - /* reserved */ - union ibv_gid dgid; - union ibv_gid sgid; - __be16 dlid; - __be16 slid; - int raw_traffic; - /* reserved */ - __be32 flow_label; - uint8_t hop_limit; - uint8_t traffic_class; - int reversible; - uint8_t numb_path; - __be16 pkey; - /* reserved */ - uint8_t sl; - uint8_t mtu_selector; - uint8_t mtu; - uint8_t rate_selector; - uint8_t rate; - uint8_t packet_life_time_selector; - uint8_t packet_life_time; - uint8_t preference; -}; - -struct ibv_sa_mcmember_rec { - union ibv_gid mgid; - union ibv_gid port_gid; - uint32_t qkey; - uint16_t mlid; - uint8_t mtu_selector; - uint8_t mtu; - uint8_t traffic_class; - uint16_t pkey; - uint8_t rate_selector; - uint8_t rate; - uint8_t packet_life_time_selector; - uint8_t packet_life_time; - uint8_t sl; - uint32_t flow_label; - uint8_t hop_limit; - uint8_t scope; - uint8_t join_state; - int proxy_join; -}; - -struct ibv_sa_service_rec { - uint64_t id; - union ibv_gid gid; - uint16_t pkey; - /* uint16_t resv; */ - uint32_t lease; - uint8_t key[16]; - uint8_t name[64]; - uint8_t data8[16]; - uint16_t data16[8]; - uint32_t data32[4]; - uint64_t data64[2]; -}; - -#define IBV_PATH_RECORD_REVERSIBLE 0x80 - -struct ibv_path_record { - __be64 service_id; - union ibv_gid dgid; - union ibv_gid sgid; - __be16 dlid; - __be16 slid; - __be32 flowlabel_hoplimit; /* resv-31:28 flow label-27:8 hop limit-7:0*/ - uint8_t tclass; - uint8_t reversible_numpath; /* reversible-7:7 num path-6:0 */ - __be16 pkey; - __be16 qosclass_sl; /* qos class-15:4 sl-3:0 */ - uint8_t mtu; /* mtu selector-7:6 mtu-5:0 */ - uint8_t rate; /* rate selector-7:6 rate-5:0 */ - uint8_t packetlifetime; /* lifetime selector-7:6 lifetime-5:0 */ - uint8_t preference; - uint8_t reserved[6]; -}; - -#define IBV_PATH_FLAG_GMP (1<<0) -#define IBV_PATH_FLAG_PRIMARY (1<<1) -#define IBV_PATH_FLAG_ALTERNATE (1<<2) -#define IBV_PATH_FLAG_OUTBOUND (1<<3) -#define IBV_PATH_FLAG_INBOUND (1<<4) -#define IBV_PATH_FLAG_INBOUND_REVERSE (1<<5) -#define IBV_PATH_FLAG_BIDIRECTIONAL (IBV_PATH_FLAG_OUTBOUND | \ - IBV_PATH_FLAG_INBOUND_REVERSE) - -struct ibv_path_data { - uint32_t flags; - uint32_t reserved; - struct ibv_path_record path; -}; - -#endif /* INFINIBAND_SA_H */ diff --git a/contrib/libs/ibdrv/include/infiniband/tm_types.h b/contrib/libs/ibdrv/include/infiniband/tm_types.h deleted file mode 100644 index f1b302ad34..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/tm_types.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ -#ifndef _TM_TYPES_H -#define _TM_TYPES_H - -#include <linux/types.h> -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -enum ibv_tmh_op { - IBV_TMH_NO_TAG = 0, - IBV_TMH_RNDV = 1, - IBV_TMH_FIN = 2, - IBV_TMH_EAGER = 3, -}; - -struct ibv_tmh { - uint8_t opcode; /* from enum ibv_tmh_op */ - uint8_t reserved[3]; /* must be zero */ - __be32 app_ctx; /* opaque user data */ - __be64 tag; -}; - -struct ibv_rvh { - __be64 va; - __be32 rkey; - __be32 len; -}; - -#ifdef __cplusplus -} -#endif -#endif /* _TM_TYPES_H */ diff --git a/contrib/libs/ibdrv/include/infiniband/verbs_api.h b/contrib/libs/ibdrv/include/infiniband/verbs_api.h deleted file mode 100644 index ded6fa401a..0000000000 --- a/contrib/libs/ibdrv/include/infiniband/verbs_api.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017, Mellanox Technologies inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef VERBS_API_H -#define VERBS_API_H - -#if UINTPTR_MAX == UINT32_MAX -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define RDMA_UAPI_PTR(_type, _name) \ - union { \ - struct { \ - _type _name; \ - __u32 _name##_reserved; \ - }; \ - __aligned_u64 _name##_data_u64; \ - } -#else -#define RDMA_UAPI_PTR(_type, _name) \ - union { \ - struct { \ - __u32 _name##_reserved; \ - _type _name; \ - }; \ - __aligned_u64 _name##_data_u64; \ - } -#endif -#elif UINTPTR_MAX == UINT64_MAX -#define RDMA_UAPI_PTR(_type, _name) \ - union { \ - _type _name; \ - __aligned_u64 _name##_data_u64; \ - } -#else -#error "Pointer size not supported" -#endif - -#include <infiniband/ib_user_ioctl_verbs.h> - -#define ibv_flow_action_esp_keymat ib_uverbs_flow_action_esp_keymat -#define IBV_FLOW_ACTION_ESP_KEYMAT_AES_GCM IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM -#define ibv_flow_action_esp_keymat_aes_gcm_iv_algo ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo -#define IBV_FLOW_ACTION_IV_ALGO_SEQ IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ -#define ibv_flow_action_esp_keymat_aes_gcm ib_uverbs_flow_action_esp_keymat_aes_gcm -#define ibv_flow_action_esp_replay ib_uverbs_flow_action_esp_replay -#define IBV_FLOW_ACTION_ESP_REPLAY_NONE IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE -#define IBV_FLOW_ACTION_ESP_REPLAY_BMP IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP -#define ibv_flow_action_esp_replay_bmp ib_uverbs_flow_action_esp_replay_bmp -#define ibv_flow_action_esp_flags ib_uverbs_flow_action_esp_flags -#define IBV_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO -#define IBV_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD -#define IBV_FLOW_ACTION_ESP_FLAGS_TUNNEL IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL -#define IBV_FLOW_ACTION_ESP_FLAGS_TRANSPORT IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT -#define IBV_FLOW_ACTION_ESP_FLAGS_DECRYPT IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT -#define IBV_FLOW_ACTION_ESP_FLAGS_ENCRYPT IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT -#define IBV_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW -#define ibv_flow_action_esp_encap ib_uverbs_flow_action_esp_encap -#define ibv_flow_action_esp ib_uverbs_flow_action_esp - -#define ibv_advise_mr_advice ib_uverbs_advise_mr_advice -#define IBV_ADVISE_MR_ADVICE_PREFETCH IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH -#define IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE - -#define IBV_ADVISE_MR_FLAG_FLUSH IB_UVERBS_ADVISE_MR_FLAG_FLUSH - -#define IBV_QPF_GRH_REQUIRED IB_UVERBS_QPF_GRH_REQUIRED - -#define IBV_ACCESS_OPTIONAL_RANGE IB_UVERBS_ACCESS_OPTIONAL_RANGE -#define IBV_ACCESS_OPTIONAL_FIRST IB_UVERBS_ACCESS_OPTIONAL_FIRST -#endif - diff --git a/contrib/libs/ibdrv/include/rdma/rdma_verbs.h b/contrib/libs/ibdrv/include/rdma/rdma_verbs.h deleted file mode 100644 index 10049c31ce..0000000000 --- a/contrib/libs/ibdrv/include/rdma/rdma_verbs.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (c) 2010-2014 Intel Corporation. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#if !defined(RDMA_VERBS_H) -#define RDMA_VERBS_H - -#include <assert.h> -#include <infiniband/verbs.h> -#include <rdma/rdma_cma.h> -#include <errno.h> - -#ifdef __cplusplus -extern "C" { -#endif - -static inline int rdma_seterrno(int ret) -{ - if (ret) { - errno = ret; - ret = -1; - } - return ret; -} - -/* - * Shared receive queues. - */ -int rdma_create_srq(struct rdma_cm_id *id, struct ibv_pd *pd, - struct ibv_srq_init_attr *attr); -int rdma_create_srq_ex(struct rdma_cm_id *id, struct ibv_srq_init_attr_ex *attr); - -void rdma_destroy_srq(struct rdma_cm_id *id); - - -/* - * Memory registration helpers. - */ -static inline struct ibv_mr * -rdma_reg_msgs(struct rdma_cm_id *id, void *addr, size_t length) -{ - return ibv_reg_mr(id->pd, addr, length, IBV_ACCESS_LOCAL_WRITE); -} - -static inline struct ibv_mr * -rdma_reg_read(struct rdma_cm_id *id, void *addr, size_t length) -{ - return ibv_reg_mr(id->pd, addr, length, IBV_ACCESS_LOCAL_WRITE | - IBV_ACCESS_REMOTE_READ); -} - -static inline struct ibv_mr * -rdma_reg_write(struct rdma_cm_id *id, void *addr, size_t length) -{ - return ibv_reg_mr(id->pd, addr, length, IBV_ACCESS_LOCAL_WRITE | - IBV_ACCESS_REMOTE_WRITE); -} - -static inline int -rdma_dereg_mr(struct ibv_mr *mr) -{ - return rdma_seterrno(ibv_dereg_mr(mr)); -} - - -/* - * Vectored send, receive, and RDMA operations. - * Support multiple scatter-gather entries. - */ -static inline int -rdma_post_recvv(struct rdma_cm_id *id, void *context, struct ibv_sge *sgl, - int nsge) -{ - struct ibv_recv_wr wr, *bad; - - wr.wr_id = (uintptr_t) context; - wr.next = NULL; - wr.sg_list = sgl; - wr.num_sge = nsge; - - if (id->srq) - return rdma_seterrno(ibv_post_srq_recv(id->srq, &wr, &bad)); - else - return rdma_seterrno(ibv_post_recv(id->qp, &wr, &bad)); -} - -static inline int -rdma_post_sendv(struct rdma_cm_id *id, void *context, struct ibv_sge *sgl, - int nsge, int flags) -{ - struct ibv_send_wr wr, *bad; - - wr.wr_id = (uintptr_t) context; - wr.next = NULL; - wr.sg_list = sgl; - wr.num_sge = nsge; - wr.opcode = IBV_WR_SEND; - wr.send_flags = flags; - - return rdma_seterrno(ibv_post_send(id->qp, &wr, &bad)); -} - -static inline int -rdma_post_readv(struct rdma_cm_id *id, void *context, struct ibv_sge *sgl, - int nsge, int flags, uint64_t remote_addr, uint32_t rkey) -{ - struct ibv_send_wr wr, *bad; - - wr.wr_id = (uintptr_t) context; - wr.next = NULL; - wr.sg_list = sgl; - wr.num_sge = nsge; - wr.opcode = IBV_WR_RDMA_READ; - wr.send_flags = flags; - wr.wr.rdma.remote_addr = remote_addr; - wr.wr.rdma.rkey = rkey; - - return rdma_seterrno(ibv_post_send(id->qp, &wr, &bad)); -} - -static inline int -rdma_post_writev(struct rdma_cm_id *id, void *context, struct ibv_sge *sgl, - int nsge, int flags, uint64_t remote_addr, uint32_t rkey) -{ - struct ibv_send_wr wr, *bad; - - wr.wr_id = (uintptr_t) context; - wr.next = NULL; - wr.sg_list = sgl; - wr.num_sge = nsge; - wr.opcode = IBV_WR_RDMA_WRITE; - wr.send_flags = flags; - wr.wr.rdma.remote_addr = remote_addr; - wr.wr.rdma.rkey = rkey; - - return rdma_seterrno(ibv_post_send(id->qp, &wr, &bad)); -} - -/* - * Simple send, receive, and RDMA calls. - */ -static inline int -rdma_post_recv(struct rdma_cm_id *id, void *context, void *addr, - size_t length, struct ibv_mr *mr) -{ - struct ibv_sge sge; - - assert((addr >= mr->addr) && - (((uint8_t *) addr + length) <= ((uint8_t *) mr->addr + mr->length))); - sge.addr = (uint64_t) (uintptr_t) addr; - sge.length = (uint32_t) length; - sge.lkey = mr->lkey; - - return rdma_post_recvv(id, context, &sge, 1); -} - -static inline int -rdma_post_send(struct rdma_cm_id *id, void *context, void *addr, - size_t length, struct ibv_mr *mr, int flags) -{ - struct ibv_sge sge; - - sge.addr = (uint64_t) (uintptr_t) addr; - sge.length = (uint32_t) length; - sge.lkey = mr ? mr->lkey : 0; - - return rdma_post_sendv(id, context, &sge, 1, flags); -} - -static inline int -rdma_post_read(struct rdma_cm_id *id, void *context, void *addr, - size_t length, struct ibv_mr *mr, int flags, - uint64_t remote_addr, uint32_t rkey) -{ - struct ibv_sge sge; - - sge.addr = (uint64_t) (uintptr_t) addr; - sge.length = (uint32_t) length; - sge.lkey = mr->lkey; - - return rdma_post_readv(id, context, &sge, 1, flags, remote_addr, rkey); -} - -static inline int -rdma_post_write(struct rdma_cm_id *id, void *context, void *addr, - size_t length, struct ibv_mr *mr, int flags, - uint64_t remote_addr, uint32_t rkey) -{ - struct ibv_sge sge; - - sge.addr = (uint64_t) (uintptr_t) addr; - sge.length = (uint32_t) length; - sge.lkey = mr ? mr->lkey : 0; - - return rdma_post_writev(id, context, &sge, 1, flags, remote_addr, rkey); -} - -static inline int -rdma_post_ud_send(struct rdma_cm_id *id, void *context, void *addr, - size_t length, struct ibv_mr *mr, int flags, - struct ibv_ah *ah, uint32_t remote_qpn) -{ - struct ibv_send_wr wr, *bad; - struct ibv_sge sge; - - sge.addr = (uint64_t) (uintptr_t) addr; - sge.length = (uint32_t) length; - sge.lkey = mr ? mr->lkey : 0; - - wr.wr_id = (uintptr_t) context; - wr.next = NULL; - wr.sg_list = &sge; - wr.num_sge = 1; - wr.opcode = IBV_WR_SEND; - wr.send_flags = flags; - wr.wr.ud.ah = ah; - wr.wr.ud.remote_qpn = remote_qpn; - wr.wr.ud.remote_qkey = RDMA_UDP_QKEY; - - return rdma_seterrno(ibv_post_send(id->qp, &wr, &bad)); -} - -static inline int -rdma_get_send_comp(struct rdma_cm_id *id, struct ibv_wc *wc) -{ - struct ibv_cq *cq; - void *context; - int ret; - - do { - ret = ibv_poll_cq(id->send_cq, 1, wc); - if (ret) - break; - - ret = ibv_req_notify_cq(id->send_cq, 0); - if (ret) - return rdma_seterrno(ret); - - ret = ibv_poll_cq(id->send_cq, 1, wc); - if (ret) - break; - - ret = ibv_get_cq_event(id->send_cq_channel, &cq, &context); - if (ret) - return ret; - - assert(cq == id->send_cq && context == id); - ibv_ack_cq_events(id->send_cq, 1); - } while (1); - - return (ret < 0) ? rdma_seterrno(ret) : ret; -} - -static inline int -rdma_get_recv_comp(struct rdma_cm_id *id, struct ibv_wc *wc) -{ - struct ibv_cq *cq; - void *context; - int ret; - - do { - ret = ibv_poll_cq(id->recv_cq, 1, wc); - if (ret) - break; - - ret = ibv_req_notify_cq(id->recv_cq, 0); - if (ret) - return rdma_seterrno(ret); - - ret = ibv_poll_cq(id->recv_cq, 1, wc); - if (ret) - break; - - ret = ibv_get_cq_event(id->recv_cq_channel, &cq, &context); - if (ret) - return ret; - - assert(cq == id->recv_cq && context == id); - ibv_ack_cq_events(id->recv_cq, 1); - } while (1); - - return (ret < 0) ? rdma_seterrno(ret) : ret; -} - -#ifdef __cplusplus -} -#endif - -#endif /* RDMA_CMA_H */ diff --git a/contrib/libs/ibdrv/symbols.cpp b/contrib/libs/ibdrv/symbols.cpp deleted file mode 100644 index 87bda96e9d..0000000000 --- a/contrib/libs/ibdrv/symbols.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "symbols.h" - -#include <util/generic/singleton.h> -#include <util/generic/utility.h> -#include <util/system/dynlib.h> - -#define LOADSYM(name, type) {name = (TId<type>::R*)L->SymOptional(#name);} - -const TInfinibandSymbols* IBSym() { - struct TSymbols: TInfinibandSymbols { - TSymbols() { - L.Reset(new TDynamicLibrary("/usr/lib/libibverbs.so")); - - DOVERBS(LOADSYM) - } - - THolder<TDynamicLibrary> L; - }; - - return SingletonWithPriority<TSymbols, 100>(); -} - -const TRdmaSymbols* RDSym() { - struct TSymbols: TRdmaSymbols { - TSymbols() { - L.Reset(new TDynamicLibrary("/usr/lib/librdmacm.so")); - - DORDMA(LOADSYM) - } - - THolder<TDynamicLibrary> L; - }; - - return SingletonWithPriority<TSymbols, 100>(); -} - -const TMlx5Symbols* M5Sym() { - struct TSymbols: TMlx5Symbols { - TSymbols() { - L.Reset(new TDynamicLibrary("/usr/lib/libmlx5.so")); - - DOMLX5(LOADSYM) - } - - THolder<TDynamicLibrary> L; - }; - - return SingletonWithPriority<TSymbols, 100>(); -} - -#undef LOADSYM diff --git a/contrib/libs/ibdrv/symbols.h b/contrib/libs/ibdrv/symbols.h deleted file mode 100644 index ec87815470..0000000000 --- a/contrib/libs/ibdrv/symbols.h +++ /dev/null @@ -1,187 +0,0 @@ -#pragma once - -#define USE_DYNAMIC_OPEN - -#include <infiniband/mlx5dv.h> -#include <infiniband/verbs.h> -#include <rdma/rdma_cma.h> - -#undef ibv_reg_mr -#undef ibv_query_port - -#ifdef __cplusplus -template <class T> -struct TId { - typedef T R; -}; - -#define DOSTRUCT(name, type) TId<type>::R* name; -#else -#define DOSTRUCT(name, type) typeof(name)* name; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// verbs - -#define DOVERBS(M) \ - M(ibv_modify_qp, int (struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask)) \ - M(ibv_create_ah, struct ibv_ah *(struct ibv_pd *pd, struct ibv_ah_attr *attr)) \ - M(ibv_create_cq, struct ibv_cq *(struct ibv_context *context, int cqe, void *cq_context, struct ibv_comp_channel *channel, int comp_vector)) \ - M(ibv_destroy_ah, int (struct ibv_ah *ah)) \ - M(ibv_create_qp, struct ibv_qp *(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr)) \ - M(ibv_fork_init, int (void)) \ - M(ibv_open_device, struct ibv_context *(struct ibv_device *device)) \ - M(ibv_close_device, int (struct ibv_context *context)) \ - M(ibv_alloc_pd, struct ibv_pd *(struct ibv_context *context)) \ - M(ibv_dealloc_pd, int (struct ibv_pd *pd)) \ - M(ibv_free_device_list, void (struct ibv_device **list)) \ - M(ibv_query_device, int (struct ibv_context *context, struct ibv_device_attr *device_attr)) \ - M(ibv_get_device_list, struct ibv_device **(int *num_devices)) \ - M(ibv_destroy_qp, int (struct ibv_qp *qp)) \ - M(ibv_create_srq, struct ibv_srq *(struct ibv_pd *pd, struct ibv_srq_init_attr *srq_init_attr)) \ - M(ibv_destroy_srq, int (struct ibv_srq *srq)) \ - M(ibv_init_ah_from_wc, int (struct ibv_context *context, uint8_t port_num, struct ibv_wc *wc, struct ibv_grh *grh, struct ibv_ah_attr *ah_attr)) \ - M(ibv_reg_mr, struct ibv_mr *(struct ibv_pd *pd, void *addr, size_t length, int access)) \ - M(ibv_reg_mr_iova2, struct ibv_mr *(struct ibv_pd *pd, void *addr, size_t length, uint64_t iova, unsigned int access)) \ - M(ibv_dereg_mr, int (struct ibv_mr *mr)) \ - M(ibv_destroy_cq, int (struct ibv_cq *cq)) \ - M(ibv_query_gid, int (struct ibv_context *context, uint8_t port_num, int index, union ibv_gid *gid)) \ - M(ibv_query_port, int (struct ibv_context *context, uint8_t port_num, struct _compat_ibv_port_attr *port_attr)) \ - M(ibv_wc_status_str, const char *(enum ibv_wc_status status)) \ - M(ibv_get_device_name, const char *(struct ibv_device *device)) \ - M(ibv_get_async_event, int (struct ibv_context *context, struct ibv_async_event *event)) \ - M(ibv_event_type_str, const char *(enum ibv_event_type event)) \ - M(ibv_query_qp, int (struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask, struct ibv_qp_init_attr *init_attr)) \ - M(ibv_resize_cq, int (struct ibv_cq *cq, int cqe)) \ - M(ibv_ack_async_event, void (struct ibv_async_event *event)) \ - M(ibv_create_comp_channel, struct ibv_comp_channel *(struct ibv_context *context)) \ - M(ibv_destroy_comp_channel, int (struct ibv_comp_channel *channel)) \ - M(ibv_get_cq_event, int (struct ibv_comp_channel *channel, struct ibv_cq **cq, void **cq_context)) \ - M(ibv_ack_cq_events, void (struct ibv_cq *cq, unsigned int nevents)) \ - M(ibv_port_state_str, const char *(enum ibv_port_state port_state)) \ -// DOVERBS - -struct TInfinibandSymbols { - DOVERBS(DOSTRUCT) -}; - -const struct TInfinibandSymbols* IBSym(); - -// rdma - -#define DORDMA(M) \ - M(rdma_ack_cm_event, int (struct rdma_cm_event *event)) \ - M(rdma_get_cm_event, int (struct rdma_event_channel *channel, struct rdma_cm_event **event)) \ - M(rdma_create_qp, int (struct rdma_cm_id *id, struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr)) \ - M(rdma_create_event_channel, struct rdma_event_channel * (void)) \ - M(rdma_create_id, int (struct rdma_event_channel *channel, struct rdma_cm_id **id, void *context, enum rdma_port_space ps)) \ - M(rdma_resolve_addr, int (struct rdma_cm_id *id, struct sockaddr *src_addr, struct sockaddr *dst_addr, int timeout_ms)) \ - M(rdma_resolve_route, int (struct rdma_cm_id *id, int timeout_ms)) \ - M(rdma_bind_addr, int (struct rdma_cm_id *id, struct sockaddr *addr)) \ - M(rdma_listen, int (struct rdma_cm_id *id, int backlog)) \ - M(rdma_accept, int (struct rdma_cm_id *id, struct rdma_conn_param *conn_param)) \ - M(rdma_connect, int (struct rdma_cm_id *id, struct rdma_conn_param *conn_param)) \ - M(rdma_disconnect, int (struct rdma_cm_id *id)) \ - M(rdma_set_option, int (struct rdma_cm_id *id, int level, int optname, void *optval, size_t optlen)) \ - M(rdma_destroy_id, int (struct rdma_cm_id *id)) \ - M(rdma_destroy_qp, void (struct rdma_cm_id *id)) \ - M(rdma_get_devices, struct ibv_context **(int *num_devices)) \ - M(rdma_free_devices, void (struct ibv_context **list)) \ - M(rdma_destroy_event_channel, void (struct rdma_event_channel *channel)) \ - M(rdma_reject, int (struct rdma_cm_id *id, const void *private_data, uint8_t private_data_len)) \ - M(rdma_get_dst_port, uint16_t (struct rdma_cm_id *id)) \ - M(rdma_get_src_port, uint16_t (struct rdma_cm_id *id)) \ - M(rdma_getaddrinfo, int (const char *node, const char *service, const struct rdma_addrinfo *hints, struct rdma_addrinfo **res)) \ - M(rdma_freeaddrinfo, void (struct rdma_addrinfo *res)) \ -// DORDMA - -struct TRdmaSymbols { - DORDMA(DOSTRUCT) -}; - -const struct TRdmaSymbols* RDSym(); - -// mlx5 - -#define DOMLX5(M) \ - M(mlx5dv_alloc_var, struct mlx5dv_var *(struct ibv_context *context, uint32_t flags)) \ - M(mlx5dv_create_cq, struct ibv_cq_ex *(struct ibv_context *context, struct ibv_cq_init_attr_ex *cq_attr, struct mlx5dv_cq_init_attr *mlx5_cq_attr)) \ - M(mlx5dv_create_flow, struct ibv_flow *(struct mlx5dv_flow_matcher *matcher, struct mlx5dv_flow_match_parameters *match_value, size_t num_actions, struct mlx5dv_flow_action_attr actions_attr[])) \ - M(mlx5dv_create_flow_matcher, struct mlx5dv_flow_matcher *(struct ibv_context *context, struct mlx5dv_flow_matcher_attr *matcher_attr)) \ - M(mlx5dv_create_qp, struct ibv_qp *(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_attr, struct mlx5dv_qp_init_attr *mlx5_qp_attr)) \ - M(mlx5dv_create_wq, struct ibv_wq *(struct ibv_context *context, struct ibv_wq_init_attr *wq_init_attr, struct mlx5dv_wq_init_attr *mlx5_wq_attr)) \ - M(mlx5dv_destroy_flow_matcher, int (struct mlx5dv_flow_matcher *matcher)) \ - M(mlx5dv_devx_alloc_uar, struct mlx5dv_devx_uar *(struct ibv_context *context, uint32_t flags)) \ - M(mlx5dv_devx_create_cmd_comp, struct mlx5dv_devx_cmd_comp *(struct ibv_context *context)) \ - M(mlx5dv_devx_create_event_channel, struct mlx5dv_devx_event_channel *(struct ibv_context *context, enum mlx5dv_devx_create_event_channel_flags flags)) \ - M(mlx5dv_devx_destroy_cmd_comp, void (struct mlx5dv_devx_cmd_comp *cmd_comp)) \ - M(mlx5dv_devx_destroy_event_channel, void (struct mlx5dv_devx_event_channel *event_channel)) \ - M(mlx5dv_devx_free_uar, void (struct mlx5dv_devx_uar *devx_uar)) \ - M(mlx5dv_devx_general_cmd, int (struct ibv_context *context, const void *in, size_t inlen, void *out, size_t outlen)) \ - M(mlx5dv_devx_get_async_cmd_comp, int (struct mlx5dv_devx_cmd_comp *cmd_comp, struct mlx5dv_devx_async_cmd_hdr *cmd_resp, size_t cmd_resp_len)) \ - M(mlx5dv_devx_get_event, ssize_t (struct mlx5dv_devx_event_channel *event_channel, struct mlx5dv_devx_async_event_hdr *event_data, size_t event_resp_len)) \ - M(mlx5dv_devx_obj_create, struct mlx5dv_devx_obj *(struct ibv_context *context, const void *in, size_t inlen, void *out, size_t outlen)) \ - M(mlx5dv_devx_obj_destroy, int (struct mlx5dv_devx_obj *obj)) \ - M(mlx5dv_devx_obj_modify, int (struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, void *out, size_t outlen)) \ - M(mlx5dv_devx_obj_query, int (struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, void *out, size_t outlen)) \ - M(mlx5dv_devx_obj_query_async, int (struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, size_t outlen, uint64_t wr_id, struct mlx5dv_devx_cmd_comp *cmd_comp)) \ - M(mlx5dv_devx_qp_query, int (struct ibv_qp *qp, const void *in, size_t inlen, void *out, size_t outlen)) \ - M(mlx5dv_devx_query_eqn, int (struct ibv_context *context, uint32_t vector, uint32_t *eqn)) \ - M(mlx5dv_devx_subscribe_devx_event, int (struct mlx5dv_devx_event_channel *event_channel, struct mlx5dv_devx_obj *obj, uint16_t events_sz, uint16_t events_num[], uint64_t cookie)) \ - M(mlx5dv_devx_subscribe_devx_event_fd, int (struct mlx5dv_devx_event_channel *event_channel, int fd, struct mlx5dv_devx_obj *obj, uint16_t event_num)) \ - M(mlx5dv_devx_umem_dereg, int (struct mlx5dv_devx_umem *umem)) \ - M(mlx5dv_devx_umem_reg, struct mlx5dv_devx_umem *(struct ibv_context *ctx, void *addr, size_t size, uint32_t access)) \ - M(mlx5dv_dr_action_create_aso, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, struct mlx5dv_devx_obj *devx_obj, uint32_t offset, uint32_t flags, uint8_t return_reg_c)) \ - M(mlx5dv_dr_action_create_default_miss, struct mlx5dv_dr_action *(void)) \ - M(mlx5dv_dr_action_create_dest_array, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, size_t num_dest, struct mlx5dv_dr_action_dest_attr *dests[])) \ - M(mlx5dv_dr_action_create_dest_devx_tir, struct mlx5dv_dr_action *(struct mlx5dv_devx_obj *devx_obj)) \ - M(mlx5dv_dr_action_create_dest_ib_port, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, uint32_t ib_port)) \ - M(mlx5dv_dr_action_create_dest_ibv_qp, struct mlx5dv_dr_action *(struct ibv_qp *ibqp)) \ - M(mlx5dv_dr_action_create_dest_table, struct mlx5dv_dr_action *(struct mlx5dv_dr_table *table)) \ - M(mlx5dv_dr_action_create_dest_vport, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, uint32_t vport)) \ - M(mlx5dv_dr_action_create_drop, struct mlx5dv_dr_action *(void)) \ - M(mlx5dv_dr_action_create_flow_counter, struct mlx5dv_dr_action *(struct mlx5dv_devx_obj *devx_obj, uint32_t offset)) \ - M(mlx5dv_dr_action_create_flow_meter, struct mlx5dv_dr_action *(struct mlx5dv_dr_flow_meter_attr *attr)) \ - M(mlx5dv_dr_action_create_flow_sampler, struct mlx5dv_dr_action *(struct mlx5dv_dr_flow_sampler_attr *attr)) \ - M(mlx5dv_dr_action_create_modify_header, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, uint32_t flags, size_t actions_sz, __be64 actions[])) \ - M(mlx5dv_dr_action_create_packet_reformat, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, uint32_t flags, enum mlx5dv_flow_action_packet_reformat_type reformat_type, size_t data_sz, void *data)) \ - M(mlx5dv_dr_action_create_pop_vlan, struct mlx5dv_dr_action *(void)) \ - M(mlx5dv_dr_action_create_push_vlan, struct mlx5dv_dr_action *(struct mlx5dv_dr_domain *domain, __be32 vlan_hdr)) \ - M(mlx5dv_dr_action_create_tag, struct mlx5dv_dr_action *(uint32_t tag_value)) \ - M(mlx5dv_dr_action_destroy, int (struct mlx5dv_dr_action *action)) \ - M(mlx5dv_dr_action_modify_flow_meter, int (struct mlx5dv_dr_action *action, struct mlx5dv_dr_flow_meter_attr *attr, __be64 modify_field_select)) \ - M(mlx5dv_dr_domain_create, struct mlx5dv_dr_domain *(struct ibv_context *ctx, enum mlx5dv_dr_domain_type type)) \ - M(mlx5dv_dr_domain_destroy, int (struct mlx5dv_dr_domain *domain)) \ - M(mlx5dv_dr_domain_set_reclaim_device_memory, void (struct mlx5dv_dr_domain *dmn, bool enable)) \ - M(mlx5dv_dr_domain_sync, int (struct mlx5dv_dr_domain *domain, uint32_t flags)) \ - M(mlx5dv_dr_matcher_create, struct mlx5dv_dr_matcher *(struct mlx5dv_dr_table *table, uint16_t priority, uint8_t match_criteria_enable, struct mlx5dv_flow_match_parameters *mask)) \ - M(mlx5dv_dr_matcher_destroy, int (struct mlx5dv_dr_matcher *matcher)) \ - M(mlx5dv_dr_rule_create, struct mlx5dv_dr_rule *(struct mlx5dv_dr_matcher *matcher, struct mlx5dv_flow_match_parameters *value, size_t num_actions, struct mlx5dv_dr_action *actions[])) \ - M(mlx5dv_dr_rule_destroy, int (struct mlx5dv_dr_rule *rule)) \ - M(mlx5dv_dr_table_create, struct mlx5dv_dr_table *(struct mlx5dv_dr_domain *domain, uint32_t level)) \ - M(mlx5dv_dr_table_destroy, int (struct mlx5dv_dr_table *table)) \ - M(mlx5dv_dump_dr_domain, int (FILE *fout, struct mlx5dv_dr_domain *domain)) \ - M(mlx5dv_free_var, void (struct mlx5dv_var *dv_var)) \ - M(mlx5dv_init_obj, int (struct mlx5dv_obj *obj, uint64_t obj_type)) \ - M(mlx5dv_open_device, struct ibv_context *(struct ibv_device *device, struct mlx5dv_context_attr *attr)) \ - M(mlx5dv_pp_alloc, struct mlx5dv_pp *(struct ibv_context *context, size_t pp_context_sz, const void *pp_context, uint32_t flags)) \ - M(mlx5dv_pp_free, void (struct mlx5dv_pp *pp)) \ - M(mlx5dv_query_device, int (struct ibv_context *ctx_in, struct mlx5dv_context *attrs_out)) \ - M(mlx5dv_query_devx_port, int (struct ibv_context *ctx, uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port)) \ - M(mlx5dv_set_context_attr, int (struct ibv_context *context, enum mlx5dv_set_ctx_attr_type type, void *attr)) \ -// DOMLX5 - -struct TMlx5Symbols { - DOMLX5(DOSTRUCT) -}; - -const struct TMlx5Symbols* M5Sym(); - -#undef DOSTRUCT - -#ifdef __cplusplus -} -#endif |