Commit Graph

146 Commits

Author SHA1 Message Date
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
Harald Welte 9fbff4adac [BSC] Add support for configfile-hardcoded System Information messages 2010-07-30 11:50:09 +02:00
Harald Welte a0b0f36ff0 ipaccess-config/network-listen update
* transition through cycles of NWL tests
2010-07-22 21:54:19 +02:00
Harald Welte 887deabe38 ipaccess-config / network listen: ordered list of RxLevels
Use libosmocore 'rxlev_stat' module to generate an ordered list
of ARFCN's, sorted by RxLev while performing test nr. 64
2010-07-22 21:54:19 +02:00
Harald Welte 549faada21 move ip.access netowrk listen (NWL) to network_listen.c
Also, we now re-start the network listen test after it has finished,
so if you run a test from ipaccess-find, the test will get re-started
and re-started all the time.
2010-07-22 21:54:19 +02:00
Holger Hans Peter Freyther 02d39b2c4d msc: Create a dummy operation to keep the channel open for five seconds
* We should create the transaction for SMS, CC on the CM Service Request
  but for now we will use a band aid and create a dummy operarion to wait
  five seconds for the transaction to be opened.
2010-07-05 15:36: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 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
Harald Welte 29aca17ed0 [BSC] Hopping: Add MA IE to ASS CMD, IMM ASS CMD and HO CMD
Also, make sure the bit ordering in the pre-computed MA is correct,
as well as the cell channel description of the target cell being
present in the HO CMD.
2010-06-20 10:44:53 +02:00
Harald Welte 7401ae6a79 [BSC] Keep a SYSTEM INFORMATION cache for each BTS
This will later be useful for handover where we need to copy the cell
channel allocation into a normal 04.08 message
2010-06-20 10:44:53 +02:00
Harald Welte fd3708976a [BSC] Generate MA for each timeslot that has hopping enabled
The MA is used in 04.08 channel assignment related messages
2010-06-20 10:44:53 +02:00
Harald Welte f3d8e92731 [BSC] introduce the concept of 'BTS features'
We can then check if a bts supports a certain feature or not.
2010-06-20 10:44:53 +02:00
Harald Welte a39b0f2bb7 [BSC] Implement per-timeslot ARFCN lists for frequency hopping
We now compute the Cell Channel Description for SI 1 by bit-wise
OR of the ARFCN bitmask of each timeslot on all the TRX of the BTS.

Also, support generating a GSM 04.08 Channel Description IE for
the hopping case (with HSN/MAIO instead of ARFCN).

What's still missing now: Sending the 04.08 Mobile Allocation IE
2010-06-20 10:44:53 +02:00
Harald Welte 6e0cd04725 unfinished support for hopping channels 2010-06-20 10:44:52 +02:00
Holger Hans Peter Freyther 9764331062 bsc_api: Move gsm48_rcvmsg into the BSC API and dispatch.
The next step in the way to the BSC API. We have a clear a
new connection was opened signal now... and the MSC could
use it...
2010-06-17 16:41:25 +08:00
Holger Hans Peter Freyther ca999a989d msc: Add msc ip-tos NR option for the BSC
Allow to set the TOS field via the VTY interface. The
SO_PRIORITY was not used as it has no effect on the
packets being sent (in contrast to the documentation).
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 9c595b7474 bsc_api: Implement transparent RLL establishment and SAPI n REJECT
When submitting a DTAP message, the BSC API will attempt to
establish the RLL layer and then send the message or send an
SAPI n REJECT. This will be used by the SMS code.
2010-06-15 12:04:34 +08:00
Sylvain Munaut e824d9c2a1 auth: Add support for XOR test A3A8 algo (and vty commands)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14 20:43:53 +02:00
Sylvain Munaut 2030a2a228 gsm_04_08: Store the key_seq given in LOC UPD REQUEST in state
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14 20:43:51 +02:00
Sylvain Munaut 30a15384f4 gsm_04_08: Add a operation to enable ciphering on a lchan
This will take care of the auth/check/enable cipher sequence
and call a callback function when done.

Currently the negotiated Kc is saved but not re-used, so
there is an authentication each time ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14 20:43:51 +02:00
Sylvain Munaut b48216f9d1 auth: Add #define for special value for key_seq
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14 20:43:48 +02:00
Holger Hans Peter Freyther abcddf1152 bsc_api: Add init, dispatch the clear request when a channel is going missing 2010-06-14 18:26:09 +08:00
Holger Hans Peter Freyther 4b4dd100f8 [rsl] Introduce an error state for the lchan and set it on release
When we issue a RF Channel Release in case of a failure we receive
RLL release indications after the channel was tearn down and we
issue another RF Channel Release as a result. The channel allocator
might have already allocated this channel and we release the channel
again with another MS on it.

Make rsl_rf_chan_release take an error argument and make it set
a new state in case of an error and change the RF Channel Release
ack to not set the state back to none in case of an error but wait
for a timeout that is a bit higher than T3111.

I tested this with removing the battery during a phonecall and
waiting for the channel failure. With this test we only send the
release once.
2010-05-31 21:39:23 +08:00
Holger Hans Peter Freyther f30c0dca0d [rsl] Implement the T3111 timer to delay the RF Channel release 2010-05-31 21:33:15 +08:00
Harald Welte 197dea95ff VTY: Introduce common code to add 'description' to objects like BTS
There is now an option to add a human-readable description to objects
that are configured in the VTY.
2010-05-14 18:05:41 +02:00
Harald Welte 615e956328 [gprs] NS/BSSGP: Make all timers configurable from VTY 2010-05-11 23:50:21 +02:00
Harald Welte 721961cf50 [gprs] correctly calculate the length of the BSSGP PDUs 2010-05-04 07:20:44 +02:00
Harald Welte 11d7c105f8 [gprs] pass BSSGP UL-UNITDATA Cell ID up into GMM layer
BSSGP stores a pointer to the Cell Identifier IE in msgb->cb, which
is later used by the GMM layer to identify the cell that has sent a
given message.

