Commit Graph

55 Commits

Author SHA1 Message Date
Harald Welte 9af6ddfcec License change: We are now AGPLv3+ instead of GPLv2+
The reason for this is quite simple: We want to make sure anyone
running a customized version of OpenBSC to operate a network will
have to release all custom modifiations to the source code.
2011-01-01 15:39:34 +01:00
Holger Hans Peter Freyther 08eebd59b7 lchan: Every SS_LCHAN signal now sends a struct lchan_sig_data
The SS_LCHAN signals now always include the lchan_sig_data. For
the measurement report it will optionally include the measurement
report as well. Attempt to update all handlers of this signal as well
2010-12-27 13:32:20 +01:00
Holger Hans Peter Freyther 3547045c73 misc: Remove gsm_subscriber.h include to reduce dependencies. 2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther abf962b096 bsc_api: Clear lchan->conn on lchan_release
Set conn to NULL before starting the release procedure, remove
code to check for a lchan->conn as it can not happen. If there
are any memleaks we will notice them.
Detach the lchan->conn from the channel before detaching.
2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther a2aedad005 bsc: Move the subscriber_con code into the bsc_api 2010-09-16 02:16:01 +08:00
Holger Hans Peter Freyther 1502ddefac chan_alloc: Allocate a subscriber connection as child of the network
Due handover we might leave the BTS and if we ever allocate/release
a BTS dynamically we have a problem here.
2010-09-16 02:16:01 +08:00
Holger Hans Peter Freyther 457c2a879c [alloc] Assign a TCH for LU when all SDCCHs are occupied.
When the cell becomes visible we will be bombed with location
updating requests and to reduce the load on the network we should
assign as many channels for it as possible. During load peek it
is even more important than to have a spare voice channel and in
general the LU procedure is pretty fast.
2010-09-06 08:58:42 +08:00
Holger Hans Peter Freyther 4b85a32360 chan_alloc: Change Channel Release to release SAPIs, then the channel
Currently every SAPI release indication will trigger the channel. It
was possible that we had SAPI=3 and SAPI=0 allocated and we tried to
release the channel by sending a RF Channel Release, the BTS answered
with a RF Channel Release ACK but also sent the SAPI Release Indication
which triggered a channel release here. So it was possible that we
would have released a newly allocated channel because of the SAPI
release of the old connection.

This code now works by releasing all SAPIs from highest to lowest,
then sending a SACH Deactivate and finally releasing the channel. This
approach is in use on the on-waves/bsc-master.
2010-07-31 04:09:38 +08:00
Holger Hans Peter Freyther aeb45f5186 chan_alloc: After freeing set the pointer to NULL. 2010-07-31 04:09:38 +08:00
Holger Hans Peter Freyther f2553a6c3a handover: Call bsc_handover_clear from gsm0808_clear
The bsc_handover_clear will release an in-progress handover
and free the lchana and the data associated with this handover
2010-06-30 13:02:08 +08:00
Holger Hans Peter Freyther e071ab70e9 handover: Attempt to use the same gsm_subscriber_conn for new/old channel
The transaction should not know on which lchan we are operating
as this can change due handover. Add untested code to share the
subscriber connection of the new and old lchan and move the pointer
in case of success/failure. Also on a clear command we will free
any resources allocated...

This code is not tested and needs to be debugged, but it should
have the right structure. I am going to fix a potential memleak
in the next commit.
2010-06-30 12:59:20 +08:00
Holger Hans Peter Freyther 4049455d74 bsc_msc: Remove use_count from the subscriber connection
A channel will be released in case of
    * Errors via the clear_request callback...
    * no more transactions and operations are going on.

This means that if we do something without a transaction
the channel might be closed down right away. The bug fix
will be to create a transaction/operation.
2010-06-28 18:01:47 +08:00
Holger Hans Peter Freyther 2412a07965 bsc_api: Allocate the subscriber_connection dynamically
This is a big change to the way we use the subscriber
connection. From now on it is is dynamically allocated
and we will slowly move from a 1:1 lchan to conn to
having more than one lchan per connection.

This is the first commit, the subscr_con* methods will
move to gsm_data once the use_count is removed from the
connection, the freeing of the connection will also change.
2010-06-28 16:12:39 +08:00
Holger Hans Peter Freyther f7a1c23e1d lchan: Document why lchan_reset is there... at least try to. 2010-06-22 12:26:35 +08:00
Holger Hans Peter Freyther 5ba05f4d26 abis_rsl: Send the IMMEDIATE Assignment after the Channel Ack.
The Channel Activate might be sent to a different TRX than the
Immediate Assignment. So we need to make sure that the channel
is activated before we send the immediate assignment for the RACH.

Another reason for that is according to GSM 08.58 we should take
the frame number from the activate and use it for the starting
time inside the immediate assignment message. We obviously do not
do this yet.

