diff options
Diffstat (limited to 'include/linux/mlx4/device.h')
-rw-r--r-- | include/linux/mlx4/device.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 222815d91c40..6cdf813cd478 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -133,6 +133,11 @@ enum { | |||
133 | MLX4_STAT_RATE_OFFSET = 5 | 133 | MLX4_STAT_RATE_OFFSET = 5 |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) | ||
137 | { | ||
138 | return (major << 32) | (minor << 16) | subminor; | ||
139 | } | ||
140 | |||
136 | struct mlx4_caps { | 141 | struct mlx4_caps { |
137 | u64 fw_ver; | 142 | u64 fw_ver; |
138 | int num_ports; | 143 | int num_ports; |
@@ -189,10 +194,8 @@ struct mlx4_buf_list { | |||
189 | }; | 194 | }; |
190 | 195 | ||
191 | struct mlx4_buf { | 196 | struct mlx4_buf { |
192 | union { | 197 | struct mlx4_buf_list direct; |
193 | struct mlx4_buf_list direct; | 198 | struct mlx4_buf_list *page_list; |
194 | struct mlx4_buf_list *page_list; | ||
195 | } u; | ||
196 | int nbufs; | 199 | int nbufs; |
197 | int npages; | 200 | int npages; |
198 | int page_shift; | 201 | int page_shift; |
@@ -308,6 +311,14 @@ struct mlx4_init_port_param { | |||
308 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, | 311 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, |
309 | struct mlx4_buf *buf); | 312 | struct mlx4_buf *buf); |
310 | void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); | 313 | void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); |
314 | static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) | ||
315 | { | ||
316 | if (BITS_PER_LONG == 64 || buf->nbufs == 1) | ||
317 | return buf->direct.buf + offset; | ||
318 | else | ||
319 | return buf->page_list[offset >> PAGE_SHIFT].buf + | ||
320 | (offset & (PAGE_SIZE - 1)); | ||
321 | } | ||
311 | 322 | ||
312 | int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn); | 323 | int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn); |
313 | void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn); | 324 | void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn); |