public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Sonic Zhang <sonic.adi@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	uclinux-dist-devel <uclinux-dist-devel@blackfin.uclinux.org>
Subject: Re: [PATCH v2] netdev:bfin_mac: reclaim and free tx skb as soon as possible after transfer
Date: Fri, 04 Jun 2010 06:05:54 +0200	[thread overview]
Message-ID: <1275624354.2533.121.camel@edumazet-laptop> (raw)
In-Reply-To: <AANLkTik4aWREeblhnbI3DU7a_CE11Rx0GvXi56O2yHzy@mail.gmail.com>

Le vendredi 04 juin 2010 à 11:29 +0800, Sonic Zhang a écrit :
> David,
> 
> Any comments?
> 
> Thanks
> 
> Sonic
> 
> On Thu, Jun 3, 2010 at 11:48 AM, sonic zhang <sonic.adi@gmail.com> wrote:
> > >From 40560ae9e8db42e2d2259b791ace160534c9a0f2 Mon Sep 17 00:00:00 2001
> > From: Sonic Zhang <sonic.zhang@analog.com>
> > Date: Thu, 3 Jun 2010 11:44:33 +0800
> > Subject: [PATCH v2] netdev:bfin_mac: reclaim and free tx skb as soon as possible after transfer
> >
> > SKBs hold onto resources that can't be held indefinitely, such as TCP
> > socket references and netfilter conntrack state.  So if a packet is left
> > in TX ring for a long time, there might be a TCP socket that cannot be
> > closed and freed up.
> >
> > Current blackfin EMAC driver always reclaim and free used tx skbs in future
> > transfers. The problem is that future transfer may not come as soon as
> > possible. This patch start a timer after transfer to reclaim and free skb.
> > There is nearly no performance drop with this patch.
> >
> > TX interrupt is not enabled for 2 reasons:
> >
> > 1) If Blackfin EMAC TX transfer control is turned on, endless TX
> > interrupts are triggered no matter if TX DMA is enabled. Since DMA walks
> > down the ring automatically, TX transfer control can't be turned off in the
> > middle. The only way is to disable TX interrupt completely.
> >
> > 2) skb can not be freed from interrupt context. A work queue or tasklet
> > has to be created, which introduce more overhead than timer only solution.
> >

Could you elaborate on this second point ?

skb can be freed from interrupt context using appropriate API :

1) If from NAPI context, no special care is needed and use
dev_kfree_skb().

2) If from hard irq context, use dev_kfree_skb_irq() :

With recent changes, skb is probably already orphaned and can be freed
immediately.

In the unlikely case it is not yet orphaned, skb is queued in
softnet_data.completion_queue.




  reply	other threads:[~2010-06-04  4:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03  3:48 [PATCH v2] netdev:bfin_mac: reclaim and free tx skb as soon as possible after transfer sonic zhang
2010-06-03  4:05 ` Eric Dumazet
2010-06-03  8:57   ` Junchang Wang
2010-06-03  9:19     ` Eric Dumazet
2010-06-03 10:54       ` Junchang Wang
2010-06-04  3:29 ` Sonic Zhang
2010-06-04  4:05   ` Eric Dumazet [this message]
2010-06-04  4:44     ` Sonic Zhang
2010-06-07  9:58       ` Eric Dumazet
2010-06-07 10:26         ` Sonic Zhang

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=1275624354.2533.121.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sonic.adi@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.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