From: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
linux@armlinux.org.uk, vadim.fedorenko@linux.dev,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, git@amd.com
Subject: Re: [PATCH net-next v3 3/4] net: macb: Add ARP support to WOL
Date: Fri, 7 Jun 2024 10:49:22 +0530 [thread overview]
Message-ID: <a358234a-8521-468e-8531-c8be0bbc619d@amd.com> (raw)
In-Reply-To: <901ec7a8-7460-492e-8f50-6d339a987020@lunn.ch>
Hi Andrew,
On 06/06/24 7:29 am, Andrew Lunn wrote:
>> @@ -3278,13 +3280,11 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
>> {
>> struct macb *bp = netdev_priv(netdev);
>>
>> - if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) {
>> - phylink_ethtool_get_wol(bp->phylink, wol);
>> - wol->supported |= WAKE_MAGIC;
>> -
>> - if (bp->wol & MACB_WOL_ENABLED)
>> - wol->wolopts |= WAKE_MAGIC;
>> - }
>> + phylink_ethtool_get_wol(bp->phylink, wol);
>
> So you ask the PHY what it supports, and what it currently has
> enabled.
>
>> + wol->supported |= (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ? WAKE_MAGIC : 0;
>> + wol->supported |= (bp->wol & MACB_WOL_HAS_ARP_PACKET) ? WAKE_ARP : 0;
>
> You mask in what the MAC supports.
>
>> + /* Pass wolopts to ethtool */
>> + wol->wolopts = bp->wolopts;
>
> And then you overwrite what the PHY is currently doing with
> bp->wolopts.
>
> Now, if we look at what macb_set_wol does:
>
>> @@ -3300,11 +3300,10 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
>> if (!ret || ret != -EOPNOTSUPP)
>> return ret;
>>
>
> We are a little bit short of context here. This is checking the return
> value of:
>
> ret = phylink_ethtool_set_wol(bp->phylink, wol);
>
> So if there is no error, or an error which is not EOPNOTSUPP, it
> returns here. So if the PHY supports WAKE_MAGIC and/or WAKE_ARP, there
> is nothing for the MAC to do. Importantly, the code below which sets
> bp->wolopts is not reached.
>
> So your get_wol looks wrong.
>
yes, with PHY supporting WOL the if/return logic needs changes.
Consider the scenario of phy supporting a,b,c and macb
supporting c,d modes. For a,b,c phy should handle and for "d"
mode the handle should be at mac.
I will make the changes accordingly.
please let me know your thoughts or suggestions.
>> - if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ||
>> - (wol->wolopts & ~WAKE_MAGIC))
>> - return -EOPNOTSUPP;
>> + bp->wolopts = (wol->wolopts & WAKE_MAGIC) ? WAKE_MAGIC : 0;
>> + bp->wolopts |= (wol->wolopts & WAKE_ARP) ? WAKE_ARP : 0;
>>
>> - if (wol->wolopts & WAKE_MAGIC)
>> + if (bp->wolopts)
>> bp->wol |= MACB_WOL_ENABLED;
>> else
>> bp->wol &= ~MACB_WOL_ENABLED;
>> @@ -5085,10 +5084,8 @@ static int macb_probe(struct platform_device *pdev)
>> else
>> bp->max_tx_length = GEM_MAX_TX_LEN;
>>
>
>> @@ -5257,6 +5255,12 @@ static int __maybe_unused macb_suspend(struct device *dev)
>> return 0;
>>
>> if (bp->wol & MACB_WOL_ENABLED) {
>> + /* Check for IP address in WOL ARP mode */
>> + ifa = rcu_dereference(__in_dev_get_rcu(bp->dev)->ifa_list);
>> + if ((bp->wolopts & WAKE_ARP) && !ifa) {
>> + netdev_err(netdev, "IP address not assigned\n");
>> + return -EOPNOTSUPP;
>> + }
>
> I don't know suspend too well. Is returning an error enough abort the
> suspend?
>
yes, it will abort suspend.
🙏 vineeth
> Andrew
next prev parent reply other threads:[~2024-06-07 5:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 10:24 [PATCH net-next v3 0/4] net: macb: WOL enhancements Vineeth Karumanchi
2024-06-05 10:24 ` [PATCH net-next v3 1/4] net: macb: queue tie-off or disable during WOL suspend Vineeth Karumanchi
2024-06-06 1:44 ` Andrew Lunn
2024-06-07 5:54 ` Vineeth Karumanchi
2024-06-05 10:24 ` [PATCH net-next v3 2/4] net: macb: Enable queue disable Vineeth Karumanchi
2024-06-06 2:00 ` Andrew Lunn
2024-06-05 10:24 ` [PATCH net-next v3 3/4] net: macb: Add ARP support to WOL Vineeth Karumanchi
2024-06-06 1:59 ` Andrew Lunn
2024-06-07 5:19 ` Vineeth Karumanchi [this message]
2024-06-05 10:24 ` [PATCH net-next v3 4/4] dt-bindings: net: cdns,macb: Deprecate magic-packet property Vineeth Karumanchi
2024-06-05 15:41 ` Rob Herring
2024-06-06 5:13 ` Vineeth Karumanchi
2024-06-06 6:17 ` Krzysztof Kozlowski
2024-06-06 7:04 ` Vineeth Karumanchi
2024-06-06 2:00 ` Andrew Lunn
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=a358234a-8521-468e-8531-c8be0bbc619d@amd.com \
--to=vineeth.karumanchi@amd.com \
--cc=andrew@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=git@amd.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=vadim.fedorenko@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
all inboxes | Powered by JetHome®