From owner-freebsd-net@FreeBSD.ORG Wed Jan 23 22:58:46 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BCFE62CD; Wed, 23 Jan 2013 22:58:46 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ob0-f176.google.com (mail-ob0-f176.google.com [209.85.214.176]) by mx1.freebsd.org (Postfix) with ESMTP id 77B03751; Wed, 23 Jan 2013 22:58:46 +0000 (UTC) Received: by mail-ob0-f176.google.com with SMTP id un3so8869423obb.21 for ; Wed, 23 Jan 2013 14:58:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=+DhsW/3Zr9W7CBzfIKjSIoneLYDSxq511dO0DdDL9f0=; b=p4aRe86rSr8/nj/GiGC9g2fknELAGx2FPU28bsMyGaKnOGv4CHfFtqttqn9ztCuD+U M8FYuzBKs/D5kju+qGm7tKt1b7nYyaO/vI2oG8kHaa/r1uBtzhTBDgizmXlfD2pufqPU wvfQn9Gcb7/d5589ZC3nhbol4/zVj08nyDmqz66A2DAuxHQw3S89WQYhMQdQNHa1jiXL HYp7WU0wPvH235RZzhUOKeMbTPp8R94TRRapkZYCDVyhMt/sSZFrH4dFs4bs1DIPBwl4 5ZxcrAs0ija4wA4xJjLQ2TPseL58jDEM6iujgAcMLa20/YDN9qQkYxC5xcaZwAR/9qKR oxvQ== MIME-Version: 1.0 X-Received: by 10.182.182.101 with SMTP id ed5mr2443990obc.23.1358981920550; Wed, 23 Jan 2013 14:58:40 -0800 (PST) Received: by 10.76.128.68 with HTTP; Wed, 23 Jan 2013 14:58:40 -0800 (PST) In-Reply-To: References: Date: Wed, 23 Jan 2013 17:58:40 -0500 Message-ID: Subject: Re: e1000 serdes link flap From: Ryan Stone To: Neel Natu Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Jack F Vogel , freebsd-net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2013 22:58:46 -0000 On Wed, Jan 23, 2013 at 2:13 AM, Neel Natu wrote: > Hi, > > I am running into a problem in head with the e1000 link state > detection logic attached to a 82571EB serdes controller. > > The symptom is that the link state keeps flapping between "up" and "down". > > After I enabled the debug output in > 'e1000_check_for_serdes_link_82571()' this is what I see: > > e1000_check_for_serdes_link_82571 > ctrl = 0x4c0241, status = 0x803a7, rxcw = 0x44000000 > FORCED_UP -> AN_PROG > em6: link state changed to DOWN > e1000_check_for_serdes_link_82571 > ctrl = 0x4c0201, status = 0x803a4, rxcw = 0x44000000 > AN_PROG -> FORCED_UP > em6: link state changed to UP > e1000_check_for_serdes_link_82571 > ctrl = 0x4c0241, status = 0x803a7, rxcw = 0x44000000 > FORCED_UP -> AN_PROG > em6: link state changed to DOWN > > > The problem goes away if I apply the following patch to bring the link > state detection logic in line with the e1000e driver in Linux: > > Index: e1000_82571.c > =================================================================== > --- e1000_82571.c (revision 245766) > +++ e1000_82571.c (working copy) > @@ -1712,10 +1712,8 @@ > * auto-negotiation in the TXCW register and > disable > * forced link in the Device Control register in an > * attempt to auto-negotiate with our link partner. > - * If the partner code word is null, stop forcing > - * and restart auto negotiation. > */ > - if ((rxcw & E1000_RXCW_C) || !(rxcw & > E1000_RXCW_CW)) { > + if ((rxcw & E1000_RXCW_C) != 0) { > /* Enable autoneg, and unforce link up */ > E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); > E1000_WRITE_REG(hw, E1000_CTRL, > > I am not sure why the !(rxcw & E1000_RXCW_CW) check was added and the > e1000 SDM does not have any more information. > > Jack, can you take a look at the patch and commit if it looks alright? > I have this change applied internally. I thought that it was something funny in my environment, so I never tried to push it upstream. Sorry for costing you time in having to debug this. :(