linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] net: stmmac: misc fix
@ 2017-01-31  9:11 Corentin Labbe
  2017-01-31  9:11 ` [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX Corentin Labbe
                   ` (17 more replies)
  0 siblings, 18 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

Hello

I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
This serie is the result of all minor problem found in the stmmac driver.

Regards

Corentin Labbe (17):
  net: stmmac: fix the typo on MAC_RNABLE_RX
  net: stmmac: Remove the bus_setup function pointer
  net: stmmac: fix some typos in comments
  net: stmmac: remove freesoftware address
  net: stmmac: remplace asm/io.h by linux/io.h
  net: stmmac: fix some code style problem
  net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
  net: stmmac: Use readl_poll_timeout
  net: stmmac: replace ENOSYS by EINVAL
  net: stmmac: Correct the error message about invalid speed
  net: stmmac: Rewrite two test against NULL value
  net: stmmac: rename rx_crc to rx_crc_errors
  net: stmmac: Implement NAPI for TX
  net: stmmac: print phy information
  net: stmmac: remove dead code in stmmac_tx_clean
  net: stmmac: remove unused variable in sysfs_display_ring
  net: stmmac: replace unsigned by u32

 drivers/net/ethernet/stmicro/stmmac/chain_mode.c   |  4 --
 drivers/net/ethernet/stmicro/stmmac/common.h       |  8 +--
 drivers/net/ethernet/stmicro/stmmac/descs.h        |  4 --
 drivers/net/ethernet/stmicro/stmmac/descs_com.h    |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |  4 --
 .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  4 --
 .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  4 --
 .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c    | 28 ++++------
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c     |  6 +--
 drivers/net/ethernet/stmicro/stmmac/mmc.h          |  4 --
 drivers/net/ethernet/stmicro/stmmac/mmc_core.c     |  4 --
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c    |  6 +--
 drivers/net/ethernet/stmicro/stmmac/ring_mode.c    |  4 --
 drivers/net/ethernet/stmicro/stmmac/stmmac.h       |  4 --
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  6 +--
 .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  4 --
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 63 ++++++++++------------
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 52 +++++++-----------
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  4 --
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  6 +--
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |  4 --
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |  4 --
 include/linux/stmmac.h                             |  1 -
 28 files changed, 65 insertions(+), 185 deletions(-)

-- 
2.10.2

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:03   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer Corentin Labbe
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

the define MAC_RNABLE_RX have a typo, rename it to MAC_ENABLE_RX

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h    | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index b13a144..0f90f91 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -340,7 +340,7 @@ struct dma_features {
 /* Common MAC defines */
 #define MAC_CTRL_REG		0x00000000	/* MAC Control */
 #define MAC_ENABLE_TX		0x00000008	/* Transmitter Enable */
-#define MAC_RNABLE_RX		0x00000004	/* Receiver Enable */
+#define MAC_ENABLE_RX		0x00000004	/* Receiver Enable */
 
 /* Default LPI timers */
 #define STMMAC_DEFAULT_LIT_LS	0x3E8
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index 84e3e84..a414bde 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -261,9 +261,9 @@ void stmmac_set_mac(void __iomem *ioaddr, bool enable)
 	u32 value = readl(ioaddr + MAC_CTRL_REG);
 
 	if (enable)
-		value |= MAC_RNABLE_RX | MAC_ENABLE_TX;
+		value |= MAC_ENABLE_RX | MAC_ENABLE_TX;
 	else
-		value &= ~(MAC_ENABLE_TX | MAC_RNABLE_RX);
+		value &= ~(MAC_ENABLE_TX | MAC_ENABLE_RX);
 
 	writel(value, ioaddr + MAC_CTRL_REG);
 }
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
  2017-01-31  9:11 ` [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:02   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 03/17] net: stmmac: fix some typos in comments Corentin Labbe
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

The bus_setup function pointer is not used at all, this patch remove it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ----
 include/linux/stmmac.h                            | 1 -
 2 files changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e3f6389..bf2d8e6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1671,10 +1671,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 	/* Copy the MAC addr into the HW  */
 	priv->hw->mac->set_umac_addr(priv->hw, dev->dev_addr, 0);
 
-	/* If required, perform hw setup of the bus. */
-	if (priv->plat->bus_setup)
-		priv->plat->bus_setup(priv->ioaddr);
-
 	/* PS and related bits will be programmed according to the speed */
 	if (priv->hw->pcs) {
 		int speed = priv->plat->mac_port_sel_speed;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 266dab9..2d82df9 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -135,7 +135,6 @@ struct plat_stmmacenet_data {
 	int tx_fifo_size;
 	int rx_fifo_size;
 	void (*fix_mac_speed)(void *priv, unsigned int speed);
-	void (*bus_setup)(void __iomem *ioaddr);
 	int (*init)(struct platform_device *pdev, void *priv);
 	void (*exit)(struct platform_device *pdev, void *priv);
 	void *bsp_priv;
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 03/17] net: stmmac: fix some typos in comments
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
  2017-01-31  9:11 ` [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX Corentin Labbe
  2017-01-31  9:11 ` [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:03   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 04/17] net: stmmac: remove freesoftware address Corentin Labbe
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

This patch fix some typos in comments.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c   |  6 +++---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++--------
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index a414bde..3b1570d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -102,7 +102,7 @@ static void show_tx_process_state(unsigned int status)
 		pr_debug("- TX (Stopped): Reset or Stop command\n");
 		break;
 	case 1:
-		pr_debug("- TX (Running):Fetching the Tx desc\n");
+		pr_debug("- TX (Running): Fetching the Tx desc\n");
 		break;
 	case 2:
 		pr_debug("- TX (Running): Waiting for end of tx\n");
@@ -136,7 +136,7 @@ static void show_rx_process_state(unsigned int status)
 		pr_debug("- RX (Running): Fetching the Rx desc\n");
 		break;
 	case 2:
-		pr_debug("- RX (Running):Checking for end of pkt\n");
+		pr_debug("- RX (Running): Checking for end of pkt\n");
 		break;
 	case 3:
 		pr_debug("- RX (Running): Waiting for Rx pkt\n");
@@ -246,7 +246,7 @@ void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
 	unsigned long data;
 
 	data = (addr[5] << 8) | addr[4];
-	/* For MAC Addr registers se have to set the Address Enable (AE)
+	/* For MAC Addr registers we have to set the Address Enable (AE)
 	 * bit that has no effect on the High Reg 0 where the bit 31 (MO)
 	 * is RO.
 	 */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bf2d8e6..ee71c07 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -216,7 +216,7 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv)
 /**
  * stmmac_hw_fix_mac_speed - callback for speed selection
  * @priv: driver private structure
- * Description: on some platforms (e.g. ST), some HW system configuraton
+ * Description: on some platforms (e.g. ST), some HW system configuration
  * registers have to be set according to the link speed negotiated.
  */
 static inline void stmmac_hw_fix_mac_speed(struct stmmac_priv *priv)
@@ -415,7 +415,7 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p,
 /**
  *  stmmac_hwtstamp_ioctl - control hardware timestamping.
  *  @dev: device pointer.
- *  @ifr: An IOCTL specefic structure, that can contain a pointer to
+ *  @ifr: An IOCTL specific structure, that can contain a pointer to
  *  a proprietary structure used to pass information to the driver.
  *  Description:
  *  This function configures the MAC to enable/disable both outgoing(TX)
@@ -1014,7 +1014,7 @@ static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i)
  * @dev: net device structure
  * @flags: gfp flag.
  * Description: this function initializes the DMA RX/TX descriptors
- * and allocates the socket buffers. It suppors the chained and ring
+ * and allocates the socket buffers. It supports the chained and ring
  * modes.
  */
 static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
@@ -2515,7 +2515,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
 		if (unlikely(status == discard_frame)) {
 			priv->dev->stats.rx_errors++;
 			if (priv->hwts_rx_en && !priv->extend_desc) {
-				/* DESC2 & DESC3 will be overwitten by device
+				/* DESC2 & DESC3 will be overwritten by device
 				 * with timestamp value, hence reinitialize
 				 * them in stmmac_rx_refill() function so that
 				 * device can reuse it.
@@ -2538,7 +2538,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
 
 			frame_len = priv->hw->desc->get_rx_frame_len(p, coe);
 
-			/*  If frame length is greather than skb buffer size
+			/*  If frame length is greater than skb buffer size
 			 *  (preallocated during init) then the packet is
 			 *  ignored
 			 */
@@ -2744,7 +2744,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
 	/* Some GMAC devices have a bugged Jumbo frame support that
 	 * needs to have the Tx COE disabled for oversized frames
 	 * (due to limited buffer sizes). In this case we disable
-	 * the TX csum insertionin the TDES and not use SF.
+	 * the TX csum insertion in the TDES and not use SF.
 	 */
 	if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN))
 		features &= ~NETIF_F_CSUM_MASK;
@@ -2971,7 +2971,7 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v)
 		   (priv->dma_cap.hash_filter) ? "Y" : "N");
 	seq_printf(seq, "\tMultiple MAC address registers: %s\n",
 		   (priv->dma_cap.multi_addr) ? "Y" : "N");
-	seq_printf(seq, "\tPCS (TBI/SGMII/RTBI PHY interfatces): %s\n",
+	seq_printf(seq, "\tPCS (TBI/SGMII/RTBI PHY interfaces): %s\n",
 		   (priv->dma_cap.pcs) ? "Y" : "N");
 	seq_printf(seq, "\tSMA (MDIO) Interface: %s\n",
 		   (priv->dma_cap.sma_mdio) ? "Y" : "N");
@@ -3508,7 +3508,7 @@ int stmmac_resume(struct device *dev)
 		priv->irq_wake = 0;
 	} else {
 		pinctrl_pm_select_default_state(priv->device);
-		/* enable the clk prevously disabled */
+		/* enable the clk previously disabled */
 		clk_enable(priv->stmmac_clk);
 		clk_enable(priv->pclk);
 		/* reset the phy so that it's ready */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index b0344c2..a1a469e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -198,7 +198,7 @@ int stmmac_mdio_reset(struct mii_bus *bus)
 
 	/* This is a workaround for problems with the STE101P PHY.
 	 * It doesn't complete its reset until at least one clock cycle
-	 * on MDC, so perform a dummy mdio read. To be upadted for GMAC4
+	 * on MDC, so perform a dummy mdio read. To be updated for GMAC4
 	 * if needed.
 	 */
 	if (!priv->plat->has_gmac4)
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 04/17] net: stmmac: remove freesoftware address
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (2 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 03/17] net: stmmac: fix some typos in comments Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31  9:11 ` [PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h Corentin Labbe
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

This patch fix the checkpatch warning about free software address.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/chain_mode.c      | 4 ----
 drivers/net/ethernet/stmicro/stmmac/common.h          | 4 ----
 drivers/net/ethernet/stmicro/stmmac/descs.h           | 4 ----
 drivers/net/ethernet/stmicro/stmmac/descs_com.h       | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac100.h        | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac1000.h       | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c  | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c   | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c   | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c    | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h       | 4 ----
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c       | 4 ----
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c        | 4 ----
 drivers/net/ethernet/stmicro/stmmac/mmc.h             | 4 ----
 drivers/net/ethernet/stmicro/stmmac/mmc_core.c        | 4 ----
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c       | 4 ----
 drivers/net/ethernet/stmicro/stmmac/ring_mode.c       | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac.h          | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c  | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c     | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c      | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c      | 4 ----
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h      | 4 ----
 26 files changed, 104 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
index 026e8e9..01a8c02 100644
--- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
@@ -16,10 +16,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 0f90f91..9da4877 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/descs.h b/drivers/net/ethernet/stmicro/stmmac/descs.h
index faeeef7..0c2432b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/descs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/descs.h
@@ -11,10 +11,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
index 1d181e2..ca9d7e4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h
+++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
@@ -17,10 +17,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
index 1657acf..e149848 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
index 52b9407..c02d366 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
@@ -10,10 +10,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 5484fd7..bfd8639 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -16,10 +16,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index 612d3aa..fbaec0f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -16,10 +16,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
index 9dd2987..8ab5189 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
@@ -18,10 +18,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index e5664da..d40e91e8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -18,10 +18,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
index 726d9d9..56e485f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index 3b1570d..e4cda39 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -10,10 +10,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index f0d8632..8427643 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc.h b/drivers/net/ethernet/stmicro/stmmac/mmc.h
index 38a1a56..c037326 100644
--- a/drivers/net/ethernet/stmicro/stmmac/mmc.h
+++ b/drivers/net/ethernet/stmicro/stmmac/mmc.h
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
index ce9aa79..e9b04c2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index fd78406..5a0d4b0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
index 9983ce9..452f256 100644
--- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
@@ -16,10 +16,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index eab04ae..c8273ef 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -10,10 +10,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 699ee1d..69db8cb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
index 10d6059..721b616 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ee71c07..98f544e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -13,10 +13,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index a1a469e..738d5c7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -13,10 +13,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 3da4737..5c9e4622 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 36942f5..eff6282 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 3eb281d..d71bd80 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
index c06938c..48fb72f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
@@ -12,10 +12,6 @@
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
 
-  You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
   The full GNU General Public License is included in this distribution in
   the file called "COPYING".
 
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (3 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 04/17] net: stmmac: remove freesoftware address Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31  9:11 ` [PATCH 06/17] net: stmmac: fix some code style problem Corentin Labbe
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

This patch fix the checkpatch warning about asm/io.h.
Sorting all includes in the process.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 738d5c7..3fdc6ec 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -20,13 +20,13 @@
   Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com>
 *******************************************************************************/
 
+#include <linux/io.h>
 #include <linux/mii.h>
-#include <linux/phy.h>
-#include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/of_mdio.h>
-#include <asm/io.h>
+#include <linux/phy.h>
+#include <linux/slab.h>
 
 #include "stmmac.h"
 
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 06/17] net: stmmac: fix some code style problem
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (4 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:05   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout Corentin Labbe
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

Checkpatch complains about some code style problem on stmmac_mdio.c.
This patch fix them.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 3fdc6ec..c24bef2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -152,9 +152,9 @@ int stmmac_mdio_reset(struct mii_bus *bus)
 
 #ifdef CONFIG_OF
 	if (priv->device->of_node) {
-
 		if (data->reset_gpio < 0) {
 			struct device_node *np = priv->device->of_node;
+
 			if (!np)
 				return 0;
 
@@ -221,7 +221,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 		return 0;
 
 	new_bus = mdiobus_alloc();
-	if (new_bus == NULL)
+	if (!new_bus)
 		return -ENOMEM;
 
 	if (mdio_bus_data->irqs)
@@ -258,6 +258,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 	found = 0;
 	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
 		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
+
 		if (phydev) {
 			int act = 0;
 			char irq_num[4];
@@ -267,7 +268,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 			 * If an IRQ was provided to be assigned after
 			 * the bus probe, do it here.
 			 */
-			if ((mdio_bus_data->irqs == NULL) &&
+			if ((!mdio_bus_data->irqs) &&
 			    (mdio_bus_data->probed_phy_irq > 0)) {
 				new_bus->irq[addr] =
 					mdio_bus_data->probed_phy_irq;
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (5 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 06/17] net: stmmac: fix some code style problem Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:13   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 08/17] net: stmmac: Use readl_poll_timeout Corentin Labbe
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

The stmmac_mdio_busy_wait() function do the same job than
readl_poll_timeout().
So is is better to replace it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index c24bef2..d9893cf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -21,6 +21,7 @@
 *******************************************************************************/
 
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/mii.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
@@ -38,22 +39,6 @@
 #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
 #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
 
-static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
-{
-	unsigned long curr;
-	unsigned long finish = jiffies + 3 * HZ;
-
-	do {
-		curr = jiffies;
-		if (readl(ioaddr + mii_addr) & MII_BUSY)
-			cpu_relax();
-		else
-			return 0;
-	} while (!time_after_eq(curr, finish));
-
-	return -EBUSY;
-}
-
 /**
  * stmmac_mdio_read
  * @bus: points to the mii_bus structure
@@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
 	unsigned int mii_data = priv->hw->mii.data;
-
+	u32 v;
 	int data;
 	u32 value = MII_BUSY;
 
@@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
 	if (priv->plat->has_gmac4)
 		value |= MII_GMAC4_READ;
 
-	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
+	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+			       100, 10000))
 		return -EBUSY;
 
 	writel(value, priv->ioaddr + mii_address);
 
-	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
+	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+			       100, 10000))
 		return -EBUSY;
 
 	/* Read the data from the MII data register */
@@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
 	unsigned int mii_data = priv->hw->mii.data;
-
+	u32 v;
 	u32 value = MII_BUSY;
 
 	value |= (phyaddr << priv->hw->mii.addr_shift)
@@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 		value |= MII_WRITE;
 
 	/* Wait until any existing MII operation is complete */
-	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
+	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+			       100, 10000))
 		return -EBUSY;
 
 	/* Set the MII address register to write */
@@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 	writel(value, priv->ioaddr + mii_address);
 
 	/* Wait until any existing MII operation is complete */
-	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
+	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+				  100, 10000);
 }
 
 /**
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 08/17] net: stmmac: Use readl_poll_timeout
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (6 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31  9:11 ` [PATCH 09/17] net: stmmac: replace ENOSYS by EINVAL Corentin Labbe
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

The dwmac_dma_reset function use an open coded of readl_poll_timeout().
Replace the open coded handling with the proper function.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index e4cda39..e60bfca 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -17,6 +17,7 @@
 *******************************************************************************/
 
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include "common.h"
 #include "dwmac_dma.h"
 
@@ -25,19 +26,16 @@
 int dwmac_dma_reset(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + DMA_BUS_MODE);
-	int limit;
+	int err;
 
 	/* DMA SW reset */
 	value |= DMA_BUS_MODE_SFT_RESET;
 	writel(value, ioaddr + DMA_BUS_MODE);
-	limit = 10;
-	while (limit--) {
-		if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
-			break;
-		mdelay(10);
-	}
 
-	if (limit < 0)
+	err = readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
+				 !(value & DMA_BUS_MODE_SFT_RESET),
+				 100000, 10000);
+	if (err)
 		return -EBUSY;
 
 	return 0;
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 09/17] net: stmmac: replace ENOSYS by EINVAL
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (7 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 08/17] net: stmmac: Use readl_poll_timeout Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:06   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 10/17] net: stmmac: Correct the error message about invalid speed Corentin Labbe
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

