[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZboVNWrlgucuxH9N@nanopsycho>
Date: Wed, 31 Jan 2024 10:39:01 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Louis Peens <louis.peens@...igine.com>
Cc: David Miller <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Fei Qin <fei.qin@...igine.com>,
netdev@...r.kernel.org, oss-drivers@...igine.com
Subject: Re: [PATCH net-next 2/2] nfp: customize the dim profiles
Wed, Jan 31, 2024 at 09:54:26AM CET, louis.peens@...igine.com wrote:
>From: Fei Qin <fei.qin@...igine.com>
>
>The latency with default profiles is not very good when adaptive
>interrupt moderation is enabled. This patch customizes the dim
>profiles to optimize the latency.
>
>Latency comparison between default and customized profiles for 5
>different runs:
> Latency (us)
>Default profiles | 158.79 158.05 158.46 157.93 157.42
>Customized profiles | 107.03 106.46 113.01 131.64 107.94
>
>Signed-off-by: Fei Qin <fei.qin@...igine.com>
>Signed-off-by: Louis Peens <louis.peens@...igine.com>
>---
> .../ethernet/netronome/nfp/nfp_net_common.c | 27 ++++++++++++++++---
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
>index 3b3210d823e8..cfbcec3045bf 100644
>--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
>+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
>@@ -1158,16 +1158,28 @@ void nfp_ctrl_close(struct nfp_net *nn)
> rtnl_unlock();
> }
>
>+struct nfp_dim {
>+ u16 usec;
>+ u16 pkts;
>+};
>+
> static void nfp_net_rx_dim_work(struct work_struct *work)
> {
>+ static const struct nfp_dim rx_profile[] = {
>+ {.usec = 0, .pkts = 1},
>+ {.usec = 4, .pkts = 32},
>+ {.usec = 64, .pkts = 64},
>+ {.usec = 128, .pkts = 256},
>+ {.usec = 256, .pkts = 256},
>+ };
> struct nfp_net_r_vector *r_vec;
> unsigned int factor, value;
>- struct dim_cq_moder moder;
>+ struct nfp_dim moder;
> struct nfp_net *nn;
> struct dim *dim;
>
> dim = container_of(work, struct dim, work);
>- moder = net_dim_get_rx_moderation(dim->mode, dim->profile_ix);
>+ moder = rx_profile[dim->profile_ix];
It looks incorrect to hardcode it like this. There is a reason this is
abstracted out in lib/dim/net_dim.c to avoid exactly this. Can't you
perhaps introduce your modified profile there and keep using
net_dim_get_[tr]x_moderation() helpers?
> r_vec = container_of(dim, struct nfp_net_r_vector, rx_dim);
> nn = r_vec->nfp_net;
>
>@@ -1190,14 +1202,21 @@ static void nfp_net_rx_dim_work(struct work_struct *work)
>
> static void nfp_net_tx_dim_work(struct work_struct *work)
> {
>+ static const struct nfp_dim tx_profile[] = {
>+ {.usec = 0, .pkts = 1},
>+ {.usec = 4, .pkts = 16},
>+ {.usec = 32, .pkts = 64},
>+ {.usec = 64, .pkts = 128},
>+ {.usec = 128, .pkts = 128},
>+ };
> struct nfp_net_r_vector *r_vec;
> unsigned int factor, value;
>- struct dim_cq_moder moder;
>+ struct nfp_dim moder;
> struct nfp_net *nn;
> struct dim *dim;
>
> dim = container_of(work, struct dim, work);
>- moder = net_dim_get_tx_moderation(dim->mode, dim->profile_ix);
>+ moder = tx_profile[dim->profile_ix];
> r_vec = container_of(dim, struct nfp_net_r_vector, tx_dim);
> nn = r_vec->nfp_net;
>
>--
>2.34.1
>
>
Powered by blists - more mailing lists