Skip to contentSkip to conversation

ethtool: Expand ethtool_cmd.speed to 32 bits

RFC Applied Brandon Philips 5 participants 8 messages Jul 15, 2008 – Aug 7, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 ethtool: Expand ethtool_cmd.speed to 32 bits

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
include/linux/ethtool.h +16 -1
Index: linux-2.6/include/linux/ethtool.h
===================================================================
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };
 
+static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+						__u32 speed)
+{
+
+	ep->speed = (__u16)speed;
+	ep->speed_hi = (__u16)(speed >> 16);
+}
+
+static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+{
+	return (ep->speed_hi << 16) | ep->speed;
+}
+
 #define ETHTOOL_BUSINFO_LEN	32
 /* these strings are set to whatever the driver author decides... */
 struct ethtool_drvinfo {
#1 lore raw
Quoted 18 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 8 lines
include/linux/ethtool.h +3 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };

I certainly agree with the concept of preparing for faster NICs. Are bits in that structure sufficiently precious to go the split route, or would it be cleaner to just grab a contiguous 32 bits from the structure?

rick jones

maintainer
#2 lore raw

From: Rick Jones <[email protected]>
Date: Tue, 15 Jul 2008 14:53:16 -0700

Quoted 23 lines
Quoted 22 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h +0 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
Quoted 8 lines

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 4 lines
include/linux/ethtool.h +3 -0
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };

I certainly agree with the concept of preparing for faster NICs. Are bits in that structure sufficiently precious to go the split route, or would it be cleaner to just grab a contiguous 32 bits from the structure?

That's less space we can use to make similar expansions.

And we have to keep the existing u16 chunk there anyways, because existing applications are only going to provide that part.

#3 lore raw
Quoted 35 lines · David Miller

From: Rick Jones <[email protected]>
Date: Tue, 15 Jul 2008 14:53:16 -0700

Quoted 23 lines
Quoted 22 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h +0 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
Quoted 8 lines

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 4 lines
include/linux/ethtool.h +3 -0
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };

I certainly agree with the concept of preparing for faster NICs. Are bits in that structure sufficiently precious to go the split route, or would it be cleaner to just grab a contiguous 32 bits from the structure?

Quoted 4 lines

That's less space we can use to make similar expansions.

And we have to keep the existing u16 chunk there anyways, because existing applications are only going to provide that part.

Agreed. Can this be queued for 2.6.27 then?

Thanks,

Brandon

maintainer
#4 lore raw

From: Brandon Philips <[email protected]>
Date: Tue, 15 Jul 2008 23:47:09 -0700

Quoted 36 lines · David Miller
Quoted 35 lines

From: Rick Jones <[email protected]>
Date: Tue, 15 Jul 2008 14:53:16 -0700

Quoted 31 lines
Quoted 18 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 8 lines
include/linux/ethtool.h +3 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };

I certainly agree with the concept of preparing for faster NICs. Are bits in that structure sufficiently precious to go the split route, or would it be cleaner to just grab a contiguous 32 bits from the structure?

Quoted 6 lines
Quoted 4 lines

That's less space we can use to make similar expansions.

And we have to keep the existing u16 chunk there anyways, because existing applications are only going to provide that part.

Agreed. Can this be queued for 2.6.27 then?

Jeff?

#5 lore raw
Quoted 39 lines · David Miller

From: Brandon Philips <[email protected]>
Date: Tue, 15 Jul 2008 23:47:09 -0700

Quoted 36 lines · David Miller
Quoted 35 lines

From: Rick Jones <[email protected]>
Date: Tue, 15 Jul 2008 14:53:16 -0700

Quoted 31 lines
Quoted 18 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 8 lines
include/linux/ethtool.h +3 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };

I certainly agree with the concept of preparing for faster NICs. Are bits in that structure sufficiently precious to go the split route, or would it be cleaner to just grab a contiguous 32 bits from the structure?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

That's less space we can use to make similar expansions.

And we have to keep the existing u16 chunk there anyways, because existing applications are only going to provide that part.

Agreed. Can this be queued for 2.6.27 then?

Jeff?

Has this been merged somewhere? I just checked net-2.6 and net-next and didn't see it.

Thanks,

Brandon

#6 lore raw
Quoted 38 lines · Brandon Philips
Quoted 37 lines · David Miller

From: Brandon Philips <[email protected]>
Date: Tue, 15 Jul 2008 23:47:09 -0700

Quoted 34 lines · David Miller
Quoted 33 lines

From: Rick Jones <[email protected]>
Date: Tue, 15 Jul 2008 14:53:16 -0700

Quoted 14 lines
Quoted 13 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Quoted 14 lines

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 13 lines

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h +3 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };

I certainly agree with the concept of preparing for faster NICs. Are bits in that structure sufficiently precious to go the split route, or would it be cleaner to just grab a contiguous 32 bits from the structure?

That's less space we can use to make similar expansions.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

And we have to keep the existing u16 chunk there anyways, because existing applications are only going to provide that part.

Agreed. Can this be queued for 2.6.27 then?

Jeff?

Has this been merged somewhere? I just checked net-2.6 and net-next and didn't see it.

Sorry, this thread was buried deep in an inbox. Rescued and queued.

Jeff

Applied
#7 lore raw
In reply to Brandon Philips
Quoted 30 lines · Brandon Philips

Introduce the speed_hi field to ethtool_cmd, using the reserved space, to expand the speed field to 2^32 Megabits/second.

Making this field expansion now gives us plenty of time to fix up the user-space pieces that use SIOCETHTOOL before hardware faster than 64 Gb/s is available.

---
 include/linux/ethtool.h |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/ethtool.h
===================================================================

include/linux/ethtool.h +6 -1
@@ -27,9 +27,24 @@ struct ethtool_cmd {
 	__u8	autoneg;	/* Enable or disable autonegotiation */
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u32	reserved[4];
+	__u16	speed_hi;
+	__u16	reserved2;
+	__u32	reserved[3];
 };
 
+static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+						__u32 speed)
+{

include/linux/ethtool.h struct ethtool_cmd { · line 47

Quoted 10 lines
include/linux/ethtool.h +10 -0
+
+	ep->speed = (__u16)speed;
+	ep->speed_hi = (__u16)(speed >> 16);
+}
+
+static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+{
+	return (ep->speed_hi << 16) | ep->speed;
+}
+

applied