linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: Elimination the forced speed reduction algorithm.
@ 2013-03-27 11:16 Kirill Kapranov
  2013-03-27 17:11 ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Kirill Kapranov @ 2013-03-27 11:16 UTC (permalink / raw)
  To: netdev
  Cc: davem, bhutchings, peppe.cavallaro, joe, bruce.w.allan,
	linux-kernel, Kirill Kapranov

In case of fixed speed set up for a NIC (e.g. ethtool -s eth0 autoneg off speed
100 duplex full) with an ethernet cable plugged off, the mentioned algorithm
slows down a NIC speed, so further cable hook-up leads to nonoperable link state.

Signed-off-by: Kirill Kapranov <kapranoff@inbox.ru>
---
 drivers/net/phy/phy.c |   50 +------------------------------------------------
 1 files changed, 1 insertions(+), 49 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ef9ea92..828d4e6 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -463,33 +463,6 @@ void phy_stop_machine(struct phy_device *phydev)
 }
 
 /**
- * phy_force_reduction - reduce PHY speed/duplex settings by one step
- * @phydev: target phy_device struct
- *
- * Description: Reduces the speed/duplex settings by one notch,
- *   in this order--
- *   1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF.
- *   The function bottoms out at 10/HALF.
- */
-static void phy_force_reduction(struct phy_device *phydev)
-{
-	int idx;
-
-	idx = phy_find_setting(phydev->speed, phydev->duplex);
-	
-	idx++;
-
-	idx = phy_find_valid(idx, phydev->supported);
-
-	phydev->speed = settings[idx].speed;
-	phydev->duplex = settings[idx].duplex;
-
-	pr_info("Trying %d/%s\n",
-		phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF");
-}
-
-
-/**
  * phy_error - enter HALTED state for this PHY device
  * @phydev: target phy_device struct
  *
@@ -818,30 +791,11 @@ void phy_state_machine(struct work_struct *work)
 				phydev->adjust_link(phydev->attached_dev);
 
 			} else if (0 == phydev->link_timeout--) {
-				int idx;
-
 				needs_aneg = 1;
 				/* If we have the magic_aneg bit,
 				 * we try again */
 				if (phydev->drv->flags & PHY_HAS_MAGICANEG)
 					break;
-
-				/* The timer expired, and we still
-				 * don't have a setting, so we try
-				 * forcing it until we find one that
-				 * works, starting from the fastest speed,
-				 * and working our way down */
-				idx = phy_find_valid(0, phydev->supported);
-
-				phydev->speed = settings[idx].speed;
-				phydev->duplex = settings[idx].duplex;
-
-				phydev->autoneg = AUTONEG_DISABLE;
-
-				pr_info("Trying %d/%s\n",
-					phydev->speed,
-					DUPLEX_FULL == phydev->duplex ?
-					"FULL" : "HALF");
 			}
 			break;
 		case PHY_NOLINK:
@@ -866,10 +820,8 @@ void phy_state_machine(struct work_struct *work)
 				phydev->state = PHY_RUNNING;
 				netif_carrier_on(phydev->attached_dev);
 			} else {
-				if (0 == phydev->link_timeout--) {
-					phy_force_reduction(phydev);
+				if (0 == phydev->link_timeout--)
 					needs_aneg = 1;
-				}
 			}
 
 			phydev->adjust_link(phydev->attached_dev);
-- 
1.7.2.5


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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-27 11:16 [PATCH] phy: Elimination the forced speed reduction algorithm Kirill Kapranov
@ 2013-03-27 17:11 ` David Miller
  0 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-03-27 17:11 UTC (permalink / raw)
  To: kapranoff
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel

From: Kirill Kapranov <kapranoff@inbox.ru>
Date: Wed, 27 Mar 2013 15:16:13 +0400

> In case of fixed speed set up for a NIC (e.g. ethtool -s eth0 autoneg off speed
> 100 duplex full) with an ethernet cable plugged off, the mentioned algorithm
> slows down a NIC speed, so further cable hook-up leads to nonoperable link state.
> 
> Signed-off-by: Kirill Kapranov <kapranoff@inbox.ru>

Applied.

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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-29 18:38 ` David Miller
@ 2013-04-01 13:51   ` Kirill Kapranov
  0 siblings, 0 replies; 13+ messages in thread
From: Kirill Kapranov @ 2013-04-01 13:51 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel


Fri, 29/03/2013 14:38 -0400, David Miller пишет:
> Why are you posting this again?  I've applied your patch 3 days
> ago.

oops...
The last letter I sent was a coding style correction -- removing
trailing whitespace in response to remark of Tue, 26 Mar 2013 12:59:13
-0400 (EDT)  by David Miller:
> 
> 
> > -                                     phy_force_reduction(phydev);
> > +                             if (0 == phydev->link_timeout--) 
>                                                                 ^^^^
> Trailing whitespace, please remove.

I sent it  Wed, 27 Mar 2013 15:16:13 +0400

After receiving confirmation (Wed, 27 Mar 2013 13:11:02 -0400 (EDT))

> Applied.

from David Miller, I haven't sent any post.



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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-26 13:34 Kirill Kapranov
  2013-03-26 14:56 ` Kirill Kapranov
  2013-03-26 16:59 ` David Miller
@ 2013-03-29 18:38 ` David Miller
  2013-04-01 13:51   ` Kirill Kapranov
  2 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2013-03-29 18:38 UTC (permalink / raw)
  To: kapranoff
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel

From: Kirill Kapranov <kapranoff@inbox.ru>
Date: Tue, 26 Mar 2013 17:34:32 +0400

> In case of fixed speed set up for a NIC (e.g. ethtool -s eth0 autoneg off speed
> 100 duplex full) with an ethernet cable plugged off, the mentioned algorithm
> slows down a NIC speed, so further cable hook-up leads to nonoperable link state.
> 
> Signed-off-by: Kirill Kapranov <kapranoff@inbox.ru>

Why are you posting this again?  I've applied your patch 3 days
ago.

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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-26 13:34 Kirill Kapranov
  2013-03-26 14:56 ` Kirill Kapranov
