IB/mlx4: Use multiple WQ blocks to post smaller send WQEs
[linux-block.git] / include / linux / mlx4 / device.h
index 222815d91c40108f87d8c47b3a0f5541d7b0c5ae..6cdf813cd47883b5c38b674003ea650c3a532709 100644 (file)
@@ -133,6 +133,11 @@ enum {
        MLX4_STAT_RATE_OFFSET   = 5
 };
 
+static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
+{
+       return (major << 32) | (minor << 16) | subminor;
+}
+
 struct mlx4_caps {
        u64                     fw_ver;
        int                     num_ports;
@@ -189,10 +194,8 @@ struct mlx4_buf_list {
 };
 
 struct mlx4_buf {
-       union {
-               struct mlx4_buf_list    direct;
-               struct mlx4_buf_list   *page_list;
-       } u;
+       struct mlx4_buf_list    direct;
+       struct mlx4_buf_list   *page_list;
        int                     nbufs;
        int                     npages;
        int                     page_shift;
@@ -308,6 +311,14 @@ struct mlx4_init_port_param {
 int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
                   struct mlx4_buf *buf);
 void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
+static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
+{
+       if (BITS_PER_LONG == 64 || buf->nbufs == 1)
+               return buf->direct.buf + offset;
+       else
+               return buf->page_list[offset >> PAGE_SHIFT].buf +
+                       (offset & (PAGE_SIZE - 1));
+}
 
 int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn);
 void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn);