Skip to content

Commit 1dcb6c3

Browse files
Eli CohenSaeed Mahameed
authored andcommitted
net/mlx5: Support setting access rights of dma addresses
mlx5_fill_page_frag_array() is used to populate dma addresses to resources that require it, such as QPs, RQs etc. When the resource is used, PA list permissions are ignored. For resources that use MTT list, the user is required to provide the access rights. Subsequent patches use resources that require MTT lists, so modify API and implementation to support that. Signed-off-by: Eli Cohen <[email protected]> Reviewed-by: Parav Pandit <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 4dca650 commit 1dcb6c3

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/alloc.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,18 @@ void mlx5_fill_page_array(struct mlx5_frag_buf *buf, __be64 *pas)
299299
}
300300
EXPORT_SYMBOL_GPL(mlx5_fill_page_array);
301301

302-
void mlx5_fill_page_frag_array(struct mlx5_frag_buf *buf, __be64 *pas)
302+
void mlx5_fill_page_frag_array_perm(struct mlx5_frag_buf *buf, __be64 *pas, u8 perm)
303303
{
304304
int i;
305305

306+
WARN_ON(perm & 0xfc);
306307
for (i = 0; i < buf->npages; i++)
307-
pas[i] = cpu_to_be64(buf->frags[i].map);
308+
pas[i] = cpu_to_be64(buf->frags[i].map | perm);
309+
}
310+
EXPORT_SYMBOL_GPL(mlx5_fill_page_frag_array_perm);
311+
312+
void mlx5_fill_page_frag_array(struct mlx5_frag_buf *buf, __be64 *pas)
313+
{
314+
mlx5_fill_page_frag_array_perm(buf, pas, 0);
308315
}
309316
EXPORT_SYMBOL_GPL(mlx5_fill_page_frag_array);

include/linux/mlx5/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,7 @@ void mlx5_register_debugfs(void);
971971
void mlx5_unregister_debugfs(void);
972972

973973
void mlx5_fill_page_array(struct mlx5_frag_buf *buf, __be64 *pas);
974+
void mlx5_fill_page_frag_array_perm(struct mlx5_frag_buf *buf, __be64 *pas, u8 perm);
974975
void mlx5_fill_page_frag_array(struct mlx5_frag_buf *frag_buf, __be64 *pas);
975976
int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn,
976977
unsigned int *irqn);

include/linux/mlx5/mlx5_ifc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10653,4 +10653,10 @@ struct mlx5_ifc_tls_progress_params_bits {
1065310653
u8 hw_offset_record_number[0x18];
1065410654
};
1065510655

10656+
enum {
10657+
MLX5_MTT_PERM_READ = 1 << 0,
10658+
MLX5_MTT_PERM_WRITE = 1 << 1,
10659+
MLX5_MTT_PERM_RW = MLX5_MTT_PERM_READ | MLX5_MTT_PERM_WRITE,
10660+
};
10661+
1065610662
#endif /* MLX5_IFC_H */

0 commit comments

Comments
 (0)