K 10 svn:author V 5 andre K 8 svn:date V 27 2012-11-06T23:42:54.150455Z K 7 svn:log V 1863 Change the bge(4) driver to use an interrupt filter and an ithread to handle RX and TX packets. Taskqueue is completely removed. The interrupt filter runs in interrupt context and only masks the NIC interrupt. Or for bge(4) the interrupt is only one-shot anyway so nothing has to be done. The step is left in place for reference. When the filter returns FILTER_SCHEDULE_THREAD the correspoding ithread is run and does the heavy packet lifting and DMA descriptor refilling. The entire setup of the interrupt filter and ithread is done with bus_setup_intr(). To prevent live-lock the ithread tries to yield after an arbitrary number of packets, 10 in this case. The function maybe_yield() takes a look at the number of consumed cycles/ticks and decides whether the ithread still has quantum left or not. If not it gets put onto the run queue and continues after other threads had their fair share. This work isn't complete yet and bge_ithr[_msix] and bge_rxeof need better coordination to be able to run in polling mode under load. Locking may be longer be necessary as there is only ever one ithread that services the DMA queues at least for RX. Depending on how TX is triggered locking may still be required. Theory of operation: intr_filter() disables the interrupt and lets the ithread get scheduled ithr_rxeof() does: while (new packets available in DMA ring) { dequeue and process packets; after a couple packets call maybe_yield(); after a couple packets re-sync DMA ring with HW; /* continue as long as new packets are available. */ } re-enable interrupt; return; This gives us polling efficiency under load while not going into live-lock and at the same time interrupt fast low latency when not under load. This change is not tested yet and committed as checkpoint. Discussed with and explained by: attilio END