Add watchdog timer to iseries_veth driver

From: David Gibson (david_at_gibson.dropbear.id.au)
Date: 05/31/04

  • Next message: Casey Tucker: "PROBLEM: network driver causes kernel panic"
    Date:	Mon, 31 May 2004 16:14:42 +1000
    To: Andrew Morton <akpm@osdl.org>
    
    

    Andrew, please apply:

    Currently the iSeries virtual ethernet driver has no Tx watchdog
    timer. This makes it vulnerable to clagging up if the other end of
    connection is misbehaving - in particular if it is not giving timely
    hypervisor level acks to our data frams.

    This patch adds a watchdog timer which resets the connection to any
    lpar we seem to be having trouble sending to. With any luck the other
    end might behave better after the reset. If not, this will at least
    unclag the queue for a while so we can keep talking to the lpars which
    are behaving correctly.

    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

    Index: working-2.6/drivers/net/iseries_veth.c
    ===================================================================
    --- working-2.6.orig/drivers/net/iseries_veth.c 2004-05-31 14:32:10.257660120 +1000
    +++ working-2.6/drivers/net/iseries_veth.c 2004-05-31 15:42:30.639623512 +1000
    @@ -807,6 +807,48 @@
             return -EOPNOTSUPP;
     }
     
    +static void veth_tx_timeout(struct net_device *dev)
    +{
    + struct veth_port *port = (struct veth_port *)dev->priv;
    + struct net_device_stats *stats = &port->stats;
    + unsigned long flags;
    + int i;
    +
    + stats->tx_errors++;
    +
    + spin_lock_irqsave(&port->pending_gate, flags);
    +
    + printk(KERN_WARNING "%s: Tx timeout! Resetting lp connections: %08x\n",
    + dev->name, port->pending_lpmask);
    +
    + /* If we've timed out the queue must be stopped, which should
    + * only ever happen when there is a pending packet. */
    + WARN_ON(! port->pending_lpmask);
    +
    + for (i = 0; i < HVMAXARCHITECTEDLPS; i++) {
    + struct veth_lpar_connection *cnx = veth_cnx[i];
    +
    + if (! (port->pending_lpmask & (1<<i)))
    + continue;
    +
    + /* If we're pending on it, we must be connected to it,
    + * so we should certainly have a structure for it. */
    + BUG_ON(! cnx);
    +
    + /* Theoretically we could be kicking a connection
    + * which doesn't deserve it, but in practice if we've
    + * had a Tx timeout, the pending_lpmask will have
    + * exactly one bit set - the connection causing the
    + * problem. */
    + spin_lock(&cnx->lock);
    + cnx->state |= VETH_STATE_RESET;
    + veth_kick_statemachine(cnx);
    + spin_unlock(&cnx->lock);
    + }
    +
    + spin_unlock_irqrestore(&port->pending_gate, flags);
    +}
    +
     struct net_device * __init veth_probe_one(int vlan)
     {
             struct net_device *dev;
    @@ -854,6 +896,9 @@
             dev->set_multicast_list = veth_set_multicast_list;
             dev->do_ioctl = veth_ioctl;
     
    + dev->watchdog_timeo = 2 * (VETH_ACKTIMEOUT * HZ / 1000000);
    + dev->tx_timeout = veth_tx_timeout;
    +
             rc = register_netdev(dev);
             if (rc != 0) {
                     veth_printk(KERN_ERR,

    -- 
    David Gibson			| For every complex problem there is a
    david AT gibson.dropbear.id.au	| solution which is simple, neat and
    				| wrong.
    http://www.ozlabs.org/people/dgibson
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Casey Tucker: "PROBLEM: network driver causes kernel panic"

    Relevant Pages

    • [PATCH 4/12] iseries_veth: Remove a FIXME WRT deletion of the ack_timer
      ... The iseries_veth driver has a timer which we use to send acks. ... Currently we only call del_timerwhen resetting a connection, ... because the flags the timer consults have been reset. ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • [PATCH 2/18] iseries_veth: Remove a FIXME WRT deletion of the ack_timer
      ... The iseries_veth driver has a timer which we use to send acks. ... Currently we only call del_timerwhen resetting a connection, ... because the flags the timer consults have been reset. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: deactivating PXA255 watchdog
      ... and get a uniform API for all the watchdog drivers. ... What this timer does is ping/tickle the watchdog internally ... The writing of the magic char V is a failsafe mechanism for if the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [GIT pull] hrtimer fixes for 2.6.25
      ... clocksource watchdog which were uncoverd by Andis clocksource watchdog ... When NOHZ is enabled this might enqueue the watchdog timer ... on an idle CPU which is in a long idle sleep. ...
      (Linux-Kernel)
    • Re: Geode GX/LX watchdog timer (RESEND)
      ... a watchdog driver for the Geode GX/LX processors is attached. ... I compiled out the timer tick, and tested the watchdog timer instead, ... +static int safe_close; ...
      (Linux-Kernel)