@ 2013-03-26 16:59 ` David Miller
  2013-03-29 18:38 ` David Miller
  2 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-03-26 16:59 UTC (permalink / raw)
  To: kapranoff
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel

From: Kirill Kapranov <kapranoff@inbox.ru>
Date: Tue, 26 Mar 2013 17:34:32 +0400

> -					phy_force_reduction(phydev);
> +				if (0 == phydev->link_timeout--) 
                                                                ^^^^

Trailing whitespace, please remove.

Also, for whatever reason this patch didn't make it to the mailing
list, that's critical because we automate the tracking of patches by
catching the patch postings made to the list.

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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-26 14:56 ` Kirill Kapranov
@ 2013-03-26 16:11   ` David Miller
  0 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-03-26 16:11 UTC (permalink / raw)
  To: kapranoff
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel

From: Kirill Kapranov <kapranoff@inbox.ru>
Date: Tue, 26 Mar 2013 18:56:32 +0400

> Does the absence of criticism mean that this patch is ready for
> upstream?

You were given feedback on coding style, did you address and fix these
issues in the submission you made today?

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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-26 13:34 Kirill Kapranov
@ 2013-03-26 14:56 ` Kirill Kapranov
  2013-03-26 16:11   ` David Miller
  2013-03-26 16:59 ` David Miller
  2013-03-29 18:38 ` David Miller
  2 siblings, 1 reply; 13+ messages in thread
From: Kirill Kapranov @ 2013-03-26 14:56 UTC (permalink / raw)
  To: netdev
  Cc: davem, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel

Does the absence of criticism mean that this patch is ready for
upstream?
Maybe I shall write more verbose explanation additionally?



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

