[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071008.152234.13748626.davem@davemloft.net>
Date: Mon, 08 Oct 2007 15:22:34 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: greearb@...delatech.com
Cc: swise@...ngridcomputing.com, rick.jones2@...com, hadi@...erus.ca,
johnpol@....mipt.ru, netdev@...r.kernel.org,
Robert.Olsson@...a.slu.se
Subject: Re: pktgen question
From: Ben Greear <greearb@...delatech.com>
Date: Mon, 08 Oct 2007 14:57:13 -0700
> This skb recycling can certainly work and has been done several
> times before. It never gets into the kernel though.
Because it doesn't work.
A socket can hang onto a receive packet essentially forever.
You cannot therefore rely upon the network stack to give you the
packet back in some reasonable finite amount of time. This is simply
the nature of the beast.
Which means that you either:
1) Starve and stop receiving packets when the recycling ring
runs out because all of those packets are stuck in socket
buffers. This is easily DoS'able by users on your system
2) End up allocating new packets anyways, but then what's the
point of the recycling ring? It's just a hack that works
when everything goes as planned, and in real life that is
rarely the case.
It also makes the driver locking more complicated. Packet
input occurs in NAPI drivers via netif_receive_skb() which
would be capable of recycling packets back to the same
driver in a recycling scheme. But the recycling can occur
from other contexts too. The netif_receive_skb() caller
already has atomic access to the receive queue, but those
other callback cases do not.
That locking issue is just the tip of the iceberg. Once you
start discussing solutions, all sorts of new issues begin to
pop up.
SKB recycling, just say no.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists