RE: Support for 2500BaseT and 5000BaseT patch
From: Ami Hadas <hidden>
Date: 2017-02-19 08:12:00
OK, Here it is again. Thanks, Ami -----Original Message----- From: John W. Linville [mailto:linville@tuxdriver.com] Sent: Friday, February 17, 2017 4:42 PM To: Ami Hadas <redacted> Subject: Re: Support for 2500BaseT and 5000BaseT patch Well, I think the patch looks fine. But I will have to ask you to post it publicly to the netdev@vger.kernel.org mailing list. Thanks, John On Wed, Feb 15, 2017 at 02:37:02PM +0000, Ami Hadas wrote:
Hi, Here is the patch: The ethtool-copy.h is a copy of include/uapi/linux/ethtool.h from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git which already include the new speeds. Ami
quoted hunk
From 7cc0357de4f5867be164afa917beff57c8094495 Mon Sep 17 00:00:00 2001 From: tehuti <redacted> Date: Wed, 15 Feb 2017 16:00:54 +0200 Subject: [PATCH] Add support for 2500BaseT and 5000BaseT link modes according to IEEE 802.3bz standard. Signed-off-by: Ami Hadas <redacted> --- ethtool-copy.h | 24 ++++++++++++++---------- ethtool.c | 4 ++++ 2 files changed, 18 insertions(+), 10 deletions(-)diff --git a/ethtool-copy.h b/ethtool-copy.h index 3d299e3..3dc91a4100644--- a/ethtool-copy.h +++ b/ethtool-copy.h@@ -10,14 +10,16 @@ * Portions Copyright (C) Sun Microsystems 2008 */ -#ifndef _LINUX_ETHTOOL_H -#define _LINUX_ETHTOOL_H +#ifndef _UAPI_LINUX_ETHTOOL_H +#define _UAPI_LINUX_ETHTOOL_H #include <linux/kernel.h> #include <linux/types.h> #include <linux/if_ether.h> +#ifndef __KERNEL__ #include <limits.h> /* for INT_MAX */ +#endif /* All structures exposed to userland should be defined such that they * have the same layout for 32-bit and 64-bit userland.@@ -114,14 +116,14 @@ struct ethtool_cmd { __u32 reserved[2]; }; -static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep, +static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, __u32 speed) { ep->speed = (__u16)(speed & 0xFFFF); ep->speed_hi = (__u16)(speed >> 16); } -static __inline__ __u32 ethtool_cmd_speed(const struct ethtool_cmd*ep) +static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) { return (ep->speed_hi << 16) | ep->speed; } @@ -892,12 +894,12 @@ struct ethtool_rx_flow_spec { #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 -static __inline__ __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) +static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) { return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; }; -static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) +static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) { return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; @@ -1382,6 +1384,8 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, + ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, + ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit @@ -1391,7 +1395,7 @@ enum ethtool_link_mode_bit_indices { */ __ETHTOOL_LINK_MODE_LAST - = ETHTOOL_LINK_MODE_10000baseER_Full_BIT, + = ETHTOOL_LINK_MODE_5000baseT_Full_BIT, }; #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \@@ -1498,7 +1502,7 @@ enum ethtool_link_mode_bit_indices { #define SPEED_UNKNOWN -1 -static __inline__ int ethtool_validate_speed(__u32 speed) +static inline int ethtool_validate_speed(__u32 speed) { return speed <= INT_MAX || speed == SPEED_UNKNOWN; } @@ -1508,7 +1512,7 @@ static __inline__ int ethtool_validate_speed(__u32 speed) #define DUPLEX_FULL 0x01 #define DUPLEX_UNKNOWN 0xff -static __inline__ int ethtool_validate_duplex(__u8 duplex) +static inline int ethtool_validate_duplex(__u8 duplex) { switch (duplex) { case DUPLEX_HALF:@@ -1758,4 +1762,4 @@ struct ethtool_link_settings { * __u32 map_lp_advertising[link_mode_masks_nwords]; */ }; -#endif /* _LINUX_ETHTOOL_H */ +#endif /* _UAPI_LINUX_ETHTOOL_H */diff --git a/ethtool.c b/ethtool.c index 7af039e..b36d40e 100644 --- a/ethtool.c +++ b/ethtool.c@@ -681,6 +681,10 @@ static void dump_link_caps(const char *prefix, const char *an_prefix, "10000baseLRM/Full" }, { 0, ETHTOOL_LINK_MODE_10000baseER_Full_BIT, "10000baseER/Full" }, + { 0, ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + "2500baseT/Full" }, + { 0, ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + "5000baseT/Full" }, }; int indent; int did1, new_line_pend, i; --2.7.4
-- John W. Linville Someday the world will need a hero, and you linville@tuxdriver.com might be all we have. Be ready.
Attachments
- 0001-Add-support-for-2500BaseT-and-5000BaseT-link-modes-a.patch [application/octet-stream] 4023 bytes · preview