Skip to content

Commit

Permalink
mlx5en: Configure relaxed PCI read and write ordering for ethernet.
Browse files Browse the repository at this point in the history
This may improve performance in some configurations.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
  • Loading branch information
hselasky committed Jul 12, 2021
1 parent 4692d98 commit de2437f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 13 additions & 1 deletion sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3707,6 +3707,18 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev,
return (0);
}

static void
mlx5e_mkey_set_relaxed_ordering(struct mlx5_core_dev *mdev, void *mkc)
{
bool ro_pci_enable =
pci_get_relaxed_ordering_enabled(mdev->pdev->dev.bsddev);
bool ro_write = MLX5_CAP_GEN(mdev, relaxed_ordering_write);
bool ro_read = MLX5_CAP_GEN(mdev, relaxed_ordering_read);

MLX5_SET(mkc, mkc, relaxed_ordering_read, ro_pci_enable && ro_read);
MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_pci_enable && ro_write);
}

static int
mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
struct mlx5_core_mr *mkey)
Expand All @@ -3729,7 +3741,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
MLX5_SET(mkc, mkc, umr_en, 1); /* used by HW TLS */
MLX5_SET(mkc, mkc, lw, 1);
MLX5_SET(mkc, mkc, lr, 1);

mlx5e_mkey_set_relaxed_ordering(mdev, mkc);
MLX5_SET(mkc, mkc, pd, pdn);
MLX5_SET(mkc, mkc, length64, 1);
MLX5_SET(mkc, mkc, qpn, 0xffffff);
Expand Down
12 changes: 8 additions & 4 deletions sys/dev/mlx5/mlx5_ifc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,12 +1069,14 @@ struct mlx5_ifc_cmd_hca_cap_bits {

u8 reserved_4[0x8];
u8 log_max_cq_sz[0x8];
u8 reserved_5[0xb];
u8 relaxed_ordering_write_umr[0x1];
u8 relaxed_ordering_read_umr[0x1];
u8 reserved_5[0x9];
u8 log_max_cq[0x5];

u8 log_max_eq_sz[0x8];
u8 relaxed_ordering_write[1];
u8 reserved_6[0x1];
u8 relaxed_ordering_write[0x1];
u8 relaxed_ordering_read[0x1];
u8 log_max_mkey[0x6];
u8 reserved_7[0xb];
u8 fast_teardown[0x1];
Expand Down Expand Up @@ -2685,7 +2687,9 @@ struct mlx5_ifc_mkc_bits {

u8 translations_octword_size[0x20];

u8 reserved_7[0x1b];
u8 reserved_at_1c0[0x19];
u8 relaxed_ordering_read[0x1];
u8 reserved_at_1d9[0x1];
u8 log_page_size[0x5];

u8 reserved_8[0x20];
Expand Down

0 comments on commit de2437f

Please sign in to comment.