[ovs-dev] [PATCH v2 1/2] netdev-linux: correctly detect port speed bits beyond 16bit
Simon Horman
simon.horman at netronome.com
Sun Nov 29 23:49:03 UTC 2015
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 at netronome.com>
---
v2
* Include compatibility code as suggested by Ben Pfaff
---
lib/netdev-linux.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index ed78868896d9..1d1a22bf1341 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -139,6 +139,18 @@ struct tpacket_auxdata {
uint16_t tp_vlan_tpid;
};
+/* Linux 2.6.27 introduced ethtool_cmd_speed
+ *
+ * To avoid revisiting problems reported with using configure to detect
+ * compatibility (see report at
+ * http://openvswitch.org/pipermail/dev/2014-October/047978.html)
+ * unconditionally replace ethtool_cmd_speed. */
+#define ethtool_cmd_speed rpl_ethtool_cmd_speed
+static inline uint32_t rpl_ethtool_cmd_speed(const struct ethtool_cmd *ep)
+{
+ return ep->speed | (ep->speed_hi << 16);
+}
+
/* Linux 2.6.35 introduced IFLA_STATS64 and rtnl_link_stats64.
*
* Tests for rtnl_link_stats64 don't seem to consistently work, e.g. on
@@ -1847,7 +1859,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) {
--
2.1.4
More information about the dev
mailing list