* [PATCH] phy: Elimination the forced speed reduction algorithm.
@ 2013-03-26 13:34 Kirill Kapranov
  2013-03-26 14:56 ` Kirill Kapranov
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Kirill Kapranov @ 2013-03-26 13:34 UTC (permalink / raw)
  To: netdev
  Cc: davem, bhutchings, peppe.cavallaro, joe, bruce.w.allan,
	linux-kernel, Kirill Kapranov

In case of fixed speed set up for a NIC (e.g. ethtool -s eth0 autoneg off speed
100 duplex full) with an ethernet cable plugged off, the mentioned algorithm
slows down a NIC speed, so further cable hook-up leads to nonoperable link state.

Signed-off-by: Kirill Kapranov <kapranoff@inbox.ru>
---
 drivers/net/phy/phy.c |   50 +------------------------------------------------
 1 files changed, 1 insertions(+), 49 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ef9ea92..fc2dd94 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -463,33 +463,6 @@ void phy_stop_machine(struct phy_device *phydev)
 }
 
 /**
- * phy_force_reduction - reduce PHY speed/duplex settings by one step
- * @phydev: target phy_device struct
- *
- * Description: Reduces the speed/duplex settings by one notch,
- *   in this order--
- *   1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF.
- *   The function bottoms out at 10/HALF.
- */
-static void phy_force_reduction(struct phy_device *phydev)
-{
-	int idx;
-
-	idx = phy_find_setting(phydev->speed, phydev->duplex);
-	
-	idx++;
-
-	idx = phy_find_valid(idx, phydev->supported);
-
-	phydev->speed = settings[idx].speed;
-	phydev->duplex = settings[idx].duplex;
-
-	pr_info("Trying %d/%s\n",
-		phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF");
-}
-
-
-/**
  * phy_error - enter HALTED state for this PHY device
  * @phydev: target phy_device struct
  *
@@ -818,30 +791,11 @@ void phy_state_machine(struct work_struct *work)
 				phydev->adjust_link(phydev->attached_dev);
 
 			} else if (0 == phydev->link_timeout--) {
-				int idx;
-
 				needs_aneg = 1;
 				/* If we have the magic_aneg bit,
 				 * we try again */
 				if (phydev->drv->flags & PHY_HAS_MAGICANEG)
 					break;
-
-				/* The timer expired, and we still
-				 * don't have a setting, so we try
-				 * forcing it until we find one that
-				 * works, starting from the fastest speed,
-				 * and working our way down */
-				idx = phy_find_valid(0, phydev->supported);
-
-				phydev->speed = settings[idx].speed;
-				phydev->duplex = settings[idx].duplex;
-
-				phydev->autoneg = AUTONEG_DISABLE;
-
-				pr_info("Trying %d/%s\n",
-					phydev->speed,
-					DUPLEX_FULL == phydev->duplex ?
-					"FULL" : "HALF");
 			}
 			break;
 		case PHY_NOLINK:
@@ -866,10 +820,8 @@ void phy_state_machine(struct work_struct *work)
 				phydev->state = PHY_RUNNING;
 				netif_carrier_on(phydev->attached_dev);
 			} else {
-				if (0 == phydev->link_timeout--) {
-					phy_force_reduction(phydev);
+				if (0 == phydev->link_timeout--) 
 					needs_aneg = 1;
-				}
 			}
 
 			phydev->adjust_link(phydev->attached_dev);
-- 
1.7.2.5


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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-15 12:35 ` David Miller
  2013-03-15 12:48   ` Joe Perches
@ 2013-03-15 14:15   ` Kirill Kapranov
  1 sibling, 0 replies; 13+ messages in thread
From: Kirill Kapranov @ 2013-03-15 14:15 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel


