From: Michael Zhivich <mzhiv...@akamai.com> Date: Mon, 1 Apr 2019 13:14:28 -0400
> When building C++ userspace code that includes ethtool.h > with "-Werror -Wall", g++ complains about signed-unsigned comparison in > ethtool_validate_speed() due to definition of SPEED_UNKNOWN as -1. > > Change definition of SPEED_UNKNOWN to UINT_MAX to match the type of > ethtool_validate_speed() argument (__u32). > > Update storage type for link speed in drivers to use u32 instead of int > or u16 to bring drivers up-to-date with ethtool.h which includes SPEED_* > constants larger than range of u16. > > Fix usage of SPEED_* constants in > drivers/net/ethernet/cavium/thunder/thunder_bgx.c and > drivers/infiniband/ulp/ipoib/ipoib_ethtool.c. > > Signed-off-by: Michael Zhivich <mzhiv...@akamai.com> Waaaaay too many changes in one patch. Do one thing at a time. Also, are you absolutely sure that the things you changed from 'int' aren't used in other ways where the signedness matters? For example for error returns? And maybe the drivers using u16 are legitimate because they are operating on speeds only within that bitmap range. Type matching is not an end to itself. So I don't want to see u16 --> u32 conversions where they aren't even necessary. Also: > /* Return lane speed in unit of 1e6 bit/sec */ > -static inline int ib_speed_enum_to_int(int speed) > +static inline u32 ib_speed_enum_to_int(int speed) This is sloppy. You are changing the return type, but not adjusting the name of the function appropriately. The function name says it converts to an 'int' but now it actually converts to and returns a u32. You need to split up, audit, and present these changes more carefully and properly. Thank you.