As said by checkpatch ENOSYS means 'invalid syscall nr' and nothing
else.
This patch replace ENOSYS by the more appropriate value EINVAL.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index eff6282..485b1cd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -353,7 +353,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev,
 struct plat_stmmacenet_data *
 stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 {
-	return ERR_PTR(-ENOSYS);
+	return ERR_PTR(-EINVAL);
 }
 
 void stmmac_remove_config_dt(struct platform_device *pdev,
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 10/17] net: stmmac: Correct the error message about invalid speed
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (8 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 09/17] net: stmmac: replace ENOSYS by EINVAL Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:07   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 11/17] net: stmmac: Rewrite two test against NULL value Corentin Labbe
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

Add 1000 as a valid speed in the error message about invalid speed
in stmmac_adjust_link()

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 98f544e..b0154d5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -749,7 +749,7 @@ static void stmmac_adjust_link(struct net_device *dev)
 				break;
 			default:
 				netif_warn(priv, link, priv->dev,
-					   "Speed (%d) not 10/100\n",
+					   "Speed (%d) not 10/100/1000\n",
 					   phydev->speed);
 				break;
 			}
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 11/17] net: stmmac: Rewrite two test against NULL value
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (9 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 10/17] net: stmmac: Correct the error message about invalid speed Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:07   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 12/17] net: stmmac: rename rx_crc to rx_crc_errors Corentin Labbe
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

This patch rewrite two test against NULL value with correct style.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b0154d5..2df36bd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -700,7 +700,7 @@ static void stmmac_adjust_link(struct net_device *dev)
 	int new_state = 0;
 	unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
 
-	if (phydev == NULL)
+	if (!phydev)
 		return;
 
 	spin_lock_irqsave(&priv->lock, flags);
@@ -1143,7 +1143,7 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
 						 DMA_TO_DEVICE);
 		}
 
-		if (priv->tx_skbuff[i] != NULL) {
+		if (priv->tx_skbuff[i]) {
 			dev_kfree_skb_any(priv->tx_skbuff[i]);
 			priv->tx_skbuff[i] = NULL;
 			priv->tx_skbuff_dma[i].buf = 0;
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 12/17] net: stmmac: rename rx_crc to rx_crc_errors
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (10 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 11/17] net: stmmac: Rewrite two test against NULL value Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:08   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 13/17] net: stmmac: Implement NAPI for TX Corentin Labbe
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

The ethtool stat counter rx_crc from stmmac is mis-named, the name
seems to speak about the number of RX CRC done, but in fact it is about
errors.

This patch rename it to rx_crc_errors, just like the same ifconfig
counter.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h         | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c   | 2 +-
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c       | 2 +-
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c      | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 9da4877..b7ee15a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -67,7 +67,7 @@ struct stmmac_extra_stats {
 	unsigned long overflow_error;
 	unsigned long ipc_csum_error;
 	unsigned long rx_collision;
-	unsigned long rx_crc;
+	unsigned long rx_crc_errors;
 	unsigned long dribbling_bit;
 	unsigned long rx_length;
 	unsigned long rx_mii;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index 8816515..843ec69 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -103,7 +103,7 @@ static int dwmac4_wrback_get_rx_status(void *data, struct stmmac_extra_stats *x,
 			x->rx_mii++;
 
 		if (unlikely(rdes3 & RDES3_CRC_ERROR)) {
-			x->rx_crc++;
+			x->rx_crc_errors++;
 			stats->rx_crc_errors++;
 		}
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 8427643..323b59e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -221,7 +221,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
 			x->rx_mii++;
 
 		if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
-			x->rx_crc++;
+			x->rx_crc_errors++;
 			stats->rx_crc_errors++;
 		}
 		ret = discard_frame;
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 5a0d4b0..efb818e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -111,7 +111,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
 			stats->collisions++;
 		}
 		if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
