netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Louis Peens <louis.peens@corigine.com>
Cc: David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Fei Qin <fei.qin@corigine.com>,
	netdev@vger.kernel.org, oss-drivers@corigine.com
Subject: Re: [PATCH net-next 2/2] nfp: customize the dim profiles
Date: Wed, 31 Jan 2024 10:39:01 +0100	[thread overview]
Message-ID: <ZboVNWrlgucuxH9N@nanopsycho> (raw)
In-Reply-To: <20240131085426.45374-3-louis.peens@corigine.com>

Wed, Jan 31, 2024 at 09:54:26AM CET, louis.peens@corigine.com wrote:
>From: Fei Qin <fei.qin@corigine.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@corigine.com>
>Signed-off-by: Louis Peens <louis.peens@corigine.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
>
>

  reply	other threads:[~2024-01-31  9:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31  8:54 [PATCH net-next 0/2] nfp: series of minor driver improvements Louis Peens
2024-01-31  8:54 ` [PATCH net-next 1/2] nfp: update devlink device info output Louis Peens
2024-01-31  9:31   ` Jiri Pirko
2024-01-31  9:40     ` Louis Peens
2024-02-02  4:29   ` Jakub Kicinski
2024-01-31  8:54 ` [PATCH net-next 2/2] nfp: customize the dim profiles Louis Peens
2024-01-31  9:39   ` Jiri Pirko [this message]
2024-01-31 11:25     ` Louis Peens
2024-02-01  2:16     ` Yinjun Zhang
2024-02-01  7:42       ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZboVNWrlgucuxH9N@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=fei.qin@corigine.com \
    --cc=kuba@kernel.org \
    --cc=louis.peens@corigine.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).