From: Jakub Kicinski <kuba@kernel.org>
To: Heng Qi <hengqi@linux.alibaba.com>
Cc: netdev@vger.kernel.org, virtualization@lists.linux.dev,
"David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Jason Wang <jasowang@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Brett Creeley <bcreeley@amd.com>,
Ratheesh Kannoth <rkannoth@marvell.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
Tal Gilboa <talgi@nvidia.com>, Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Jiri Pirko <jiri@resnulli.us>,
Paul Greenwalt <paul.greenwalt@intel.com>,
Ahmed Zaki <ahmed.zaki@intel.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Kory Maincent <kory.maincent@bootlin.com>,
Andrew Lunn <andrew@lunn.ch>,
justinstitt@google.com, Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net-next v12 2/4] ethtool: provide customized dim profile management
Date: Tue, 7 May 2024 19:57:52 -0700 [thread overview]
Message-ID: <20240507195752.7275cb63@kernel.org> (raw)
In-Reply-To: <20240504064447.129622-3-hengqi@linux.alibaba.com>
On Sat, 4 May 2024 14:44:45 +0800 Heng Qi wrote:
> @@ -1325,6 +1354,8 @@ operations:
> - tx-aggr-max-bytes
> - tx-aggr-max-frames
> - tx-aggr-time-usecs
> + - rx-profile
> + - tx-profile
> dump: *coalesce-get-op
> -
> name: coalesce-set
set probably needs to get the new attributes, too?
> Request is rejected if it attributes declared as unsupported by driver (i.e.
> diff --git a/include/linux/dim.h b/include/linux/dim.h
> index 43398f5eade2..d848b790ca50 100644
> --- a/include/linux/dim.h
> +++ b/include/linux/dim.h
> @@ -9,6 +9,7 @@
> #include <linux/module.h>
> #include <linux/types.h>
> #include <linux/workqueue.h>
> +#include <linux/netdevice.h>
looks unnecessary, you just need a forward declaration of
struct net_device, no?
> diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> index 67d5beb34dc3..b3e01619f929 100644
> --- a/lib/dim/net_dim.c
> +++ b/lib/dim/net_dim.c
> @@ -4,6 +4,7 @@
> */
>
> #include <linux/dim.h>
> +#include <linux/rtnetlink.h>
>
> /*
> * Net DIM profiles:
> @@ -95,6 +96,76 @@ net_dim_get_def_tx_moderation(u8 cq_period_mode)
> }
> EXPORT_SYMBOL(net_dim_get_def_tx_moderation);
>
> +int net_dim_init_irq_moder(struct net_device *dev, u8 profile_flags,
> + u8 coal_flags, u8 rx_mode, u8 tx_mode,
> + void (*rx_dim_work)(struct work_struct *work),
> + void (*tx_dim_work)(struct work_struct *work))
> +{
> + struct dim_cq_moder *rxp = NULL, *txp;
> + struct dim_irq_moder *moder;
> + int len;
> +
> + dev->irq_moder = kzalloc(sizeof(*dev->irq_moder), GFP_KERNEL);
> + if (!dev->irq_moder)
> + goto err_moder;
return the error directly here, no need to goto
> + moder = dev->irq_moder;
> + len = NET_DIM_PARAMS_NUM_PROFILES * sizeof(*moder->rx_profile);
> +
> + moder->coal_flags = coal_flags;
> + moder->profile_flags = profile_flags;
> +
> + if (profile_flags & DIM_PROFILE_RX) {
> + moder->rx_dim_work = rx_dim_work;
> + WRITE_ONCE(moder->dim_rx_mode, rx_mode);
why WRITE_ONCE()? The structure can't be used, yet
> + rxp = kmemdup(rx_profile[rx_mode], len, GFP_KERNEL);
> + if (!rxp)
> + goto err_rx_profile;
name the labels after the target, please, not the source
> + rcu_assign_pointer(moder->rx_profile, rxp);
> + }
> +static int ethnl_update_profile(struct net_device *dev,
> + struct dim_cq_moder __rcu **dst,
> + const struct nlattr *nests,
> + struct netlink_ext_ack *extack)
> + rcu_assign_pointer(*dst, new_profile);
> + kfree_rcu(old_profile, rcu);
> +
> + return 0;
Don't we need to inform DIM somehow that profile has switched
and it should restart itself?
next prev parent reply other threads:[~2024-05-08 2:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-04 6:44 [PATCH net-next v12 0/4] ethtool: provide the dim profile fine-tuning channel Heng Qi
2024-05-04 6:44 ` [PATCH net-next v12 1/4] linux/dim: move useful macros to .h file Heng Qi
2024-05-04 6:44 ` [PATCH net-next v12 2/4] ethtool: provide customized dim profile management Heng Qi
2024-05-08 2:57 ` Jakub Kicinski [this message]
2024-05-08 13:26 ` Heng Qi
2024-05-08 15:11 ` Jakub Kicinski
2024-05-08 15:52 ` Heng Qi
2024-05-04 6:44 ` [PATCH net-next v12 3/4] dim: add new interfaces for initialization and getting results Heng Qi
2024-05-04 6:44 ` [PATCH net-next v12 4/4] virtio-net: support dim profile fine-tuning Heng Qi
2024-05-08 2:12 ` [PATCH net-next v12 0/4] ethtool: provide the dim profile fine-tuning channel Heng Qi
2024-05-08 2:47 ` Jakub Kicinski
2024-05-08 15:53 ` Heng Qi
2024-05-08 3:01 ` Jakub Kicinski
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=20240507195752.7275cb63@kernel.org \
--to=kuba@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew@lunn.ch \
--cc=bcreeley@amd.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hengqi@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=jasowang@redhat.com \
--cc=jiri@resnulli.us \
--cc=justinstitt@google.com \
--cc=kory.maincent@bootlin.com \
--cc=linux-doc@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paul.greenwalt@intel.com \
--cc=rkannoth@marvell.com \
--cc=talgi@nvidia.com \
--cc=virtualization@lists.linux.dev \
--cc=vladimir.oltean@nxp.com \
--cc=xuanzhuo@linux.alibaba.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).