-			x->rx_crc++;
+			x->rx_crc_errors++;
 			stats->rx_crc_errors++;
 		}
 		ret = discard_frame;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 69db8cb..6ca0a10 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -61,7 +61,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
 	STMMAC_STAT(overflow_error),
 	STMMAC_STAT(ipc_csum_error),
 	STMMAC_STAT(rx_collision),
-	STMMAC_STAT(rx_crc),
+	STMMAC_STAT(rx_crc_errors),
 	STMMAC_STAT(dribbling_bit),
 	STMMAC_STAT(rx_length),
 	STMMAC_STAT(rx_mii),
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (11 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 12/17] net: stmmac: rename rx_crc to rx_crc_errors Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:28   ` Giuseppe CAVALLARO
  2017-02-01  4:12   ` David Miller
  2017-01-31  9:11 ` [PATCH 14/17] net: stmmac: print phy information Corentin Labbe
                   ` (4 subsequent siblings)
  17 siblings, 2 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

The stmmac driver run TX completion under NAPI but without checking the
work done by the TX completion function.

This patch add work/budget to the TX completion function.

The visible effect is that it keep the driver longer under NAPI and
boost performance.
Under dwmac-sun8i the iperf goes from 140Mbit/s to 500Mbit/s.
Under dwmac-sunxi an iperf run use half less interrupts.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2df36bd..e53b727 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1299,10 +1299,11 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
  * @priv: driver private structure
  * Description: it reclaims the transmit resources after transmission completes.
  */
-static void stmmac_tx_clean(struct stmmac_priv *priv)
+static int stmmac_tx_clean(struct stmmac_priv *priv, int budget)
 {
 	unsigned int bytes_compl = 0, pkts_compl = 0;
 	unsigned int entry = priv->dirty_tx;
+	int work = 0;
 
 	netif_tx_lock(priv->dev);
 
@@ -1369,6 +1370,9 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
 		priv->hw->desc->release_tx_desc(p, priv->mode);
 
 		entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
+		work++;
+		if (work >= budget)
+			break;
 	}
 	priv->dirty_tx = entry;
 
@@ -1386,6 +1390,11 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
 		mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
 	}
 	netif_tx_unlock(priv->dev);
+
+	if (work < budget)
+		work = 0;
+
+	return work;
 }
 
 static inline void stmmac_enable_dma_irq(struct stmmac_priv *priv)
