netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Henriksson <andreas@fjortis.info>
To: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Cc: Francois Romieu <romieu@fr.zoreil.com>,
	Jeff Garzik <jgarzik@pobox.com>,
	Andreas Henriksson <andreas@fjortis.info>,
	netdev@oss.sgi.com
Subject: Re: fealnx oopses
Date: Mon, 29 Mar 2004 01:27:07 +0200	[thread overview]
Message-ID: <20040328232707.GA17524@scream.fjortis.info> (raw)
In-Reply-To: <200403282219.56799.vda@port.imtp.ilyichevsk.odessa.ua>

On Sun, Mar 28, 2004 at 10:19:56PM +0200, Denis Vlasenko wrote:
> I tested on 2.4.25, patch applied with minimal manual correction
> in last hunk (rediffed patch attached).

I tested on 2.6.5-rc2-bk7 ... with both jeffs (which was exactly the
same patch I had except for removing the return at the end of the void
function) and francis patches...

Btw. I haven't seen any panics at all because of rx, just tx, and that
problem seems solved. But I thought testing additional patches that
is supposed to cure other problems won't hurt me.. ;)

> 
> Patched driver oopses in allocate_rx_buffers() shortly after boot,

It oops as soon as the first packet is sent out....


> --- fealnx.c.orig	Fri Nov 28 20:26:20 2003
> +++ fealnx.c	Sun Mar 28 21:32:56 2004
> @@ -1134,15 +1134,17 @@
>  		struct sk_buff *skb;
>  
>  		skb = dev_alloc_skb(np->rx_buf_sz);
> -		np->lack_rxbuf->skbuff = skb;
> -
>  		if (skb == NULL)
>  			break;	/* Better luck next round. */
>  

np->lack_rxbuf == NULL here....

(verified by inserting a "BUG_ON(np->lack_rxbuf==NULL);"...)

> +		while (np->lack_rxbuf->skbuff)

and now we are dead.. ;(

> +			np->lack_rxbuf = np->lack_rxbuf->next_desc_logical;
> +		np->lack_rxbuf->skbuff = skb;
> +
>  		skb->dev = dev;	/* Mark as being used by this device. */
>  		np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->tail,
>  			np->rx_buf_sz, PCI_DMA_FROMDEVICE);
> -		np->lack_rxbuf = np->lack_rxbuf->next_desc_logical;
> +		np->lack_rxbuf->status = RXOWN;
>  		++np->really_rx_count;
>  	}
>  }
> @@ -1380,33 +1382,22 @@
>  	return 0;
>  }
>  
> -
> -void free_one_rx_descriptor(struct netdev_private *np)
> -{
> -	if (np->really_rx_count == RX_RING_SIZE)
> -		np->cur_rx->status = RXOWN;
> -	else {
> -		np->lack_rxbuf->skbuff = np->cur_rx->skbuff;
> -		np->lack_rxbuf->buffer = np->cur_rx->buffer;
> -		np->lack_rxbuf->status = RXOWN;
> -		++np->really_rx_count;
> -		np->lack_rxbuf = np->lack_rxbuf->next_desc_logical;
> -	}
> -	np->cur_rx = np->cur_rx->next_desc_logical;
> -}
> -
> -
>  void reset_rx_descriptors(struct net_device *dev)
>  {
>  	struct netdev_private *np = dev->priv;
> +	struct fealnx_desc *cur = np->cur_rx;
> +	int i;
>  
>  	stop_nic_rx(dev->base_addr, np->crvalue);
>  
> -	while (!(np->cur_rx->status & RXOWN))
> -		free_one_rx_descriptor(np);
> -
>  	allocate_rx_buffers(dev);
>  
> +	for (i = 0; i < RX_RING_SIZE; i++) {
> +		if (cur->skbuff)
> +			cur->status = RXOWN;
> +		cur = cur->next_desc_logical;
> +	}
> +
>  	writel(np->rx_ring_dma + (np->cur_rx - np->rx_ring),
>  		dev->base_addr + RXLBA);
>  	writel(np->crvalue, dev->base_addr + TCRRCR);
> @@ -1576,7 +1567,7 @@
>  	struct netdev_private *np = dev->priv;
>  
>  	/* If EOP is set on the next entry, it's a new packet. Send it up. */
> -	while (!(np->cur_rx->status & RXOWN)) {
> +	while (!(np->cur_rx->status & RXOWN) && np->cur_rx->skbuff) {
>  		s32 rx_status = np->cur_rx->status;
>  
>  		if (np->really_rx_count == 0)
> @@ -1628,8 +1619,15 @@
>  					np->stats.rx_length_errors++;
>  
>  					/* free all rx descriptors related this long pkt */
> -					for (i = 0; i < desno; ++i)
> -						free_one_rx_descriptor(np);
> +					for (i = 0; i < desno; ++i) {
> +						if (!np->cur_rx->skbuff) {
> +							printk(KERN_DEBUG
> +								"%s: I'm scared\n", dev->name);
> +							break;
> +						}
> +						np->cur_rx->status = RXOWN;
> +						np->cur_rx = np->cur_rx->next_desc_logical;
> +					}
>  					continue;
>  				} else {	/* something error, need to reset this chip */
>  					reset_rx_descriptors(dev);
> @@ -1671,8 +1669,6 @@
>  			} else {
>  				skb_put(skb = np->cur_rx->skbuff, pkt_len);
>  				np->cur_rx->skbuff = NULL;
> -				if (np->really_rx_count == RX_RING_SIZE)
> -					np->lack_rxbuf = np->cur_rx;
>  				--np->really_rx_count;
>  			}
>  			skb->protocol = eth_type_trans(skb, dev);
> @@ -1682,22 +1678,7 @@
>  			np->stats.rx_bytes += pkt_len;
>  		}
>  
> -		if (np->cur_rx->skbuff == NULL) {
> -			struct sk_buff *skb;
> -
> -			skb = dev_alloc_skb(np->rx_buf_sz);
> -
> -			if (skb != NULL) {
> -				skb->dev = dev;	/* Mark as being used by this device. */
> -				np->cur_rx->buffer = pci_map_single(np->pci_dev, skb->tail,
> -					np->rx_buf_sz, PCI_DMA_FROMDEVICE);
> -				np->cur_rx->skbuff = skb;
> -				++np->really_rx_count;
> -			}
> -		}
> -
> -		if (np->cur_rx->skbuff != NULL)
> -			free_one_rx_descriptor(np);
> +		np->cur_rx = np->cur_rx->next_desc_logical;
>  	}			/* end of while loop */
>  
>  	/*  allocate skb for rx buffers */


