<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">Andrew Lunn 於 12/3/2024 10:58 PM 寫道:<br>
</div>
<blockquote type="cite"
cite="mid:ba09cea2-4cf7-4203-ae98-ea5d8413f69e@lunn.ch">
<pre wrap="" class="moz-quote-pre">On Tue, Dec 03, 2024 at 05:12:24PM +0800, Joey Lu wrote:
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">Dear Andrew,
You're correct. In the stmmac_hw_init function within stmmac_main.c, whether
pmt is true is determined by checking the pmt_remote_wake_up bit in the
hardware feature register. However, our hardware configuration only supports
magic packet and not remote wakeup, so it must be overwritten in the glue
driver.
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
Please add a comment explaining this.
I'm not sure why the original code doesn't include magic packet as part
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">of pmt.
source code:
stmmac_hw_init() @net/ethernet/stmicro/stmmac/stmmac_main.c
priv->plat->enh_desc = priv->dma_cap.enh_desc;
priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up &&
!(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
priv->hw->pmt = priv->plat->pmt;
Or modify the condition as follows:
priv->plat->pmt = (priv->dma_cap.pmt_remote_wake_up || priv->
dma_cap.pmt_magic_frame) &&
!(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
Are there other glue drivers which would benefit from this? It is hard
for me to say if you hardware is odd, or if this should be a generic
feature which other glue drivers would use.
Andrew</pre>
</blockquote>
<p>After reviewing the Synopsys DWMAC databook, it turns out that
RWK is actually optional.</p>
<p>I reviewed the usage of the PMT flag in the core driver. In <code><i>stmmac_ethtool.c</i></code>,
within the <code><i>stmmac_set_wol</i></code> function, the
driver supports two wake-up methods corresponding to <code><i>pmt_remote_wake_up</i></code>
and<i> <code>pmt_magic_frame</code></i>. When the hardware is
configured for magic packet only, <code>device_can_wakeup()</code>
returns not supported. However, magic packet is the more widely
used option.</p>
<p>In <code><i>stmmac_hw_init()</i></code>, adding a condition to
check <code>pmt_magic_frame</code> for PMT flag will not affect
the existing glue layer drivers, regardless of whether they config
only RWK or both RWK and MGK.</p>
<p>However, it is hard for me to decide whether to modify stmmac
driver. Overwriting the PMT flag and leaving a comment is fine for
me.</p>
<p>BR,</p>
<p>Joey</p>
</body>
</html>