From: James Prestwood <prestwoj@gmail.com>
To: Denis Kenzior <denkenz@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH 5/7] netdev: disable power save if required
Date: Mon, 19 Jun 2023 07:54:03 -0700 [thread overview]
Message-ID: <c4e78f5a-e11a-bc90-bcab-688c79f5bf23@gmail.com> (raw)
In-Reply-To: <8e99b15b-7730-3c25-7811-e1cef6f2d6e4@gmail.com>
Hi Denis,
On 6/18/23 12:11 PM, Denis Kenzior wrote:
> Hi James,
>
> On 6/15/23 14:24, James Prestwood wrote:
>> Disable power save if the wiphy indicates its needed. Do this
>> before issuing GET_LINK so the netdev doesn't signal its up until
>> power save is disabled.
>> ---
>> src/netdev.c | 80 +++++++++++++++++++++++++++++++++++++++++++---------
>> 1 file changed, 66 insertions(+), 14 deletions(-)
>>
>
> <snip>
>
>> +static void netdev_disable_ps_cb(struct l_genl_msg *msg, void
>> *user_data)
>> +{
>> + int err = l_genl_msg_get_error(msg);
>> + uint32_t ifindex = L_PTR_TO_UINT(user_data);
>> +
>> + /* Can't do anything about it but inform the user */
>> + if (err < 0) {
>> + l_error("Failed to disable power save for ifindex %u (%s: %d)",
>> + ifindex, strerror(-err), err);
>> + return;
>> + }
>> +
>> + l_debug("Disabled power save for ifindex %u", ifindex);
>> +}
>> +
>> +static void netdev_disable_ps_destroy(void *user_data)
>> +{
>> + uint32_t ifindex = L_PTR_TO_UINT(user_data);
>> +
>> + netdev_get_link(ifindex);
>
> So why do we do this in the destroy callback? What happens if this
> operation is canceled (maybe by hot-unplug?)
>
>> +}
>> +
>
> <snip>
>
>> - l_free(rtmmsg);
>> + if (wiphy_disable_power_save(wiphy)) {
>> + /* Wait to issue GET_LINK until PS is disabled */
>> + if (netdev_disable_power_save(ifindex))
>
> Should we be saving a command id here so we can cancel this operation in
> case of hot-unplug?
Yeah I can do this. My theory for not was if it was a hot-unplug the
cb/destroy were never accessing netdev directly, just the ifindex. But
an explicit cancel (for getlink too) is better.
>
> Ideally we should switch to using l_genl_family_new per netdev so that
> all the outstanding commands are auto-canceled, but this might require
> some care.
That would actually be pretty nice, and remove that massive block of
cancels.
>
>> + return netdev;
>> + }
>> - netdev_setup_interface(netdev);
>> + netdev_get_link(ifindex);
>
> We should be saving the command id here too, but as a separate fix.
>
>> return netdev;
>> }
>
> Regards,
> -Denis
next prev parent reply other threads:[~2023-06-19 14:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 19:24 [PATCH 1/7] wiphy: store driver flags directly in wiphy object James Prestwood
2023-06-15 19:24 ` [PATCH 2/7] wiphy: allow for user-defined driver flags James Prestwood
2023-06-18 19:03 ` Denis Kenzior
2023-06-15 19:24 ` [PATCH 3/7] doc: document [DriverFlags] group settings James Prestwood
2023-06-15 19:24 ` [PATCH 4/7] wiphy: add [DriverFlags].PowerSaveDisable flag James Prestwood
2023-06-18 19:07 ` Denis Kenzior
2023-06-19 14:49 ` James Prestwood
2023-06-15 19:24 ` [PATCH 5/7] netdev: disable power save if required James Prestwood
2023-06-18 19:11 ` Denis Kenzior
2023-06-19 14:54 ` James Prestwood [this message]
2023-06-15 19:24 ` [PATCH 6/7] wiphy: print driver flags on startup James Prestwood
2023-06-15 19:24 ` [PATCH 7/7] doc: Document [DriverFlags].PowerSaveDisable James Prestwood
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=c4e78f5a-e11a-bc90-bcab-688c79f5bf23@gmail.com \
--to=prestwoj@gmail.com \
--cc=denkenz@gmail.com \
--cc=iwd@lists.linux.dev \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).