openwrt / netifd

[MIRROR] OpenWrt Network interface configuration daemon
https://git.openwrt.org/?p=project/netifd.git;
17 stars 19 forks source link

system-linux: fix autoneg for 2.5G/5G/10G #2

Closed crwnet closed 1 year ago

crwnet commented 1 year ago

ETHTOOL_GSET / ETHTOOL_SSET API is deprecated, migrate to ETHTOOL_GLINKSETTINGS / ETHTOOL_SLINKSETTINGS API to handle auto-negotiation for higher bandwidth like 2.5G, 5G, 10G

ynezz commented 1 year ago
/usr/bin/clang-15  -I/include -I/usr/include/libnl3 -g   -Wall -Werror -Wextra -Werror=implicit-function-declaration -Wformat -Werror=format-security -Werror=format-nonliteral -Os --std=gnu99 -Wmissing-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter -Wimplicit-fallthrough -MD -MT CMakeFiles/netifd.dir/system-linux.c.o -MF CMakeFiles/netifd.dir/system-linux.c.o.d -o CMakeFiles/netifd.dir/system-linux.c.o -c system-linux.c
system-linux.c:1754:14: error: incompatible pointer to integer conversion assigning to '__u32' (aka 'unsigned int') from '__u32 *' (aka 'unsigned int *'); remove & [-Werror,-Wint-conversion]
        advertising = &ecmd.link_mode_data[nwords];
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
system-linux.c:1755:9: error: incompatible integer to pointer conversion passing '__u32' (aka 'unsigned int') to parameter of type 'void *' [-Werror,-Wint-conversion]
        memset(advertising, 0, sizeof(__u32) * nwords);
               ^~~~~~~~~~~
/usr/include/string.h:60:28: note: passing argument to parameter '__s' here
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
                           ^
system-linux.c:1760:35: error: incompatible integer to pointer conversion passing '__u32' (aka 'unsigned int') to parameter of type '__u32 *' (aka 'unsigned int *'); take the address with & [-Werror,-Wint-conversion]
                        ethtool_link_mode_set_bit(bit, advertising);
                                                       ^~~~~~~~~~~
                                                       &
system-linux.c:1699:69: note: passing argument to parameter 'mask' here
static inline int ethtool_link_mode_set_bit(unsigned int nr, __u32 *mask)                                                                    
crwnet commented 1 year ago
/usr/bin/clang-15  -I/include -I/usr/include/libnl3 -g   -Wall -Werror -Wextra -Werror=implicit-function-declaration -Wformat -Werror=format-security -Werror=format-nonliteral -Os --std=gnu99 -Wmissing-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter -Wimplicit-fallthrough -MD -MT CMakeFiles/netifd.dir/system-linux.c.o -MF CMakeFiles/netifd.dir/system-linux.c.o.d -o CMakeFiles/netifd.dir/system-linux.c.o -c system-linux.c
system-linux.c:1754:14: error: incompatible pointer to integer conversion assigning to '__u32' (aka 'unsigned int') from '__u32 *' (aka 'unsigned int *'); remove & [-Werror,-Wint-conversion]
        advertising = &ecmd.link_mode_data[nwords];
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
system-linux.c:1755:9: error: incompatible integer to pointer conversion passing '__u32' (aka 'unsigned int') to parameter of type 'void *' [-Werror,-Wint-conversion]
        memset(advertising, 0, sizeof(__u32) * nwords);
               ^~~~~~~~~~~
/usr/include/string.h:60:28: note: passing argument to parameter '__s' here
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
                           ^
system-linux.c:1760:35: error: incompatible integer to pointer conversion passing '__u32' (aka 'unsigned int') to parameter of type '__u32 *' (aka 'unsigned int *'); take the address with & [-Werror,-Wint-conversion]
                        ethtool_link_mode_set_bit(bit, advertising);
                                                       ^~~~~~~~~~~
                                                       &
system-linux.c:1699:69: note: passing argument to parameter 'mask' here
static inline int ethtool_link_mode_set_bit(unsigned int nr, __u32 *mask)                                                                    

Sorry, I made a stupid mistake. Because need to follow project's coding style, I changed it directly through Notepad. now corrected

robimarko commented 1 year ago

It would be great to get this merged as AQR PHY-s actually check whether certain speeds are allowed to be advertised so 2500BaseT and 5000BaseT are not currently advertised and this makes them allowed again.

robimarko commented 1 year ago

@crwnet Do you have time to do the modifications?

If not, I can do them as this has been a quite long-standing issue.

robimarko commented 1 year ago

LGTM, so: Reviewed-by: Robert Marko <robimarko@gmail.com

dangowrt commented 1 year ago

Closing in favor of #9 which has been merged