diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 14:41:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 14:41:08 -0500 |
commit | 70a3a06d01ed9ca887316a881813cdefb8a20170 (patch) | |
tree | fbdb7982040ba77818e4b738d76eef8bb06fb47f /include | |
parent | f6c0ffa8f0b0781f4954cb06f0a81d6c10c1b434 (diff) | |
parent | ef4e359d9b9e2dc022f79840fd207796b524a893 (diff) |
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull infiniband update from Roland Dreier:
"Main batch of InfiniBand/RDMA changes for 3.9:
- SRP error handling fixes from Bart Van Assche
- Implementation of memory windows for mlx4 from Shani Michaeli
- Lots of cxgb4 HW driver fixes from Vipul Pandya
- Make iSER work for virtual functions, other fixes from Or Gerlitz
- Fix for bug in qib HW driver from Mike Marciniszyn
- IPoIB fixes from me, Itai Garbi, Shlomo Pongratz, Yan Burman
- Various cleanups and warning fixes from Julia Lawall, Paul Bolle,
Wei Yongjun"
* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (41 commits)
IB/mlx4: Advertise MW support
IB/mlx4: Support memory window binding
mlx4: Implement memory windows allocation and deallocation
mlx4_core: Enable memory windows in {INIT, QUERY}_HCA
mlx4_core: Disable memory windows for virtual functions
IPoIB: Free ipoib neigh on path record failure so path rec queries are retried
IB/srp: Fail I/O requests if the transport is offline
IB/srp: Avoid endless SCSI error handling loop
IB/srp: Avoid sending a task management function needlessly
IB/srp: Track connection state properly
IB/mlx4: Remove redundant NULL check before kfree
IB/mlx4: Fix compiler warning about uninitialized 'vlan' variable
IB/mlx4: Convert is_xxx variables in build_mlx_header() to bool
IB/iser: Enable iser when FMRs are not supported
IB/iser: Avoid error prints on EAGAIN registration failures
IB/iser: Use proper define for the commands per LUN value advertised to SCSI ML
IB/uverbs: Implement memory windows support in uverbs
IB/core: Add "type 2" memory windows support
mlx4_core: Propagate MR deregistration failures to caller
mlx4_core: Rename MPT-related functions to have mpt_ prefix
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mlx4/device.h | 22 | ||||
-rw-r--r-- | include/linux/mlx4/qp.h | 19 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 73 | ||||
-rw-r--r-- | include/uapi/rdma/ib_user_verbs.h | 16 |
4 files changed, 111 insertions, 19 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 6d48fce06b4a..811f91cf5e8c 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -171,6 +171,7 @@ enum { | |||
171 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) | 171 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) |
172 | 172 | ||
173 | enum { | 173 | enum { |
174 | MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1, | ||
174 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, | 175 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, |
175 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, | 176 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, |
176 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 177 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
@@ -238,7 +239,8 @@ enum { | |||
238 | MLX4_PERM_LOCAL_WRITE = 1 << 11, | 239 | MLX4_PERM_LOCAL_WRITE = 1 << 11, |
239 | MLX4_PERM_REMOTE_READ = 1 << 12, | 240 | MLX4_PERM_REMOTE_READ = 1 << 12, |
240 | MLX4_PERM_REMOTE_WRITE = 1 << 13, | 241 | MLX4_PERM_REMOTE_WRITE = 1 << 13, |
241 | MLX4_PERM_ATOMIC = 1 << 14 | 242 | MLX4_PERM_ATOMIC = 1 << 14, |
243 | MLX4_PERM_BIND_MW = 1 << 15, | ||
242 | }; | 244 | }; |
243 | 245 | ||
244 | enum { | 246 | enum { |
@@ -504,6 +506,18 @@ struct mlx4_mr { | |||
504 | int enabled; | 506 | int enabled; |
505 | }; | 507 | }; |
506 | 508 | ||
509 | enum mlx4_mw_type { | ||
510 | MLX4_MW_TYPE_1 = 1, | ||
511 | MLX4_MW_TYPE_2 = 2, | ||
512 | }; | ||
513 | |||
514 | struct mlx4_mw { | ||
515 | u32 key; | ||
516 | u32 pd; | ||
517 | enum mlx4_mw_type type; | ||
518 | int enabled; | ||
519 | }; | ||
520 | |||
507 | struct mlx4_fmr { | 521 | struct mlx4_fmr { |
508 | struct mlx4_mr mr; | 522 | struct mlx4_mr mr; |
509 | struct mlx4_mpt_entry *mpt; | 523 | struct mlx4_mpt_entry *mpt; |
@@ -802,8 +816,12 @@ u64 mlx4_mtt_addr(struct mlx4_dev *dev, struct mlx4_mtt *mtt); | |||
802 | 816 | ||
803 | int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, | 817 | int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, |
804 | int npages, int page_shift, struct mlx4_mr *mr); | 818 | int npages, int page_shift, struct mlx4_mr *mr); |
805 | void mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr); | 819 | int mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr); |
806 | int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr); | 820 | int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr); |
821 | int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type, | ||
822 | struct mlx4_mw *mw); | ||
823 | void mlx4_mw_free(struct mlx4_dev *dev, struct mlx4_mw *mw); | ||
824 | int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw); | ||
807 | int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | 825 | int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, |
808 | int start_index, int npages, u64 *page_list); | 826 | int start_index, int npages, u64 *page_list); |
809 | int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | 827 | int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 4b4ad6ffef92..67f46ad6920a 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -265,6 +265,11 @@ struct mlx4_wqe_lso_seg { | |||
265 | __be32 header[0]; | 265 | __be32 header[0]; |
266 | }; | 266 | }; |
267 | 267 | ||
268 | enum mlx4_wqe_bind_seg_flags2 { | ||
269 | MLX4_WQE_BIND_ZERO_BASED = (1 << 30), | ||
270 | MLX4_WQE_BIND_TYPE_2 = (1 << 31), | ||
271 | }; | ||
272 | |||
268 | struct mlx4_wqe_bind_seg { | 273 | struct mlx4_wqe_bind_seg { |
269 | __be32 flags1; | 274 | __be32 flags1; |
270 | __be32 flags2; | 275 | __be32 flags2; |
@@ -277,9 +282,9 @@ struct mlx4_wqe_bind_seg { | |||
277 | enum { | 282 | enum { |
278 | MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27, | 283 | MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27, |
279 | MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, | 284 | MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, |
280 | MLX4_WQE_FMR_PERM_REMOTE_READ = 1 << 29, | 285 | MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ = 1 << 29, |
281 | MLX4_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30, | 286 | MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE = 1 << 30, |
282 | MLX4_WQE_FMR_PERM_ATOMIC = 1 << 31 | 287 | MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC = 1 << 31 |
283 | }; | 288 | }; |
284 | 289 | ||
285 | struct mlx4_wqe_fmr_seg { | 290 | struct mlx4_wqe_fmr_seg { |
@@ -304,12 +309,10 @@ struct mlx4_wqe_fmr_ext_seg { | |||
304 | }; | 309 | }; |
305 | 310 | ||
306 | struct mlx4_wqe_local_inval_seg { | 311 | struct mlx4_wqe_local_inval_seg { |
307 | __be32 flags; | 312 | u64 reserved1; |
308 | u32 reserved1; | ||
309 | __be32 mem_key; | 313 | __be32 mem_key; |
310 | u32 reserved2[2]; | 314 | u32 reserved2; |
311 | __be32 guest_id; | 315 | u64 reserved3[2]; |
312 | __be64 pa; | ||
313 | }; | 316 | }; |
314 | 317 | ||
315 | struct mlx4_wqe_raddr_seg { | 318 | struct mlx4_wqe_raddr_seg { |
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 | ||
120 | enum ib_atomic_cap { | 122 | enum ib_atomic_cap { |
@@ -715,6 +717,11 @@ enum ib_mig_state { | |||
715 | IB_MIG_ARMED | 717 | IB_MIG_ARMED |
716 | }; | 718 | }; |
717 | 719 | ||
720 | enum ib_mw_type { | ||
721 | IB_MW_TYPE_1 = 1, | ||
722 | IB_MW_TYPE_2 = 2 | ||
723 | }; | ||
724 | |||
718 | struct ib_qp_attr { | 725 | struct 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 | ||
763 | enum ib_send_flags { | 771 | enum 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 | */ | ||
801 | struct ib_mw_bind_info { | ||
802 | struct ib_mr *mr; | ||
803 | u64 addr; | ||
804 | u64 length; | ||
805 | int mw_access_flags; | ||
806 | }; | ||
807 | |||
783 | struct ib_send_wr { | 808 | struct 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 | ||
845 | struct ib_phys_buf { | 877 | struct 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 | */ | ||
865 | struct ib_mw_bind { | 903 | struct 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 | ||
874 | struct ib_fmr_attr { | 909 | struct 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 | ||
996 | struct ib_fmr { | 1032 | struct 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 | */ |
2023 | int ib_dereg_mr(struct ib_mr *mr); | 2062 | int 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 | */ | ||
2117 | static 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 | */ |
2077 | struct ib_mw *ib_alloc_mw(struct ib_pd *pd); | 2128 | struct 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 | */ |
2088 | static inline int ib_bind_mw(struct ib_qp *qp, | 2143 | static inline int ib_bind_mw(struct ib_qp *qp, |
2089 | struct ib_mw *mw, | 2144 | struct ib_mw *mw, |
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 81aba3a73aa3..805711ea2005 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h | |||
@@ -261,6 +261,22 @@ struct ib_uverbs_dereg_mr { | |||
261 | __u32 mr_handle; | 261 | __u32 mr_handle; |
262 | }; | 262 | }; |
263 | 263 | ||
264 | struct ib_uverbs_alloc_mw { | ||
265 | __u64 response; | ||
266 | __u32 pd_handle; | ||
267 | __u8 mw_type; | ||
268 | __u8 reserved[3]; | ||
269 | }; | ||
270 | |||
271 | struct ib_uverbs_alloc_mw_resp { | ||
272 | __u32 mw_handle; | ||
273 | __u32 rkey; | ||
274 | }; | ||
275 | |||
276 | struct ib_uverbs_dealloc_mw { | ||
277 | __u32 mw_handle; | ||
278 | }; | ||
279 | |||
264 | struct ib_uverbs_create_comp_channel { | 280 | struct ib_uverbs_create_comp_channel { |
265 | __u64 response; | 281 | __u64 response; |
266 | }; | 282 | }; |