Annotation of wikisrc/projects/project/if_poll.mdwn, revision 1.1

1.1     ! jmmv        1: [[!template id=project
        !             2: 
        !             3: title="Implement per-interface interrupt handling"
        !             4: 
        !             5: contact="""
        !             6: [tech-kern](mailto:tech-kern@NetBSD.org),
        !             7: [tech-net](mailto:tech-net@NetBSD.org),
        !             8: [board](mailto:board@NetBSD.org),
        !             9: [core](mailto:core@NetBSD.org)
        !            10: """
        !            11: 
        !            12: category="networking"
        !            13: difficulty="hard"
        !            14: funded="The NetBSD Foundation"
        !            15: 
        !            16: description="""
        !            17: This project proposal is a subtask of [[smp_networking]] and is elegible
        !            18: for funding independently.
        !            19: 
        !            20: The goal of this project is to implement interrupt handling at the
        !            21: granularity of a networking interface.  When a network device gets an
        !            22: interrupt, it could call `<iftype>_defer(ifp)` to schedule a kernel
        !            23: continuation (see [[kernel_continuations]]) for that interface which could
        !            24: then invoke `<iftype>_poll`.  Whether the interrupted source should be
        !            25: masked depends on if the device is a DMA device or a PIO device.  This
        !            26: routine should then call `(*ifp->if_poll)(ifp)` to deal with the
        !            27: interrupt's servicing.
        !            28: 
        !            29: During servicing, any received packets should be passed up via
        !            30: `(*ifp->if_input)(ifp, m)` which would be responsible for ALTQ or any other
        !            31: optional processing as well as protocol dispatch.  Protocol dispatch in
        !            32: `<iftype>_input` decodes the datalink headers, if needed, via a table
        !            33: lookup and call the matching protocol's `pr_input` to process the packet.
        !            34: As such, interrupt queues (e.g. `ipintrq`) would no longer be needed.  Any
        !            35: transmitted packets can be processed as can MII events.  Either true or
        !            36: false should be returned by `if_poll` depending on whether another
        !            37: invokation of `<iftype>_poll` for this interface should be immediately
        !            38: scheduled or not, respectively.
        !            39: 
        !            40: Memory allocation has to be prohibited in the interrupt routines.  The
        !            41: device's `if_poll` routine should pre-allocate enough mbufs to do any
        !            42: required buffering.  For devices doing DMA, the buffers are placed into
        !            43: receive descripors to be filled via DMA.
        !            44: 
        !            45: For devices doing PIO, pre-allocated mbufs are enqueued onto the softc of
        !            46: the device so when the interrupt routine needs one it simply dequeues one,
        !            47: fills in it in, and then enqueues it onto a completed queue, finally calls
        !            48: `<iftype>_defer`.  If the number of pre-allocated mbufs drops below a
        !            49: threshold, the driver may decide to increase the number of mbufs that
        !            50: `if_poll` pre-allocates.  If there are no mbufs left to receive the packet,
        !            51: the packets is dropped and the number of mbufs for `if_poll` to
        !            52: pre-allocate should be increased.
        !            53: 
        !            54: When interrupts are unmasked depends on a few things.  If the device is
        !            55: interrupting "too often", it might make sense for the device's interrupts
        !            56: to remain masked and just schedule the device's continuation for the next
        !            57: clock tick. This assumes the system has a high enough value set for HZ.
        !            58: """
        !            59: ]]
        !            60: 
        !            61: [[!tag smp_networking]]

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb