Re: [PATCH v2 net-next] net: stmmac: Enable EEE HW LPI timer with auto SW/HW switching

2020-10-15 Thread kernel test robot
Hi Voon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Voon-Weifeng/net-stmmac-Enable-EEE-HW-LPI-timer-with-auto-SW-HW-switching/20201016-000231
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
d25e2e9388eda61b6e298585024ee3355f50c493
config: x86_64-randconfig-a012-20201015 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
e7b4feea8e1bf520b34ad8c116abab6677344b74)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# 
https://github.com/0day-ci/linux/commit/b208a1e7f74a391d1d7c2950e35b97c59af55585
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Voon-Weifeng/net-stmmac-Enable-EEE-HW-LPI-timer-with-auto-SW-HW-switching/20201016-000231
git checkout b208a1e7f74a391d1d7c2950e35b97c59af55585
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:297:6: warning: no 
>> previous prototype for function 'stmmac_lpi_entry_timer_config' 
>> [-Wmissing-prototypes]
   void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
^
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:297:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
   ^
   static 
   1 warning generated.

vim +/stmmac_lpi_entry_timer_config +297 
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

   296  
 > 297  void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
   298  {
   299  int tx_lpi_timer;
   300  
   301  /* Clear/set the SW EEE timer flag based on LPI ET enablement */
   302  priv->eee_sw_timer_en = en ? 0 : 1;
   303  tx_lpi_timer  = en ? priv->tx_lpi_timer : 0;
   304  stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer);
   305  }
   306  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


Re: [PATCH v2 net-next] net: stmmac: Enable EEE HW LPI timer with auto SW/HW switching

2020-10-15 Thread kernel test robot
Hi Voon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Voon-Weifeng/net-stmmac-Enable-EEE-HW-LPI-timer-with-auto-SW-HW-switching/20201016-000231
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
d25e2e9388eda61b6e298585024ee3355f50c493
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/0day-ci/linux/commit/b208a1e7f74a391d1d7c2950e35b97c59af55585
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Voon-Weifeng/net-stmmac-Enable-EEE-HW-LPI-timer-with-auto-SW-HW-switching/20201016-000231
git checkout b208a1e7f74a391d1d7c2950e35b97c59af55585
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=xtensa 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:297:6: warning: no 
>> previous prototype for 'stmmac_lpi_entry_timer_config' [-Wmissing-prototypes]
 297 | void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
 |  ^

vim +/stmmac_lpi_entry_timer_config +297 
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

   296  
 > 297  void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
   298  {
   299  int tx_lpi_timer;
   300  
   301  /* Clear/set the SW EEE timer flag based on LPI ET enablement */
   302  priv->eee_sw_timer_en = en ? 0 : 1;
   303  tx_lpi_timer  = en ? priv->tx_lpi_timer : 0;
   304  stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer);
   305  }
   306  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[PATCH v2 net-next] net: stmmac: Enable EEE HW LPI timer with auto SW/HW switching

2020-10-15 Thread Voon Weifeng
From: "Vineetha G. Jaya Kumaran" 

This patch enables the HW LPI Timer which controls the automatic entry
and exit of the LPI state.
The EEE LPI timer value is configured through ethtool. The driver will
auto select the LPI HW timer if the value in the HW timer supported range.
Else, the driver will fallback to SW timer.

Signed-off-by: Vineetha G. Jaya Kumaran 
Signed-off-by: Voon Weifeng 
---
v2 changelog:
-removed #define for LPI_ET_ENABLE and LPI_ET_DISABLE and directly use
 literals
-removed not required function header in stmmac.h
-renamed stmmac_lpi_entry_timer_enable() to stmmac_lpi_entry_timer_config()
-Moved stmmac_lpi_entry_timer_enable() up in the file before
 stmmac_disable_eee_mode()

 drivers/net/ethernet/stmicro/stmmac/common.h  |  1 +
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h  |  2 ++
 .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 24 ++
 drivers/net/ethernet/stmicro/stmmac/hwif.h|  3 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 31 +--
 6 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h 