This now also means that the gsm_04_08_gprs.c code is free of any
legacy references to msg->trx or struct gsm_bts.
2010-05-04 07:20:43 +02:00
Harald Welte e6afd60779 [gprs] SGSN: Expect all Identifiers to be stored at highest level
We now expect the highest level (actual SGSN GMM code) to know
all identifiers for every element in the protocol stack, i.e.
TLLI, SAPI, BVCI and NSEI.  The layer-inetrnal state is looked
up based on those identifiers.

The reason for this is to ensure only the highest level state
needs to be persistent, while everything else can be regenerated
dynamically (e.g. in a SGSN restart)
2010-05-04 07:20:43 +02:00
Harald Welte fd3fa1d4e0 [gprs] Ensure msgb->l3h points to Layer3 (04.08)
In the old code
	l3h = BSSGP, l4h = LLC, cb[gmmh] = 04.08
Now, this has been changed to
	cb[bssgph] = BSSGP, cb[llch] = LLC, l3h = 04.08

This way, GSM general 04.08 and GPRS 04.08 code can expect a
GSM 04.08 header at msgb->l3h
2010-05-04 07:20:43 +02:00
Harald Welte 44f1c27460 gprs: remove msgb->nsvc pointer and replace it with NSEI and BVCI
According to TS 08.16, the BSSGP layer needs to specify NSEI and BVCI when
executing the NS UNITDATA REQUEST primitive of the underlying NS layer.

Rather than passing around a pointer to the 'struct gprs_nsvc', we now
have NSEI and BVCI as members of 'struct obsc_msgb_cb' and set them
when BSSGP hands a message down to NS.

NS then does a lookup of the 'gprs_nsvc' based on the NSEI parameter.
2010-05-04 07:20:42 +02:00
Harald Welte 06aa111fda gprs: Use new msgb->cb[] for storing a pointer to the NS-VC through which it was received 2010-05-04 07:20:42 +02:00
Harald Welte 943c5bc595 gprs: Update gprs-sgsn branch to use new msgb->cb layout
The explicit 'tlli, gmmh' members of struct msgb are gone from
current libosmocore and have been replaced by the more generic
'control buffer' mechanism.
2010-05-04 07:20:41 +02:00
Harald Welte ab88a62f66 some more GPRS related comments 2010-05-04 07:20:41 +02:00
Harald Welte 9624364b4e 'struct gprs_ra_id' is now defined in libosmocore 2010-05-01 14:01:23 +02:00
Harald Welte 0809d79ef8 define 'struct openbsc_msgb_cb' and accessor macro OBSC_MSGB_CB() 2010-04-30 14:36:25 +02:00
Harald Welte 52e8da6ea1 remove any reference to 'struct gsm_bts_link' 2010-04-30 14:04:01 +02:00
Holger Hans Peter Freyther 95c229006e [vty] Allow to set the RACH NM attributes on a per BTS basis
Be able to tune the RACH settings of the BTS via the vty interface,
by default they are initialized to -1 which means we will use the
content of the static array (BTS default) and can be changed via
the VTY interface. I have verified the setting on the nanoBTS with
wireshark and I have tested writing the config file.
2010-04-25 23:08:39 +08:00
Harald Welte 4511d891dd GPRS: change 'gprs enabled <0-1>' to 'gprs mode (none|gprs|egprs)'
This causes some config file breakage but sounds like a much cleaner
approach than to have two separate config variables for this.
2010-04-18 21:25:56 +02:00
Holger Hans Peter Freyther bb110f91e8 [statistics] Keep track of OML/RSL failures of the BTS. 2010-04-17 06:48:43 +02:00
Holger Hans Peter Freyther 3ba36d5b57 [statistics] Keep track of rf failures and rll release failures
Add two new counters to count the RF Failures and the RLL Release
failure and make them available via the vty interface.
2010-04-17 06:48:29 +02:00
Sylvain Munaut b54dda4cef ipaccess: Send RTP Payload IE for CRCX & MDCX
For GSM V1 FR, the payload type is fixed to 3 in the RFC.
But for the other codecs, the payload type is dynamically assigned
between 96 and 127. Here, we use a static mapping internal to OpenBSC.

This patch is needed to make a rather old 139 unit (with sw version
120a002_v149b42d0) work with something else than FR codec. I also tested
this patch on a newer 139 (with sw version 120a352_v267b22d0) to make
sure it didn't add a regression. More testing with newer EDGE units
should be done by whoever has some of theses.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-04-12 19:58:57 +02:00
Holger Hans Peter Freyther 754e801826 [paging] Simplify the last request and treat llist as a queue
The current code was overly complex. It tried to iterate over
the list in a round robin and we had to keep track of the last
element, see if we remove that one, check if the list becomes
empty... This can all replaced by treating the double linked
list as a queue. We take the item at the front, do something
on it and then and then put it back to the list at the end.
2010-04-10 00:00:15 +02:00
Harald Welte 4563eab30e RSL: keep track of ip.access dynamic TCH/PDCH activation
We use the (currently unusued) flags member of the bts_trx_ts structure
to track if a dynamic TCH/PDCH is currently on PDCH mode or not.
2010-03-28 14:42:09 +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 a5731cffc4 GPRS: make NSEI configurable from VTY 2010-03-22 19:02:04 +08:00
Harald Welte af387633db GPRS: make NSVC parameters VTY-configurable 2010-03-22 19:02:04 +08:00