[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1283348550.2268.7.camel@achroite.uk.solarflarecom.com>
Date: Wed, 01 Sep 2010 14:42:30 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Liang Li <liang.li@...driver.com>
Cc: leoli@...escale.com, davem@...emloft.net, avorontsov@...mvista.com,
netdev@...r.kernel.org, linuxppc-dev@...abs.org
Subject: Re: [v1 PATCH] ucc_geth: fix ethtool set ring param bug
On Wed, 2010-09-01 at 09:43 +0800, Liang Li wrote:
> It's common sense that when we should do change to driver ring
> desc/buffer etc only after 'stop/shutdown' the device. When we
> do change while devices/driver is running, kernel oops occur:
[...]
> - ug_info->bdRingLenRx[queue] = ring->rx_pending;
> - ug_info->bdRingLenTx[queue] = ring->tx_pending;
> -
> if (netif_running(netdev)) {
> - /* FIXME: restart automatically */
> - printk(KERN_INFO
> - "Please re-open the interface.\n");
> + u16 rx_t;
> + u16 tx_t;
> + printk(KERN_INFO "Stopping interface %s.\n", netdev->name);
> + ucc_geth_close(netdev);
> +
> + rx_t = ug_info->bdRingLenRx[queue];
> + tx_t = ug_info->bdRingLenTx[queue];
> +
> + ug_info->bdRingLenRx[queue] = ring->rx_pending;
> + ug_info->bdRingLenTx[queue] = ring->tx_pending;
> +
> + printk(KERN_INFO "Reactivating interface %s.\n", netdev->name);
> + ret = ucc_geth_open(netdev);
> + if (ret) {
> + printk(KERN_WARNING "uec_set_ringparam: set ring param for running"
> + " interface %s failed. Please try to make the interface "
> + " down, then try again.\n", netdev->name);
> + ug_info->bdRingLenRx[queue] = rx_t;
> + ug_info->bdRingLenTx[queue] = tx_t;
> + }
[...]
Bringing the interface down will call ucc_geth_close(), which will try
to free resources that have not been allocated!
If you cannot roll back a failed change then at least use dev_close()
and dev_open() rather than calling ucc_geth_{close,open}() directly, so
that the interface state is updated correctly. Or just refuse to make
the change if the interface is up.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists