All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>, davem@davemloft.net
Cc: Yi Zou <yi.zou@intel.com>,
	e1000-devel@lists.sourceforge.net,
	Bruce Allan <bruce.w.allan@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	John Ronciak <john.ronciak@intel.com>,
	Anton Blanchard <anton@samba.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] e1000: Fix DMA mapping error handling on TX
Date: Tue, 26 Jan 2010 16:59:32 +0100	[thread overview]
Message-ID: <4B5F1164.8030102@gmail.com> (raw)
In-Reply-To: <9929d2391001231958n3f8d5165yaeed9ec1e0d7121a@mail.gmail.com>


>>> This patch does not apply to the current e1000 driver in net-2.6, much
>>> of this patch has already been corrected (applied) by Roel Kluin
>>> recent patch.
>>
>> Sorry I was basing off net-next. I just compared it to my fix and looks like
>> the patch in net-2.6 has an off by one error doesn't it?
> 
> This was discussed during our code review of Roel's patch, and it was
> found that there was not an issue.  But I will review the code again
> to ensure that there is not "an off by one error".  Thanks for looking
> at this.

He is right, as also reported by Juha Leppanen:

> Before your patch I suppose the logic disregarding the signed/unsigned error was :
> 1) if count==0, no unmapping/freeing inside while loop
> 2) if count>0, do 'count' loops unmapping/freeing
> 
> After your patch the logic is :
> 1) if count==0, no unmapping/freeing inside while loop
> 1) if count==1, no unmapping/freeing inside while loop
> 2) if count>1, do 'count-1' loops unmapping/freeing

> Can tx_ring->count be zero? I hope not.

His suggested fix works:

> dma_error:
> 	dev_err(&pdev->dev, "TX DMA map failed\n");
> 	buffer_info->dma = 0;
> -	if (count)
> -		count--;
> 
> 	while (count--) {
> 		if (i==0)
> -			i += tx_ring->count;
> +			i = tx_ring->count;
> 		i--;
> 		buffer_info = &tx_ring->buffer_info[i];
> 		e1000_unmap_and_free_tx_resource(adapter, buffer_info);
> 	}
> 
> 	return 0;
> }

This affects the patches:
[PATCH] e1000: Fix tests of unsigned in e1000_tx_map()
and the other patch in the same thread.

Do you want me to send a delta patch?

Roel

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

  reply	other threads:[~2010-01-26 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 11:42 [PATCH 1/2] e1000: Fix DMA mapping error handling on TX Anton Blanchard
2010-01-21 11:44 ` [PATCH 2/2] e1000: Fix DMA mapping error handling on RX Anton Blanchard
2010-01-23  3:42   ` Jeff Kirsher
2010-01-23  3:40 ` [PATCH 1/2] e1000: Fix DMA mapping error handling on TX Jeff Kirsher
2010-01-24  0:47   ` Anton Blanchard
2010-01-24  3:58     ` Jeff Kirsher
2010-01-26 15:59       ` Roel Kluin [this message]
2010-02-04 13:00         ` Roel Kluin

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=4B5F1164.8030102@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=anton@samba.org \
    --cc=bruce.w.allan@intel.com \
    --cc=davem@davemloft.net \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=yi.zou@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.