ixgbe ifmedia handling

Alexander V. Chernikov melifaro at FreeBSD.org
Wed Oct 22 10:45:34 UTC 2014


There is a problem with correct media reporting in ixgbe:

ixgbe_setup_optics() is called only at ixgbe_attach().
This means that:
1) if SFP slot was empty at the attach() time, "media" part will be set 
to adapter->optics = IFM_ETHER | IFM_AUTO;
e.g. after attaching SFP status will look like
         media: Ethernet autoselect (autoselect <full-duplex>)
         status: active
2) If SFP slot was not empty, ifmedia will not be updated.

The former case may trigger problems in other places inside kernel 
relying for ifmedia to be set correctly.
For example, ifmedia_baudrate() will return 0 for given active interface 
(and this breaks best LACP aggregator selection
making lagg interface attach impossible until module unload or reboot.

Attached patch seems to work for 82599 NIC, but I'm pretty sure that it 
needs more checks.
(And I wonder if we have the same problems with if_ixl).

While investigating this case/performing tests I've noticed the following:

* code inside ixgbe_local_timer() probing SFP seems to be dead
          /* Check for pluggable optics */
         if (adapter->sfp_probe)
   was always false (due to failure to detect/set 
IXGBE_ERR_SFP_NOT_PRESENT status?)

* ixgbe_handle_mod() was triggered in 1/4 of cases:
e.g. if you detach SFP witin 2-3 seconds after attach it will not trigger.
Even if detaching SFP which was inserted half an hour ago (and link was 
UP) this interrupt does not always trigger.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: ixgbe_media.diff
Type: text/x-patch
Size: 675 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20141022/0045f2f3/attachment.bin>


More information about the freebsd-net mailing list