15/03/2013 08:35 -0400, David Miller wrote:
> From: Kirill Kapranov <kapranoff@inbox.ru>
> Date: Thu, 14 Mar 2013 14:40:52 +0400
> 
> > @@ -867,7 +821,6 @@ void phy_state_machine(struct work_struct *work)
> >  				netif_carrier_on(phydev->attached_dev);
> >  			} else {
> >  				if (0 == phydev->link_timeout--) {
> > -					phy_force_reduction(phydev);
> >  					needs_aneg = 1;
> >  				}
> 
> This is not a single-statement basic block, and therefore you
> should remove the surrounding braces.

Thank You, the excess braces will be removed.


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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-15 12:48   ` Joe Perches
@ 2013-03-15 12:51     ` David Miller
  0 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-03-15 12:51 UTC (permalink / raw)
  To: joe
  Cc: kapranoff, netdev, bhutchings, peppe.cavallaro, bruce.w.allan,
	linux-kernel

From: Joe Perches <joe@perches.com>
Date: Fri, 15 Mar 2013 05:48:49 -0700

> The phy code also uses non standard kernel style tests like
> 	if (CONSTANT == variable)
> instead of
> 	if (variable == CONSTANT)

Right, to trigger compile time errors when "=" is accidently used
instead of "==".

But the whole driver is like this already.

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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-15 12:35 ` David Miller
@ 2013-03-15 12:48   ` Joe Perches
  2013-03-15 12:51     ` David Miller
  2013-03-15 14:15   ` Kirill Kapranov
  1 sibling, 1 reply; 13+ messages in thread
From: Joe Perches @ 2013-03-15 12:48 UTC (permalink / raw)
  To: David Miller
  Cc: kapranoff, netdev, bhutchings, peppe.cavallaro, bruce.w.allan,
	linux-kernel

On Fri, 2013-03-15 at 08:35 -0400, David Miller wrote:
> From: Kirill Kapranov <kapranoff@inbox.ru>
> Date: Thu, 14 Mar 2013 14:40:52 +0400
> 
> > @@ -867,7 +821,6 @@ void phy_state_machine(struct work_struct *work)
> >                               netif_carrier_on(phydev->attached_dev);
> >                       } else {
> >                               if (0 == phydev->link_timeout--) {
> > -                                     phy_force_reduction(phydev);
> >                                       needs_aneg = 1;
> >                               }
> 
> This is not a single-statement basic block, and therefore you
> should remove the surrounding braces.

s/not/now/

The phy code also uses non standard kernel style tests like
	if (CONSTANT == variable)
instead of
	if (variable == CONSTANT)



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

* Re: [PATCH] phy: Elimination the forced speed reduction algorithm.
  2013-03-14 10:40 Kirill Kapranov
@ 2013-03-15 12:35 ` David Miller
  2013-03-15 12:48   ` Joe Perches
  2013-03-15 14:15   ` Kirill Kapranov
  0 siblings, 2 replies; 13+ messages in thread
From: David Miller @ 2013-03-15 12:35 UTC (permalink / raw)
  To: kapranoff
  Cc: netdev, bhutchings, peppe.cavallaro, joe, bruce.w.allan, linux-kernel

From: Kirill Kapranov <kapranoff@inbox.ru>
Date: Thu, 14 Mar 2013 14:40:52 +0400

> @@ -867,7 +821,6 @@ void phy_state_machine(struct work_struct *work)
>  				netif_carrier_on(phydev->attached_dev);
>  			} else {
>  				if (0 == phydev->link_timeout--) {
> -					phy_force_reduction(phydev);
>  					needs_aneg = 1;
>  				}

This is not a single-statement basic block, and therefore you
should remove the surrounding braces.

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

* [PATCH] phy: Elimination the forced speed reduction algorithm.
@ 2013-03-14 10:40 Kirill Kapranov
  2013-03-15 12:35 ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Kirill Kapranov @ 2013-03-14 10:40 UTC (permalink / raw)
  To: netdev
  Cc: davem, bhutchings, peppe.cavallaro, joe, bruce.w.allan,
	linux-kernel, Kirill Kapranov

In case of fixed speed set up for a NIC (e.g. ethtool -s eth0 autoneg off speed
100 duplex full) with an ethernet cable plugged off, the mentioned algorithm
slows down a NIC speed, so further cable hook-up leads to nonoperable link state.

Signed-off-by: Kirill Kapranov <kapranoff@inbox.ru>
---
 drivers/net/phy/phy.c |   47 -----------------------------------------------
 1 files changed, 0 insertions(+), 47 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ef9ea92..0e40170 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -463,33 +463,6 @@ void phy_stop_machine(struct phy_device *phydev)
 }
 
 /**
- * phy_force_reduction - reduce PHY speed/duplex settings by one step
- * @phydev: target phy_device struct
- *
- * Description: Reduces the speed/duplex settings by one notch,
- *   in this order--
- *   1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF.
- *   The function bottoms out at 10/HALF.
- */
-static void phy_force_reduction(struct phy_device *phydev)
-{
-	int idx;
-
-	idx = phy_find_setting(phydev->speed, phydev->duplex);
-	
-	idx++;
-
-	idx = phy_find_valid(idx, phydev->supported);
-
-	phydev->speed = settings[idx].speed;
-	phydev->duplex = settings[idx].duplex;
-
-	pr_info("Trying %d/%s\n",
-		phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF");
-}
-
-
-/**
  * phy_error - enter HALTED state for this PHY device
  * @phydev: target phy_device struct
  *
@@ -818,30 +791,11 @@ void phy_state_machine(struct work_struct *work)
 				phydev->adjust_link(phydev->attached_dev);
 
 			} else if (0 == phydev->link_timeout--) {
-				int idx;
-
 				needs_aneg = 1;
 				/* If we have the magic_aneg bit,
 				 * we try again */
 				if (phydev->drv->flags & PHY_HAS_MAGICANEG)
 					break;
-
-				/* The timer expired, and we still
-				 * don't have a setting, so we try
-				 * forcing it until we find one that
-				 * works, starting from the fastest speed,
-				 * and working our way down */
-				idx = phy_find_valid(0, phydev->supported);
-
-				phydev->speed = settings[idx].speed;
-				phydev->duplex = settings[idx].duplex;
-
-				phydev->autoneg = AUTONEG_DISABLE;
-
-				pr_info("Trying %d/%s\n",
-					phydev->speed,
-					DUPLEX_FULL == phydev->duplex ?
-					"FULL" : "HALF");
 			}
 			break;
 		case PHY_NOLINK:
@@ -867,7 +821,6 @@ void phy_state_machine(struct work_struct *work)
 				netif_carrier_on(phydev->attached_dev);
 			} else {
 				if (0 == phydev->link_timeout--) {
-					phy_force_reduction(phydev);
 					needs_aneg = 1;
 				}
 			}
-- 
1.7.2.5


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

end of thread, other threads:[~2013-04-01 13:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-27 11:16 [PATCH] phy: Elimination the forced speed reduction algorithm Kirill Kapranov
2013-03-27 17:11 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-03-26 13:34 Kirill Kapranov
2013-03-26 14:56 ` Kirill Kapranov
2013-03-26 16:11   ` David Miller
2013-03-26 16:59 ` David Miller
2013-03-29 18:38 ` David Miller
2013-04-01 13:51   ` Kirill Kapranov
2013-03-14 10:40 Kirill Kapranov
2013-03-15 12:35 ` David Miller
2013-03-15 12:48   ` Joe Perches
2013-03-15 12:51     ` David Miller
2013-03-15 14:15   ` Kirill Kapranov

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