All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy/ethtool: Add missing SPEED_<foo> strings
@ 2017-04-02 21:30 Joe Perches
  2017-04-02 21:40 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joe Perches @ 2017-04-02 21:30 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli; +Cc: netdev, linux-kernel

Add all the currently available SPEED_<foo> strings.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/phy/phy.c        | 14 ++++++++++++++
 include/uapi/linux/ethtool.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d019bbf42c31..e7d0367a1455 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -50,8 +50,22 @@ static const char *phy_speed_to_str(int speed)
 		return "1Gbps";
 	case SPEED_2500:
 		return "2.5Gbps";
+	case SPEED_5000:
+		return "5Gbps";
 	case SPEED_10000:
 		return "10Gbps";
+	case SPEED_20000:
+		return "20Gbps";
+	case SPEED_25000:
+		return "25Gbps";
+	case SPEED_40000:
+		return "40Gbps";
+	case SPEED_50000:
+		return "50Gbps";
+	case SPEED_56000:
+		return "56Gbps";
+	case SPEED_100000:
+		return "100Gbps";
 	case SPEED_UNKNOWN:
 		return "Unknown";
 	default:
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 3dc91a46e8b8..5f4ea28eabe4 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1487,6 +1487,7 @@ enum ethtool_link_mode_bit_indices {
  */
 
 /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
+/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */
 #define SPEED_10		10
 #define SPEED_100		100
 #define SPEED_1000		1000
-- 
2.10.0.rc2.1.g053435c

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

* Re: [PATCH] phy/ethtool: Add missing SPEED_<foo> strings
  2017-04-02 21:30 [PATCH] phy/ethtool: Add missing SPEED_<foo> strings Joe Perches
@ 2017-04-02 21:40 ` Andrew Lunn
  2017-04-02 21:49   ` Joe Perches
  2017-04-02 22:29 ` Florian Fainelli
  2017-04-05 13:36 ` David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2017-04-02 21:40 UTC (permalink / raw)
  To: Joe Perches; +Cc: Florian Fainelli, netdev, linux-kernel

On Sun, Apr 02, 2017 at 02:30:06PM -0700, Joe Perches wrote:
> Add all the currently available SPEED_<foo> strings.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/phy/phy.c        | 14 ++++++++++++++
>  include/uapi/linux/ethtool.h |  1 +
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index d019bbf42c31..e7d0367a1455 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -50,8 +50,22 @@ static const char *phy_speed_to_str(int speed)
>  		return "1Gbps";
>  	case SPEED_2500:
>  		return "2.5Gbps";
> +	case SPEED_5000:
> +		return "5Gbps";
>  	case SPEED_10000:
>  		return "10Gbps";
> +	case SPEED_20000:
> +		return "20Gbps";
> +	case SPEED_25000:
> +		return "25Gbps";
> +	case SPEED_40000:
> +		return "40Gbps";
> +	case SPEED_50000:
> +		return "50Gbps";
> +	case SPEED_56000:
> +		return "56Gbps";
> +	case SPEED_100000:
> +		return "100Gbps";
>  	case SPEED_UNKNOWN:
>  		return "Unknown";
>  	default:
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 3dc91a46e8b8..5f4ea28eabe4 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -1487,6 +1487,7 @@ enum ethtool_link_mode_bit_indices {
>   */
>  
>  /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */

Hi Joe

Given that this list is getting longer and longer, and the comment
that 0..INT_MAX are legal, is it time to replace this with something
dynamic?

	Andrew

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

* Re: [PATCH] phy/ethtool: Add missing SPEED_<foo> strings
  2017-04-02 21:40 ` Andrew Lunn
@ 2017-04-02 21:49   ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2017-04-02 21:49 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Florian Fainelli, netdev, linux-kernel

On Sun, 2017-04-02 at 23:40 +0200, Andrew Lunn wrote:
> On Sun, Apr 02, 2017 at 02:30:06PM -0700, Joe Perches wrote:
> > Add all the currently available SPEED_<foo> strings.
[]
> > diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
[]
> > @@ -1487,6 +1487,7 @@ enum ethtool_link_mode_bit_indices {
> >   */
> >  
> >  /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
> 
> Hi Joe
> 
> Given that this list is getting longer and longer, and the comment
> that 0..INT_MAX are legal, is it time to replace this with something
> dynamic?

Hey Andrew.

Probably not.

INT_MAX in units of millions is likely large enough for
quite awhile yet, maybe 2 decades or even more.

If you feel ambitious, and remember ethtool.h and
SPEED_<foo> uses are a public API, write something up.

cheers, Joe

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

* Re: [PATCH] phy/ethtool: Add missing SPEED_<foo> strings
  2017-04-02 21:30 [PATCH] phy/ethtool: Add missing SPEED_<foo> strings Joe Perches
  2017-04-02 21:40 ` Andrew Lunn
@ 2017-04-02 22:29 ` Florian Fainelli
  2017-04-03  2:44   ` Joe Perches
  2017-04-05 13:36 ` David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2017-04-02 22:29 UTC (permalink / raw)
  To: Joe Perches, Andrew Lunn; +Cc: netdev, linux-kernel

Le 04/02/17 à 14:30, Joe Perches a écrit :
> Add all the currently available SPEED_<foo> strings.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Considering that PHYLIB does not support anything > 10Gbs at the moment,
I am not sure how useful that is except if we wanted to re-use
phy_speed_to_str() in other places of the kernel?

> ---
>  drivers/net/phy/phy.c        | 14 ++++++++++++++
>  include/uapi/linux/ethtool.h |  1 +
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index d019bbf42c31..e7d0367a1455 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -50,8 +50,22 @@ static const char *phy_speed_to_str(int speed)
>  		return "1Gbps";
>  	case SPEED_2500:
>  		return "2.5Gbps";
> +	case SPEED_5000:
> +		return "5Gbps";
>  	case SPEED_10000:
>  		return "10Gbps";
> +	case SPEED_20000:
> +		return "20Gbps";
> +	case SPEED_25000:
> +		return "25Gbps";
> +	case SPEED_40000:
> +		return "40Gbps";
> +	case SPEED_50000:
> +		return "50Gbps";
> +	case SPEED_56000:
> +		return "56Gbps";
> +	case SPEED_100000:
> +		return "100Gbps";
>  	case SPEED_UNKNOWN:
>  		return "Unknown";
>  	default:
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 3dc91a46e8b8..5f4ea28eabe4 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -1487,6 +1487,7 @@ enum ethtool_link_mode_bit_indices {
>   */
>  
>  /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
> +/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */
>  #define SPEED_10		10
>  #define SPEED_100		100
>  #define SPEED_1000		1000
> 


-- 
Florian

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

* Re: [PATCH] phy/ethtool: Add missing SPEED_<foo> strings
  2017-04-02 22:29 ` Florian Fainelli
@ 2017-04-03  2:44   ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2017-04-03  2:44 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn; +Cc: netdev, linux-kernel

On Sun, 2017-04-02 at 15:29 -0700, Florian Fainelli wrote:
> Le 04/02/17 à 14:30, Joe Perches a écrit :
> > Add all the currently available SPEED_<foo> strings.
> > 
> > Signed-off-by: Joe Perches <joe@perches.com>
> 
> Considering that PHYLIB does not support anything > 10Gbs at the moment,
> I am not sure how useful that is except if we wanted to re-use
> phy_speed_to_str() in other places of the kernel?

phy_print_status() can be used several places already
independent of phylib.

Might as well make it more generic and so more usable.

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

* Re: [PATCH] phy/ethtool: Add missing SPEED_<foo> strings
  2017-04-02 21:30 [PATCH] phy/ethtool: Add missing SPEED_<foo> strings Joe Perches
  2017-04-02 21:40 ` Andrew Lunn
  2017-04-02 22:29 ` Florian Fainelli
@ 2017-04-05 13:36 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-04-05 13:36 UTC (permalink / raw)
  To: joe; +Cc: andrew, f.fainelli, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Sun,  2 Apr 2017 14:30:06 -0700

> Add all the currently available SPEED_<foo> strings.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

I'll apply this for now, thanks.

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

end of thread, other threads:[~2017-04-05 13:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-02 21:30 [PATCH] phy/ethtool: Add missing SPEED_<foo> strings Joe Perches
2017-04-02 21:40 ` Andrew Lunn
2017-04-02 21:49   ` Joe Perches
2017-04-02 22:29 ` Florian Fainelli
2017-04-03  2:44   ` Joe Perches
2017-04-05 13:36 ` 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.