diff mbox

[ovs-dev] netdev-linux: correctly detect port speed bits beyond 16bit

Message ID 1448065572-23160-1-git-send-email-simon.horman@netronome.com
State Changes Requested
Headers show

Commit Message

Simon Horman Nov. 21, 2015, 12:26 a.m. UTC
This includes bits for:
* Backplane
* 1000 baseKX (full duplex)
* All speeds of 10Gbit and above other than 10000 baseT (full duplex).

Signed-off-by: Simon Horman <simon.horman@netronome.com>

---

* ethtool_cmd_speed() is a trivial provided by Linux kernel headers.
  It was introduced in 2.6.27.  The source file in question is only
  compiled when building for a Linux host.  I am unsure of that
  compatibility considerations are regarding Linux kernel versions and OVS
  user-space code.
---
 lib/netdev-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Nov. 27, 2015, 6:36 p.m. UTC | #1
On Fri, Nov 20, 2015 at 04:26:12PM -0800, Simon Horman wrote:
> This includes bits for:
> * Backplane
> * 1000 baseKX (full duplex)
> * All speeds of 10Gbit and above other than 10000 baseT (full duplex).
> 
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> 
> ---
> 
> * ethtool_cmd_speed() is a trivial provided by Linux kernel headers.
>   It was introduced in 2.6.27.  The source file in question is only
>   compiled when building for a Linux host.  I am unsure of that
>   compatibility considerations are regarding Linux kernel versions and OVS
>   user-space code.

netdev-linux.c has some #defines that add compatibility for building
against headers as old as Linux 2.6.14, so probably this should add a
compatibility #define for ethtool_cmd_speed().

The same thing is probably true for the other related patch you posted.
diff mbox

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 584e804b6c8a..9ce1e29ecf15 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1849,7 +1849,7 @@  netdev_linux_read_features(struct netdev_linux *netdev)
     }
 
     /* Current settings. */
-    speed = ecmd.speed;
+    speed = ethtool_cmd_speed(&ecmd);
     if (speed == SPEED_10) {
         netdev->current = ecmd.duplex ? NETDEV_F_10MB_FD : NETDEV_F_10MB_HD;
     } else if (speed == SPEED_100) {