netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hubert WS Lin <wslin@tw.ibm.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, fubar@us.ibm.com, donf@us.ibm.com,
	jklewis@us.ibm.com
Subject: [PATCH 2.6.13] pcnet32: set min ring size to 4
Date: Mon, 12 Sep 2005 15:09:01 +0800	[thread overview]
Message-ID: <4325298D.1010600@tw.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Hi,

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.

Changelog:
- 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>

[-- Attachment #2: pcnet32-min-ring-size.diff --]
[-- Type: text/x-patch, Size: 2419 bytes --]

--- a/drivers/net/pcnet32.c	2005-09-12 14:24:40.000000000 +0800
+++ b/drivers/net/pcnet32.c	2005-09-12 14:39:11.000000000 +0800
@@ -22,8 +22,8 @@
  *************************************************************************/
 
 #define DRV_NAME	"pcnet32"
-#define DRV_VERSION	"1.31"
-#define DRV_RELDATE	"02.Sep.2005"
+#define DRV_VERSION	"1.31a"
+#define DRV_RELDATE	"12.Sep.2005"
 #define PFX		DRV_NAME ": "
 
 static const char *version =
@@ -258,6 +258,8 @@ static int homepna[MAX_UNITS];
  * v1.30i  28 Jun 2004 Don Fry change to use module_param.
  * v1.30j  29 Apr 2005 Don Fry fix skb/map leak with loopback test.
  * v1.31   02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam().
+ * v1.31a  12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4
+ *	   to allow loopback test to work unchanged.
  */
 
 
@@ -335,14 +337,14 @@ struct pcnet32_access {
 };
 
 /*
- * The first three fields of pcnet32_private are read by the ethernet device
- * so we allocate the structure should be allocated by pci_alloc_consistent().
+ * The first field of pcnet32_private is read by the ethernet device
+ * so the structure should be allocated using pci_alloc_consistent().
  */
 struct pcnet32_private {
+    struct pcnet32_init_block init_block;
     /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */
     struct pcnet32_rx_head    *rx_ring;
     struct pcnet32_tx_head    *tx_ring;
-    struct pcnet32_init_block init_block;
     dma_addr_t		dma_addr;	/* DMA address of beginning of this
 					   object, returned by
 					   pci_alloc_consistent */
@@ -648,7 +650,10 @@ static int pcnet32_set_ringparam(struct 
     lp->tx_ring_size = min(ering->tx_pending, (unsigned int) TX_MAX_RING_SIZE);
     lp->rx_ring_size = min(ering->rx_pending, (unsigned int) RX_MAX_RING_SIZE);
 
-    for (i = 0; i <= PCNET32_LOG_MAX_TX_BUFFERS; i++) {
+    /* set the minimum ring size to 4, to allow the loopback test to work
+     * unchanged.
+     */
+    for (i = 2; i <= PCNET32_LOG_MAX_TX_BUFFERS; i++) {
 	if (lp->tx_ring_size <= (1 << i))
 	    break;
     }
@@ -656,7 +661,7 @@ static int pcnet32_set_ringparam(struct 
     lp->tx_mod_mask = lp->tx_ring_size - 1;
     lp->tx_len_bits = (i << 12);
 
-    for (i = 0; i <= PCNET32_LOG_MAX_RX_BUFFERS; i++) {
+    for (i = 2; i <= PCNET32_LOG_MAX_RX_BUFFERS; i++) {
 	if (lp->rx_ring_size <= (1 << i))
 	    break;
     }

             reply	other threads:[~2005-09-12  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12  7:09 Hubert WS Lin [this message]
2005-09-14 12:28 ` [PATCH 2.6.13] pcnet32: set min ring size to 4 Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4325298D.1010600@tw.ibm.com \
    --to=wslin@tw.ibm.com \
    --cc=donf@us.ibm.com \
    --cc=fubar@us.ibm.com \
    --cc=jklewis@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).