@@ -1617,7 +1626,7 @@ static void stmmac_tx_timer(unsigned long data)
 {
 	struct stmmac_priv *priv = (struct stmmac_priv *)data;
 
-	stmmac_tx_clean(priv);
+	stmmac_tx_clean(priv, 256);
 }
 
 /**
@@ -2657,9 +2666,10 @@ static int stmmac_poll(struct napi_struct *napi, int budget)
 	int work_done = 0;
 
 	priv->xstats.napi_poll++;
-	stmmac_tx_clean(priv);
+	work_done += stmmac_tx_clean(priv, budget);
 
-	work_done = stmmac_rx(priv, budget);
+	if (work_done < budget)
+		work_done += stmmac_rx(priv, budget - work_done);
 	if (work_done < budget) {
 		napi_complete(napi);
 		stmmac_enable_dma_irq(priv);
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 14/17] net: stmmac: print phy information
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (12 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 13/17] net: stmmac: Implement NAPI for TX Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:10   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean Corentin Labbe
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

When a PHY is found, printing which one was found (and which type/model) is
a good information to know.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e53b727..3d52b8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -885,6 +885,7 @@ static int stmmac_init_phy(struct net_device *dev)
 	netdev_dbg(priv->dev, "%s: attached to PHY (UID 0x%x) Link = %d\n",
 		   __func__, phydev->phy_id, phydev->link);
 
+	phy_attached_info(phydev);
 	return 0;
 }
 
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (13 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 14/17] net: stmmac: print phy information Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:21   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 16/17] net: stmmac: remove unused variable in sysfs_display_ring Corentin Labbe
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

Since commit cf32deec16e4 ("stmmac: add tx_skbuff_dma to save descriptors used by PTP"),
the struct dma_desc *p in stmmac_tx_clean was not used at all.

This patch remove this dead code.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3d52b8c..b494bc2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1124,13 +1124,6 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
 	int i;
 
 	for (i = 0; i < DMA_TX_SIZE; i++) {
-		struct dma_desc *p;
-
-		if (priv->extend_desc)
-			p = &((priv->dma_etx + i)->basic);
-		else
-			p = priv->dma_tx + i;
-
 		if (priv->tx_skbuff_dma[i].buf) {
 			if (priv->tx_skbuff_dma[i].map_as_page)
 				dma_unmap_page(priv->device,
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 16/17] net: stmmac: remove unused variable in sysfs_display_ring
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (14 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:11   ` Giuseppe CAVALLARO
  2017-01-31  9:11 ` [PATCH 17/17] net: stmmac: replace unsigned by u32 Corentin Labbe
  2017-01-31 10:00 ` [PATCH 00/17] net: stmmac: misc fix Giuseppe CAVALLARO
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

The u64 x variable in sysfs_display_ring is unused.
This patch remove it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b494bc2..f0ce780 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2890,9 +2890,7 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
 	struct dma_desc *p = (struct dma_desc *)head;
 
 	for (i = 0; i < size; i++) {
-		u64 x;
 		if (extend_desc) {
-			x = *(u64 *) ep;
 			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
 				   i, (unsigned int)virt_to_phys(ep),
 				   le32_to_cpu(ep->basic.des0),
@@ -2901,7 +2899,6 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
 				   le32_to_cpu(ep->basic.des3));
 			ep++;
 		} else {
-			x = *(u64 *) p;
 			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
 				   i, (unsigned int)virt_to_phys(ep),
 				   le32_to_cpu(p->des0), le32_to_cpu(p->des1),
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 17/17] net: stmmac: replace unsigned by u32
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (15 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 16/17] net: stmmac: remove unused variable in sysfs_display_ring Corentin Labbe
@ 2017-01-31  9:11 ` Corentin Labbe
  2017-01-31 10:12   ` Giuseppe CAVALLARO
  2017-01-31 10:00 ` [PATCH 00/17] net: stmmac: misc fix Giuseppe CAVALLARO
  17 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31  9:11 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Corentin Labbe

checkpatch complains about two unsigned without type after.
Since the value return is u32, it is simpler to replace it by u32 instead
of "unsigned int"

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f0ce780..6260b6f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -187,7 +187,7 @@ static void print_pkt(unsigned char *buf, int len)
 
 static inline u32 stmmac_tx_avail(struct stmmac_priv *priv)
 {
-	unsigned avail;
+	u32 avail;
 
 	if (priv->dirty_tx > priv->cur_tx)
 		avail = priv->dirty_tx - priv->cur_tx - 1;
@@ -199,7 +199,7 @@ static inline u32 stmmac_tx_avail(struct stmmac_priv *priv)
 
 static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv)
 {
-	unsigned dirty;
+	u32 dirty;
 
 	if (priv->dirty_rx <= priv->cur_rx)
 		dirty = priv->cur_rx - priv->dirty_rx;
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/17] net: stmmac: misc fix
  2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
                   ` (16 preceding siblings ...)
  2017-01-31  9:11 ` [PATCH 17/17] net: stmmac: replace unsigned by u32 Corentin Labbe
@ 2017-01-31 10:00 ` Giuseppe CAVALLARO
  2017-01-31 10:23   ` Joao Pinto
  17 siblings, 1 reply; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:00 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel, Joao Pinto

Hello Corentin

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> Hello
>
> I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
> This serie is the result of all minor problem found in the stmmac driver.

thank for this effort, many changes are to tidy up some part of the code
so  I wonder if these should stay on top of net-next.
There is on-going a thread to change something in the stmmac (where I
missed more details and I tried to refresh all asap); so added on copy
Joao.

I will give you my feedback on some patches too.

peppe

> Regards
>
> Corentin Labbe (17):
>   net: stmmac: fix the typo on MAC_RNABLE_RX
>   net: stmmac: Remove the bus_setup function pointer
>   net: stmmac: fix some typos in comments
>   net: stmmac: remove freesoftware address
>   net: stmmac: remplace asm/io.h by linux/io.h
>   net: stmmac: fix some code style problem
>   net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
>   net: stmmac: Use readl_poll_timeout
>   net: stmmac: replace ENOSYS by EINVAL
>   net: stmmac: Correct the error message about invalid speed
>   net: stmmac: Rewrite two test against NULL value
>   net: stmmac: rename rx_crc to rx_crc_errors
>   net: stmmac: Implement NAPI for TX
>   net: stmmac: print phy information
>   net: stmmac: remove dead code in stmmac_tx_clean
>   net: stmmac: remove unused variable in sysfs_display_ring
>   net: stmmac: replace unsigned by u32
>
>  drivers/net/ethernet/stmicro/stmmac/chain_mode.c   |  4 --
>  drivers/net/ethernet/stmicro/stmmac/common.h       |  8 +--
>  drivers/net/ethernet/stmicro/stmmac/descs.h        |  4 --
>  drivers/net/ethernet/stmicro/stmmac/descs_com.h    |  4 --
>  drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |  4 --
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |  4 --
>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  4 --
>  .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  4 --
>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  4 --
>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  4 --
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |  2 +-
>  drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |  4 --
>  drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c    | 28 ++++------
>  drivers/net/ethernet/stmicro/stmmac/enh_desc.c     |  6 +--
>  drivers/net/ethernet/stmicro/stmmac/mmc.h          |  4 --
>  drivers/net/ethernet/stmicro/stmmac/mmc_core.c     |  4 --
>  drivers/net/ethernet/stmicro/stmmac/norm_desc.c    |  6 +--
>  drivers/net/ethernet/stmicro/stmmac/ring_mode.c    |  4 --
>  drivers/net/ethernet/stmicro/stmmac/stmmac.h       |  4 --
>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  6 +--
>  .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  4 --
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 63 ++++++++++------------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 52 +++++++-----------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  4 --
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  6 +--
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |  4 --
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |  4 --
>  include/linux/stmmac.h                             |  1 -
>  28 files changed, 65 insertions(+), 185 deletions(-)
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer
  2017-01-31  9:11 ` [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer Corentin Labbe
@ 2017-01-31 10:02   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:02 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Patrice CHOTARD

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The bus_setup function pointer is not used at all, this patch remove it.

indeed this was used and documented on some previous kernels where some
ST40/SH4 platforms (w/o DT).

It's ok to remove it in the new MAC generation; I do not think that
ST will re-use it on new development.

Peppe

>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ----
>  include/linux/stmmac.h                            | 1 -
>  2 files changed, 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e3f6389..bf2d8e6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1671,10 +1671,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
>  	/* Copy the MAC addr into the HW  */
>  	priv->hw->mac->set_umac_addr(priv->hw, dev->dev_addr, 0);
>
> -	/* If required, perform hw setup of the bus. */
> -	if (priv->plat->bus_setup)
> -		priv->plat->bus_setup(priv->ioaddr);
> -
>  	/* PS and related bits will be programmed according to the speed */
>  	if (priv->hw->pcs) {
>  		int speed = priv->plat->mac_port_sel_speed;
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index 266dab9..2d82df9 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -135,7 +135,6 @@ struct plat_stmmacenet_data {
>  	int tx_fifo_size;
>  	int rx_fifo_size;
>  	void (*fix_mac_speed)(void *priv, unsigned int speed);
> -	void (*bus_setup)(void __iomem *ioaddr);
>  	int (*init)(struct platform_device *pdev, void *priv);
>  	void (*exit)(struct platform_device *pdev, void *priv);
>  	void *bsp_priv;
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX
  2017-01-31  9:11 ` [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX Corentin Labbe
@ 2017-01-31 10:03   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:03 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> the define MAC_RNABLE_RX have a typo, rename it to MAC_ENABLE_RX
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/common.h    | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index b13a144..0f90f91 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -340,7 +340,7 @@ struct dma_features {
>  /* Common MAC defines */
>  #define MAC_CTRL_REG		0x00000000	/* MAC Control */
>  #define MAC_ENABLE_TX		0x00000008	/* Transmitter Enable */
> -#define MAC_RNABLE_RX		0x00000004	/* Receiver Enable */
> +#define MAC_ENABLE_RX		0x00000004	/* Receiver Enable */
>
>  /* Default LPI timers */
>  #define STMMAC_DEFAULT_LIT_LS	0x3E8
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> index 84e3e84..a414bde 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> @@ -261,9 +261,9 @@ void stmmac_set_mac(void __iomem *ioaddr, bool enable)
>  	u32 value = readl(ioaddr + MAC_CTRL_REG);
>
>  	if (enable)
> -		value |= MAC_RNABLE_RX | MAC_ENABLE_TX;
> +		value |= MAC_ENABLE_RX | MAC_ENABLE_TX;
>  	else
> -		value &= ~(MAC_ENABLE_TX | MAC_RNABLE_RX);
> +		value &= ~(MAC_ENABLE_TX | MAC_ENABLE_RX);
>
>  	writel(value, ioaddr + MAC_CTRL_REG);
>  }
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 03/17] net: stmmac: fix some typos in comments
  2017-01-31  9:11 ` [PATCH 03/17] net: stmmac: fix some typos in comments Corentin Labbe
@ 2017-01-31 10:03   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:03 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> This patch fix some typos in comments.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c   |  6 +++---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++--------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |  2 +-
>  3 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> index a414bde..3b1570d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> @@ -102,7 +102,7 @@ static void show_tx_process_state(unsigned int status)
>  		pr_debug("- TX (Stopped): Reset or Stop command\n");
>  		break;
>  	case 1:
> -		pr_debug("- TX (Running):Fetching the Tx desc\n");
> +		pr_debug("- TX (Running): Fetching the Tx desc\n");
>  		break;
>  	case 2:
>  		pr_debug("- TX (Running): Waiting for end of tx\n");
> @@ -136,7 +136,7 @@ static void show_rx_process_state(unsigned int status)
>  		pr_debug("- RX (Running): Fetching the Rx desc\n");
>  		break;
>  	case 2:
> -		pr_debug("- RX (Running):Checking for end of pkt\n");
> +		pr_debug("- RX (Running): Checking for end of pkt\n");
>  		break;
>  	case 3:
>  		pr_debug("- RX (Running): Waiting for Rx pkt\n");
> @@ -246,7 +246,7 @@ void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
>  	unsigned long data;
>
>  	data = (addr[5] << 8) | addr[4];
> -	/* For MAC Addr registers se have to set the Address Enable (AE)
> +	/* For MAC Addr registers we have to set the Address Enable (AE)
>  	 * bit that has no effect on the High Reg 0 where the bit 31 (MO)
>  	 * is RO.
>  	 */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index bf2d8e6..ee71c07 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -216,7 +216,7 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv)
>  /**
>   * stmmac_hw_fix_mac_speed - callback for speed selection
>   * @priv: driver private structure
> - * Description: on some platforms (e.g. ST), some HW system configuraton
> + * Description: on some platforms (e.g. ST), some HW system configuration
>   * registers have to be set according to the link speed negotiated.
>   */
>  static inline void stmmac_hw_fix_mac_speed(struct stmmac_priv *priv)
> @@ -415,7 +415,7 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p,
>  /**
>   *  stmmac_hwtstamp_ioctl - control hardware timestamping.
>   *  @dev: device pointer.
> - *  @ifr: An IOCTL specefic structure, that can contain a pointer to
> + *  @ifr: An IOCTL specific structure, that can contain a pointer to
>   *  a proprietary structure used to pass information to the driver.
>   *  Description:
>   *  This function configures the MAC to enable/disable both outgoing(TX)
> @@ -1014,7 +1014,7 @@ static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i)
>   * @dev: net device structure
>   * @flags: gfp flag.
>   * Description: this function initializes the DMA RX/TX descriptors
> - * and allocates the socket buffers. It suppors the chained and ring
> + * and allocates the socket buffers. It supports the chained and ring
>   * modes.
>   */
>  static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
> @@ -2515,7 +2515,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
>  		if (unlikely(status == discard_frame)) {
>  			priv->dev->stats.rx_errors++;
>  			if (priv->hwts_rx_en && !priv->extend_desc) {
> -				/* DESC2 & DESC3 will be overwitten by device
> +				/* DESC2 & DESC3 will be overwritten by device
>  				 * with timestamp value, hence reinitialize
>  				 * them in stmmac_rx_refill() function so that
>  				 * device can reuse it.
> @@ -2538,7 +2538,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
>
>  			frame_len = priv->hw->desc->get_rx_frame_len(p, coe);
>
> -			/*  If frame length is greather than skb buffer size
> +			/*  If frame length is greater than skb buffer size
>  			 *  (preallocated during init) then the packet is
>  			 *  ignored
>  			 */
> @@ -2744,7 +2744,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
>  	/* Some GMAC devices have a bugged Jumbo frame support that
>  	 * needs to have the Tx COE disabled for oversized frames
>  	 * (due to limited buffer sizes). In this case we disable
> -	 * the TX csum insertionin the TDES and not use SF.
> +	 * the TX csum insertion in the TDES and not use SF.
>  	 */
>  	if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN))
>  		features &= ~NETIF_F_CSUM_MASK;
> @@ -2971,7 +2971,7 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v)
>  		   (priv->dma_cap.hash_filter) ? "Y" : "N");
>  	seq_printf(seq, "\tMultiple MAC address registers: %s\n",
>  		   (priv->dma_cap.multi_addr) ? "Y" : "N");
> -	seq_printf(seq, "\tPCS (TBI/SGMII/RTBI PHY interfatces): %s\n",
> +	seq_printf(seq, "\tPCS (TBI/SGMII/RTBI PHY interfaces): %s\n",
>  		   (priv->dma_cap.pcs) ? "Y" : "N");
>  	seq_printf(seq, "\tSMA (MDIO) Interface: %s\n",
>  		   (priv->dma_cap.sma_mdio) ? "Y" : "N");
> @@ -3508,7 +3508,7 @@ int stmmac_resume(struct device *dev)
>  		priv->irq_wake = 0;
>  	} else {
>  		pinctrl_pm_select_default_state(priv->device);
> -		/* enable the clk prevously disabled */
> +		/* enable the clk previously disabled */
>  		clk_enable(priv->stmmac_clk);
>  		clk_enable(priv->pclk);
>  		/* reset the phy so that it's ready */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index b0344c2..a1a469e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -198,7 +198,7 @@ int stmmac_mdio_reset(struct mii_bus *bus)
>
>  	/* This is a workaround for problems with the STE101P PHY.
>  	 * It doesn't complete its reset until at least one clock cycle
> -	 * on MDC, so perform a dummy mdio read. To be upadted for GMAC4
> +	 * on MDC, so perform a dummy mdio read. To be updated for GMAC4
>  	 * if needed.
>  	 */
>  	if (!priv->plat->has_gmac4)
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 06/17] net: stmmac: fix some code style problem
  2017-01-31  9:11 ` [PATCH 06/17] net: stmmac: fix some code style problem Corentin Labbe
@ 2017-01-31 10:05   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:05 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> Checkpatch complains about some code style problem on stmmac_mdio.c.
> This patch fix them.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index 3fdc6ec..c24bef2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -152,9 +152,9 @@ int stmmac_mdio_reset(struct mii_bus *bus)
>
>  #ifdef CONFIG_OF
>  	if (priv->device->of_node) {
> -
>  		if (data->reset_gpio < 0) {
>  			struct device_node *np = priv->device->of_node;
> +
>  			if (!np)
>  				return 0;
>
> @@ -221,7 +221,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  		return 0;
>
>  	new_bus = mdiobus_alloc();
> -	if (new_bus == NULL)
> +	if (!new_bus)
>  		return -ENOMEM;
>
>  	if (mdio_bus_data->irqs)
> @@ -258,6 +258,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  	found = 0;
>  	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
>  		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
> +
>  		if (phydev) {
>  			int act = 0;
>  			char irq_num[4];
> @@ -267,7 +268,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  			 * If an IRQ was provided to be assigned after
>  			 * the bus probe, do it here.
>  			 */
> -			if ((mdio_bus_data->irqs == NULL) &&
> +			if ((!mdio_bus_data->irqs) &&
>  			    (mdio_bus_data->probed_phy_irq > 0)) {
>  				new_bus->irq[addr] =
>  					mdio_bus_data->probed_phy_irq;
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 09/17] net: stmmac: replace ENOSYS by EINVAL
  2017-01-31  9:11 ` [PATCH 09/17] net: stmmac: replace ENOSYS by EINVAL Corentin Labbe
@ 2017-01-31 10:06   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:06 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> As said by checkpatch ENOSYS means 'invalid syscall nr' and nothing
> else.
> This patch replace ENOSYS by the more appropriate value EINVAL.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index eff6282..485b1cd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -353,7 +353,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev,
>  struct plat_stmmacenet_data *
>  stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>  {
> -	return ERR_PTR(-ENOSYS);
> +	return ERR_PTR(-EINVAL);
>  }
>
>  void stmmac_remove_config_dt(struct platform_device *pdev,
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 10/17] net: stmmac: Correct the error message about invalid speed
  2017-01-31  9:11 ` [PATCH 10/17] net: stmmac: Correct the error message about invalid speed Corentin Labbe
@ 2017-01-31 10:07   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:07 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> Add 1000 as a valid speed in the error message about invalid speed
> in stmmac_adjust_link()
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 98f544e..b0154d5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -749,7 +749,7 @@ static void stmmac_adjust_link(struct net_device *dev)
>  				break;
>  			default:
>  				netif_warn(priv, link, priv->dev,
> -					   "Speed (%d) not 10/100\n",
> +					   "Speed (%d) not 10/100/1000\n",

maybe, it could be "broken speed: %d"

peppe

>  					   phydev->speed);
>  				break;
>  			}
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 11/17] net: stmmac: Rewrite two test against NULL value
  2017-01-31  9:11 ` [PATCH 11/17] net: stmmac: Rewrite two test against NULL value Corentin Labbe
