From: Jiri Pirko <jiri@resnulli.us>
To: Moshe Shemesh <moshe@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@mellanox.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next RFC v3 02/14] devlink: Add reload actions counters
Date: Mon, 31 Aug 2020 12:48:27 +0200 [thread overview]
Message-ID: <20200831104827.GB3794@nanopsycho.orion> (raw)
In-Reply-To: <1598801254-27764-3-git-send-email-moshe@mellanox.com>
Sun, Aug 30, 2020 at 05:27:22PM CEST, moshe@mellanox.com wrote:
>Add reload actions counters to hold the history per reload action type.
>For example, the number of times fw_activate has been done on this
>device since the driver module was added or if the firmware activation
>was done with or without reset.
>The function devlink_reload_actions_cnts_update() is exported to enable
>also drivers update on reload actions done, for example in case firmware
>activation with reset finished successfully but was initiated by remote
>host.
>
>Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
>---
>v2 -> v3:
>- New patch
>---
> include/net/devlink.h | 2 ++
> net/core/devlink.c | 24 +++++++++++++++++++++---
> 2 files changed, 23 insertions(+), 3 deletions(-)
>
>diff --git a/include/net/devlink.h b/include/net/devlink.h
>index b8f0152a1fff..0547f0707d92 100644
>--- a/include/net/devlink.h
>+++ b/include/net/devlink.h
>@@ -38,6 +38,7 @@ struct devlink {
> struct list_head trap_policer_list;
> const struct devlink_ops *ops;
> struct xarray snapshot_ids;
>+ u32 reload_actions_cnts[DEVLINK_RELOAD_ACTION_MAX];
> struct device *dev;
> possible_net_t _net;
> struct mutex lock; /* Serializes access to devlink instance specific objects such as
>@@ -1372,6 +1373,7 @@ void
> devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
>
> bool devlink_is_reload_failed(const struct devlink *devlink);
>+void devlink_reload_actions_cnts_update(struct devlink *devlink, unsigned long actions_done);
>
> void devlink_flash_update_begin_notify(struct devlink *devlink);
> void devlink_flash_update_end_notify(struct devlink *devlink);
>diff --git a/net/core/devlink.c b/net/core/devlink.c
>index 8d4137ad40db..20a29c34ff71 100644
>--- a/net/core/devlink.c
>+++ b/net/core/devlink.c
>@@ -2969,10 +2969,23 @@ bool devlink_is_reload_failed(const struct devlink *devlink)
> }
> EXPORT_SYMBOL_GPL(devlink_is_reload_failed);
>
>+void devlink_reload_actions_cnts_update(struct devlink *devlink, unsigned long actions_done)
>+{
>+ int action;
>+
>+ for (action = 0; action < DEVLINK_RELOAD_ACTION_MAX; action++) {
>+ if (!test_bit(action, &actions_done))
>+ continue;
>+ devlink->reload_actions_cnts[action]++;
>+ }
>+}
>+EXPORT_SYMBOL_GPL(devlink_reload_actions_cnts_update);
I don't follow why this is an exported symbol if you only use it from
this .c. Looks like a leftover...
>+
> static int devlink_reload(struct devlink *devlink, struct net *dest_net,
> enum devlink_reload_action action, struct netlink_ext_ack *extack,
>- unsigned long *actions_done)
>+ unsigned long *actions_done_out)
> {
>+ unsigned long actions_done;
> int err;
>
> if (!devlink->reload_enabled)
>@@ -2985,9 +2998,14 @@ static int devlink_reload(struct devlink *devlink, struct net *dest_net,
> if (dest_net && !net_eq(dest_net, devlink_net(devlink)))
> devlink_reload_netns_change(devlink, dest_net);
>
>- err = devlink->ops->reload_up(devlink, action, extack, actions_done);
>+ err = devlink->ops->reload_up(devlink, action, extack, &actions_done);
> devlink_reload_failed_set(devlink, !!err);
>- return err;
>+ if (err)
>+ return err;
>+ devlink_reload_actions_cnts_update(devlink, actions_done);
>+ if (actions_done_out)
>+ *actions_done_out = actions_done;
Why don't you just use the original actions_done directly without having
extra local variable?
>+ return 0;
> }
>
> static int
>--
>2.17.1
>
next prev parent reply other threads:[~2020-08-31 10:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-30 15:27 [PATCH net-next RFC v3 00/14] Add devlink reload action option Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 01/14] devlink: Add reload action option to devlink reload command Moshe Shemesh
2020-08-31 12:15 ` Jiri Pirko
2020-09-01 19:43 ` Moshe Shemesh
2020-09-02 9:46 ` Jiri Pirko
2020-09-02 15:30 ` Jakub Kicinski
2020-09-03 5:57 ` Jiri Pirko
2020-09-03 19:47 ` Jakub Kicinski
2020-09-04 9:04 ` Jiri Pirko
2020-09-04 19:56 ` Jakub Kicinski
2020-09-07 13:46 ` Moshe Shemesh
2020-09-07 17:58 ` Jakub Kicinski
2020-09-09 13:27 ` Moshe Shemesh
2020-09-09 19:24 ` Jakub Kicinski
2020-09-10 5:16 ` Vasundhara Volam
2020-09-10 6:51 ` Jiri Pirko
2020-08-30 15:27 ` [PATCH net-next RFC v3 02/14] devlink: Add reload actions counters Moshe Shemesh
2020-08-31 10:48 ` Jiri Pirko [this message]
2020-09-01 19:05 ` Moshe Shemesh
2020-09-02 0:01 ` Jakub Kicinski
2020-09-04 5:03 ` Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 03/14] devlink: Add reload actions counters to dev get Moshe Shemesh
2020-08-31 10:44 ` Jiri Pirko
2020-09-01 19:00 ` Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 04/14] net/mlx5: Add functions to set/query MFRL register Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 05/14] net/mlx5: Set cap for pci sync for fw update event Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 06/14] net/mlx5: Handle sync reset request event Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 07/14] net/mlx5: Handle sync reset now event Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 08/14] net/mlx5: Handle sync reset abort event Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 09/14] net/mlx5: Add support for devlink reload action fw activate Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 10/14] devlink: Add enable_remote_dev_reset generic parameter Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 11/14] net/mlx5: Add devlink param enable_remote_dev_reset support Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 12/14] net/mlx5: Add support for fw live patch event Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 13/14] net/mlx5: Add support for devlink reload action fw activate no reset Moshe Shemesh
2020-08-30 15:27 ` [PATCH net-next RFC v3 14/14] devlink: Add Documentation/networking/devlink/devlink-reload.rst Moshe Shemesh
2020-08-31 10:49 ` [PATCH net-next RFC v3 00/14] Add devlink reload action option Jiri Pirko
2020-09-01 20:05 ` Moshe Shemesh
[not found] ` <36e30108-26e3-44ae-e133-48d412f7efe6@nvidia.com>
2020-09-02 7:55 ` 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=20200831104827.GB3794@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=moshe@mellanox.com \
--cc=netdev@vger.kernel.org \
/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).