netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: nlhintz@hotmail.com
Cc: zajec5@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH] bgmac: don't update slot on skb alloc/dma mapping error
Date: Tue, 29 Oct 2013 15:39:57 -0400 (EDT)	[thread overview]
Message-ID: <20131029.153957.1658989244969068757.davem@davemloft.net> (raw)
In-Reply-To: <BLU0-SMTP200803D333FF3A2F15AB82DAC090@phx.gbl>

From: Nathan Hintz <nlhintz@hotmail.com>
Date: Tue, 29 Oct 2013 01:22:55 -0700

> On Tue, 29 Oct 2013 07:52:58 +0100
> Rafał Miłecki <zajec5@gmail.com> wrote:
> 
>> 2013/10/29 Nathan Hintz <nlhintz@hotmail.com>:
>> > Don't update the slot in "bgmac_dma_rx_skb_for_slot" unless both the
>> > skb alloc and dma mapping are successful; and free the newly allocated
>> > skb if a dma mapping error occurs.  This will prevent an skb leak upon
>> > returning when an error occurs.
>> 
>> In case of bgmac_dma_rx_skb_for_slot failure we're giving up anyway
>> (and freeing everything), but with your patch code is simpler to
>> understand, so I'm OK with that.
>> 
>> Acked-by: Rafał Miłecki <zajec5@gmail.com>
>> 
> 
> I might be misunderstanding; but it in the case of failure, it appeared to me
> that the currently received packet was dropped and the old skb would continue
> to be assigned to the slot and would be used to receive future packets (this
> would continue until bgmac_dma_rx_skb_for_slot was successful).

That's exactly the wanted, and most desirable, behavior for any network
driver.

If you can't allocate a new SKB, reuse the old one, because the worst
thing you can do is prioritize packet reception over making sure the
device doesn't end up with no RX slots to DMA into.

      parent reply	other threads:[~2013-10-29 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29  6:44 [PATCH] bgmac: don't update slot on skb alloc/dma mapping error Nathan Hintz
2013-10-29  6:52 ` Rafał Miłecki
2013-10-29  8:22   ` Nathan Hintz
2013-10-29  8:28     ` Rafał Miłecki
2013-10-29 15:20       ` Nathan Hintz
2013-10-29 19:39     ` David Miller [this message]

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=20131029.153957.1658989244969068757.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nlhintz@hotmail.com \
    --cc=zajec5@gmail.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).