[v2 PATCH] ucc_geth: fix ethtool set ring param bug

David Miller davem at davemloft.net
Tue Sep 7 06:22:23 EST 2010


From: Liang Li <liang.li at windriver.com>
Date: Fri,  3 Sep 2010 00:02:44 +0800

> +		printk(KERN_INFO "Stopping interface %s.\n", netdev->name);
 ...
> +		printk(KERN_INFO "Reactivating interface %s.\n", netdev->name);

Please get rid of these log messages.

Also, this isn't the way to implement this.

Abstract out the one and only operation that can fail when you change
the ring size, which is the memory allocations, into seperate code.

Allocate the newly sized rings first, and if that fails abort the
ring size change attempt.  This will let the device continue to
function and operate properly even if the ring resizing fails.

Then stop the RX/TX DMA, switch the ring pointers and configuration
inside of the device, restart RX/TX DMA, and finally free up the
old ring memory.

I know why you want to use *_close() and *_open(), it requires less
coding and work on your part.  But this is why the error handling
behavior is difficult and what happens on failure (device goes down
and becomes inoperative) is extremely unpleasant for the user.

The user should be able to make this kind of change over an SSH
shell that uses the interface itself, and not expect to lose
connectivity completely just because the ring allocation fails.

Thanks.


More information about the Linuxppc-dev mailing list