From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com,
sthemmin@microsoft.com, dsahern@gmail.com, saeedm@mellanox.com,
leon@kernel.org, f.fainelli@gmail.com
Subject: Re: [patch net-next v2 7/7] netdevsim: implement fake flash updating with notifications
Date: Wed, 29 May 2019 21:30:45 +0200 [thread overview]
Message-ID: <20190529193045.GA4214@nanopsycho> (raw)
In-Reply-To: <20190529094754.49a15c20@cakuba.netronome.com>
Wed, May 29, 2019 at 06:47:54PM CEST, jakub.kicinski@netronome.com wrote:
>On Wed, 29 May 2019 10:00:16 +0200, Jiri Pirko wrote:
>> Tue, May 28, 2019 at 10:01:15PM CEST, jakub.kicinski@netronome.com wrote:
>> >On Tue, 28 May 2019 13:48:46 +0200, Jiri Pirko wrote:
>> >> From: Jiri Pirko <jiri@mellanox.com>
>> >>
>> >> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> >> ---
>> >> v1->v2:
>> >> - added debugfs toggle to enable/disable flash status notifications
>> >
>> >Could you please add a selftest making use of netdevsim code?
>>
>> How do you imagine the selftest should look like. What should it test
>> exactly?
>
>Well you're adding notifications, probably that the notifications
>arrive correctly? Plus that devlink doesn't hung when there are no
>notifications. It doesn't have to be a super advanced test, just
>exercising the code paths in the kernel is fine.
>
>In principle netdevsim is for testing and you add no tests, its not
>the first time you're doing this.
:/
Will add tests and send v3. Monday. Thanks!
>
>> >Sorry, I must have liked the feature so much first time I missed this :)
>> >
>> >> diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
>> >> index b509b941d5ca..c5c417a3c0ce 100644
>> >> --- a/drivers/net/netdevsim/dev.c
>> >> +++ b/drivers/net/netdevsim/dev.c
>> >> @@ -220,8 +222,49 @@ static int nsim_dev_reload(struct devlink *devlink,
>> >> return 0;
>> >> }
>> >>
>> >> +#define NSIM_DEV_FLASH_SIZE 500000
>> >> +#define NSIM_DEV_FLASH_CHUNK_SIZE 1000
>> >> +#define NSIM_DEV_FLASH_CHUNK_TIME_MS 10
>> >> +
>> >> +static int nsim_dev_flash_update(struct devlink *devlink, const char *file_name,
>> >> + const char *component,
>> >> + struct netlink_ext_ack *extack)
>> >> +{
>> >> + struct nsim_dev *nsim_dev = devlink_priv(devlink);
>> >> + int i;
>> >> +
>> >> + if (nsim_dev->fw_update_status) {
>> >> + devlink_flash_update_begin_notify(devlink);
>> >> + devlink_flash_update_status_notify(devlink,
>> >> + "Preparing to flash",
>> >> + component, 0, 0);
>> >> + }
>> >> +
>> >> + for (i = 0; i < NSIM_DEV_FLASH_SIZE / NSIM_DEV_FLASH_CHUNK_SIZE; i++) {
>> >> + if (nsim_dev->fw_update_status)
>> >> + devlink_flash_update_status_notify(devlink, "Flashing",
>> >> + component,
>> >> + i * NSIM_DEV_FLASH_CHUNK_SIZE,
>> >> + NSIM_DEV_FLASH_SIZE);
>> >> + msleep(NSIM_DEV_FLASH_CHUNK_TIME_MS);
>> >
>> >In automated testing it may be a little annoying if this takes > 5sec
>>
>> I wanted to emulate real device. I can make this 5 sec if you want, no
>> problem.
>
>Is my maths off? The loop is 5 sec now:
>
> 500000 / 1000 * 10 ms = 5000 ms = 5 sec?
Ah, yes. Originally I had this 20 sec. Pardon me.
next prev parent reply other threads:[~2019-05-29 19:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 11:48 [patch net-next v2 0/7] expose flash update status to user Jiri Pirko
2019-05-28 11:48 ` [patch net-next v2 1/7] mlxsw: Move firmware flash implementation to devlink Jiri Pirko
2019-05-29 6:03 ` Ido Schimmel
2019-05-28 11:48 ` [patch net-next v2 2/7] mlx5: " Jiri Pirko
2019-05-28 11:48 ` [patch net-next v2 3/7] mlxfw: Propagate error messages through extack Jiri Pirko
2019-05-29 6:03 ` Ido Schimmel
2019-05-28 11:48 ` [patch net-next v2 4/7] devlink: allow driver to update progress of flash update Jiri Pirko
2019-05-28 19:55 ` Jakub Kicinski
2019-05-29 6:04 ` Ido Schimmel
2019-05-28 11:48 ` [patch net-next v2 5/7] mlxfw: Introduce status_notify op and call it to notify about the status Jiri Pirko
2019-05-29 6:10 ` Ido Schimmel
2019-05-28 11:48 ` [patch net-next v2 6/7] mlxsw: Implement flash update status notifications Jiri Pirko
2019-05-29 6:12 ` Ido Schimmel
2019-05-28 11:48 ` [patch net-next v2 7/7] netdevsim: implement fake flash updating with notifications Jiri Pirko
2019-05-28 20:01 ` Jakub Kicinski
2019-05-29 8:00 ` Jiri Pirko
2019-05-29 16:47 ` Jakub Kicinski
2019-05-29 19:30 ` Jiri Pirko [this message]
2019-05-28 11:50 ` [patch net-next v2 1/3] header update Jiri Pirko
2019-05-28 11:50 ` [patch net-next v2 2/3] devlink: implement flash update status monitoring Jiri Pirko
2019-05-28 11:50 ` [patch net-next v2 3/3] devlink: implement flash " 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=20190529193045.GA4214@nanopsycho \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=leon@kernel.org \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=sthemmin@microsoft.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).