@@ -3902,16 +3902,20 @@ static int mlx5e_get_pci_bw(struct mlx5_core_dev *mdev, u32 *pci_bw)
3902
3902
return 0 ;
3903
3903
}
3904
3904
3905
- static bool cqe_compress_heuristic ( u32 link_speed , u32 pci_bw )
3905
+ static bool slow_pci_heuristic ( struct mlx5_core_dev * mdev )
3906
3906
{
3907
- return (link_speed && pci_bw &&
3908
- (pci_bw < 40000 ) && (pci_bw < link_speed ));
3909
- }
3907
+ u32 link_speed = 0 ;
3908
+ u32 pci_bw = 0 ;
3910
3909
3911
- static bool hw_lro_heuristic (u32 link_speed , u32 pci_bw )
3912
- {
3913
- return !(link_speed && pci_bw &&
3914
- (pci_bw <= 16000 ) && (pci_bw < link_speed ));
3910
+ mlx5e_get_max_linkspeed (mdev , & link_speed );
3911
+ mlx5e_get_pci_bw (mdev , & pci_bw );
3912
+ mlx5_core_dbg_once (mdev , "Max link speed = %d, PCI BW = %d\n" ,
3913
+ link_speed , pci_bw );
3914
+
3915
+ #define MLX5E_SLOW_PCI_RATIO (2)
3916
+
3917
+ return link_speed && pci_bw &&
3918
+ link_speed > MLX5E_SLOW_PCI_RATIO * pci_bw ;
3915
3919
}
3916
3920
3917
3921
void mlx5e_set_tx_cq_mode_params (struct mlx5e_params * params , u8 cq_period_mode )
@@ -3980,17 +3984,10 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
3980
3984
u16 max_channels )
3981
3985
{
3982
3986
u8 cq_period_mode = 0 ;
3983
- u32 link_speed = 0 ;
3984
- u32 pci_bw = 0 ;
3985
3987
3986
3988
params -> num_channels = max_channels ;
3987
3989
params -> num_tc = 1 ;
3988
3990
3989
- mlx5e_get_max_linkspeed (mdev , & link_speed );
3990
- mlx5e_get_pci_bw (mdev , & pci_bw );
3991
- mlx5_core_dbg (mdev , "Max link speed = %d, PCI BW = %d\n" ,
3992
- link_speed , pci_bw );
3993
-
3994
3991
/* SQ */
3995
3992
params -> log_sq_size = is_kdump_kernel () ?
3996
3993
MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE :
@@ -4000,7 +3997,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
4000
3997
params -> rx_cqe_compress_def = false;
4001
3998
if (MLX5_CAP_GEN (mdev , cqe_compression ) &&
4002
3999
MLX5_CAP_GEN (mdev , vport_group_manager ))
4003
- params -> rx_cqe_compress_def = cqe_compress_heuristic ( link_speed , pci_bw );
4000
+ params -> rx_cqe_compress_def = slow_pci_heuristic ( mdev );
4004
4001
4005
4002
MLX5E_SET_PFLAG (params , MLX5E_PFLAG_RX_CQE_COMPRESS , params -> rx_cqe_compress_def );
4006
4003
@@ -4011,7 +4008,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
4011
4008
4012
4009
/* TODO: && MLX5_CAP_ETH(mdev, lro_cap) */
4013
4010
if (params -> rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ )
4014
- params -> lro_en = hw_lro_heuristic ( link_speed , pci_bw );
4011
+ params -> lro_en = ! slow_pci_heuristic ( mdev );
4015
4012
params -> lro_timeout = mlx5e_choose_lro_timeout (mdev , MLX5E_DEFAULT_LRO_TIMEOUT );
4016
4013
4017
4014
/* CQ moderation params */
0 commit comments