From: Manfred Spraul <manfred@colorfullife.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH] cleanup large frame handling for natsemi.c
Date: Sun, 20 Jun 2004 18:43:07 +0200 [thread overview]
Message-ID: <40D5BE9B.9040106@colorfullife.com> (raw)
In-Reply-To: <20040620163036.GD16038@havoc.gtf.org>
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
Jeff Garzik wrote:
>On Sun, Jun 20, 2004 at 02:14:59PM +0200, Manfred Spraul wrote:
>
>
>>Jeff, could you apply it? I've stress tested vlan for an hour with
>>tbench and parallel kernel compiles, not obvious problems.
>>
>>
>
>I would if you had actually included a patch ;-)
>
>
>
Ups, sorry. Here's the patch.
--
Manfred
[-- Attachment #2: patch-natsemi-long --]
[-- Type: text/plain, Size: 2797 bytes --]
--- 2.6/drivers/net/natsemi.c 2004-06-20 11:24:02.959200463 +0200
+++ build-2.6/drivers/net/natsemi.c 2004-06-20 12:11:31.170607816 +0200
@@ -236,7 +236,14 @@
#define NATSEMI_REGS_SIZE (NATSEMI_NREGS * sizeof(u32))
#define NATSEMI_EEPROM_SIZE 24 /* 12 16-bit values */
-#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */
+/* Buffer sizes:
+ * The nic writes 32-bit values, even if the upper bytes of
+ * a 32-bit value are beyond the end of the buffer.
+ */
+#define NATSEMI_HEADERS 22 /* 2*mac,type,vlan,crc */
+#define NATSEMI_PADDING 64 /* 2 bytes should be sufficient */
+#define NATSEMI_LONGPKT 1518 /* limit for long packets */
+#define NATSEMI_RX_LIMIT 2046 /* maximum supported by hardware */
/* These identify the driver base version and may not be removed. */
static char version[] __devinitdata =
@@ -1688,7 +1695,7 @@
*/
np->rx_config = RxMxdma_256 | 0x20;
/* if receive ring now has bigger buffers than normal, enable jumbo */
- if (np->rx_buf_sz > PKT_BUF_SZ)
+ if (np->rx_buf_sz > NATSEMI_LONGPKT)
np->rx_config |= RxAcceptLong;
writel(np->rx_config, ioaddr + RxConfig);
@@ -1870,7 +1877,7 @@
struct sk_buff *skb;
int entry = np->dirty_rx % RX_RING_SIZE;
if (np->rx_skbuff[entry] == NULL) {
- unsigned int buflen = np->rx_buf_sz + RX_OFFSET;
+ unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
skb = dev_alloc_skb(buflen);
np->rx_skbuff[entry] = skb;
if (skb == NULL)
@@ -1909,9 +1916,13 @@
np->dirty_rx = 0;
np->cur_rx = RX_RING_SIZE;
np->oom = 0;
- np->rx_buf_sz = PKT_BUF_SZ;
- if (dev->mtu > ETH_DATA_LEN)
- np->rx_buf_sz += dev->mtu - ETH_DATA_LEN;
+ if (dev->mtu <= ETH_DATA_LEN)
+ np->rx_buf_sz = ETH_DATA_LEN + NATSEMI_HEADERS;
+ else
+ np->rx_buf_sz = dev->mtu + NATSEMI_HEADERS;
+ if (np->rx_buf_sz > NATSEMI_RX_LIMIT)
+ np->rx_buf_sz = NATSEMI_RX_LIMIT;
+
np->rx_head_desc = &np->rx_ring[0];
/* Please be carefull before changing this loop - at least gcc-2.95.1
@@ -1949,7 +1960,7 @@
static void drain_ring(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
- unsigned int buflen = np->rx_buf_sz + RX_OFFSET;
+ unsigned int buflen = np->rx_buf_sz;
int i;
/* Free all the skbuffs in the Rx queue. */
@@ -2154,7 +2165,7 @@
int entry = np->cur_rx % RX_RING_SIZE;
int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
s32 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status);
- unsigned int buflen = np->rx_buf_sz + RX_OFFSET;
+ unsigned int buflen = np->rx_buf_sz;
/* If the driver owns the next entry it's a new packet. Send it up. */
while (desc_status < 0) { /* e.g. & DescOwn */
@@ -2881,6 +2892,7 @@
}
return 0;
}
+
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct mii_ioctl_data *data = if_mii(rq);
next prev parent reply other threads:[~2004-06-20 16:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-20 12:14 [PATCH] cleanup large frame handling for natsemi.c Manfred Spraul
2004-06-20 16:30 ` Jeff Garzik
2004-06-20 16:43 ` Manfred Spraul [this message]
2004-06-20 18:38 ` Jeff Garzik
2004-06-20 19:31 ` Manfred Spraul
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=40D5BE9B.9040106@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
/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).