Subject: Re: [PATCH net-next v4 3/4] dim: introduce a specific dim profile for better latency

From: Simon Horman <[email-masked]>
Date: Mon, 8 Apr 2024 14:12:51 +0100

+ Tal Gilboa

On Fri, Apr 05, 2024 at 10:15:46AM +0200, Louis Peens wrote:
> From: Fei Qin <[email-masked]>
> 
> The current profile is not well-adaptive to NFP NICs in
> terms of latency, so introduce a specific profile for better
> latency.
> 
> Signed-off-by: Fei Qin <[email-masked]>
> Signed-off-by: Louis Peens <[email-masked]>

Noting that this is consistent of review of v1 [1], this looks good to me.

Reviewed-by: Simon Horman <[email-masked]>

[1] https://lore.kernel.org/all/[email-masked]/

> ---
>  include/linux/dim.h |  2 ++
>  lib/dim/net_dim.c   | 18 ++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/include/linux/dim.h b/include/linux/dim.h
> index f343bc9aa2ec..edd6d7bceb28 100644
> --- a/include/linux/dim.h
> +++ b/include/linux/dim.h
> @@ -119,11 +119,13 @@ struct dim {
>   *
>   * @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE
>   * @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset)
> + * @DIM_CQ_PERIOD_MODE_SPECIFIC_0: Specific mode to improve latency
>   * @DIM_CQ_PERIOD_NUM_MODES: Number of modes
>   */
>  enum dim_cq_period_mode {
>  	DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0,
>  	DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1,
> +	DIM_CQ_PERIOD_MODE_SPECIFIC_0 = 0x2,
>  	DIM_CQ_PERIOD_NUM_MODES
>  };
>  
> diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> index 4e32f7aaac86..2b5dccb6242c 100644
> --- a/lib/dim/net_dim.c
> +++ b/lib/dim/net_dim.c
> @@ -33,6 +33,14 @@
>  	{.usec = 64, .pkts = 64,}               \
>  }
>  
> +#define NET_DIM_RX_SPECIFIC_0_PROFILES { \
> +	{.usec = 0,   .pkts = 1,},   \
> +	{.usec = 4,   .pkts = 32,},  \
> +	{.usec = 64,  .pkts = 64,},  \
> +	{.usec = 128, .pkts = 256,}, \
> +	{.usec = 256, .pkts = 256,}  \
> +}
> +
>  #define NET_DIM_TX_EQE_PROFILES { \
>  	{.usec = 1,   .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,},  \
>  	{.usec = 8,   .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,},  \
> @@ -49,16 +57,26 @@
>  	{.usec = 64, .pkts = 32,}   \
>  }
>  
> +#define NET_DIM_TX_SPECIFIC_0_PROFILES { \
> +	{.usec = 0,   .pkts = 1,},   \
> +	{.usec = 4,   .pkts = 16,},  \
> +	{.usec = 32,  .pkts = 64,},  \
> +	{.usec = 64,  .pkts = 128,}, \
> +	{.usec = 128, .pkts = 128,}  \
> +}
> +
>  static const struct dim_cq_moder
>  rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
>  	NET_DIM_RX_EQE_PROFILES,
>  	NET_DIM_RX_CQE_PROFILES,
> +	NET_DIM_RX_SPECIFIC_0_PROFILES,
>  };
>  
>  static const struct dim_cq_moder
>  tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
>  	NET_DIM_TX_EQE_PROFILES,
>  	NET_DIM_TX_CQE_PROFILES,
> +	NET_DIM_TX_SPECIFIC_0_PROFILES,
>  };
>  
>  struct dim_cq_moder
> -- 
> 2.34.1
> 
>