All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported
@ 2013-08-19  6:38 Giuseppe CAVALLARO
  2013-08-19  6:38 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
  2013-08-19 18:44 ` [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Sergei Shtylyov
  0 siblings, 2 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2013-08-19  6:38 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.

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

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0a9bb9d..75cc2d3 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;
 	}
@@ -2166,7 +2181,6 @@ static int stmmac_poll(struct napi_struct *napi, int budget)
 static void stmmac_tx_timeout(struct net_device *dev)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
-
 	/* Clear Tx resources and restart transmitting again */
 	stmmac_tx_err(priv);
 }
-- 
1.7.4.4

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

* [PATCH (net.git) 2/2] stmmac: remove useless csum flag
  2013-08-19  6:38 [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Giuseppe CAVALLARO
@ 2013-08-19  6:38 ` Giuseppe CAVALLARO
  2013-08-19 18:44 ` [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Sergei Shtylyov
  1 sibling, 0 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2013-08-19  6:38 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 75cc2d3..65ae7e6 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] 4+ messages in thread

* Re: [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported
  2013-08-19  6:38 [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Giuseppe CAVALLARO
  2013-08-19  6:38 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
@ 2013-08-19 18:44 ` Sergei Shtylyov
  2013-08-21  0:04   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2013-08-19 18:44 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: netdev

Hello.

On 08/19/2013 10:38 AM, Giuseppe CAVALLARO wrote:

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

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

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 0a9bb9d..75cc2d3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[...]
> @@ -2166,7 +2181,6 @@ static int stmmac_poll(struct napi_struct *napi, int budget)
>   static void stmmac_tx_timeout(struct net_device *dev)
>   {
>   	struct stmmac_priv *priv = netdev_priv(dev);
> -
>   	/* Clear Tx resources and restart transmitting again */

    Why? This seems unneeded change.

WBR, Sergei

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

* Re: [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported
  2013-08-19 18:44 ` [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Sergei Shtylyov
@ 2013-08-21  0:04   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-08-21  0:04 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: peppe.cavallaro, netdev

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Mon, 19 Aug 2013 22:44:24 +0400

>> @@ -2166,7 +2181,6 @@ static int stmmac_poll(struct napi_struct *napi,
>> int budget)
>>   static void stmmac_tx_timeout(struct net_device *dev)
>>   {
>>   	struct stmmac_priv *priv = netdev_priv(dev);
>> -
>>   	/* Clear Tx resources and restart transmitting again */
> 
>    Why? This seems unneeded change.

Agreed, not only was this code properly styled already, changing it
is totally unrelated to what this patch is supposed to be doing.

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

end of thread, other threads:[~2013-08-21  0:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-19  6:38 [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Giuseppe CAVALLARO
2013-08-19  6:38 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
2013-08-19 18:44 ` [PATCH (net.git) 1/2] stmmac: disable at run-time the EEE if not supported Sergei Shtylyov
2013-08-21  0:04   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.