siw_verbs.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
  2. /* Authors: Bernard Metzler <[email protected]> */
  3. /* Copyright (c) 2008-2019, IBM Corporation */
  4. #ifndef _SIW_VERBS_H
  5. #define _SIW_VERBS_H
  6. #include <linux/errno.h>
  7. #include <rdma/iw_cm.h>
  8. #include <rdma/ib_verbs.h>
  9. #include <rdma/ib_user_verbs.h>
  10. #include "siw.h"
  11. #include "siw_cm.h"
  12. /*
  13. * siw_copy_sgl()
  14. *
  15. * Copy SGL from RDMA core representation to local
  16. * representation.
  17. */
  18. static inline void siw_copy_sgl(struct ib_sge *sge, struct siw_sge *siw_sge,
  19. int num_sge)
  20. {
  21. while (num_sge--) {
  22. siw_sge->laddr = sge->addr;
  23. siw_sge->length = sge->length;
  24. siw_sge->lkey = sge->lkey;
  25. siw_sge++;
  26. sge++;
  27. }
  28. }
  29. int siw_alloc_ucontext(struct ib_ucontext *base_ctx, struct ib_udata *udata);
  30. void siw_dealloc_ucontext(struct ib_ucontext *base_ctx);
  31. int siw_query_port(struct ib_device *base_dev, u32 port,
  32. struct ib_port_attr *attr);
  33. int siw_get_port_immutable(struct ib_device *base_dev, u32 port,
  34. struct ib_port_immutable *port_immutable);
  35. int siw_query_device(struct ib_device *base_dev, struct ib_device_attr *attr,
  36. struct ib_udata *udata);
  37. int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr,
  38. struct ib_udata *udata);
  39. int siw_query_port(struct ib_device *base_dev, u32 port,
  40. struct ib_port_attr *attr);
  41. int siw_query_gid(struct ib_device *base_dev, u32 port, int idx,
  42. union ib_gid *gid);
  43. int siw_alloc_pd(struct ib_pd *base_pd, struct ib_udata *udata);
  44. int siw_dealloc_pd(struct ib_pd *base_pd, struct ib_udata *udata);
  45. int siw_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attr,
  46. struct ib_udata *udata);
  47. int siw_query_qp(struct ib_qp *base_qp, struct ib_qp_attr *qp_attr,
  48. int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
  49. int siw_verbs_modify_qp(struct ib_qp *base_qp, struct ib_qp_attr *attr,
  50. int attr_mask, struct ib_udata *udata);
  51. int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata);
  52. int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
  53. const struct ib_send_wr **bad_wr);
  54. int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr,
  55. const struct ib_recv_wr **bad_wr);
  56. int siw_destroy_cq(struct ib_cq *base_cq, struct ib_udata *udata);
  57. int siw_poll_cq(struct ib_cq *base_cq, int num_entries, struct ib_wc *wc);
  58. int siw_req_notify_cq(struct ib_cq *base_cq, enum ib_cq_notify_flags flags);
  59. struct ib_mr *siw_reg_user_mr(struct ib_pd *base_pd, u64 start, u64 len,
  60. u64 rnic_va, int rights, struct ib_udata *udata);
  61. struct ib_mr *siw_alloc_mr(struct ib_pd *base_pd, enum ib_mr_type mr_type,
  62. u32 max_sge);
  63. struct ib_mr *siw_get_dma_mr(struct ib_pd *base_pd, int rights);
  64. int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,
  65. unsigned int *sg_off);
  66. int siw_dereg_mr(struct ib_mr *base_mr, struct ib_udata *udata);
  67. int siw_create_srq(struct ib_srq *base_srq, struct ib_srq_init_attr *attr,
  68. struct ib_udata *udata);
  69. int siw_modify_srq(struct ib_srq *base_srq, struct ib_srq_attr *attr,
  70. enum ib_srq_attr_mask mask, struct ib_udata *udata);
  71. int siw_query_srq(struct ib_srq *base_srq, struct ib_srq_attr *attr);
  72. int siw_destroy_srq(struct ib_srq *base_srq, struct ib_udata *udata);
  73. int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr,
  74. const struct ib_recv_wr **bad_wr);
  75. int siw_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma);
  76. void siw_mmap_free(struct rdma_user_mmap_entry *rdma_entry);
  77. void siw_qp_event(struct siw_qp *qp, enum ib_event_type type);
  78. void siw_cq_event(struct siw_cq *cq, enum ib_event_type type);
  79. void siw_srq_event(struct siw_srq *srq, enum ib_event_type type);
  80. void siw_port_event(struct siw_device *dev, u32 port, enum ib_event_type type);
  81. #endif