@ 2017-01-31 10:07   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:07 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> This patch rewrite two test against NULL value with correct style.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index b0154d5..2df36bd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -700,7 +700,7 @@ static void stmmac_adjust_link(struct net_device *dev)
>  	int new_state = 0;
>  	unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
>
> -	if (phydev == NULL)
> +	if (!phydev)
>  		return;
>
>  	spin_lock_irqsave(&priv->lock, flags);
> @@ -1143,7 +1143,7 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
>  						 DMA_TO_DEVICE);
>  		}
>
> -		if (priv->tx_skbuff[i] != NULL) {
> +		if (priv->tx_skbuff[i]) {
>  			dev_kfree_skb_any(priv->tx_skbuff[i]);
>  			priv->tx_skbuff[i] = NULL;
>  			priv->tx_skbuff_dma[i].buf = 0;
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 12/17] net: stmmac: rename rx_crc to rx_crc_errors
  2017-01-31  9:11 ` [PATCH 12/17] net: stmmac: rename rx_crc to rx_crc_errors Corentin Labbe
@ 2017-01-31 10:08   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:08 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The ethtool stat counter rx_crc from stmmac is mis-named, the name
> seems to speak about the number of RX CRC done, but in fact it is about
> errors.
>
> This patch rename it to rx_crc_errors, just like the same ifconfig
> counter.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/common.h         | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c   | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/enh_desc.c       | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/norm_desc.c      | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index 9da4877..b7ee15a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -67,7 +67,7 @@ struct stmmac_extra_stats {
>  	unsigned long overflow_error;
>  	unsigned long ipc_csum_error;
>  	unsigned long rx_collision;
> -	unsigned long rx_crc;
> +	unsigned long rx_crc_errors;
>  	unsigned long dribbling_bit;
>  	unsigned long rx_length;
>  	unsigned long rx_mii;
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> index 8816515..843ec69 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> @@ -103,7 +103,7 @@ static int dwmac4_wrback_get_rx_status(void *data, struct stmmac_extra_stats *x,
>  			x->rx_mii++;
>
>  		if (unlikely(rdes3 & RDES3_CRC_ERROR)) {
> -			x->rx_crc++;
> +			x->rx_crc_errors++;
>  			stats->rx_crc_errors++;
>  		}
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> index 8427643..323b59e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> @@ -221,7 +221,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
>  			x->rx_mii++;
>
>  		if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
> -			x->rx_crc++;
> +			x->rx_crc_errors++;
>  			stats->rx_crc_errors++;
>  		}
>  		ret = discard_frame;
> diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
> index 5a0d4b0..efb818e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
> @@ -111,7 +111,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
>  			stats->collisions++;
>  		}
>  		if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
> -			x->rx_crc++;
> +			x->rx_crc_errors++;
>  			stats->rx_crc_errors++;
>  		}
>  		ret = discard_frame;
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> index 69db8cb..6ca0a10 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> @@ -61,7 +61,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
>  	STMMAC_STAT(overflow_error),
>  	STMMAC_STAT(ipc_csum_error),
>  	STMMAC_STAT(rx_collision),
> -	STMMAC_STAT(rx_crc),
> +	STMMAC_STAT(rx_crc_errors),
>  	STMMAC_STAT(dribbling_bit),
>  	STMMAC_STAT(rx_length),
>  	STMMAC_STAT(rx_mii),
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 14/17] net: stmmac: print phy information
  2017-01-31  9:11 ` [PATCH 14/17] net: stmmac: print phy information Corentin Labbe
@ 2017-01-31 10:10   ` Giuseppe CAVALLARO
  2017-02-03 13:16     ` Corentin Labbe
  0 siblings, 1 reply; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:10 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> When a PHY is found, printing which one was found (and which type/model) is
> a good information to know.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e53b727..3d52b8c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -885,6 +885,7 @@ static int stmmac_init_phy(struct net_device *dev)
>  	netdev_dbg(priv->dev, "%s: attached to PHY (UID 0x%x) Link = %d\n",
>  		   __func__, phydev->phy_id, phydev->link);
>
> +	phy_attached_info(phydev);

maybe we could remove the netdev_dbg above and just keep
phy_attached_info(phydev);

peppe

>  	return 0;
>  }
>
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 16/17] net: stmmac: remove unused variable in sysfs_display_ring
  2017-01-31  9:11 ` [PATCH 16/17] net: stmmac: remove unused variable in sysfs_display_ring Corentin Labbe
@ 2017-01-31 10:11   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:11 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The u64 x variable in sysfs_display_ring is unused.
> This patch remove it.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>


well spot

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>


> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index b494bc2..f0ce780 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2890,9 +2890,7 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
>  	struct dma_desc *p = (struct dma_desc *)head;
>
>  	for (i = 0; i < size; i++) {
> -		u64 x;
>  		if (extend_desc) {
> -			x = *(u64 *) ep;
>  			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
>  				   i, (unsigned int)virt_to_phys(ep),
>  				   le32_to_cpu(ep->basic.des0),
> @@ -2901,7 +2899,6 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
>  				   le32_to_cpu(ep->basic.des3));
>  			ep++;
>  		} else {
> -			x = *(u64 *) p;
>  			seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
>  				   i, (unsigned int)virt_to_phys(ep),
>  				   le32_to_cpu(p->des0), le32_to_cpu(p->des1),
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 17/17] net: stmmac: replace unsigned by u32
  2017-01-31  9:11 ` [PATCH 17/17] net: stmmac: replace unsigned by u32 Corentin Labbe
