<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"等线 Light";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@等线 Light";}
@font-face
        {font-family:"DejaVu Sans";}
@font-face
        {font-family:"Noto Serif";}
@font-face
        {font-family:CESI宋体-GB2312;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:12.0pt;
        font-family:宋体;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        font-size:12.0pt;
        font-family:宋体;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Hao Chen <chenhaoa@uniontech.com>
<br>
<b>Sent:</b> 2021</span><span style="font-size:11.0pt">年</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">7</span><span style="font-size:11.0pt">月</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">21</span><span style="font-size:11.0pt">日</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">
 14:07<br>
<b>To:</b> Joakim Zhang <qiangqing.zhang@nxp.com>; Heiner Kallweit <hkallweit1@gmail.com><br>
<b>Cc:</b> alexandre.torgue@foss.st.com; joabreu@synopsys.com; davem@davemloft.net; kuba@kernel.org; mcoquelin.stm32@gmail.com; linux@armlinux.org.uk; netdev@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; peppe.cavallaro@st.com<br>
<b>Subject:</b> Re: [PATCH v5] net: stmmac: fix 'ethtool -P' return -EBUSY<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal">在<span lang="EN-US"> 2021/7/21 </span>上午<span lang="EN-US">11:02, Joakim Zhang
</span>写道<span lang="EN-US">:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">-----Original Message-----<o:p></o:p></span></pre>
<pre><span lang="EN-US">From: Hao Chen <a href="mailto:chenhaoa@uniontech.com"><chenhaoa@uniontech.com></a><o:p></o:p></span></pre>
<pre><span lang="EN-US">Sent: 2021</span>年<span lang="EN-US">7</span>月<span lang="EN-US">21</span>日<span lang="EN-US"> 9:35<o:p></o:p></span></pre>
<pre><span lang="EN-US">To: Heiner Kallweit <a href="mailto:hkallweit1@gmail.com"><hkallweit1@gmail.com></a><o:p></o:p></span></pre>
<pre><span lang="EN-US">Cc: <a href="mailto:alexandre.torgue@foss.st.com">alexandre.torgue@foss.st.com</a>; <a href="mailto:joabreu@synopsys.com">joabreu@synopsys.com</a>;<o:p></o:p></span></pre>
<pre><span lang="EN-US"><a href="mailto:davem@davemloft.net">davem@davemloft.net</a>; <a href="mailto:kuba@kernel.org">kuba@kernel.org</a>; <a href="mailto:mcoquelin.stm32@gmail.com">mcoquelin.stm32@gmail.com</a>;<o:p></o:p></span></pre>
<pre><span lang="EN-US"><a href="mailto:linux@armlinux.org.uk">linux@armlinux.org.uk</a>; <a href="mailto:netdev@vger.kernel.org">netdev@vger.kernel.org</a>;<o:p></o:p></span></pre>
<pre><span lang="EN-US"><a href="mailto:linux-stm32@st-md-mailman.stormreply.com">linux-stm32@st-md-mailman.stormreply.com</a>; Joakim Zhang<o:p></o:p></span></pre>
<pre><span lang="EN-US"><a href="mailto:qiangqing.zhang@nxp.com"><qiangqing.zhang@nxp.com></a>; <a href="mailto:peppe.cavallaro@st.com">peppe.cavallaro@st.com</a><o:p></o:p></span></pre>
<pre><span lang="EN-US">Subject: Re: [PATCH v5] net: stmmac: fix 'ethtool -P' return -EBUSY<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre>在<span lang="EN-US"> 2021/7/19 </span>下午<span lang="EN-US">9:57, Heiner Kallweit </span>写道<span lang="EN-US">:<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">On 19.07.2021 15:08, Hao Chen wrote:<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">The permanent mac address should be available for query when the<o:p></o:p></span></pre>
<pre><span lang="EN-US">device is not up.<o:p></o:p></span></pre>
<pre><span lang="EN-US">NetworkManager, the system network daemon, uses 'ethtool -P' to<o:p></o:p></span></pre>
<pre><span lang="EN-US">obtain the permanent address after the kernel start. When the network<o:p></o:p></span></pre>
<pre><span lang="EN-US">device is not up, it will return the device busy error with 'ethtool<o:p></o:p></span></pre>
<pre><span lang="EN-US">-P'. At that time, it is unable to access the Internet through the<o:p></o:p></span></pre>
<pre><span lang="EN-US">permanent address by NetworkManager.<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US">At first a few formal aspects:<o:p></o:p></span></pre>
<pre><span lang="EN-US">- You don't get a lot of new friends when posting a new version every<o:p></o:p></span></pre>
<pre><span lang="EN-US">   few hours. Consolidate feedback and then post a new version,<o:p></o:p></span></pre>
<pre><span lang="EN-US">   typically not more than one version per day. Mileage of maintainers<o:p></o:p></span></pre>
<pre><span lang="EN-US">   may vary here.<o:p></o:p></span></pre>
<pre><span lang="EN-US">- When posting a new version include a change log.<o:p></o:p></span></pre>
<pre><span lang="EN-US">- Properly annotate the patch as net vs. net-next.<o:p></o:p></span></pre>
<pre><span lang="EN-US">- If you declare something to be a fix, add a Fixes tag.<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US">Thanks for your guidance.<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">I think that the '.begin' is not used to check if the device is up,<o:p></o:p></span></pre>
<pre><span lang="EN-US">it's just a pre hook for ethtool. We shouldn't check if the device is<o:p></o:p></span></pre>
<pre><span lang="EN-US">up there.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
</blockquote>
<pre><span lang="EN-US">Supposedly the check is there for a reason. Your statement leaves the<o:p></o:p></span></pre>
<pre><span lang="EN-US">impression that you're not aware of why the check exists.<o:p></o:p></span></pre>
<pre><span lang="EN-US">Therefore: First understand this, and then explain why it's safe to<o:p></o:p></span></pre>
<pre><span lang="EN-US">remove the check. This drivers uses runtime pm, so device might be in<o:p></o:p></span></pre>
<pre><span lang="EN-US">PCI D3 if interface is down (don't know this driver in detail).<o:p></o:p></span></pre>
<pre><span lang="EN-US">Therefore registers may not be accessible what may impact certain<o:p></o:p></span></pre>
<pre><span lang="EN-US">ethtool ops.<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">The network manager obtains and stores the permanent MAC address before<o:p></o:p></span></pre>
<pre><span lang="EN-US">the network<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">card is up, and then the user can specify the MAC address of the device in the<o:p></o:p></span></pre>
<pre><span lang="EN-US">desktop network<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">manager for networking.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">If the driver needs the network card up to obtain the permanent MAC address,<o:p></o:p></span></pre>
<pre><span lang="EN-US">the user will<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">not be able to specify the device MAC address for networking after power on.<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I'm not sure quite understand what's your requirements, AFAIK, NIC driver has<o:p></o:p></span></pre>
<pre><span lang="EN-US">.ndo_set_mac_address to set mac address, and it can be done whether ifup or ifdown.<o:p></o:p></span></pre>
</blockquote>
<p><span lang="EN-US">I want to get permanent MAC address when the card is down.And I think it is more convenient to get statistics<o:p></o:p></span></p>
<p><span lang="EN-US">in the down state by ethtool -S. But current all of the ethool command return -EBUSY.<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I don't think we should detect that the network card is up in '. Begin', which will<o:p></o:p></span></pre>
<pre><span lang="EN-US">cause that<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">all the ethtool commands can't be used when the network card is down. If<o:p></o:p></span></pre>
<pre><span lang="EN-US">some ethtool<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">commands can only be used in the up state, they should be detected in the<o:p></o:p></span></pre>
<pre><span lang="EN-US">corresponding<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">ethool OPS function instead of in the pre hook. This is too rude and<o:p></o:p></span></pre>
<pre><span lang="EN-US">unreasonable.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">As for safe, remove the '. Begin' implementation. After modification, it<o:p></o:p></span></pre>
<pre><span lang="EN-US">should be safer to<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">operate Ethernet in the down state than in the up state.<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">As Heiner mentioned, ethtool ops may access NIC hardware registers which need<o:p></o:p></span></pre>
<pre><span lang="EN-US">clocks enabled. Now we have .begin that means clocks enabled when use ethtool,<o:p></o:p></span></pre>
<pre><span lang="EN-US">if you remove .begin, you need ensure clocks enabled whenever ethtool used. So,<o:p></o:p></span></pre>
<pre><span lang="EN-US">remove .begin directly wound not be acceptable.<o:p></o:p></span></pre>
</blockquote>
<p class="MsoNormal"><span lang="EN-US">Yeah.<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I have checked the '. Begin' implementation of other drivers, most of<o:p></o:p></span></pre>
<pre><span lang="EN-US">which support the<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">submission of NIC driver for the first time. They are too long to know<o:p></o:p></span></pre>
<pre><span lang="EN-US">why '. Begin' is<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">implemented. I suspect that they have not noticed the usage of '. Begin'.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">In cpsw NIC driver, commit ID 7898b1daf0555, a bug was found to be fixed:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">"The CPSW might be suspended by RPM if all ethX interfaces are down,<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">but it still could be accesible through ethtool interfce. In this case<o:p></o:p></span></pre>
<pre><span lang="EN-US">ethtool operations, requiring registers access, will cause L3 errors and<o:p></o:p></span></pre>
<pre><span lang="EN-US">CPSW crash."<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">My machine uses platform GMAC. I don't have PCI network card. I can't<o:p></o:p></span></pre>
<pre><span lang="EN-US">test the use<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">of PCI network card. Through cat /sys/devices/... /power/<o:p></o:p></span></pre>
<pre><span lang="EN-US">runtime_status, return<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">unsupported. Therefore, runtime PM is not supported.<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I have a GMAC5.10 at my hand, and check the runtime PM status on net-next tree:<o:p></o:p></span></pre>
<pre><span lang="EN-US">~# cat /sys/class/net/eth0/device/power/runtime_status<o:p></o:p></span></pre>
<pre><span lang="EN-US">Active<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Another main you said:<o:p></o:p></span></pre>
<pre><span lang="EN-US">"By browse the code and test it,  I find that stmmac not support runtime_status,<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">pm_runtime_get_sync will return -13 errno. So shouldn't modify it in this way.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I think we should just delete the implementation of begin, it's a pre hook for ethtool."<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I don't know why " pm_runtime_get_sync will return -13 errno ". If so, STMMAC driver still<o:p></o:p></span></pre>
<pre><span lang="EN-US">can work at you side? Clocks always enabled after probed?<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Best Regards,<o:p></o:p></span></pre>
<pre><span lang="EN-US">Joakim Zhang<o:p></o:p></span></pre>
</blockquote>
<p><span lang="EN-US">I find -13 error is because there:<o:p></o:p></span></p>
<p><span lang="EN-US">@@drivers/base/power/runtime.c <o:p></o:p></span></p>
<p><span lang="EN-US">   733 static int rpm_resume(struct device *dev, int rpmflags)                                                                                                            
<br>
   734         __releases(&dev->power.lock) __acquires(&dev->power.lock) <br>
   735 { <br>
...... <br>
   743         if (dev->power.runtime_error)                                                                                                                              
<br>
   744                 retval = -EINVAL;                                                                                                                                  
<br>
   745         else if (dev->power.disable_depth == 1 && dev->power.is_suspended                                                                                          
<br>
   746             && dev->power.runtime_status == RPM_ACTIVE)                                                                                                            
<br>
   747                 retval = 1;                                                                                                                                        
<br>
   748         else if (dev->power.disable_depth > 0)                                                                                                                     
<br>
   749                 retval = -EACCES;                  //-13 errno.                                                                                                                
<br>
   750         if (retval)                                                                                                                                                
<br>
   751                 goto out;  <br>
...... <br>
}<o:p></o:p></span></p>
<p><span lang="EN-US">I used the kernel changed base on 4.19.90,maybe there is some problem that I don't know.<o:p></o:p></span></p>
<p><span lang="EN-US">The pm_runtime_get_sync is called at stmmac_open at latest kernel . Maybe only I have problem when call
<o:p></o:p></span></p>
<p><span lang="EN-US">pm_runtime_get_sync at '.begin' :-(<o:p></o:p></span></p>
<p><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
<p><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif">4.19 have not added Runtime PM support, please prepare and test patch on latest net-next tree.<o:p></o:p></span></p>
<p><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif">And I think it should be fine invoking pm_runtime_get_sync from .begin callback.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif">Best Regards,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif">Joakim Zhang<o:p></o:p></span></p>
<p><span lang="EN-US" style="font-size:10.5pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
<p><span lang="EN-US">@drivers/net/ethernet/stmicro/stmmac/stmmac_main.c<o:p></o:p></span></p>
<p><span lang="EN-US">  3629 int stmmac_open(struct net_device *dev)                                                                                                                           
<br>
  3630 {                                                                                                                                                                 
<br>
  3631         struct stmmac_priv *priv = netdev_priv(dev);                                                                                                              
<br>
  3632         int mode = priv->plat->phy_interface;                                                                                                                     
<br>
  3633         int bfsize = 0;                                                                                                                                           
<br>
  3634         u32 chan;                                                                                                                                                 
<br>
  3635         int ret;                                                                                                                                                  
<br>
  3636                                                                                                                                                                   
<br>
  3637         ret = pm_runtime_get_sync(priv->device);                                                                                                                  
<br>
  3638         if (ret < 0) {                                                                                                                                            
<br>
  3639                 pm_runtime_put_noidle(priv->device);                                                                                                              
<br>
  3640                 return ret;                                                                                                                                       
<br>
  3641         }<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">To sum up, I think it's better to remove the '. Begin' implementation here.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Or use the following implementation:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">   static int stmmac_ethtool_begin(struct net_device *dev)<o:p></o:p></span></pre>
<pre><span lang="EN-US">{<o:p></o:p></span></pre>
<pre><span lang="EN-US">           struct stmmac_priv *priv = netdev_priv(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US">           int ret;<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">           if (strcmp(priv->device->bus_type->name, "pci"))<o:p></o:p></span></pre>
<pre><span lang="EN-US">                   return 0;<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">           return pm_runtime_resume_and_get(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US">}<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">   static void stmmac_ethtool_complete(struct net_device *dev)<o:p></o:p></span></pre>
<pre><span lang="EN-US">{<o:p></o:p></span></pre>
<pre><span lang="EN-US">           struct stmmac_priv *priv = netdev_priv(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">           if (strcmp(priv->device->bus_type->name, "pci"))<o:p></o:p></span></pre>
<pre><span lang="EN-US">return;<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">pm_runtime_put(priv->device);<o:p></o:p></span></pre>
<pre><span lang="EN-US">   }<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">  .begin = stmmac_ethtool_begin,<o:p></o:p></span></pre>
<pre><span lang="EN-US">  .complete = stmmac_ethtool_complete,<o:p></o:p></span></pre>
</blockquote>
</blockquote>
<p><span lang="EN-US">This go to be:<o:p></o:p></span></p>
<pre><span lang="EN-US">static int stmmac_ethtool_begin(struct net_device *dev)<o:p></o:p></span></pre>
<pre><span lang="EN-US">{<o:p></o:p></span></pre>
<pre><span lang="EN-US">       struct stmmac_priv *priv = netdev_priv(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">       return pm_runtime_resume_and_get(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US">}<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">static void stmmac_ethtool_complete(struct net_device *dev)<o:p></o:p></span></pre>
<pre><span lang="EN-US">{<o:p></o:p></span></pre>
<pre><span lang="EN-US">       struct stmmac_priv *priv = netdev_priv(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">       pm_runtime_put(priv->device);<o:p></o:p></span></pre>
<pre><span lang="EN-US">}<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">  .begin = stmmac_ethtool_begin,<o:p></o:p></span></pre>
<pre><span lang="EN-US">  .complete = stmmac_ethtool_complete,<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">Signed-off-by: Hao Chen <a href="mailto:chenhaoa@uniontech.com"><chenhaoa@uniontech.com></a><o:p></o:p></span></pre>
<pre><span lang="EN-US">---<o:p></o:p></span></pre>
<pre><span lang="EN-US">  drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 8 --------<o:p></o:p></span></pre>
<pre><span lang="EN-US">  1 file changed, 8 deletions(-)<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c<o:p></o:p></span></pre>
</blockquote>
</blockquote>
<pre><span lang="EN-US">b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">index d0ce608b81c3..8901dc9f758e 100644<o:p></o:p></span></pre>
<pre><span lang="EN-US">--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c<o:p></o:p></span></pre>
<pre><span lang="EN-US">+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c<o:p></o:p></span></pre>
<pre><span lang="EN-US">@@ -410,13 +410,6 @@ static void stmmac_ethtool_setmsglevel(struct<o:p></o:p></span></pre>
</blockquote>
</blockquote>
<pre><span lang="EN-US">net_device *dev, u32 level)<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">  }<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">-static int stmmac_check_if_running(struct net_device *dev)<o:p></o:p></span></pre>
<pre><span lang="EN-US">-{<o:p></o:p></span></pre>
<pre><span lang="EN-US">-      if (!netif_running(dev))<o:p></o:p></span></pre>
<pre><span lang="EN-US">-            return -EBUSY;<o:p></o:p></span></pre>
<pre><span lang="EN-US">-  return 0;<o:p></o:p></span></pre>
<pre><span lang="EN-US">-}<o:p></o:p></span></pre>
<pre><span lang="EN-US">-<o:p></o:p></span></pre>
<pre><span lang="EN-US">  static int stmmac_ethtool_get_regs_len(struct net_device *dev)<o:p></o:p></span></pre>
<pre><span lang="EN-US">  {<o:p></o:p></span></pre>
<pre><span lang="EN-US">    struct stmmac_priv *priv = netdev_priv(dev);<o:p></o:p></span></pre>
<pre><span lang="EN-US">@@ -1073,7 +1066,6 @@ static int stmmac_set_tunable(struct net_device<o:p></o:p></span></pre>
</blockquote>
</blockquote>
<pre><span lang="EN-US">*dev,<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">  static const struct ethtool_ops stmmac_ethtool_ops = {<o:p></o:p></span></pre>
<pre><span lang="EN-US">   .supported_coalesce_params = ETHTOOL_COALESCE_USECS |<o:p></o:p></span></pre>
<pre><span lang="EN-US">                                  ETHTOOL_COALESCE_MAX_FRAMES,<o:p></o:p></span></pre>
<pre><span lang="EN-US">-  .begin = stmmac_check_if_running,<o:p></o:p></span></pre>
<pre><span lang="EN-US">   .get_drvinfo = stmmac_ethtool_getdrvinfo,<o:p></o:p></span></pre>
<pre><span lang="EN-US">   .get_msglevel = stmmac_ethtool_getmsglevel,<o:p></o:p></span></pre>
<pre><span lang="EN-US">   .set_msglevel = stmmac_ethtool_setmsglevel,<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
</blockquote>
</blockquote>
</blockquote>
</div>
</div>
</body>
</html>