On Fri, May 11, 2007 at 02:48:14PM +0530, Krishna Kumar2 ([EMAIL PROTECTED]) wrote: > > And what if you have thousand(s) of packets queued and first one has > > failed, requeing all the rest one-by-one is not a solution. If it is > > being done under heavy lock (with disabled irqs especially) it becomes a > > disaster. > > If first one failed for other reasons from described below, it is freed up > and the next one attempted. There are three cases where we cannot continue > : > no slots, device blocked, no lock. > > Jamal had suggested to get information on #available slots from the driver. > The queue_stopped is checked before linking packets, so the only other > error case is not getting a lock. And this too is true only in the ~LLTX > case, > which optionally could be a check to enable this linking. Also, there could > be limits to how many packets are queue'd. I tried tx_queue_len as well as > tx_queue_len/2, but there could be other options.
Why stack should ever know what hardware is being used? If you are going to break things, break it with scary sound :) Design new interface, where driver has access to the queue (say only using one helper dequeue_first_packet()), stack can only queue packets to the tail, driver can also stop that by setting a bit (which was there likely before we had knew word Linux). That is all, driver does not access qdisk, it only gets the first skb. Transmit function is completely lockless (until something is shared with receive path/interrupts, but it is private driver's part), stack will not be changed at all (except new helper to dequeue first packet from the qdisk, actually it is already there, it just needs to be exported), driver's xit function sets a flag that there are packets (or it can be even empty, since packet's presense can be detected via the same qdisk interface). You read qdisk len, setup several descriptors in one go, dequeue set of skbs and commit them. If something has failed, it is not requeued, but resent (or even dropped after fair amount of attempts). No locks, no requeues? Seems simple imho. -- Evgeniy Polyakov - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html