netgraph: why does ng_ether bother enqueuing packets?

Dave Dolson ddolson at sandvine.com
Wed May 21 14:03:47 PDT 2003


For reasons of performance, I tried the following modification to ng_ether.c
in FreeBSD 4.7, and it seemed to work fine.
The change is to call ng_send_data() vs. ng_queue_data().

We are running in polling mode, so ng_ether_input is called @ netisr anyhow.
(Always ?)

  static void
  ng_ether_input2(node_p node, struct mbuf **mp, struct ether_header *eh)
  {
        const priv_p priv = node->private;
        meta_p meta = NULL;
        int error;
  
        /* Glue Ethernet header back on */
        if ((error = ng_ether_glueback_header(mp, eh)) != 0)
                return;
  
        /* Send out lower/orphan hook */
+ #ifdef DEVICE_POLLING
+       /* send directly, since we're already @ splnet */
+       (void)ng_send_data(priv->lower, *mp, meta);
+ #else
        (void)ng_queue_data(priv->lower, *mp, meta);
+ #endif
        *mp = NULL;
  }

Does anyone know why this might be bad?  
Any reason why this couldn't be done in interrupt (non-polling) mode also?

The system's main purpose is to process packets.

Thanks,
David Dolson (ddolson at sandvine.com, www.sandvine.com)
   


More information about the freebsd-net mailing list