net/mlx5: Support setting access rights of dma addresses
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx5 / core / alloc.c
index 42198e64a7f49b03de260c24aff91c491c0cb0fb..8db4b5f0f963b30028e94c40690e988334eb8fc6 100644 (file)
@@ -299,11 +299,18 @@ void mlx5_fill_page_array(struct mlx5_frag_buf *buf, __be64 *pas)
 }
 EXPORT_SYMBOL_GPL(mlx5_fill_page_array);
 
-void mlx5_fill_page_frag_array(struct mlx5_frag_buf *buf, __be64 *pas)
+void mlx5_fill_page_frag_array_perm(struct mlx5_frag_buf *buf, __be64 *pas, u8 perm)
 {
        int i;
 
+       WARN_ON(perm & 0xfc);
        for (i = 0; i < buf->npages; i++)
-               pas[i] = cpu_to_be64(buf->frags[i].map);
+               pas[i] = cpu_to_be64(buf->frags[i].map | perm);
+}
+EXPORT_SYMBOL_GPL(mlx5_fill_page_frag_array_perm);
+
+void mlx5_fill_page_frag_array(struct mlx5_frag_buf *buf, __be64 *pas)
+{
+       mlx5_fill_page_frag_array_perm(buf, pas, 0);
 }
 EXPORT_SYMBOL_GPL(mlx5_fill_page_frag_array);