impl.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. #include "symbols.h"
  2. #include <util/generic/yexception.h>
  3. template <typename Method, typename... Args>
  4. static auto Call(Method* m, Args&&... args) {
  5. Y_ENSURE(m);
  6. return m(std::forward<Args>(args)...);
  7. }
  8. // verbs
  9. Y_HIDDEN
  10. int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) {
  11. return Call(IBSym()->ibv_modify_qp, qp, attr, attr_mask);
  12. }
  13. Y_HIDDEN
  14. int ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
  15. int index, __be16 *pkey) {
  16. return Call(IBSym()->ibv_query_pkey, context, port_num, index, pkey);
  17. }
  18. Y_HIDDEN
  19. const char *ibv_node_type_str(enum ibv_node_type node_type) {
  20. return Call(IBSym()->ibv_node_type_str, node_type);
  21. }
  22. Y_HIDDEN
  23. struct ibv_ah *ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) {
  24. return Call(IBSym()->ibv_create_ah, pd, attr);
  25. }
  26. Y_HIDDEN
  27. struct ibv_cq *ibv_create_cq(struct ibv_context *context, int cqe, void *cq_context, struct ibv_comp_channel *channel, int comp_vector) {
  28. return Call(IBSym()->ibv_create_cq, context, cqe, cq_context, channel, comp_vector);
  29. }
  30. Y_HIDDEN
  31. int ibv_destroy_ah(struct ibv_ah *ah) {
  32. return Call(IBSym()->ibv_destroy_ah, ah);
  33. }
  34. Y_HIDDEN
  35. struct ibv_qp *ibv_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) {
  36. return Call(IBSym()->ibv_create_qp, pd, qp_init_attr);
  37. }
  38. Y_HIDDEN
  39. int ibv_fork_init() {
  40. return Call(IBSym()->ibv_fork_init);
  41. }
  42. Y_HIDDEN
  43. struct ibv_context *ibv_open_device(struct ibv_device *device) {
  44. return Call(IBSym()->ibv_open_device, device);
  45. }
  46. Y_HIDDEN
  47. int ibv_close_device(struct ibv_context *context) {
  48. return Call(IBSym()->ibv_close_device, context);
  49. }
  50. Y_HIDDEN
  51. struct ibv_pd *ibv_alloc_pd(struct ibv_context *context) {
  52. return Call(IBSym()->ibv_alloc_pd, context);
  53. }
  54. Y_HIDDEN
  55. int ibv_dealloc_pd(struct ibv_pd *pd) {
  56. return Call(IBSym()->ibv_dealloc_pd, pd);
  57. }
  58. Y_HIDDEN
  59. void ibv_free_device_list(struct ibv_device **list) {
  60. return Call(IBSym()->ibv_free_device_list, list);
  61. }
  62. Y_HIDDEN
  63. int ibv_query_device(struct ibv_context *context, struct ibv_device_attr *device_attr) {
  64. return Call(IBSym()->ibv_query_device, context, device_attr);
  65. }
  66. Y_HIDDEN
  67. struct ibv_device **ibv_get_device_list(int *num_devices) {
  68. return Call(IBSym()->ibv_get_device_list, num_devices);
  69. }
  70. Y_HIDDEN
  71. int ibv_destroy_qp(struct ibv_qp *qp) {
  72. return Call(IBSym()->ibv_destroy_qp, qp);
  73. }
  74. Y_HIDDEN
  75. struct ibv_srq *ibv_create_srq(struct ibv_pd *pd, struct ibv_srq_init_attr *srq_init_attr) {
  76. return Call(IBSym()->ibv_create_srq, pd, srq_init_attr);
  77. }
  78. Y_HIDDEN
  79. int ibv_destroy_srq(struct ibv_srq *srq) {
  80. return Call(IBSym()->ibv_destroy_srq, srq);
  81. }
  82. Y_HIDDEN
  83. 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) {
  84. return Call(IBSym()->ibv_init_ah_from_wc, context, port_num, wc, grh, ah_attr);
  85. }
  86. Y_HIDDEN
  87. struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) {
  88. return Call(IBSym()->ibv_reg_mr, pd, addr, length, access);
  89. }
  90. Y_HIDDEN
  91. struct ibv_mr *ibv_reg_mr_iova2(struct ibv_pd *pd, void *addr, size_t length, uint64_t iova, unsigned int access) {
  92. auto symFunc = IBSym()->ibv_reg_mr_iova2;
  93. if (!symFunc) {
  94. // On old versions we don`t have optimized ibv_reg_mr_iova2 on machines,
  95. // so fallback on ibv_reg_mr
  96. return Call(IBSym()->ibv_reg_mr, pd, addr, length, access);
  97. }
  98. return Call(symFunc, pd, addr, length, iova, access);
  99. }
  100. Y_HIDDEN
  101. int ibv_dereg_mr(struct ibv_mr *mr) {
  102. return Call(IBSym()->ibv_dereg_mr, mr);
  103. }
  104. Y_HIDDEN
  105. int ibv_destroy_cq(struct ibv_cq *cq) {
  106. return Call(IBSym()->ibv_destroy_cq, cq);
  107. }
  108. Y_HIDDEN
  109. int ibv_query_gid(struct ibv_context *context, uint8_t port_num, int index, union ibv_gid *gid) {
  110. return Call(IBSym()->ibv_query_gid, context, port_num, index, gid);
  111. }
  112. Y_HIDDEN
  113. int ibv_query_port(struct ibv_context *context, uint8_t port_num, struct _compat_ibv_port_attr *port_attr) {
  114. return Call(IBSym()->ibv_query_port, context, port_num, port_attr);
  115. }
  116. Y_HIDDEN
  117. const char *ibv_wc_status_str(enum ibv_wc_status status) {
  118. return Call(IBSym()->ibv_wc_status_str, status);
  119. }
  120. Y_HIDDEN
  121. const char *ibv_get_device_name(struct ibv_device *device) {
  122. return Call(IBSym()->ibv_get_device_name, device);
  123. }
  124. Y_HIDDEN
  125. int ibv_get_async_event(struct ibv_context *context, struct ibv_async_event *event) {
  126. return Call(IBSym()->ibv_get_async_event, context, event);
  127. }
  128. Y_HIDDEN
  129. const char *ibv_event_type_str(enum ibv_event_type event) {
  130. return Call(IBSym()->ibv_event_type_str, event);
  131. }
  132. Y_HIDDEN
  133. int ibv_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask, struct ibv_qp_init_attr *init_attr) {
  134. return Call(IBSym()->ibv_query_qp, qp, attr, attr_mask, init_attr);
  135. }
  136. Y_HIDDEN
  137. int ibv_resize_cq(struct ibv_cq *cq, int cqe) {
  138. return Call(IBSym()->ibv_resize_cq, cq, cqe);
  139. }
  140. Y_HIDDEN
  141. void ibv_ack_async_event(struct ibv_async_event *event) {
  142. return Call(IBSym()->ibv_ack_async_event, event);
  143. }
  144. Y_HIDDEN
  145. struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context) {
  146. return Call(IBSym()->ibv_create_comp_channel, context);
  147. }
  148. Y_HIDDEN
  149. int ibv_destroy_comp_channel(struct ibv_comp_channel *channel) {
  150. return Call(IBSym()->ibv_destroy_comp_channel, channel);
  151. }
  152. Y_HIDDEN
  153. int ibv_get_cq_event(struct ibv_comp_channel *channel, struct ibv_cq **cq, void **cq_context) {
  154. return Call(IBSym()->ibv_get_cq_event, channel, cq, cq_context);
  155. }
  156. Y_HIDDEN
  157. void ibv_ack_cq_events(struct ibv_cq *cq, unsigned int nevents) {
  158. return Call(IBSym()->ibv_ack_cq_events, cq, nevents);
  159. }
  160. Y_HIDDEN
  161. const char *ibv_port_state_str(enum ibv_port_state port_state) {
  162. return Call(IBSym()->ibv_port_state_str, port_state);
  163. }
  164. // rdma
  165. Y_HIDDEN
  166. int rdma_ack_cm_event(struct rdma_cm_event *event) {
  167. return Call(RDSym()->rdma_ack_cm_event, event);
  168. }
  169. Y_HIDDEN
  170. int rdma_get_cm_event(struct rdma_event_channel *channel, struct rdma_cm_event **event) {
  171. return Call(RDSym()->rdma_get_cm_event, channel, event);
  172. }
  173. Y_HIDDEN
  174. int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr) {
  175. return Call(RDSym()->rdma_create_qp, id, pd, qp_init_attr);
  176. }
  177. Y_HIDDEN
  178. struct rdma_event_channel *rdma_create_event_channel() {
  179. return Call(RDSym()->rdma_create_event_channel);
  180. }
  181. Y_HIDDEN
  182. int rdma_create_id(struct rdma_event_channel *channel, struct rdma_cm_id **id, void *context, enum rdma_port_space ps) {
  183. return Call(RDSym()->rdma_create_id, channel, id, context, ps);
  184. }
  185. Y_HIDDEN
  186. int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, struct sockaddr *dst_addr, int timeout_ms) {
  187. return Call(RDSym()->rdma_resolve_addr, id, src_addr, dst_addr, timeout_ms);
  188. }
  189. Y_HIDDEN
  190. int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms) {
  191. return Call(RDSym()->rdma_resolve_route, id, timeout_ms);
  192. }
  193. Y_HIDDEN
  194. int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr) {
  195. return Call(RDSym()->rdma_bind_addr, id, addr);
  196. }
  197. Y_HIDDEN
  198. int rdma_listen(struct rdma_cm_id *id, int backlog) {
  199. return Call(RDSym()->rdma_listen, id, backlog);
  200. }
  201. Y_HIDDEN
  202. int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) {
  203. return Call(RDSym()->rdma_accept, id, conn_param);
  204. }
  205. Y_HIDDEN
  206. int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) {
  207. return Call(RDSym()->rdma_connect, id, conn_param);
  208. }
  209. Y_HIDDEN
  210. int rdma_disconnect(struct rdma_cm_id *id) {
  211. return Call(RDSym()->rdma_disconnect, id);
  212. }
  213. Y_HIDDEN
  214. int rdma_set_option(struct rdma_cm_id *id, int level, int optname, void *optval, size_t optlen) {
  215. return Call(RDSym()->rdma_set_option, id, level, optname, optval, optlen);
  216. }
  217. Y_HIDDEN
  218. int rdma_destroy_id(struct rdma_cm_id *id) {
  219. return Call(RDSym()->rdma_destroy_id, id);
  220. }
  221. Y_HIDDEN
  222. void rdma_destroy_qp(struct rdma_cm_id *id) {
  223. return Call(RDSym()->rdma_destroy_qp, id);
  224. }
  225. Y_HIDDEN
  226. struct ibv_context **rdma_get_devices(int *num_devices) {
  227. return Call(RDSym()->rdma_get_devices, num_devices);
  228. }
  229. Y_HIDDEN
  230. void rdma_free_devices(struct ibv_context **list) {
  231. return Call(RDSym()->rdma_free_devices, list);
  232. }
  233. Y_HIDDEN
  234. void rdma_destroy_event_channel(struct rdma_event_channel *channel) {
  235. return Call(RDSym()->rdma_destroy_event_channel, channel);
  236. }
  237. Y_HIDDEN
  238. int rdma_reject(struct rdma_cm_id *id, const void *private_data, uint8_t private_data_len) {
  239. return Call(RDSym()->rdma_reject, id, private_data, private_data_len);
  240. }
  241. Y_HIDDEN
  242. uint16_t rdma_get_dst_port(struct rdma_cm_id *id) {
  243. return Call(RDSym()->rdma_get_dst_port, id);
  244. }
  245. Y_HIDDEN
  246. uint16_t rdma_get_src_port(struct rdma_cm_id *id) {
  247. return Call(RDSym()->rdma_get_src_port, id);
  248. }
  249. Y_HIDDEN
  250. int rdma_getaddrinfo(const char *node, const char *service, const struct rdma_addrinfo *hints, struct rdma_addrinfo **res) {
  251. return Call(RDSym()->rdma_getaddrinfo, node, service, hints, res);
  252. }
  253. Y_HIDDEN
  254. void rdma_freeaddrinfo(struct rdma_addrinfo *res) {
  255. return Call(RDSym()->rdma_freeaddrinfo, res);
  256. }
  257. // mlx5
  258. Y_HIDDEN
  259. struct mlx5dv_var *mlx5dv_alloc_var(struct ibv_context *context, uint32_t flags) {
  260. return Call(M5Sym()->mlx5dv_alloc_var, context, flags);
  261. }
  262. Y_HIDDEN
  263. 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) {
  264. return Call(M5Sym()->mlx5dv_create_cq, context, cq_attr, mlx5_cq_attr);
  265. }
  266. Y_HIDDEN
  267. 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[]) {
  268. return Call(M5Sym()->mlx5dv_create_flow, matcher, match_value, num_actions, actions_attr);
  269. }
  270. Y_HIDDEN
  271. struct mlx5dv_flow_matcher *mlx5dv_create_flow_matcher(struct ibv_context *context, struct mlx5dv_flow_matcher_attr *matcher_attr) {
  272. return Call(M5Sym()->mlx5dv_create_flow_matcher, context, matcher_attr);
  273. }
  274. Y_HIDDEN
  275. 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) {
  276. return Call(M5Sym()->mlx5dv_create_qp, context, qp_attr, mlx5_qp_attr);
  277. }
  278. Y_HIDDEN
  279. 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) {
  280. return Call(M5Sym()->mlx5dv_create_wq, context, wq_init_attr, mlx5_wq_attr);
  281. }
  282. Y_HIDDEN
  283. int mlx5dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *matcher) {
  284. return Call(M5Sym()->mlx5dv_destroy_flow_matcher, matcher);
  285. }
  286. Y_HIDDEN
  287. struct mlx5dv_devx_uar *mlx5dv_devx_alloc_uar(struct ibv_context *context, uint32_t flags) {
  288. return Call(M5Sym()->mlx5dv_devx_alloc_uar, context, flags);
  289. }
  290. Y_HIDDEN
  291. struct mlx5dv_devx_cmd_comp *mlx5dv_devx_create_cmd_comp(struct ibv_context *context) {
  292. return Call(M5Sym()->mlx5dv_devx_create_cmd_comp, context);
  293. }
  294. Y_HIDDEN
  295. struct mlx5dv_devx_event_channel *mlx5dv_devx_create_event_channel(struct ibv_context *context, enum mlx5dv_devx_create_event_channel_flags flags) {
  296. return Call(M5Sym()->mlx5dv_devx_create_event_channel, context, flags);
  297. }
  298. Y_HIDDEN
  299. void mlx5dv_devx_destroy_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp) {
  300. return Call(M5Sym()->mlx5dv_devx_destroy_cmd_comp, cmd_comp);
  301. }
  302. Y_HIDDEN
  303. void mlx5dv_devx_destroy_event_channel(struct mlx5dv_devx_event_channel *event_channel) {
  304. return Call(M5Sym()->mlx5dv_devx_destroy_event_channel, event_channel);
  305. }
  306. Y_HIDDEN
  307. void mlx5dv_devx_free_uar(struct mlx5dv_devx_uar *devx_uar) {
  308. return Call(M5Sym()->mlx5dv_devx_free_uar, devx_uar);
  309. }
  310. Y_HIDDEN
  311. int mlx5dv_devx_general_cmd(struct ibv_context *context, const void *in, size_t inlen, void *out, size_t outlen) {
  312. return Call(M5Sym()->mlx5dv_devx_general_cmd, context, in, inlen, out, outlen);
  313. }
  314. Y_HIDDEN
  315. 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) {
  316. return Call(M5Sym()->mlx5dv_devx_get_async_cmd_comp, cmd_comp, cmd_resp, cmd_resp_len);
  317. }
  318. Y_HIDDEN
  319. 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) {
  320. return Call(M5Sym()->mlx5dv_devx_get_event, event_channel, event_data, event_resp_len);
  321. }
  322. Y_HIDDEN
  323. struct mlx5dv_devx_obj *mlx5dv_devx_obj_create(struct ibv_context *context, const void *in, size_t inlen, void *out, size_t outlen) {
  324. return Call(M5Sym()->mlx5dv_devx_obj_create, context, in, inlen, out, outlen);
  325. }
  326. Y_HIDDEN
  327. int mlx5dv_devx_obj_destroy(struct mlx5dv_devx_obj *obj) {
  328. return Call(M5Sym()->mlx5dv_devx_obj_destroy, obj);
  329. }
  330. Y_HIDDEN
  331. int mlx5dv_devx_obj_modify(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, void *out, size_t outlen) {
  332. return Call(M5Sym()->mlx5dv_devx_obj_modify, obj, in, inlen, out, outlen);
  333. }
  334. Y_HIDDEN
  335. int mlx5dv_devx_obj_query(struct mlx5dv_devx_obj *obj, const void *in, size_t inlen, void *out, size_t outlen) {
  336. return Call(M5Sym()->mlx5dv_devx_obj_query, obj, in, inlen, out, outlen);
  337. }
  338. Y_HIDDEN
  339. 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) {
  340. return Call(M5Sym()->mlx5dv_devx_obj_query_async, obj, in, inlen, outlen, wr_id, cmd_comp);
  341. }
  342. Y_HIDDEN
  343. int mlx5dv_devx_qp_query(struct ibv_qp *qp, const void *in, size_t inlen, void *out, size_t outlen) {
  344. return Call(M5Sym()->mlx5dv_devx_qp_query, qp, in, inlen, out, outlen);
  345. }
  346. Y_HIDDEN
  347. int mlx5dv_devx_query_eqn(struct ibv_context *context, uint32_t vector, uint32_t *eqn) {
  348. return Call(M5Sym()->mlx5dv_devx_query_eqn, context, vector, eqn);
  349. }
  350. Y_HIDDEN
  351. 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) {
  352. return Call(M5Sym()->mlx5dv_devx_subscribe_devx_event, event_channel, obj, events_sz, events_num, cookie);
  353. }
  354. Y_HIDDEN
  355. 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) {
  356. return Call(M5Sym()->mlx5dv_devx_subscribe_devx_event_fd, event_channel, fd, obj, event_num);
  357. }
  358. Y_HIDDEN
  359. int mlx5dv_devx_umem_dereg(struct mlx5dv_devx_umem *umem) {
  360. return Call(M5Sym()->mlx5dv_devx_umem_dereg, umem);
  361. }
  362. Y_HIDDEN
  363. struct mlx5dv_devx_umem *mlx5dv_devx_umem_reg(struct ibv_context *ctx, void *addr, size_t size, uint32_t access) {
  364. return Call(M5Sym()->mlx5dv_devx_umem_reg, ctx, addr, size, access);
  365. }
  366. Y_HIDDEN
  367. 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) {
  368. return Call(M5Sym()->mlx5dv_dr_action_create_aso, domain, devx_obj, offset, flags, return_reg_c);
  369. }
  370. Y_HIDDEN
  371. struct mlx5dv_dr_action *mlx5dv_dr_action_create_default_miss(void) {
  372. return Call(M5Sym()->mlx5dv_dr_action_create_default_miss);
  373. }
  374. Y_HIDDEN
  375. 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[]) {
  376. return Call(M5Sym()->mlx5dv_dr_action_create_dest_array, domain, num_dest, dests);
  377. }
  378. Y_HIDDEN
  379. struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_devx_tir(struct mlx5dv_devx_obj *devx_obj) {
  380. return Call(M5Sym()->mlx5dv_dr_action_create_dest_devx_tir, devx_obj);
  381. }
  382. Y_HIDDEN
  383. struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_ib_port(struct mlx5dv_dr_domain *domain, uint32_t ib_port) {
  384. return Call(M5Sym()->mlx5dv_dr_action_create_dest_ib_port, domain, ib_port);
  385. }
  386. Y_HIDDEN
  387. struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_ibv_qp(struct ibv_qp *ibqp) {
  388. return Call(M5Sym()->mlx5dv_dr_action_create_dest_ibv_qp, ibqp);
  389. }
  390. Y_HIDDEN
  391. struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_table(struct mlx5dv_dr_table *table) {
  392. return Call(M5Sym()->mlx5dv_dr_action_create_dest_table, table);
  393. }
  394. Y_HIDDEN
  395. struct mlx5dv_dr_action *mlx5dv_dr_action_create_dest_vport(struct mlx5dv_dr_domain *domain, uint32_t vport) {
  396. return Call(M5Sym()->mlx5dv_dr_action_create_dest_vport, domain, vport);
  397. }
  398. Y_HIDDEN
  399. struct mlx5dv_dr_action *mlx5dv_dr_action_create_drop(void) {
  400. return Call(M5Sym()->mlx5dv_dr_action_create_drop);
  401. }
  402. Y_HIDDEN
  403. struct mlx5dv_dr_action *mlx5dv_dr_action_create_flow_counter(struct mlx5dv_devx_obj *devx_obj, uint32_t offset) {
  404. return Call(M5Sym()->mlx5dv_dr_action_create_flow_counter, devx_obj, offset);
  405. }
  406. Y_HIDDEN
  407. struct mlx5dv_dr_action *mlx5dv_dr_action_create_flow_meter(struct mlx5dv_dr_flow_meter_attr *attr) {
  408. return Call(M5Sym()->mlx5dv_dr_action_create_flow_meter, attr);
  409. }
  410. Y_HIDDEN
  411. struct mlx5dv_dr_action *mlx5dv_dr_action_create_flow_sampler(struct mlx5dv_dr_flow_sampler_attr *attr) {
  412. return Call(M5Sym()->mlx5dv_dr_action_create_flow_sampler, attr);
  413. }
  414. Y_HIDDEN
  415. struct mlx5dv_dr_action *mlx5dv_dr_action_create_modify_header(struct mlx5dv_dr_domain *domain, uint32_t flags, size_t actions_sz, __be64 actions[]) {
  416. return Call(M5Sym()->mlx5dv_dr_action_create_modify_header, domain, flags, actions_sz, actions);
  417. }
  418. Y_HIDDEN
  419. 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) {
  420. return Call(M5Sym()->mlx5dv_dr_action_create_packet_reformat, domain, flags, reformat_type, data_sz, data);
  421. }
  422. Y_HIDDEN
  423. struct mlx5dv_dr_action *mlx5dv_dr_action_create_pop_vlan(void) {
  424. return Call(M5Sym()->mlx5dv_dr_action_create_pop_vlan);
  425. }
  426. Y_HIDDEN
  427. struct mlx5dv_dr_action *mlx5dv_dr_action_create_push_vlan(struct mlx5dv_dr_domain *domain, __be32 vlan_hdr) {
  428. return Call(M5Sym()->mlx5dv_dr_action_create_push_vlan, domain, vlan_hdr);
  429. }
  430. Y_HIDDEN
  431. struct mlx5dv_dr_action *mlx5dv_dr_action_create_tag(uint32_t tag_value) {
  432. return Call(M5Sym()->mlx5dv_dr_action_create_tag, tag_value);
  433. }
  434. Y_HIDDEN
  435. int mlx5dv_dr_action_destroy(struct mlx5dv_dr_action *action) {
  436. return Call(M5Sym()->mlx5dv_dr_action_destroy, action);
  437. }
  438. Y_HIDDEN
  439. int mlx5dv_dr_action_modify_flow_meter(struct mlx5dv_dr_action *action, struct mlx5dv_dr_flow_meter_attr *attr, __be64 modify_field_select) {
  440. return Call(M5Sym()->mlx5dv_dr_action_modify_flow_meter, action, attr, modify_field_select);
  441. }
  442. Y_HIDDEN
  443. struct mlx5dv_dr_domain *mlx5dv_dr_domain_create(struct ibv_context *ctx, enum mlx5dv_dr_domain_type type) {
  444. return Call(M5Sym()->mlx5dv_dr_domain_create, ctx, type);
  445. }
  446. Y_HIDDEN
  447. int mlx5dv_dr_domain_destroy(struct mlx5dv_dr_domain *domain) {
  448. return Call(M5Sym()->mlx5dv_dr_domain_destroy, domain);
  449. }
  450. Y_HIDDEN
  451. void mlx5dv_dr_domain_set_reclaim_device_memory(struct mlx5dv_dr_domain *dmn, bool enable) {
  452. return Call(M5Sym()->mlx5dv_dr_domain_set_reclaim_device_memory, dmn, enable);
  453. }
  454. Y_HIDDEN
  455. int mlx5dv_dr_domain_sync(struct mlx5dv_dr_domain *domain, uint32_t flags) {
  456. return Call(M5Sym()->mlx5dv_dr_domain_sync, domain, flags);
  457. }
  458. Y_HIDDEN
  459. 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) {
  460. return Call(M5Sym()->mlx5dv_dr_matcher_create, table, priority, match_criteria_enable, mask);
  461. }
  462. Y_HIDDEN
  463. int mlx5dv_dr_matcher_destroy(struct mlx5dv_dr_matcher *matcher) {
  464. return Call(M5Sym()->mlx5dv_dr_matcher_destroy, matcher);
  465. }
  466. Y_HIDDEN
  467. 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[]) {
  468. return Call(M5Sym()->mlx5dv_dr_rule_create, matcher, value, num_actions, actions);
  469. }
  470. Y_HIDDEN
  471. int mlx5dv_dr_rule_destroy(struct mlx5dv_dr_rule *rule) {
  472. return Call(M5Sym()->mlx5dv_dr_rule_destroy, rule);
  473. }
  474. Y_HIDDEN
  475. struct mlx5dv_dr_table *mlx5dv_dr_table_create(struct mlx5dv_dr_domain *domain, uint32_t level) {
  476. return Call(M5Sym()->mlx5dv_dr_table_create, domain, level);
  477. }
  478. Y_HIDDEN
  479. int mlx5dv_dr_table_destroy(struct mlx5dv_dr_table *table) {
  480. return Call(M5Sym()->mlx5dv_dr_table_destroy, table);
  481. }
  482. Y_HIDDEN
  483. int mlx5dv_dump_dr_domain(FILE *fout, struct mlx5dv_dr_domain *domain) {
  484. return Call(M5Sym()->mlx5dv_dump_dr_domain, fout, domain);
  485. }
  486. Y_HIDDEN
  487. void mlx5dv_free_var(struct mlx5dv_var *dv_var) {
  488. return Call(M5Sym()->mlx5dv_free_var, dv_var);
  489. }
  490. Y_HIDDEN
  491. int mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type) {
  492. return Call(M5Sym()->mlx5dv_init_obj, obj, obj_type);
  493. }
  494. Y_HIDDEN
  495. struct ibv_context *mlx5dv_open_device(struct ibv_device *device, struct mlx5dv_context_attr *attr) {
  496. return Call(M5Sym()->mlx5dv_open_device, device, attr);
  497. }
  498. Y_HIDDEN
  499. struct mlx5dv_pp *mlx5dv_pp_alloc(struct ibv_context *context, size_t pp_context_sz, const void *pp_context, uint32_t flags) {
  500. return Call(M5Sym()->mlx5dv_pp_alloc, context, pp_context_sz, pp_context, flags);
  501. }
  502. Y_HIDDEN
  503. void mlx5dv_pp_free(struct mlx5dv_pp *pp) {
  504. return Call(M5Sym()->mlx5dv_pp_free, pp);
  505. }
  506. Y_HIDDEN
  507. int mlx5dv_query_device(struct ibv_context *ctx_in, struct mlx5dv_context *attrs_out) {
  508. return Call(M5Sym()->mlx5dv_query_device, ctx_in, attrs_out);
  509. }
  510. Y_HIDDEN
  511. int mlx5dv_query_devx_port(struct ibv_context *ctx, uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port) {
  512. return Call(M5Sym()->mlx5dv_query_devx_port, ctx, port_num, mlx5_devx_port);
  513. }
  514. Y_HIDDEN
  515. int mlx5dv_set_context_attr(struct ibv_context *context, enum mlx5dv_set_ctx_attr_type type, void *attr) {
  516. return Call(M5Sym()->mlx5dv_set_context_attr, context, type, attr);
  517. }