AW: patch 22: lchan_use

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Andreas.Eversberg Andreas.Eversberg at versatel.de
Tue Jun 2 15:04:33 UTC 2009


lchan_free() is called when RSL released the logical channel. all ressources that 'uses' the channel, must be released. i aggree with you, that it makes no sense to consider everything that 'uses' the logical channel. to fix this, i have an idea and need some response before implementing.

problems:
 - what instance uses the logical channel?
 - how do we release them, if the channel is closed?
 - how do we change the channel (handover/SDCCH->TCH ...)? (is this required?)

one possible solution:

every logical channel gets a list of 'users'. these users have nodes in this list. users can be i.e.: an active call, a call on hold, an SMS transaction, a location update....

each node has a pointer to the lchan. the 'user' can access the logical channel via node.

each node has a destructor function pointer. during lchan_free(), the destructor of each node is called. the 'user' will remove the node. with that, the chan_alloc does not need to know how to free 'users'

if we want to change the logical channel, we just unlink the nodes from the old channel and attach them to the new channel.

each node has:
- "struct llist_head" to link to previous and next node
- pointer to the logical channel (lchan)
- pointer to the destructor for the node owner. (the 'user')
- void pointer to the owner's private structure.

user 'uses' a channel:
- it calls the lchan_use() function with the logical channel, the destructor, and private structure pointer
- the node is created and linked to the logical channel
- the pointers within that node are set

user 'drops' a channel:
- it calls the lchan_put() function with the pointer to the node.
- the node is unlinked from lchan and destroyed

lchan closes:
- for each node of a logical channel, the destructor is created.
- within this destructor, the 'user' must remove all relations to that channel, remove the node, and set the node pointer to NULL.


user can refers to it's channel:
struct gsm_lchan *lchan = private->lchan_node->lchan;


what do you think?



-----Ursprüngliche Nachricht-----
Von: openbsc-bounces at lists.gnumonks.org [mailto:openbsc-bounces at lists.gnumonks.org] Im Auftrag von Holger Freyther
Gesendet: Dienstag, 2. Juni 2009 03:02
An: openbsc at lists.gnumonks.org
Betreff: Re: patch 22: lchan_use


I don't like this part. First of all when making release_loc_update_req 
"public" it should be properly prefixed, but I don't think chan_alloc.c should 
know/care about gsm_04_08.c at all. Also tying the timeout of the Location 
Update with the autorelease of the channel does not seem appropriate.

I would very much prefer if this logic can stay within gsm_04_08.c and we fix 
the usage count issue there.

For me it looks like:
	- We get a reference when creating the loc_update_request
	- We start a timer
	- We put the reference when destroying the loc update request...

	- So we might just remove the extra put/use for the waiting for IMSI/IMEI
          and fix the "leak" like this?


what do you think?


	z.





More information about the OpenBSC mailing list