Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Apr 2002 16:35:51 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        Maksim Yevmenkin <myevmenk@digisle.net>
Cc:        freebsd-current@FreeBSD.ORG, freebsd-net@FreeBSD.ORG
Subject:   Re: Bluetooth stack for FreeBSD
Message-ID:  <Pine.BSF.4.21.0204161627020.92755-100000@InterJet.elischer.org>
In-Reply-To: <3CBC96F2.3032077A@digisle.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 16 Apr 2002, Maksim Yevmenkin wrote:

> 
> initially all nodes were WRITERs to "release the stack", but then i
> changed my strategy and now i'm serializing data at the edge of graph.
> for example both "bt3c" and "h4" nodes will NG_HOOK_FORCE_WRITER on 
> upstream hook. also i probably should should turn WRITER bit on "ctl"
> hook for HCI node  since it accepts data. L2CAP node accepts whole 
> L2CAP packet from upstream hook, so (i think) it should be fine unless
> these packets gets re-ordered somehow. protocols that run over L2CAP 
> may not like it.
> 
> is it possible that SMP Netgraph can re-order data? if so then sockets
> node probably should turn WRITER bit on downstream hooks too.

it is not likely that data is re-ordered, but remember that data may enter
the graph from different edge nodes simultaneously on different processors
so that a single node may be processing both incoming and outgoing data at
the same time unless the node itself is marked as needing a writer lock.


>  
> > NG_NODE_PRIVATE(NG_HOOK_NODE(hook))
> > can be saved if you store information relavant to a hook in it's own 
> > private data pointer..
> > In some nodes I store the same data in NG_HOOK_PRIVATE(hook)
> > as is in NG_NODE_PRIVATE(node), just to save the dereference
> > if it's going to be done per packet. Sometimes there are better things to
> > store there however..
> 
> i'm sorry, but i'm not sure what do you mean here. i use such calls
> in several places (connect, disconnect, rcvdata) to get to the node
> private structure, but (i think) it just a macros that expanded to a
> couple pointer accesses. 

It's not a serious comment. just that you should be aware that one can 
sometimes simplify code by using the per-hook private information as well.

>  
> >         /* Detach mbuf, discard item and process data */
> >         NGI_GET_M(item, m);
> >         NG_FREE_ITEM(item);
> > 
> > If there is any chance that you will need a new 'item' in a function or a
> > child function, then it's worth keeping them around to save teh expense of
> > re-allocating them..
> > 
> > I guess I shuld make a macro NG_FWD_DATA_HOOK() to make this easier to
> > do..
> 
> you right. i should not destroy item and use NG_FWD_ITEM_HOOK where 
> required.
> 

Netgraph is not an unchangeable work.. If you have comments on things that
may mek it easier to do what you need then please let us (archie &
me) know.. 


> again thank you for your comments, i'm looking forward to hear more :)
> thanks,
> max
> 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0204161627020.92755-100000>