sfxge: use if_initbaudrate() to set interface baudrate

It is required to cope with u_long limit for 10 Gbps in a right way.
It is a direct commit to stable/10 since head differs (head does not
have if_initbaudrate(), if_baudrate is simply uint64_t).

Sponsored by: Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2849
This commit is contained in:
arybchik 2015-06-18 15:41:09 +00:00
parent 9d6c0060b8
commit 7f9011de0c

View File

@ -224,14 +224,14 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLER_ARGS)
#endif /* SFXGE_HAVE_PAUSE_MEDIAOPTS */
static const u_long sfxge_link_baudrate[EFX_LINK_NMODES] = {
static const uint64_t sfxge_link_baudrate[EFX_LINK_NMODES] = {
[EFX_LINK_10HDX] = IF_Mbps(10),
[EFX_LINK_10FDX] = IF_Mbps(10),
[EFX_LINK_100HDX] = IF_Mbps(100),
[EFX_LINK_100FDX] = IF_Mbps(100),
[EFX_LINK_1000HDX] = IF_Gbps(1),
[EFX_LINK_1000FDX] = IF_Gbps(1),
[EFX_LINK_10000FDX] = MIN(IF_Gbps(10ULL), ULONG_MAX),
[EFX_LINK_10000FDX] = IF_Gbps(10),
};
void
@ -250,7 +250,7 @@ sfxge_mac_link_update(struct sfxge_softc *sc, efx_link_mode_t mode)
/* Push link state update to the OS */
link_state = (port->link_mode != EFX_LINK_DOWN ?
LINK_STATE_UP : LINK_STATE_DOWN);
sc->ifnet->if_baudrate = sfxge_link_baudrate[port->link_mode];
if_initbaudrate(sc->ifnet, sfxge_link_baudrate[port->link_mode]);
if_link_state_change(sc->ifnet, link_state);
}