diff options
author | jmallett <jmallett@FreeBSD.org> | 2010-10-13 21:45:56 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2010-10-13 21:45:56 +0000 |
commit | 0bb5ac096bb0d546494afbf549435eff775b392e (patch) | |
tree | 86ec2a4c106ada3b5394bf35156f3edd57b31e79 | |
parent | 03fb652c81c7b84fa7511e839900c535356cd01e (diff) | |
download | FreeBSD-src-0bb5ac096bb0d546494afbf549435eff775b392e.zip FreeBSD-src-0bb5ac096bb0d546494afbf549435eff775b392e.tar.gz |
Keep polling at 50hz as long as link state is changing.
-rw-r--r-- | sys/mips/cavium/octe/ethernet.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/mips/cavium/octe/ethernet.c b/sys/mips/cavium/octe/ethernet.c index bdcb1cb..1463c8a 100644 --- a/sys/mips/cavium/octe/ethernet.c +++ b/sys/mips/cavium/octe/ethernet.c @@ -173,6 +173,7 @@ static void cvm_oct_update_link(void *context, int pending) 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); + } } } |