Bug 261866 - ixgbe(4): Resets media type -> autoselect after setting any other type on Intel 82599ES
Summary: ixgbe(4): Resets media type -> autoselect after setting any other type on Int...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.3-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-net (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-02-10 15:48 UTC by Brian Poole
Modified: 2022-02-14 19:54 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback? (rstone)
koobs: maintainer-feedback? (kbowling)
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Poole 2022-02-10 15:48:29 UTC
Hello,

I am testing FreeBSD-12.3 using an '82599ES 10-Gigabit SFI/SFP+ Network Connection' with an 10Gbase-LR transceiver. A similar box at a remote location was unable to establish a 10GbE link and fell back to 1GbE. I wanted to force the 1000baseLX media type to see if that could be established reliably. After my testing, I believe ixgbe resets the media type to autoselect immediately after setting any other type - making the 'ifconfig ixl0 media 1000baseLX' command useless. I believe it is revision r312544 that causes this behavior. I am interested if ixgbe can be reworked so that fixed media types can be applied. Thank you!


When linked at 10G, the output of 'ifconfig ixl0' includes:
	media: Ethernet autoselect (10Gbase-LR <full-duplex>)
My understanding is the first 'Ethernet autoselect' reflects what is configured while the section in parenthesis '10Gbase-LR' is what is negotiated. I can try to force the negotiated speed but ifconfig still reports 'Ethernet autoselect':
# ifconfig ixl0 media 10Gbase-LR
        media: Ethernet autoselect (10Gbase-LR <full-duplex>)
Note if I try this on a 1GbE igb driver, the configured media type is displayed:
# ifconfig igb0 media 100baseTX
       media: Ethernet 100baseTX (100baseTX <half-duplex>)

Next, I built the kernel using options 'IFMEDIA_DEBUG' and after booting set 'sysctl debug.ifmedia=1'. I added additional logging before the two ifmedia_set() calls in the if_ix.c - in ixgbe_setup_interface() and ixgbe_handl_msf(). Testing showed that after setting a new mode, the link goes down then comes back up, and the handle_msf() function is called. That function clears and reloads the available media types then sets the interface to auto. That cancels out the forced media type.

I traced this problem to r312544 where ifmedia_set() was added to avoid an invalid memory access. Is there a way to retain the configured media state and attempt to use it after reloading the available types? Otherwise, at least when using optics, it seems like I am unable to set a media type. I see ixl and ice drivers don't support setting a media type - perhaps it is related to this problem?
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-13 23:55:26 UTC
@Reporter Are you able to test 13-R and/or 14-CURRENT snapshots to confirm reproducibility in those versions?

^Triage:

- Request feedback from committer of base r312544 and Kevin
Comment 2 Brian Poole 2022-02-14 17:30:46 UTC
(In reply to Kubilay Kocak from comment #1)

Thank you for your help. I was able to place the card in a system running FreeBSD-13.0-RELEASE-p6. I do see the same behavior.

I try to force 10Gbase-LR but it reverts to auto:
# ifconfig ix1 media 10Gbase-LR;sleep 5; ifconfig ix1
ix1: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=4800020<JUMBO_MTU,NOMAP>
	ether 00:23:56:1e:91:ab
	media: Ethernet autoselect (10Gbase-LR <full-duplex,rxpause,txpause>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

I try to force 1000baseLX and it still displays auto:
# ifconfig ix1 media 1000baseLX;sleep 5; ifconfig ix1
ix1: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=4800020<JUMBO_MTU,NOMAP>
	ether 00:23:56:1e:91:ab
	media: Ethernet autoselect (1000baseLX <full-duplex,rxpause,txpause>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Looking at the problem on this machine, I'm thinking the issue is really displaying the current setting. When I switch between 10G and 1G, the link is negotiating the requested speed. Looking at sysctl dev.ix.1.advertise_speed, it is changing from 6 for (10G | 1G) to 2 (1G).
Comment 3 Krzysztof Galazka 2022-02-14 19:54:50 UTC
Hi,

Setting media type on 82599ES (and other HW supported by ixgbe) is implemented by limiting list of advertised speeds to single value and restarting auto-negotiation. This is the way HW works - see Datasheet chapter 3.7.4.2 MAC Link Setup and Auto-Negotiation for details. I'm not sure if showing 'Ethernet autoselect' should be considered as a bug in this case.