Regards,
Andreas Henriksson

  reply	other threads:[~2004-03-28 23:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-26 10:14 fealnx oopses Denis Vlasenko
2004-03-26 19:22 ` Andreas Henriksson
2004-03-26 19:33   ` [PATCH] " Jeff Garzik
2004-03-26 20:05     ` Denis Vlasenko
2004-03-27  2:13     ` Andreas Henriksson
2004-03-26 19:57   ` Denis Vlasenko
     [not found]     ` <40648CAF.5010203@pobox.com>
2004-03-26 22:14       ` Denis Vlasenko
2004-03-26 22:35         ` Francois Romieu
2004-03-27  0:03           ` Denis Vlasenko
2004-03-27  0:30             ` Francois Romieu
     [not found]           ` <4064BB35.4050301@pobox.com>
2004-03-27 21:28             ` Denis Vlasenko
2004-03-27 23:55               ` Francois Romieu
2004-03-28 20:19                 ` Denis Vlasenko
2004-03-28 23:27                   ` Andreas Henriksson [this message]
2004-03-28 23:38                     ` Francois Romieu
2004-03-29 17:01                       ` Andreas Henriksson
2004-03-29 21:49                         ` Denis Vlasenko
2004-03-29 22:20                           ` Francois Romieu
2004-03-29 22:50                             ` Denis Vlasenko
2004-03-29 23:16                               ` Denis Vlasenko
2004-03-31 21:01                                 ` Francois Romieu
     [not found]                               ` <4068AC87.2030506@pobox.com>
2004-03-29 23:18                                 ` Denis Vlasenko
2004-03-31 16:39                                   ` fealnx oopses (with [PATCH]) Denis Vlasenko
2004-03-31 19:24                                     ` Andreas Henriksson
2004-03-31 20:38                                       ` Denis Vlasenko
2004-03-31 20:53                                         ` Jeff Garzik
2004-03-31 22:23                                           ` Francois Romieu
2004-04-01 11:09                                             ` Denis Vlasenko
2004-04-01 12:28                                               ` Francois Romieu
2004-03-29  7:52                     ` fealnx oopses Denis Vlasenko
2004-03-26 20:20   ` Francois Romieu

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=20040328232707.GA17524@scream.fjortis.info \
    --to=andreas@fjortis.info \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    --cc=romieu@fr.zoreil.com \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /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).