Fix ix advertise value after media change

When ifconfig sets media then the values displayed by the advertise_speed
value are invalidated.

Fix this by setting the bits correctly including setting advertise to 0 for
media = auto.

Reviewed by:	sbruno
MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5034
This commit is contained in:
Steven Hartland 2016-01-22 17:03:32 +00:00
parent e79b31967d
commit 1566d8d57a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294578

View File

@ -1948,10 +1948,16 @@ ixgbe_media_change(struct ifnet * ifp)
hw->mac.autotry_restart = TRUE;
hw->mac.ops.setup_link(hw, speed, TRUE);
adapter->advertise =
((speed & IXGBE_LINK_SPEED_10GB_FULL) << 2) |
((speed & IXGBE_LINK_SPEED_1GB_FULL) << 1) |
((speed & IXGBE_LINK_SPEED_100_FULL) << 0);
if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) {
adapter->advertise = 0;
} else {
if ((speed & IXGBE_LINK_SPEED_10GB_FULL) != 0)
adapter->advertise |= 1 << 2;
if ((speed & IXGBE_LINK_SPEED_1GB_FULL) != 0)
adapter->advertise |= 1 << 1;
if ((speed & IXGBE_LINK_SPEED_100_FULL) != 0)
adapter->advertise |= 1 << 0;
}
return (0);