@ 2017-01-31 10:12   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:12 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> checkpatch complains about two unsigned without type after.
> Since the value return is u32, it is simpler to replace it by u32 instead
> of "unsigned int"
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>


Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index f0ce780..6260b6f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -187,7 +187,7 @@ static void print_pkt(unsigned char *buf, int len)
>
>  static inline u32 stmmac_tx_avail(struct stmmac_priv *priv)
>  {
> -	unsigned avail;
> +	u32 avail;
>
>  	if (priv->dirty_tx > priv->cur_tx)
>  		avail = priv->dirty_tx - priv->cur_tx - 1;
> @@ -199,7 +199,7 @@ static inline u32 stmmac_tx_avail(struct stmmac_priv *priv)
>
>  static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv)
>  {
> -	unsigned dirty;
> +	u32 dirty;
>
>  	if (priv->dirty_rx <= priv->cur_rx)
>  		dirty = priv->cur_rx - priv->dirty_rx;
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
  2017-01-31  9:11 ` [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout Corentin Labbe
@ 2017-01-31 10:13   ` Giuseppe CAVALLARO
  2017-01-31 10:39     ` Corentin Labbe
  0 siblings, 1 reply; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:13 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The stmmac_mdio_busy_wait() function do the same job than
> readl_poll_timeout().
> So is is better to replace it.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

I just wonder if you also tested it, this impacts all the platforms
where SMA block is used

if yes, pls consider my:

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index c24bef2..d9893cf 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -21,6 +21,7 @@
>  *******************************************************************************/
>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/mii.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
> @@ -38,22 +39,6 @@
>  #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
>  #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
>
> -static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
> -{
> -	unsigned long curr;
> -	unsigned long finish = jiffies + 3 * HZ;
> -
> -	do {
> -		curr = jiffies;
> -		if (readl(ioaddr + mii_addr) & MII_BUSY)
> -			cpu_relax();
> -		else
> -			return 0;
> -	} while (!time_after_eq(curr, finish));
> -
> -	return -EBUSY;
> -}
> -
>  /**
>   * stmmac_mdio_read
>   * @bus: points to the mii_bus structure
> @@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>  	struct stmmac_priv *priv = netdev_priv(ndev);
>  	unsigned int mii_address = priv->hw->mii.addr;
>  	unsigned int mii_data = priv->hw->mii.data;
> -
> +	u32 v;
>  	int data;
>  	u32 value = MII_BUSY;
>
> @@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>  	if (priv->plat->has_gmac4)
>  		value |= MII_GMAC4_READ;
>
> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +			       100, 10000))
>  		return -EBUSY;
>
>  	writel(value, priv->ioaddr + mii_address);
>
> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +			       100, 10000))
>  		return -EBUSY;
>
>  	/* Read the data from the MII data register */
> @@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>  	struct stmmac_priv *priv = netdev_priv(ndev);
>  	unsigned int mii_address = priv->hw->mii.addr;
>  	unsigned int mii_data = priv->hw->mii.data;
> -
> +	u32 v;
>  	u32 value = MII_BUSY;
>
>  	value |= (phyaddr << priv->hw->mii.addr_shift)
> @@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>  		value |= MII_WRITE;
>
>  	/* Wait until any existing MII operation is complete */
> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +			       100, 10000))
>  		return -EBUSY;
>
>  	/* Set the MII address register to write */
> @@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>  	writel(value, priv->ioaddr + mii_address);
>
>  	/* Wait until any existing MII operation is complete */
> -	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
> +	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +				  100, 10000);
>  }
>
>  /**
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean
  2017-01-31  9:11 ` [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean Corentin Labbe
@ 2017-01-31 10:21   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:21 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> Since commit cf32deec16e4 ("stmmac: add tx_skbuff_dma to save descriptors used by PTP"),
> the struct dma_desc *p in stmmac_tx_clean was not used at all.
>
> This patch remove this dead code.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 3d52b8c..b494bc2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1124,13 +1124,6 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
>  	int i;
>
>  	for (i = 0; i < DMA_TX_SIZE; i++) {
> -		struct dma_desc *p;
> -
> -		if (priv->extend_desc)
> -			p = &((priv->dma_etx + i)->basic);
> -		else
> -			p = priv->dma_tx + i;
> -
>  		if (priv->tx_skbuff_dma[i].buf) {
>  			if (priv->tx_skbuff_dma[i].map_as_page)
>  				dma_unmap_page(priv->device,
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/17] net: stmmac: misc fix
  2017-01-31 10:00 ` [PATCH 00/17] net: stmmac: misc fix Giuseppe CAVALLARO
@ 2017-01-31 10:23   ` Joao Pinto
  2017-01-31 10:33     ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 44+ messages in thread
From: Joao Pinto @ 2017-01-31 10:23 UTC (permalink / raw)
  To: Giuseppe CAVALLARO, Corentin Labbe, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Joao Pinto


Hi Peppe,

Às 10:00 AM de 1/31/2017, Giuseppe CAVALLARO escreveu:
> Hello Corentin
> 
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
>> Hello
>>
>> I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
>> This serie is the result of all minor problem found in the stmmac driver.
> 
> thank for this effort, many changes are to tidy up some part of the code
> so  I wonder if these should stay on top of net-next.
> There is on-going a thread to change something in the stmmac (where I
> missed more details and I tried to refresh all asap); so added on copy
> Joao.

I submitted 2 suggestions that would rename folder stmicro to dwc and dwmac4*
files to eqos. The second one is important, since there is no dwmc4/gmac4 core,
in fact it is called eqos that will have 5.00 version very soon. Both
suggestions were rejected and so I turned to developing features.
I am available to discuss with you any improvement on these aspects if you think
it makes sense.

Currently I am developing the support for multi-queues / multi-channels which
will enable in the future stmmac to be used in QAv and TSN applications.

Thanks,
Joao

> 
> I will give you my feedback on some patches too.
> 
> peppe
> 
>> Regards
>>
>> Corentin Labbe (17):
>>   net: stmmac: fix the typo on MAC_RNABLE_RX
>>   net: stmmac: Remove the bus_setup function pointer
>>   net: stmmac: fix some typos in comments
>>   net: stmmac: remove freesoftware address
>>   net: stmmac: remplace asm/io.h by linux/io.h
>>   net: stmmac: fix some code style problem
>>   net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
>>   net: stmmac: Use readl_poll_timeout
>>   net: stmmac: replace ENOSYS by EINVAL
>>   net: stmmac: Correct the error message about invalid speed
>>   net: stmmac: Rewrite two test against NULL value
>>   net: stmmac: rename rx_crc to rx_crc_errors
>>   net: stmmac: Implement NAPI for TX
>>   net: stmmac: print phy information
>>   net: stmmac: remove dead code in stmmac_tx_clean
>>   net: stmmac: remove unused variable in sysfs_display_ring
>>   net: stmmac: replace unsigned by u32
>>
>>  drivers/net/ethernet/stmicro/stmmac/chain_mode.c   |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/common.h       |  8 +--
>>  drivers/net/ethernet/stmicro/stmmac/descs.h        |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/descs_com.h    |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |  4 --
>>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  4 --
>>  .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  4 --
>>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |  2 +-
>>  drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c    | 28 ++++------
>>  drivers/net/ethernet/stmicro/stmmac/enh_desc.c     |  6 +--
>>  drivers/net/ethernet/stmicro/stmmac/mmc.h          |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/mmc_core.c     |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/norm_desc.c    |  6 +--
>>  drivers/net/ethernet/stmicro/stmmac/ring_mode.c    |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/stmmac.h       |  4 --
>>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  6 +--
>>  .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 63 ++++++++++------------
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 52 +++++++-----------
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  4 --
>>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  6 +--
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |  4 --
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |  4 --
>>  include/linux/stmmac.h                             |  1 -
>>  28 files changed, 65 insertions(+), 185 deletions(-)
>>
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-01-31  9:11 ` [PATCH 13/17] net: stmmac: Implement NAPI for TX Corentin Labbe
@ 2017-01-31 10:28   ` Giuseppe CAVALLARO
  2017-01-31 13:38     ` Corentin Labbe
  2017-02-01  4:12   ` David Miller
  1 sibling, 1 reply; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:28 UTC (permalink / raw)
  To: Corentin Labbe, alexandre.torgue, netdev; +Cc: davem, linux-kernel

On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The stmmac driver run TX completion under NAPI but without checking the
> work done by the TX completion function.
>
> This patch add work/budget to the TX completion function.
>
> The visible effect is that it keep the driver longer under NAPI and
> boost performance.
> Under dwmac-sun8i the iperf goes from 140Mbit/s to 500Mbit/s.
> Under dwmac-sunxi an iperf run use half less interrupts.

I think that this patch should be sent separately with more details
about the implementation you are adopting and results.

For example, in the timer callback you force 256 (it seems
DMA_TX_SIZE/2); do you think this should be tunable or fixed to
NAPI budget?

I'd like to understand if performance you get are for TCP traffic;
can you tell me what happens on unidirectional traffic?

Thx a lot for your effort, pls let me know

Regards
peppe

>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 2df36bd..e53b727 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1299,10 +1299,11 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
>   * @priv: driver private structure
>   * Description: it reclaims the transmit resources after transmission completes.
>   */
> -static void stmmac_tx_clean(struct stmmac_priv *priv)
> +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget)
>  {
>  	unsigned int bytes_compl = 0, pkts_compl = 0;
>  	unsigned int entry = priv->dirty_tx;
> +	int work = 0;
>
>  	netif_tx_lock(priv->dev);
>
> @@ -1369,6 +1370,9 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
>  		priv->hw->desc->release_tx_desc(p, priv->mode);
>
>  		entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
> +		work++;
> +		if (work >= budget)
> +			break;
>  	}
>  	priv->dirty_tx = entry;
>
> @@ -1386,6 +1390,11 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
>  		mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
>  	}
>  	netif_tx_unlock(priv->dev);
> +
> +	if (work < budget)
> +		work = 0;
> +
> +	return work;
>  }
>
>  static inline void stmmac_enable_dma_irq(struct stmmac_priv *priv)
> @@ -1617,7 +1626,7 @@ static void stmmac_tx_timer(unsigned long data)
>  {
>  	struct stmmac_priv *priv = (struct stmmac_priv *)data;
>
> -	stmmac_tx_clean(priv);
> +	stmmac_tx_clean(priv, 256);
>  }
>
>  /**
> @@ -2657,9 +2666,10 @@ static int stmmac_poll(struct napi_struct *napi, int budget)
>  	int work_done = 0;
>
>  	priv->xstats.napi_poll++;
> -	stmmac_tx_clean(priv);
> +	work_done += stmmac_tx_clean(priv, budget);
>
> -	work_done = stmmac_rx(priv, budget);
> +	if (work_done < budget)
> +		work_done += stmmac_rx(priv, budget - work_done);
>  	if (work_done < budget) {
>  		napi_complete(napi);
>  		stmmac_enable_dma_irq(priv);
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/17] net: stmmac: misc fix
  2017-01-31 10:23   ` Joao Pinto
@ 2017-01-31 10:33     ` Giuseppe CAVALLARO
  2017-01-31 10:37       ` Joao Pinto
  0 siblings, 1 reply; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:33 UTC (permalink / raw)
  To: Joao Pinto, Corentin Labbe, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Lars Persson

On 1/31/2017 11:23 AM, Joao Pinto wrote:
>
> Hi Peppe,
>
> Às 10:00 AM de 1/31/2017, Giuseppe CAVALLARO escreveu:
>> Hello Corentin
>>
>> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
>>> Hello
>>>
>>> I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
>>> This serie is the result of all minor problem found in the stmmac driver.
>>
>> thank for this effort, many changes are to tidy up some part of the code
>> so  I wonder if these should stay on top of net-next.
>> There is on-going a thread to change something in the stmmac (where I
>> missed more details and I tried to refresh all asap); so added on copy
>> Joao.
>
> I submitted 2 suggestions that would rename folder stmicro to dwc and dwmac4*
> files to eqos. The second one is important, since there is no dwmc4/gmac4 core,
> in fact it is called eqos that will have 5.00 version very soon. Both
> suggestions were rejected and so I turned to developing features.
> I am available to discuss with you any improvement on these aspects if you think
> it makes sense.
>
> Currently I am developing the support for multi-queues / multi-channels which
> will enable in the future stmmac to be used in QAv and TSN applications.

this is a really good point, so I am happy that you are looking for this
supports that can stay on high priority and do not generate conflicts
with this patch series.

We will reopen the renaming story later... I hope to be more reactive
on that and sorry for my absence.

Regards
Peppe

>
> Thanks,
> Joao
>
>>
>> I will give you my feedback on some patches too.
>>
>> peppe
>>
>>> Regards
>>>
>>> Corentin Labbe (17):
>>>   net: stmmac: fix the typo on MAC_RNABLE_RX
>>>   net: stmmac: Remove the bus_setup function pointer
>>>   net: stmmac: fix some typos in comments
>>>   net: stmmac: remove freesoftware address
>>>   net: stmmac: remplace asm/io.h by linux/io.h
>>>   net: stmmac: fix some code style problem
>>>   net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
>>>   net: stmmac: Use readl_poll_timeout
>>>   net: stmmac: replace ENOSYS by EINVAL
>>>   net: stmmac: Correct the error message about invalid speed
>>>   net: stmmac: Rewrite two test against NULL value
>>>   net: stmmac: rename rx_crc to rx_crc_errors
>>>   net: stmmac: Implement NAPI for TX
>>>   net: stmmac: print phy information
>>>   net: stmmac: remove dead code in stmmac_tx_clean
>>>   net: stmmac: remove unused variable in sysfs_display_ring
>>>   net: stmmac: replace unsigned by u32
>>>
>>>  drivers/net/ethernet/stmicro/stmmac/chain_mode.c   |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/common.h       |  8 +--
>>>  drivers/net/ethernet/stmicro/stmmac/descs.h        |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/descs_com.h    |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |  4 --
>>>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  4 --
>>>  .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  4 --
>>>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |  2 +-
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c    | 28 ++++------
>>>  drivers/net/ethernet/stmicro/stmmac/enh_desc.c     |  6 +--
>>>  drivers/net/ethernet/stmicro/stmmac/mmc.h          |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/mmc_core.c     |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/norm_desc.c    |  6 +--
>>>  drivers/net/ethernet/stmicro/stmmac/ring_mode.c    |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac.h       |  4 --
>>>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  6 +--
>>>  .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 63 ++++++++++------------
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 52 +++++++-----------
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  4 --
>>>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  6 +--
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |  4 --
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |  4 --
>>>  include/linux/stmmac.h                             |  1 -
>>>  28 files changed, 65 insertions(+), 185 deletions(-)
>>>
>>
>
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/17] net: stmmac: misc fix
  2017-01-31 10:33     ` Giuseppe CAVALLARO
@ 2017-01-31 10:37       ` Joao Pinto
  0 siblings, 0 replies; 44+ messages in thread
From: Joao Pinto @ 2017-01-31 10:37 UTC (permalink / raw)
  To: Giuseppe CAVALLARO, Joao Pinto, Corentin Labbe, alexandre.torgue, netdev
  Cc: davem, linux-kernel, Lars Persson

Às 10:33 AM de 1/31/2017, Giuseppe CAVALLARO escreveu:
> On 1/31/2017 11:23 AM, Joao Pinto wrote:
>>
>> Hi Peppe,
>>
>> Às 10:00 AM de 1/31/2017, Giuseppe CAVALLARO escreveu:
>>> Hello Corentin
>>>
>>> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
>>>> Hello
>>>>
>>>> I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
>>>> This serie is the result of all minor problem found in the stmmac driver.
>>>
>>> thank for this effort, many changes are to tidy up some part of the code
>>> so  I wonder if these should stay on top of net-next.
>>> There is on-going a thread to change something in the stmmac (where I
>>> missed more details and I tried to refresh all asap); so added on copy
>>> Joao.
>>
>> I submitted 2 suggestions that would rename folder stmicro to dwc and dwmac4*
>> files to eqos. The second one is important, since there is no dwmc4/gmac4 core,
>> in fact it is called eqos that will have 5.00 version very soon. Both
>> suggestions were rejected and so I turned to developing features.
>> I am available to discuss with you any improvement on these aspects if you think
>> it makes sense.
>>
>> Currently I am developing the support for multi-queues / multi-channels which
>> will enable in the future stmmac to be used in QAv and TSN applications.
> 
> this is a really good point, so I am happy that you are looking for this
> supports that can stay on high priority and do not generate conflicts
> with this patch series.
> 
> We will reopen the renaming story later... I hope to be more reactive
> on that and sorry for my absence.

No problem Peppe. When you feel that makes sense I am available.
You can check here the patches I submited:
https://patchwork.ozlabs.org/patch/715682/
https://patchwork.ozlabs.org/patch/717620/

Regards,
Joao

> 
> Regards
> Peppe
> 
>>
>> Thanks,
>> Joao
>>
>>>
>>> I will give you my feedback on some patches too.
>>>
>>> peppe
>>>
>>>> Regards
>>>>
>>>> Corentin Labbe (17):
>>>>   net: stmmac: fix the typo on MAC_RNABLE_RX
>>>>   net: stmmac: Remove the bus_setup function pointer
>>>>   net: stmmac: fix some typos in comments
>>>>   net: stmmac: remove freesoftware address
>>>>   net: stmmac: remplace asm/io.h by linux/io.h
>>>>   net: stmmac: fix some code style problem
>>>>   net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
>>>>   net: stmmac: Use readl_poll_timeout
>>>>   net: stmmac: replace ENOSYS by EINVAL
>>>>   net: stmmac: Correct the error message about invalid speed
>>>>   net: stmmac: Rewrite two test against NULL value
>>>>   net: stmmac: rename rx_crc to rx_crc_errors
>>>>   net: stmmac: Implement NAPI for TX
>>>>   net: stmmac: print phy information
>>>>   net: stmmac: remove dead code in stmmac_tx_clean
>>>>   net: stmmac: remove unused variable in sysfs_display_ring
>>>>   net: stmmac: replace unsigned by u32
>>>>
>>>>  drivers/net/ethernet/stmicro/stmmac/chain_mode.c   |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/common.h       |  8 +--
>>>>  drivers/net/ethernet/stmicro/stmmac/descs.h        |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/descs_com.h    |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |  4 --
>>>>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  4 --
>>>>  .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  4 --
>>>>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |  2 +-
>>>>  drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c    | 28 ++++------
>>>>  drivers/net/ethernet/stmicro/stmmac/enh_desc.c     |  6 +--
>>>>  drivers/net/ethernet/stmicro/stmmac/mmc.h          |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/mmc_core.c     |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/norm_desc.c    |  6 +--
>>>>  drivers/net/ethernet/stmicro/stmmac/ring_mode.c    |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/stmmac.h       |  4 --
>>>>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  6 +--
>>>>  .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 63 ++++++++++------------
>>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 52 +++++++-----------
>>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  4 --
>>>>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  6 +--
>>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |  4 --
>>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |  4 --
>>>>  include/linux/stmmac.h                             |  1 -
>>>>  28 files changed, 65 insertions(+), 185 deletions(-)
>>>>
>>>
>>
>>
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
  2017-01-31 10:13   ` Giuseppe CAVALLARO
@ 2017-01-31 10:39     ` Corentin Labbe
  2017-01-31 10:44       ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31 10:39 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: alexandre.torgue, netdev, davem, linux-kernel

On Tue, Jan 31, 2017 at 11:13:49AM +0100, Giuseppe CAVALLARO wrote:
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> > The stmmac_mdio_busy_wait() function do the same job than
> > readl_poll_timeout().
> > So is is better to replace it.
> >
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> 
> I just wonder if you also tested it, this impacts all the platforms
> where SMA block is used

I have tested all patch in this series on my cubieboard2 (dwmac-sunxi) and my opipc/pine64/bpim2+ (dwmac-sun8i)
(Yes I could have said that in cover letter).
So this code was tested on two different stmmac glue driver.

> 
> if yes, pls consider my:
> 
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> 
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
> >  1 file changed, 11 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> > index c24bef2..d9893cf 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> > @@ -21,6 +21,7 @@
> >  *******************************************************************************/
> >
> >  #include <linux/io.h>
> > +#include <linux/iopoll.h>
> >  #include <linux/mii.h>
> >  #include <linux/of.h>
> >  #include <linux/of_gpio.h>
> > @@ -38,22 +39,6 @@
> >  #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
> >  #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
> >
> > -static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
> > -{
> > -	unsigned long curr;
> > -	unsigned long finish = jiffies + 3 * HZ;
> > -
> > -	do {
> > -		curr = jiffies;
> > -		if (readl(ioaddr + mii_addr) & MII_BUSY)
> > -			cpu_relax();
> > -		else
> > -			return 0;
> > -	} while (!time_after_eq(curr, finish));
> > -
> > -	return -EBUSY;
> > -}
> > -
> >  /**
> >   * stmmac_mdio_read
> >   * @bus: points to the mii_bus structure
> > @@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
> >  	struct stmmac_priv *priv = netdev_priv(ndev);
> >  	unsigned int mii_address = priv->hw->mii.addr;
> >  	unsigned int mii_data = priv->hw->mii.data;
> > -
> > +	u32 v;
> >  	int data;
> >  	u32 value = MII_BUSY;
> >
> > @@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
> >  	if (priv->plat->has_gmac4)
> >  		value |= MII_GMAC4_READ;
> >
> > -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> > +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +			       100, 10000))
> >  		return -EBUSY;
> >
> >  	writel(value, priv->ioaddr + mii_address);
> >
> > -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> > +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +			       100, 10000))
> >  		return -EBUSY;
> >
> >  	/* Read the data from the MII data register */
> > @@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
> >  	struct stmmac_priv *priv = netdev_priv(ndev);
> >  	unsigned int mii_address = priv->hw->mii.addr;
> >  	unsigned int mii_data = priv->hw->mii.data;
> > -
> > +	u32 v;
> >  	u32 value = MII_BUSY;
> >
> >  	value |= (phyaddr << priv->hw->mii.addr_shift)
> > @@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
> >  		value |= MII_WRITE;
> >
> >  	/* Wait until any existing MII operation is complete */
> > -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> > +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +			       100, 10000))
> >  		return -EBUSY;
> >
> >  	/* Set the MII address register to write */
> > @@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
> >  	writel(value, priv->ioaddr + mii_address);
> >
> >  	/* Wait until any existing MII operation is complete */
> > -	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
> > +	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +				  100, 10000);
> >  }
> >
> >  /**
> >
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
  2017-01-31 10:39     ` Corentin Labbe
@ 2017-01-31 10:44       ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2017-01-31 10:44 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: alexandre.torgue, netdev, davem, linux-kernel

On 1/31/2017 11:39 AM, Corentin Labbe wrote:
> On Tue, Jan 31, 2017 at 11:13:49AM +0100, Giuseppe CAVALLARO wrote:
>> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
>>> The stmmac_mdio_busy_wait() function do the same job than
>>> readl_poll_timeout().
>>> So is is better to replace it.
>>>
>>> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
>>
>> I just wonder if you also tested it, this impacts all the platforms
>> where SMA block is used
>
> I have tested all patch in this series on my cubieboard2 (dwmac-sunxi) and my opipc/pine64/bpim2+ (dwmac-sun8i)
> (Yes I could have said that in cover letter).
> So this code was tested on two different stmmac glue driver.

perfect :-) thx for the clarification and consider my Acked-by.

peppe

>>
>> if yes, pls consider my:
>>
>> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>>
>>> ---
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
>>>  1 file changed, 11 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> index c24bef2..d9893cf 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> @@ -21,6 +21,7 @@
>>>  *******************************************************************************/
>>>
>>>  #include <linux/io.h>
>>> +#include <linux/iopoll.h>
>>>  #include <linux/mii.h>
>>>  #include <linux/of.h>
>>>  #include <linux/of_gpio.h>
>>> @@ -38,22 +39,6 @@
>>>  #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
>>>  #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
>>>
>>> -static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
>>> -{
>>> -	unsigned long curr;
>>> -	unsigned long finish = jiffies + 3 * HZ;
>>> -
>>> -	do {
>>> -		curr = jiffies;
>>> -		if (readl(ioaddr + mii_addr) & MII_BUSY)
>>> -			cpu_relax();
>>> -		else
>>> -			return 0;
>>> -	} while (!time_after_eq(curr, finish));
>>> -
>>> -	return -EBUSY;
>>> -}
>>> -
>>>  /**
>>>   * stmmac_mdio_read
>>>   * @bus: points to the mii_bus structure
>>> @@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>>>  	struct stmmac_priv *priv = netdev_priv(ndev);
>>>  	unsigned int mii_address = priv->hw->mii.addr;
>>>  	unsigned int mii_data = priv->hw->mii.data;
>>> -
>>> +	u32 v;
>>>  	int data;
>>>  	u32 value = MII_BUSY;
>>>
>>> @@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>>>  	if (priv->plat->has_gmac4)
>>>  		value |= MII_GMAC4_READ;
>>>
>>> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
>>> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +			       100, 10000))
>>>  		return -EBUSY;
>>>
>>>  	writel(value, priv->ioaddr + mii_address);
>>>
>>> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
>>> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +			       100, 10000))
>>>  		return -EBUSY;
>>>
>>>  	/* Read the data from the MII data register */
>>> @@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>>>  	struct stmmac_priv *priv = netdev_priv(ndev);
>>>  	unsigned int mii_address = priv->hw->mii.addr;
>>>  	unsigned int mii_data = priv->hw->mii.data;
>>> -
>>> +	u32 v;
>>>  	u32 value = MII_BUSY;
>>>
>>>  	value |= (phyaddr << priv->hw->mii.addr_shift)
>>> @@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>>>  		value |= MII_WRITE;
>>>
>>>  	/* Wait until any existing MII operation is complete */
>>> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
>>> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +			       100, 10000))
>>>  		return -EBUSY;
>>>
>>>  	/* Set the MII address register to write */
>>> @@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>>>  	writel(value, priv->ioaddr + mii_address);
>>>
>>>  	/* Wait until any existing MII operation is complete */
>>> -	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
>>> +	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +				  100, 10000);
>>>  }
>>>
>>>  /**
>>>
>>
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-01-31 10:28   ` Giuseppe CAVALLARO
@ 2017-01-31 13:38     ` Corentin Labbe
  0 siblings, 0 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-01-31 13:38 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: alexandre.torgue, netdev, davem, linux-kernel

On Tue, Jan 31, 2017 at 11:28:03AM +0100, Giuseppe CAVALLARO wrote:
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> > The stmmac driver run TX completion under NAPI but without checking the
> > work done by the TX completion function.
> >
> > This patch add work/budget to the TX completion function.
> >
> > The visible effect is that it keep the driver longer under NAPI and
> > boost performance.
> > Under dwmac-sun8i the iperf goes from 140Mbit/s to 500Mbit/s.
> > Under dwmac-sunxi an iperf run use half less interrupts.
> 
> I think that this patch should be sent separately with more details
> about the implementation you are adopting and results.
> 

This patch is just implementing what NAPI documentation say.
"The budget parameter places a limit on the amount of work the driver may do. Each received packet counts as one unit of work. The poll() function may also process TX completions, in which case if it processes the entire TX ring then it should count that work as the rest of the budget. Otherwise, TX completions are not counted."

For the history, I have done the sun8i-emac driver for H3/A64 and get with if very good performance.
Some people find that the hardware was in fact a modified version of dwmac and so I start working on dwmac-sun8i glue driver.
Testing dwmac-sun8i give very bad performance and the only real difference between thoses two driver was the handling of NAPI TX mitigation.

The performance are tested with a simple iperf.
I will redo some test with some numbers

> For example, in the timer callback you force 256 (it seems
> DMA_TX_SIZE/2); do you think this should be tunable or fixed to
> NAPI budget?

I think that the whole "TX mitigation timer" is useless when using TX completion within NAPI.
I will do some bench for checking with and without it.

> 
> I'd like to understand if performance you get are for TCP traffic;
> can you tell me what happens on unidirectional traffic?
> 
> Thx a lot for your effort, pls let me know
> 
> Regards
> peppe
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-01-31  9:11 ` [PATCH 13/17] net: stmmac: Implement NAPI for TX Corentin Labbe
  2017-01-31 10:28   ` Giuseppe CAVALLARO
@ 2017-02-01  4:12   ` David Miller
  2017-02-03 13:41     ` Corentin Labbe
  1 sibling, 1 reply; 44+ messages in thread
From: David Miller @ 2017-02-01  4:12 UTC (permalink / raw)
  To: clabbe.montjoie; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel

From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Tue, 31 Jan 2017 10:11:48 +0100

> The stmmac driver run TX completion under NAPI but without checking
> the work done by the TX completion function.

The current behavior is correct and completely intentional.

A driver should _never_ account TX work to the NAPI poll budget.

This is because TX liberation is orders of magnitude cheaper than
receiving a packet, and such SKB freeing makes more SKBs available
for RX processing.

Therefore, TX work should never count against the NAPI budget.

Please do not fix something which is not broken.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 14/17] net: stmmac: print phy information
  2017-01-31 10:10   ` Giuseppe CAVALLARO
@ 2017-02-03 13:16     ` Corentin Labbe
  0 siblings, 0 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-02-03 13:16 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: alexandre.torgue, netdev, davem, linux-kernel

On Tue, Jan 31, 2017 at 11:10:04AM +0100, Giuseppe CAVALLARO wrote:
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> > When a PHY is found, printing which one was found (and which type/model) is
> > a good information to know.
> >
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index e53b727..3d52b8c 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -885,6 +885,7 @@ static int stmmac_init_phy(struct net_device *dev)
> >  	netdev_dbg(priv->dev, "%s: attached to PHY (UID 0x%x) Link = %d\n",
> >  		   __func__, phydev->phy_id, phydev->link);
> >
> > +	phy_attached_info(phydev);
> 
> maybe we could remove the netdev_dbg above and just keep
> phy_attached_info(phydev);
> 
> peppe
> 

Ok, I will remove it

Regards
Corentin Labbe

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-02-01  4:12   ` David Miller
@ 2017-02-03 13:41     ` Corentin Labbe
  2017-02-03 15:15       ` David Miller
  0 siblings, 1 reply; 44+ messages in thread
From: Corentin Labbe @ 2017-02-03 13:41 UTC (permalink / raw)
  To: David Miller; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel

On Tue, Jan 31, 2017 at 11:12:25PM -0500, David Miller wrote:
> From: Corentin Labbe <clabbe.montjoie@gmail.com>
> Date: Tue, 31 Jan 2017 10:11:48 +0100
> 
> > The stmmac driver run TX completion under NAPI but without checking
> > the work done by the TX completion function.
> 
> The current behavior is correct and completely intentional.
> 
> A driver should _never_ account TX work to the NAPI poll budget.
> 
> This is because TX liberation is orders of magnitude cheaper than
> receiving a packet, and such SKB freeing makes more SKBs available
> for RX processing.
> 
> Therefore, TX work should never count against the NAPI budget.
> 
> Please do not fix something which is not broken.

So at least the documentation I read must be fixed (https://wiki.linuxfoundation.org/networking/napi)

So perhaps the best way is to do like intel igb/ixgbe, keeping under NAPI until the stmmac_tx_clean function said that it finish handling the queue ?

Regards
Corentin Labbe

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-02-03 13:41     ` Corentin Labbe
@ 2017-02-03 15:15       ` David Miller
  2017-02-03 15:58         ` Corentin Labbe
  0 siblings, 1 reply; 44+ messages in thread
From: David Miller @ 2017-02-03 15:15 UTC (permalink / raw)
  To: clabbe.montjoie; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel

From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Fri, 3 Feb 2017 14:41:45 +0100

> On Tue, Jan 31, 2017 at 11:12:25PM -0500, David Miller wrote:
>> From: Corentin Labbe <clabbe.montjoie@gmail.com>
>> Date: Tue, 31 Jan 2017 10:11:48 +0100
>> 
>> > The stmmac driver run TX completion under NAPI but without checking
>> > the work done by the TX completion function.
>> 
>> The current behavior is correct and completely intentional.
>> 
>> A driver should _never_ account TX work to the NAPI poll budget.
>> 
>> This is because TX liberation is orders of magnitude cheaper than
>> receiving a packet, and such SKB freeing makes more SKBs available
>> for RX processing.
>> 
>> Therefore, TX work should never count against the NAPI budget.
>> 
>> Please do not fix something which is not broken.
> 
> So at least the documentation I read must be fixed (https://wiki.linuxfoundation.org/networking/napi)

We have no control over nor care about what the Linux Foundation writes
about the Linux networking code.

Complain to them and please do not bother us about it.

Thank you.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/17] net: stmmac: Implement NAPI for TX
  2017-02-03 15:15       ` David Miller
@ 2017-02-03 15:58         ` Corentin Labbe
  0 siblings, 0 replies; 44+ messages in thread
From: Corentin Labbe @ 2017-02-03 15:58 UTC (permalink / raw)
  To: David Miller; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel

On Fri, Feb 03, 2017 at 10:15:30AM -0500, David Miller wrote:
> From: Corentin Labbe <clabbe.montjoie@gmail.com>
> Date: Fri, 3 Feb 2017 14:41:45 +0100
> 
> > On Tue, Jan 31, 2017 at 11:12:25PM -0500, David Miller wrote:
> >> From: Corentin Labbe <clabbe.montjoie@gmail.com>
> >> Date: Tue, 31 Jan 2017 10:11:48 +0100
> >> 
> >> > The stmmac driver run TX completion under NAPI but without checking
> >> > the work done by the TX completion function.
> >> 
> >> The current behavior is correct and completely intentional.
> >> 
> >> A driver should _never_ account TX work to the NAPI poll budget.
> >> 
> >> This is because TX liberation is orders of magnitude cheaper than
> >> receiving a packet, and such SKB freeing makes more SKBs available
> >> for RX processing.
> >> 
> >> Therefore, TX work should never count against the NAPI budget.
> >> 
> >> Please do not fix something which is not broken.
> > 
> > So at least the documentation I read must be fixed (https://wiki.linuxfoundation.org/networking/napi)
> 
> We have no control over nor care about what the Linux Foundation writes
> about the Linux networking code.
> 
> Complain to them and please do not bother us about it.
> 
> Thank you.

Sorry, this was not to bother you.

Could you give me your opinion on the other question of the mail ? (just copied below)
So perhaps the best way is to do like intel igb/ixgbe, keeping under NAPI until the stmmac_tx_clean function said that it finished handling the queue (with a distinct TX budget)?

Thanks
Regards

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2017-02-03 15:58 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31  9:11 [PATCH 00/17] net: stmmac: misc fix Corentin Labbe
2017-01-31  9:11 ` [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX Corentin Labbe
2017-01-31 10:03   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer Corentin Labbe
2017-01-31 10:02   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 03/17] net: stmmac: fix some typos in comments Corentin Labbe
2017-01-31 10:03   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 04/17] net: stmmac: remove freesoftware address Corentin Labbe
2017-01-31  9:11 ` [PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h Corentin Labbe
2017-01-31  9:11 ` [PATCH 06/17] net: stmmac: fix some code style problem Corentin Labbe
2017-01-31 10:05   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout Corentin Labbe
2017-01-31 10:13   ` Giuseppe CAVALLARO
2017-01-31 10:39     ` Corentin Labbe
2017-01-31 10:44       ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 08/17] net: stmmac: Use readl_poll_timeout Corentin Labbe
2017-01-31  9:11 ` [PATCH 09/17] net: stmmac: replace ENOSYS by EINVAL Corentin Labbe
2017-01-31 10:06   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 10/17] net: stmmac: Correct the error message about invalid speed Corentin Labbe
2017-01-31 10:07   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 11/17] net: stmmac: Rewrite two test against NULL value Corentin Labbe
2017-01-31 10:07   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 12/17] net: stmmac: rename rx_crc to rx_crc_errors Corentin Labbe
2017-01-31 10:08   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 13/17] net: stmmac: Implement NAPI for TX Corentin Labbe
2017-01-31 10:28   ` Giuseppe CAVALLARO
2017-01-31 13:38     ` Corentin Labbe
2017-02-01  4:12   ` David Miller
2017-02-03 13:41     ` Corentin Labbe
2017-02-03 15:15       ` David Miller
2017-02-03 15:58         ` Corentin Labbe
2017-01-31  9:11 ` [PATCH 14/17] net: stmmac: print phy information Corentin Labbe
2017-01-31 10:10   ` Giuseppe CAVALLARO
2017-02-03 13:16     ` Corentin Labbe
2017-01-31  9:11 ` [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean Corentin Labbe
2017-01-31 10:21   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 16/17] net: stmmac: remove unused variable in sysfs_display_ring Corentin Labbe
2017-01-31 10:11   ` Giuseppe CAVALLARO
2017-01-31  9:11 ` [PATCH 17/17] net: stmmac: replace unsigned by u32 Corentin Labbe
2017-01-31 10:12   ` Giuseppe CAVALLARO
2017-01-31 10:00 ` [PATCH 00/17] net: stmmac: misc fix Giuseppe CAVALLARO
2017-01-31 10:23   ` Joao Pinto
2017-01-31 10:33     ` Giuseppe CAVALLARO
2017-01-31 10:37       ` Joao Pinto

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 NNTP newsgroup(s).