Re: pfil question

From: Andre Oppermann (andre_at_freebsd.org)
Date: 09/20/04

  • Next message: Aragon Gouveia: "Wierd tunnel+MTU issue"
    Date: Mon, 20 Sep 2004 22:53:19 +0200
    To: Petri Helenius <pete@he.iki.fi>
    
    

    Petri Helenius wrote:
    >
    > Andre Oppermann wrote:
    >
    > >BTW: You may be better off using pfil_hooks instead of netgraph for your
    > >tool. You'll save one m_copym and m_freem for each packet.
    > >
    > Is pfil zero copy or one copy by default? If the driver supports it,
    > does a packet get directly DMA'd in mbufs and passed over the pf which
    > then drops the packet if applicable?

    pfil is in the ip_input() and ip_output() path. pfil stands for packet
    filter hooks. You chose to hook yourself into both of them or either
    of input or output.

    You get a reference to the mbuf passed when being called from the pfil
    hook. You can modify the packet (but it must still be a valid packet
    of that address family afterwards) or you can 'consume' the packet.
    That means you can take the packet and move it somewhere else (like
    dummynet into a queue for example) or you can decide to drop it (m_freem).

    pfil is zero-copy because of the mbuf pointer passing. The packet has
    been DMA'd to memory before naturally (otherwise we don't have access
    to it).

    > Also, did the locking work for network stack in 5.3 make pf fully
    > parallel so packets arriving can be processed by multiple CPU's? Do
    > these need to be coming in from multiple interfaces or can even packets
    > from one interface be distributed among multiple CPU's?

    The pfil hooks mechnism doesn't have any locking (other than for
    configuration changes) in itself. Which means more than one CPU can
    enter a pfil hook at the same time. All pfil hooks consumers have
    to do their own locking. If your pfil hook consumer doesn't require
    any internal locking then as many packets as you have CPUs can be in
    there at the same time. Which CPU handles a packet depends on which
    one is servicing the interrupt to collect the packet from the network
    interface. If the network driver is fully SMP capable then everthing
    can work fully in parallel.

    -- 
    Andre
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Aragon Gouveia: "Wierd tunnel+MTU issue"

    Relevant Pages

    • Re: Changes in the network interface queueing handoff model
      ... bouncing around for some time is a restructuring of the network interface packet transmission API to reduce the number of locking operations and allow network device drivers increased control of the queueing behavior. ... to "start" output by the driver. ... encapsulation and wrapping, and notifies the hardware. ... The ifnet layer send queue is becoming decreasingly useful over time. ...
      (freebsd-arch)
    • Re: Changes in the network interface queueing handoff model
      ... bouncing around for some time is a restructuring of the network interface packet transmission API to reduce the number of locking operations and allow network device drivers increased control of the queueing behavior. ... to "start" output by the driver. ... encapsulation and wrapping, and notifies the hardware. ... The ifnet layer send queue is becoming decreasingly useful over time. ...
      (freebsd-net)
    • PATCH: Remove file riowinif.h from rio driver (unused file)
      ... -/* The RUP (Remote Unit Port) structure relates to the Remote Terminal Adapters ... - CONFIG is sent from the driver to configure an already opened port. ... - Packet structure is same as OPEN. ... - of the specified port's RTA address space. ...
      (Linux-Kernel)
    • Re: Changes in the network interface queueing handoff model
      ... layer output routine via ifp->if_outputwith the ifnet pointer, packet, ... as ARP), and hands off to the ifnet driver via a call to IFQ_HANDOFF, ... encapsulation and wrapping, and notifies the hardware. ... The ifnet layer send queue is becoming decreasingly useful over time. ...
      (freebsd-arch)
    • Changes in the network interface queueing handoff model
      ... 5BOne of the ideas that I, Scott Long, and a few others have been bouncing around for some time is a restructuring of the network interface packet transmission API to reduce the number of locking operations and allow network device drivers increased control of the queueing behavior. ... to "start" output by the driver. ... encapsulation and wrapping, and notifies the hardware. ... The ifnet layer send queue is becoming decreasingly useful over time. ...
      (freebsd-arch)