b/drivers/net/ethernet/stmicro/stmmac/common.h
index df7de50497a0..6f271c46368d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -402,6 +402,7 @@ struct dma_features {
 /* Default LPI timers */
 #define STMMAC_DEFAULT_LIT_LS  0x3E8
 #define STMMAC_DEFAULT_TWT_LS  0x1E
+#define STMMAC_ET_MAX  0xF
 
 #define STMMAC_CHAIN_MODE  0x1
 #define STMMAC_RING_MODE   0x2
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h 
b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 592b043f9676..82df91c130f7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -176,9 +176,11 @@ enum power_event {
  */
 #define GMAC4_LPI_CTRL_STATUS  0xd0
 #define GMAC4_LPI_TIMER_CTRL   0xd4
+#define GMAC4_LPI_ENTRY_TIMER  0xd8
 
 /* LPI control and status defines */
 #define GMAC4_LPI_CTRL_STATUS_LPITCSE  BIT(21) /* LPI Tx Clock Stop Enable */
+#define GMAC4_LPI_CTRL_STATUS_LPIATE   BIT(20) /* LPI Timer Enable */
 #define GMAC4_LPI_CTRL_STATUS_LPITXA   BIT(19) /* Enable LPI TX Automate */
 #define GMAC4_LPI_CTRL_STATUS_PLS  BIT(17) /* PHY Link Status */
 #define GMAC4_LPI_CTRL_STATUS_LPIENBIT(16) /* LPI Enable */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c 
b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 002791b77356..3ed4f4cda7f9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -379,6 +379,27 @@ static void dwmac4_set_eee_pls(struct mac_device_info *hw, 
int link)
writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
 }
 
+static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, int et)
+{
+   void __iomem *ioaddr = hw->pcsr;
+   int value = et & STMMAC_ET_MAX;
+   int regval;
+
+   /* Program LPI entry timer value into register */
+   writel(value, ioaddr + GMAC4_LPI_ENTRY_TIMER);
+
+   /* Enable/disable LPI entry timer */
+   regval = readl(ioaddr + GMAC4_LPI_CTRL_STATUS);
+   regval |= GMAC4_LPI_CTRL_STATUS_LPIEN | GMAC4_LPI_CTRL_STATUS_LPITXA;
+
+   if (et)
+   regval |= GMAC4_LPI_CTRL_STATUS_LPIATE;
+   else
+   regval &= ~GMAC4_LPI_CTRL_STATUS_LPIATE;
+
+   writel(regval, ioaddr + GMAC4_LPI_CTRL_STATUS);
+}
+
 static void dwmac4_set_eee_timer(struct mac_device_info *hw, int ls, int tw)
 {
void __iomem *ioaddr = hw->pcsr;
@@ -1164,6 +1185,7 @@ const struct stmmac_ops dwmac4_ops = {
.get_umac_addr = dwmac4_get_umac_addr,
.set_eee_mode = dwmac4_set_eee_mode,
.reset_eee_mode = dwmac4_reset_eee_mode,
+   .set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
.set_eee_timer = dwmac4_set_eee_timer,
.set_eee_pls = dwmac4_set_eee_pls,
.pcs_ctrl_ane = dwmac4_ctrl_ane,
@@ -1206,6 +1228,7 @@ const struct stmmac_ops dwmac410_ops = {
.get_umac_addr = dwmac4_get_umac_addr,
.set_eee_mode = dwmac4_set_eee_mode,
.reset_eee_mode = dwmac4_reset_eee_mode,
+   .set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
.set_eee_timer = dwmac4_set_eee_timer,
.set_eee_pls = dwmac4_set_eee_pls,
.pcs_ctrl_ane = dwmac4_ctrl_ane,
@@ -1249,6 +1272,7 @@ const struct stmmac_ops dwmac510_ops = {
.get_umac_addr = dwmac4_get_umac_addr,
.set_eee_mode = dwmac4_set_eee_mode,
.reset_eee_mode = dwmac4_reset_eee_mode,
+   .set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
.set_eee_timer = dwmac4_set_eee_timer,
.set_eee_pls = dwmac4_set_eee_pls,
.pcs_ctrl_ane = dwmac4_ctrl_ane,
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h 
b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index e2dca9b6e992..b40b2e0667bb 1006