Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 2014 14:43:37 +0400
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        eric Joyner <ricera10@gmail.com>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   ixgbe ifmedia handling
Message-ID:  <54478A59.10804@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010003070702060804070603
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

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.




--------------010003070702060804070603
Content-Type: text/x-patch;
 name="ixgbe_media.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ixgbe_media.diff"

Index: ixgbe.c
===================================================================
--- ixgbe.c	(revision 273327)
+++ ixgbe.c	(working copy)
@@ -5341,7 +5341,17 @@
 	struct ixgbe_hw *hw = &adapter->hw;
 	u32 autoneg;
 	bool negotiate;
+	int err;
 
+	err = hw->phy.ops.identify_sfp(hw);
+	if (err == IXGBE_ERR_SFP_NOT_PRESENT) {
+		device_printf(adapter->dev,
+		    "SFP+ module was detached.\n");
+	} else {
+		ixgbe_setup_optics(adapter);
+		INIT_DEBUGOUT1("ixgbe_sfp_probe: flags: %X\n", adapter->optics);
+	}
+
 	autoneg = hw->phy.autoneg_advertised;
 	if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
 		hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate);

--------------010003070702060804070603--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54478A59.10804>