The code assumes that the BTS will either respond with a CHAN ACK
or a CHAN NACK if not the lchan will remain in the request state.
2010-06-22 12:26:35 +08:00
Holger Hans Peter Freyther b2be195b50 bsc_api: Rename lchan_for_subscr to connection_for_subscr and update code
With handover and late/early assignment there might be two channels
for one subscriber and only the BSC knows which one to use, so use
the gsm_subscriber_connection everywhere...
2010-06-16 15:42:38 +08:00
Holger Hans Peter Freyther ea01ca764f chan_alloc: Make the lchan_find(bts,subscr) private/internal.. 2010-06-16 15:42:22 +08:00
Holger Hans Peter Freyther de4b0a207d chan_alloc: Stop the channel timers in the reset 2010-06-08 12:16:17 +08:00
Holger Hans Peter Freyther 4f5848dc91 abis_rsl: Allow to specify the release mode for a given channel.
This can be used by handover, early assignment to indicate the
close of the old channel...
2010-06-08 12:16:17 +08:00
Holger Hans Peter Freyther 135f797a37 [bsc_init] When the RSL/OML connection drops, free all lchans
Free all allocated channels on the TRX that failed, go through
lchan_free to signal higher layers and then force a reset of
the channel. Make the TRX and TS unusable by setting the operational
set to 0 (not really defined) which should be reset once the
RSL is coming up again.
2010-04-15 11:24:53 +02:00
Holger Hans Peter Freyther 63d18b51a7 [rsl] Set the release state from within the lchan class
Currently our GSM04.11 code is closing the link for SAPI=3
and this would mean that the whole channel would be scheduled
for close... where we only want to close everything when freeing
the lchan or handling an error.
2010-04-10 00:14:55 +02:00
Holger Hans Peter Freyther acf8a0c59f [misc] Remove whitespace from the end of the line. 2010-03-29 08:47:44 +02:00
Harald Welte c0d83b0647 chan_alloc: Support allocating TCH/F of a dynamic TCH/F + PDCH
This code simply enables the channel allocator to understand the
dynamic TCH/F / PDCH channel type as used by ip.access nanoBTS.

It does not actually try to switch the dynamic mode, but instead
sends signals to a (not yet present) dynamic switching algorithm.
2010-03-28 15:58:03 +08:00
Holger Hans Peter Freyther 18b63f4b41 Store the GSM BTS in the gsm subscriber connection
Remove further usage of lchan from the gsm 04.11 bits
2010-03-25 09:07:28 +01:00
Holger Hans Peter Freyther 68884aa156 lchan: Create a structure for MSC data of the lchan
Prepare to split the BSC and the MSC part by putting the
MSC data for a connection into a "gsm_subscriber_connection"
struct and renaming the macros.
2010-03-25 09:07:28 +01:00
Harald Welte (local) 0b11414f38 print full lchan name when recycling it 2010-01-03 11:02:54 +01:00
Sylvain Munaut 1f6c11fda8 abis_nm: Introduce & use a nm_is_running function to test gsm_nm_state
This returns true if the gsm_nm_state can be considered 'running'.
Note that we also accept availability==0xff (which is a code for
no value) because according to 12.21 it is perfectly valid.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03 10:11:24 +01:00
Harald Welte 83579ca8ff keep 'silent call' state in struct lchan
This enables us to reliably detect if a lchan is part of a silent
call or not.
2010-01-01 10:59:19 +01:00
Harald Welte (local) 82ff397e31 export the 'trx_is_usable() function and use it from paging
this ensures we don't send paging requests to currently inactive transceivers.
2009-12-29 11:00:18 +01:00
Harald Welte (local) 3e46031f52 Introduce new ACT_REQ state to prevent race condition during channel allocation
When we allocate a channel, we send the RSL CHAN ACT REQ and wait until we get
a CHAN ACT ACK.  Only the ACK will change the state, so there is a race where
we allocate that same channel to a different channel request before we get
the ACT ACK.

Introducing a new ACT_REQ state resolves this issue.
2009-12-28 13:41:16 +01:00
Harald Welte 4c70454bae channel allocator: don't allocate channels of unavalable TRXs
In case we have multiple TRX configured, but not all of them are
actually active/operational, we should not try to allocate channels
from such transceivers.
2009-12-24 10:10:16 +01:00
Harald Welte b908cb7e0e Display current channel usage load in 'show bts' and 'show network'
This is just the load at one given instant.  We definitely also want to see
some averages and record the measurements in a database later.
2009-12-22 13:11:28 +01:00
Harald Welte f7c28b099f [handover] Real handover algorithm
This implements the handover algorithm (and associated parameters)
as described in Chapter 8 of the book "Performance Enhancements in
a Frequency |Hopping GSM Network" by Thomas Toftegard Nielsen and Jeroen
Wigard.

The parameters such as averaging windows are configured in struct
gsm_network.  We keep some state to trakc up to 10 neighbors as
they are being reported from the MS.

