netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH (net.git) 1/2 (v2)] stmmac: disable at run-time the EEE if not supported
@ 2013-08-21  5:28 Giuseppe CAVALLARO
  2013-08-21  5:28 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe CAVALLARO @ 2013-08-21  5:28 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro

This patch is to disable the EEE (so HW and timers)
for example when the phy communicates that the EEE
can be supported nomore.

v2: clean the patch removing an useless change

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   23 +++++++++++++++++---
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0a9bb9d..45ca081 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -285,10 +285,25 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 
 	/* MAC core supports the EEE feature. */
 	if (priv->dma_cap.eee) {
+		int tx_lpi_timer = priv->tx_lpi_timer;
+
 		/* Check if the PHY supports EEE */
-		if (phy_init_eee(priv->phydev, 1))
+		if (phy_init_eee(priv->phydev, 1)) {
+			/* To manage at run-time if the EEE cannot be supported
+			 * anymore (for example becasue the lp caps have been
+			 * changed).
+			 * In that case the driver disable own timers.
+			 */
+			if (priv->eee_active) {
+				pr_debug("stmmac: disable EEE\n");
+				del_timer_sync(&priv->eee_ctrl_timer);
+				priv->hw->mac->set_eee_timer(priv->ioaddr, 0,
+							     tx_lpi_timer);
+			}
+			priv->eee_active = 0;
 			goto out;
-
+		}
+		/* Activate the EEE and start timers */
 		if (!priv->eee_active) {
 			priv->eee_active = 1;
 			init_timer(&priv->eee_ctrl_timer);
@@ -299,13 +314,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 
 			priv->hw->mac->set_eee_timer(priv->ioaddr,
 						     STMMAC_DEFAULT_LIT_LS,
-						     priv->tx_lpi_timer);
+						     tx_lpi_timer);
 		} else
 			/* Set HW EEE according to the speed */
 			priv->hw->mac->set_eee_pls(priv->ioaddr,
 						   priv->phydev->link);
 
-		pr_info("stmmac: Energy-Efficient Ethernet initialized\n");
+		pr_debug("stmmac: Energy-Efficient Ethernet initialized\n");
 
 		ret = true;
 	}
-- 
1.7.4.4

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

* [PATCH (net.git) 2/2] stmmac: remove useless csum flag
  2013-08-21  5:28 [PATCH (net.git) 1/2 (v2)] stmmac: disable at run-time the EEE if not supported Giuseppe CAVALLARO
@ 2013-08-21  5:28 ` Giuseppe CAVALLARO
  2013-08-21  7:06   ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe CAVALLARO @ 2013-08-21  5:28 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro, Sonic Zhang

This patch removes the no_csum_insertion private parameter that is not used anymore
and, also,  the "likely" annotation from the condition that is not in a critical path.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h      |    1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    3 +--
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index c922fde..f16a9bd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -70,7 +70,6 @@ struct stmmac_priv {
 	struct net_device *dev;
 	struct device *device;
 	struct mac_device_info *hw;
-	int no_csum_insertion;
 	spinlock_t lock;
 
 	struct phy_device *phydev ____cacheline_aligned_in_smp;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 45ca081..dbba2c2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1239,8 +1239,7 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
  */
 static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
 {
-	if (likely(priv->plat->force_sf_dma_mode ||
-		   ((priv->plat->tx_coe) && (!priv->no_csum_insertion)))) {
+	if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {
 		/*
 		 * In case of GMAC, SF mode can be enabled
 		 * to perform the TX COE in HW. This depends on:
-- 
1.7.4.4

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

* Re: [PATCH (net.git) 2/2] stmmac: remove useless csum flag
  2013-08-21  5:28 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
@ 2013-08-21  7:06   ` David Miller
  2013-08-21  7:11     ` [net-next.git] " Giuseppe CAVALLARO
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2013-08-21  7:06 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, sonic.zhang

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Wed, 21 Aug 2013 07:28:28 +0200

> This patch removes the no_csum_insertion private parameter that is not used anymore
> and, also,  the "likely" annotation from the condition that is not in a critical path.
> 
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

This is absolutely just a cleanup and therefore not suitable for 'net',
resubmit your changes targetted to the correct tree, 'net-next'.

Thank you.

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

* [net-next.git] stmmac: remove useless csum flag
  2013-08-21  7:06   ` David Miller
@ 2013-08-21  7:11     ` Giuseppe CAVALLARO
  2013-08-22  3:38       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe CAVALLARO @ 2013-08-21  7:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, Giuseppe Cavallaro, Sonic Zhang

This patch removes the no_csum_insertion private parameter that is not used anymore
and, also,  the "likely" annotation from the condition that is not in a critical path.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h      |    1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    3 +--
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index c922fde..f16a9bd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -70,7 +70,6 @@ struct stmmac_priv {
 	struct net_device *dev;
 	struct device *device;
 	struct mac_device_info *hw;
-	int no_csum_insertion;
 	spinlock_t lock;
 
 	struct phy_device *phydev ____cacheline_aligned_in_smp;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0a9bb9d..be40691 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1224,8 +1224,7 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
  */
 static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
 {
-	if (likely(priv->plat->force_sf_dma_mode ||
-		   ((priv->plat->tx_coe) && (!priv->no_csum_insertion)))) {
+	if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {
 		/*
 		 * In case of GMAC, SF mode can be enabled
 		 * to perform the TX COE in HW. This depends on:
-- 
1.7.4.4

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

* Re: [net-next.git] stmmac: remove useless csum flag
  2013-08-21  7:11     ` [net-next.git] " Giuseppe CAVALLARO
@ 2013-08-22  3:38       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-08-22  3:38 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, sonic.zhang

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Wed, 21 Aug 2013 09:11:14 +0200

> This patch removes the no_csum_insertion private parameter that is not used anymore
> and, also,  the "likely" annotation from the condition that is not in a critical path.
> 
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Sonic Zhang <sonic.zhang@analog.com>

Applied, thanks.

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

end of thread, other threads:[~2013-08-22  3:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-21  5:28 [PATCH (net.git) 1/2 (v2)] stmmac: disable at run-time the EEE if not supported Giuseppe CAVALLARO
2013-08-21  5:28 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
2013-08-21  7:06   ` David Miller
2013-08-21  7:11     ` [net-next.git] " Giuseppe CAVALLARO
2013-08-22  3:38       ` David Miller

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).