AltQ + ng_iface

Daniel O'Connor doconnor at
Sun Jul 31 13:23:52 GMT 2005

On Sunday 31 July 2005 05:08, Julian Elischer wrote:
> mbuf tags have "families"  so that differetn modules can use
> the same ID numbers and not clash.
> here is a netgraph family for tags, using the netgraph cookies.
> It's been a while since I looked at it but if you are using mbuf
> tags in netgraph you should check out the netgraph tag facilities.

I see the cookies for ksocket, lmi and ipfw, but I don't understand how the 
magic numbers were chosen.. gettimeofday() ?

There is NGM_GENERIC_COOKIE.. should I use that and add an entry to 

> If you queue data to be send over a hook you must have the data hold a
> reference on the hook to ensure that the hook is not removed while your
> packet is in teh queue. Similarly either the packet holds a reference
> on teh node as well, or the node must lock it's queue and remove all
> packets when shut down.
> I see that you don't actually decid eon what hook will be used until later 
> so teh reference to teh hook needn't be done, but you haven't added any code 
> to either hold a reference on the node, or to clean the queue on shutdown.
> (or is that done automatically by some iface base code that is called
> during shutdown).

I think cleaning the queue is done by the generic interface code - I couldn't 
find anything in other drivers that cleans up the queue on unload (for 

> The calling code must always have a reference on the node to ensure that
> it is not removed while it is running in it. This is sometimes
> done automatically. This is why there is an ng_callout facility to ensure
> that the locking andreferences are done automatically and correctly.

OK, I'll look into that.

> I would also want to have the altq optional..
> in other words I'd want a control message to ng_iface that could make it
> act as before.

I believe that if ALTQ is not enabled then the IFQ_HANDOFF/DEQUEUE macros do 
nothing special so ng_iface should act as before albeit slightly more slowly 
(but not any different to just about every other network interface)

Daniel O'Connor software and network engineer
for Genesis Software -
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-net mailing list