This has so far only been tested in a network with two BTS that
have each other as neighbor.  Networks with morge neighbors might
encounter bugs.
2009-12-21 13:33:10 +01:00
Sylvain Munaut f77af1fb30 chan_alloc: Delete T3101 on lchan_free as well
If a RF channel is assigned but no response is ever heard from
the phone, we will receive a CONNECTION FAIL from the BTS,
triggering a RF release freeing the channel. Then sometime later,
T3101 will expire as well and free the channel again ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2009-12-21 01:11:25 +01:00
Harald Welte b1d4c8ed9d logging: introduce log levels at caller site
This introduces a new LOGP() macro together with LOGL_* definition to
support multiple log levels (severities) throughout the codebase.

Please note that the actual logging system does not use them yet,
in this patch we simply introduce the new macros at the caller site.
2009-12-17 23:10:46 +01:00
Harald Welte d12b0fdf51 introduce cache of 6 last recently received measurement reports for each lchan 2009-12-15 21:36:05 +01:00
Harald Welte 487e6befb8 make speech calls with NECI=1 work
Fix minor bug with speech calls in case of NECI=1
2009-12-12 21:16:38 +01:00
Harald Welte 210c850a36 If we're trying to allocate TCH/H but don't have it, fallback to TCH/F
The rationale is as following:

If we have NECI=1, then the phone will request a channel with CHREQ
"0100xxxx Originating speech call from dual-rate mobile station when TCH/H is
 sufficient and supported by the MS for speech calls", then we will try to
allocate a TCH/H [as it is sufficient].

However, if there are no free TCH/H slots on the BTS, we abandon and can't
handle the MO call at all :(
2009-12-12 20:58:20 +01:00
Holger Hans Peter Freyther ea52802762 [lchan] RSL and RR need the multirate config, place it in the lchan
Both GSM 04.08 RR and GSM 08.58 RSL need the multirate config
in the channel modify. Place the config in the lchan, change
the gsm48 methods to not take the argument, change the RSL
implementation to make use of it with the right IE.

The other code should use the t(l)v_put routines as well but
were left untouched for now.
2009-11-19 11:42:03 +01:00
Holger Hans Peter Freyther 45b0243a41 [lchan] Fix the SAPI reset in the chan allocation...
Reset the whole array instead of just the first element.
2009-11-19 09:40:03 +01:00
Holger Hans Peter Freyther 5ba6f48092 [lchan] Keep track which SAPIs has been established with the BTS
Keep track of which SAPIs have been established either by the
BTS (from the MS) or by us. This can be used by the on-waves
BSC code to figure out if a new request should be made.
2009-10-29 04:20:21 +01:00
Holger Hans Peter Freyther ba92587cd5 misc: Use NULL instead of integer value for a NULL pointer 2009-10-27 10:42:53 +01:00
Harald Welte 65676fe73f when channel allocator operates in reverse order, prefer SDCCH/8 over SDCCH/4 2009-08-10 14:44:24 +02:00
Harald Welte fc0d952602 introduce bts->chan_alloc_reverse flag
The channel allocator can be set in ascending or descending order.

Ascnending means we first try to allocate channels on TRX0, then TRX1, etc.
Descending means we first try to allocate cahnnels on TRXn, then n-1 down to 0.
2009-08-10 13:46:55 +02:00
Harald Welte 8836726348 use list iteration macros to iterate over list of TRX 2009-08-10 13:25:55 +02:00
Harald Welte 21bd3a52f1 move chcomb4pchan to public abis_nm_chcomb4pchan() function 2009-08-10 12:21:22 +02:00
Harald Welte 89e9d5927e chane TRX0/TS0 channel combination to not include a CBCH
We don't support CBCH anyway, and using CBCH will reduce the number of uesable
SDCCH/4 channels to 3 on TS0
2009-08-09 22:01:26 +02:00
Harald Welte 1a6f79818e move search for existing lchan for subscriber to new function
There's now a new function called 'lchan_for_subscr()' which can be
used to determine if there is any existing lchan for this subscriber.
2009-08-09 18:52:33 +02:00
Harald Welte d2dc1de9d9 start using the RLL RELEASE procedures
So far, we immediately disable the RF channel without following a proper
RLL RELEASE procedure.  This patch changes this.

If we locally terminate the connection, the channel allocator now triggers a
RLL RELEASE REQuest, which is responsed by the MS with a RLL RELEASE CONFirm,
based on which we send the RF CHANnel RELease to the BTS.

If the MS terminates the connection, we receive a RLL RELEASE INDication,
based on which we trigger RF CHANnel RELease to the BTS.
2009-08-08 13:15:07 +02:00
Harald Welte d46299da00 make channel allocator policy multi-TRX aware
For now, we assume that TRX1 (and higher) all have a TCH/F configuration
on all of their timeslots
2009-07-29 16:46:37 +02:00