aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_verbs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r--include/rdma/ib_verbs.h73
1 files changed, 64 insertions, 9 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 46bc045bbe15..98cc4b29fc5b 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -115,6 +115,8 @@ enum ib_device_cap_flags {
115 IB_DEVICE_XRC = (1<<20), 115 IB_DEVICE_XRC = (1<<20),
116 IB_DEVICE_MEM_MGT_EXTENSIONS = (1<<21), 116 IB_DEVICE_MEM_MGT_EXTENSIONS = (1<<21),
117 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22), 117 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22),
118 IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23),
119 IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24)
118}; 120};
119 121
120enum ib_atomic_cap { 122enum ib_atomic_cap {
@@ -715,6 +717,11 @@ enum ib_mig_state {
715 IB_MIG_ARMED 717 IB_MIG_ARMED
716}; 718};
717 719
720enum ib_mw_type {
721 IB_MW_TYPE_1 = 1,
722 IB_MW_TYPE_2 = 2
723};
724
718struct ib_qp_attr { 725struct ib_qp_attr {
719 enum ib_qp_state qp_state; 726 enum ib_qp_state qp_state;
720 enum ib_qp_state cur_qp_state; 727 enum ib_qp_state cur_qp_state;
@@ -758,6 +765,7 @@ enum ib_wr_opcode {
758 IB_WR_FAST_REG_MR, 765 IB_WR_FAST_REG_MR,
759 IB_WR_MASKED_ATOMIC_CMP_AND_SWP, 766 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
760 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD, 767 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
768 IB_WR_BIND_MW,
761}; 769};
762 770
763enum ib_send_flags { 771enum ib_send_flags {
@@ -780,6 +788,23 @@ struct ib_fast_reg_page_list {
780 unsigned int max_page_list_len; 788 unsigned int max_page_list_len;
781}; 789};
782 790
791/**
792 * struct ib_mw_bind_info - Parameters for a memory window bind operation.
793 * @mr: A memory region to bind the memory window to.
794 * @addr: The address where the memory window should begin.
795 * @length: The length of the memory window, in bytes.
796 * @mw_access_flags: Access flags from enum ib_access_flags for the window.
797 *
798 * This struct contains the shared parameters for type 1 and type 2
799 * memory window bind operations.
800 */
801struct ib_mw_bind_info {
802 struct ib_mr *mr;
803 u64 addr;
804 u64 length;
805 int mw_access_flags;
806};
807
783struct ib_send_wr { 808struct ib_send_wr {
784 struct ib_send_wr *next; 809 struct ib_send_wr *next;
785 u64 wr_id; 810 u64 wr_id;
@@ -823,6 +848,12 @@ struct ib_send_wr {
823 int access_flags; 848 int access_flags;
824 u32 rkey; 849 u32 rkey;
825 } fast_reg; 850 } fast_reg;
851 struct {
852 struct ib_mw *mw;
853 /* The new rkey for the memory window. */
854 u32 rkey;
855 struct ib_mw_bind_info bind_info;
856 } bind_mw;
826 } wr; 857 } wr;
827 u32 xrc_remote_srq_num; /* XRC TGT QPs only */ 858 u32 xrc_remote_srq_num; /* XRC TGT QPs only */
828}; 859};
@@ -839,7 +870,8 @@ enum ib_access_flags {
839 IB_ACCESS_REMOTE_WRITE = (1<<1), 870 IB_ACCESS_REMOTE_WRITE = (1<<1),
840 IB_ACCESS_REMOTE_READ = (1<<2), 871 IB_ACCESS_REMOTE_READ = (1<<2),
841 IB_ACCESS_REMOTE_ATOMIC = (1<<3), 872 IB_ACCESS_REMOTE_ATOMIC = (1<<3),
842 IB_ACCESS_MW_BIND = (1<<4) 873 IB_ACCESS_MW_BIND = (1<<4),
874 IB_ZERO_BASED = (1<<5)
843}; 875};
844 876
845struct ib_phys_buf { 877struct ib_phys_buf {
@@ -862,13 +894,16 @@ enum ib_mr_rereg_flags {
862 IB_MR_REREG_ACCESS = (1<<2) 894 IB_MR_REREG_ACCESS = (1<<2)
863}; 895};
864 896
897/**
898 * struct ib_mw_bind - Parameters for a type 1 memory window bind operation.
899 * @wr_id: Work request id.
900 * @send_flags: Flags from ib_send_flags enum.
901 * @bind_info: More parameters of the bind operation.
902 */
865struct ib_mw_bind { 903struct ib_mw_bind {
866 struct ib_mr *mr; 904 u64 wr_id;
867 u64 wr_id; 905 int send_flags;
868 u64 addr; 906 struct ib_mw_bind_info bind_info;
869 u32 length;
870 int send_flags;
871 int mw_access_flags;
872}; 907};
873 908
874struct ib_fmr_attr { 909struct ib_fmr_attr {
@@ -991,6 +1026,7 @@ struct ib_mw {
991 struct ib_pd *pd; 1026 struct ib_pd *pd;
992 struct ib_uobject *uobject; 1027 struct ib_uobject *uobject;
993 u32 rkey; 1028 u32 rkey;
1029 enum ib_mw_type type;
994}; 1030};
995 1031
996struct ib_fmr { 1032struct ib_fmr {
@@ -1202,7 +1238,8 @@ struct ib_device {
1202 int num_phys_buf, 1238 int num_phys_buf,
1203 int mr_access_flags, 1239 int mr_access_flags,
1204 u64 *iova_start); 1240 u64 *iova_start);
1205 struct ib_mw * (*alloc_mw)(struct ib_pd *pd); 1241 struct ib_mw * (*alloc_mw)(struct ib_pd *pd,
1242 enum ib_mw_type type);
1206 int (*bind_mw)(struct ib_qp *qp, 1243 int (*bind_mw)(struct ib_qp *qp,
1207 struct ib_mw *mw, 1244 struct ib_mw *mw,
1208 struct ib_mw_bind *mw_bind); 1245 struct ib_mw_bind *mw_bind);
@@ -2019,6 +2056,8 @@ int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
2019 * ib_dereg_mr - Deregisters a memory region and removes it from the 2056 * ib_dereg_mr - Deregisters a memory region and removes it from the
2020 * HCA translation table. 2057 * HCA translation table.
2021 * @mr: The memory region to deregister. 2058 * @mr: The memory region to deregister.
2059 *
2060 * This function can fail, if the memory region has memory windows bound to it.
2022 */ 2061 */
2023int ib_dereg_mr(struct ib_mr *mr); 2062int ib_dereg_mr(struct ib_mr *mr);
2024 2063
@@ -2071,10 +2110,22 @@ static inline void ib_update_fast_reg_key(struct ib_mr *mr, u8 newkey)
2071} 2110}
2072 2111
2073/** 2112/**
2113 * ib_inc_rkey - increments the key portion of the given rkey. Can be used
2114 * for calculating a new rkey for type 2 memory windows.
2115 * @rkey - the rkey to increment.
2116 */
2117static inline u32 ib_inc_rkey(u32 rkey)
2118{
2119 const u32 mask = 0x000000ff;
2120 return ((rkey + 1) & mask) | (rkey & ~mask);
2121}
2122
2123/**
2074 * ib_alloc_mw - Allocates a memory window. 2124 * ib_alloc_mw - Allocates a memory window.
2075 * @pd: The protection domain associated with the memory window. 2125 * @pd: The protection domain associated with the memory window.
2126 * @type: The type of the memory window (1 or 2).
2076 */ 2127 */
2077struct ib_mw *ib_alloc_mw(struct ib_pd *pd); 2128struct ib_mw *ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
2078 2129
2079/** 2130/**
2080 * ib_bind_mw - Posts a work request to the send queue of the specified 2131 * ib_bind_mw - Posts a work request to the send queue of the specified
@@ -2084,6 +2135,10 @@ struct ib_mw *ib_alloc_mw(struct ib_pd *pd);
2084 * @mw: The memory window to bind. 2135 * @mw: The memory window to bind.
2085 * @mw_bind: Specifies information about the memory window, including 2136 * @mw_bind: Specifies information about the memory window, including
2086 * its address range, remote access rights, and associated memory region. 2137 * its address range, remote access rights, and associated memory region.
2138 *
2139 * If there is no immediate error, the function will update the rkey member
2140 * of the mw parameter to its new value. The bind operation can still fail
2141 * asynchronously.
2087 */ 2142 */
2088static inline int ib_bind_mw(struct ib_qp *qp, 2143static inline int ib_bind_mw(struct ib_qp *qp,
2089 struct ib_mw *mw, 2144 struct ib_mw *mw,