aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcnet32.c
diff options
context:
space:
mode:
authorHubert WS Lin <wslin@tw.ibm.com>2005-09-14 14:39:27 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-16 02:43:23 -0400
commit76209926e3756f66c9cdc8a4becbf34df8c47799 (patch)
tree173b55358f0864026fe9957407409f8613448ed4 /drivers/net/pcnet32.c
parenteabf04151682bc7b57c84fea58cf9e4e5a3cf2a9 (diff)
[PATCH] pcnet32: set min ring size to 4
Don Fry reminded me that the pcnet32_loopback_test() asssumes the ring size is no less than 4. The minimum ring size was changed to 4 in pcnet32_set_ringparam() to allow the loopback test to work unchanged. - Set minimum ring size to 4 to allow loopback test to work unchanged - Moved variable init_block to first field in struct pcnet32_private Signed-off-by: Hubert WS Lin <wslin@tw.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/pcnet32.c')
-rw-r--r--drivers/net/pcnet32.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 7350c27ea2dc..70fe81a89df9 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -22,8 +22,8 @@
22 *************************************************************************/ 22 *************************************************************************/
23 23
24#define DRV_NAME "pcnet32" 24#define DRV_NAME "pcnet32"
25#define DRV_VERSION "1.31" 25#define DRV_VERSION "1.31a"
26#define DRV_RELDATE "02.Sep.2005" 26#define DRV_RELDATE "12.Sep.2005"
27#define PFX DRV_NAME ": " 27#define PFX DRV_NAME ": "
28 28
29static const char *version = 29static const char *version =
@@ -258,6 +258,8 @@ static int homepna[MAX_UNITS];
258 * v1.30i 28 Jun 2004 Don Fry change to use module_param. 258 * v1.30i 28 Jun 2004 Don Fry change to use module_param.
259 * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test. 259 * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test.
260 * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam(). 260 * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam().
261 * v1.31a 12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4
262 * to allow loopback test to work unchanged.
261 */ 263 */
262 264
263 265
@@ -335,14 +337,14 @@ struct pcnet32_access {
335}; 337};
336 338
337/* 339/*
338 * The first three fields of pcnet32_private are read by the ethernet device 340 * The first field of pcnet32_private is read by the ethernet device
339 * so we allocate the structure should be allocated by pci_alloc_consistent(). 341 * so the structure should be allocated using pci_alloc_consistent().
340 */ 342 */
341struct pcnet32_private { 343struct pcnet32_private {
344 struct pcnet32_init_block init_block;
342 /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */ 345 /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */
343 struct pcnet32_rx_head *rx_ring; 346 struct pcnet32_rx_head *rx_ring;
344 struct pcnet32_tx_head *tx_ring; 347 struct pcnet32_tx_head *tx_ring;
345 struct pcnet32_init_block init_block;
346 dma_addr_t dma_addr; /* DMA address of beginning of this 348 dma_addr_t dma_addr; /* DMA address of beginning of this
347 object, returned by 349 object, returned by
348 pci_alloc_consistent */ 350 pci_alloc_consistent */
@@ -648,7 +650,10 @@ static int pcnet32_set_ringparam(struct net_device *dev, struct ethtool_ringpara
648 lp->tx_ring_size = min(ering->tx_pending, (unsigned int) TX_MAX_RING_SIZE); 650 lp->tx_ring_size = min(ering->tx_pending, (unsigned int) TX_MAX_RING_SIZE);
649 lp->rx_ring_size = min(ering->rx_pending, (unsigned int) RX_MAX_RING_SIZE); 651 lp->rx_ring_size = min(ering->rx_pending, (unsigned int) RX_MAX_RING_SIZE);
650 652
651 for (i = 0; i <= PCNET32_LOG_MAX_TX_BUFFERS; i++) { 653 /* set the minimum ring size to 4, to allow the loopback test to work
654 * unchanged.
655 */
656 for (i = 2; i <= PCNET32_LOG_MAX_TX_BUFFERS; i++) {
652 if (lp->tx_ring_size <= (1 << i)) 657 if (lp->tx_ring_size <= (1 << i))
653 break; 658 break;
654 } 659 }
@@ -656,7 +661,7 @@ static int pcnet32_set_ringparam(struct net_device *dev, struct ethtool_ringpara
656 lp->tx_mod_mask = lp->tx_ring_size - 1; 661 lp->tx_mod_mask = lp->tx_ring_size - 1;
657 lp->tx_len_bits = (i << 12); 662 lp->tx_len_bits = (i << 12);
658 663
659 for (i = 0; i <= PCNET32_LOG_MAX_RX_BUFFERS; i++) { 664 for (i = 2; i <= PCNET32_LOG_MAX_RX_BUFFERS; i++) {
660 if (lp->rx_ring_size <= (1 << i)) 665 if (lp->rx_ring_size <= (1 << i))
661 break; 666 break;
662 } 667 }