From owner-svn-src-all@FreeBSD.ORG Wed Oct 13 21:45:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E7C106566B; Wed, 13 Oct 2010 21:45:57 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 225C78FC0C; Wed, 13 Oct 2010 21:45:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9DLjvDq001768; Wed, 13 Oct 2010 21:45:57 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9DLjvT8001766; Wed, 13 Oct 2010 21:45:57 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201010132145.o9DLjvT8001766@svn.freebsd.org> From: Juli Mallett Date: Wed, 13 Oct 2010 21:45:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213807 - head/sys/mips/cavium/octe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2010 21:45:57 -0000 Author: jmallett Date: Wed Oct 13 21:45:56 2010 New Revision: 213807 URL: http://svn.freebsd.org/changeset/base/213807 Log: Keep polling at 50hz as long as link state is changing. Modified: head/sys/mips/cavium/octe/ethernet.c Modified: head/sys/mips/cavium/octe/ethernet.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet.c Wed Oct 13 21:37:02 2010 (r213806) +++ head/sys/mips/cavium/octe/ethernet.c Wed Oct 13 21:45:56 2010 (r213807) @@ -173,6 +173,7 @@ static void cvm_oct_update_link(void *co static void cvm_do_timer(void *arg) { static int port; + static int updated; if (port < CVMX_PIP_NUM_INPUT_PORTS) { if (cvm_oct_device[port]) { int queues_per_port; @@ -186,6 +187,7 @@ static void cvm_do_timer(void *arg) MDIO_UNLOCK(); if (priv->need_link_update) { + updated++; taskqueue_enqueue(cvm_oct_link_taskq, &priv->link_task); } } @@ -220,9 +222,19 @@ static void cvm_do_timer(void *arg) callout_reset(&cvm_oct_poll_timer, hz / 50, cvm_do_timer, NULL); } else { port = 0; - /* All ports have been polled. Start the next iteration through - the ports in one second */ - callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, NULL); + /* If any updates were made in this run, continue iterating at + * 1/50th of a second, so that if a link has merely gone down + * temporarily (e.g. because of interface reinitialization) it + * will not be forced to stay down for an entire second. + */ + if (updated > 0) { + updated = 0; + callout_reset(&cvm_oct_poll_timer, hz / 50, cvm_do_timer, NULL); + } else { + /* All ports have been polled. Start the next iteration through + the ports in one second */ + callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, NULL); + } } }