Commit Graph

67 Commits

Author SHA1 Message Date
Neels Hofmeyr 9f5d231f00 debug log: cosmetic fixes
Drop erroneous C from a DEBUGPC, should be on a new line.

Drop underscores from IPAC_PDCH_[DE]ACT: all other log messages for IPAC PDCH
are without underscores -- git grep "P(.*IPAC.PDCH.*ACT"

Change-Id: I8fb7a1c1beabb1f4388517383fd0bdc082d557ca
2016-06-05 23:02:09 +00:00
Harald Welte 7184bd088e subscr_name(): Handle case for subscr == NULL
subscr_name() was called from several places:
* either without a check for subscr being NULL, which for example
  was causing a segfault if we hand-over a channel before identifying the
  subscriber
* or with an explicit NULL check and the ternary operator (?).

We now simplify the code by checking for the NULL Subscriber in subscr_name()
itself.

Change-Id: Ide09f4a515222eb2ec6c25e7a6a8c5f6cc2ffd4b
Reviewed-on: https://gerrit.osmocom.org/92
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-22 11:51:18 +00:00
Max c08ee71bff Move DTX settings to BTS
* Add per-BTS DTX settings
* Configure Uplink and Downlink DTX separately
* Deprecate global DTX option (it was never tested/used anyway)
* Use libosmocore function for DTX indicator in System
  Information (previously it was incorrectly assigned for half-rate
  channels)

Related: OS#22
Change-Id: I3d55168475ad47044b6238b55846ea22bdd518a4
Reviewed-on: https://gerrit.osmocom.org/40
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-17 16:17:54 +00:00
Max 5fa7e36bbc Refactor SI-related code
Move define to header file.
Use inline functions where appropriate.
Change int variables which are used as boolean into actual bool to make
code easier to follow.
2016-04-16 13:47:56 +02:00
Holger Hans Peter Freyther 11cb7a9fd9 amr: Remove some code duplication in preparation
Merge two copies into a local static helper function. The format
of the message will change and then it is easier to modify it in
one place than in two.

Sadly the original patch was merged before this clean-up so do
the clean-up as second step.

Conflicts:
	openbsc/src/libbsc/abis_rsl.c
	openbsc/src/libbsc/gsm_04_08_utils.c
2015-10-02 15:30:28 +02:00
Andreas Eversberg 732665269e Add full AMR multirate IE support with VTY config for MS and BTS side 2015-09-22 16:46:27 +02:00
Holger Hans Peter Freyther 6f6cbf7c5d bts: "Repair" broken channels if we receive the release ack
We had issues with odd behavior on the nanoBTS which lead
to the introduction of the "broken" state. On busy multi
BTS cells (e.g. rhizomatica) with wifi backhaul the timeout
we set to wait for a RF Channe Release ACK is sometimes too
little and channels are marked broken that look to be okay
(besides the still to be determined delay).

In case of a sysmoBTS we now know that we can change the
state of a broken channel back to normal in case we do
receive the right response.

Manually verified using the Smalltalk BTS code

PackageLoader fileInPackage: 'FakeBTS'
bts := FakeBTS.BTS new.
bts btsId: '1903/0/0'.
bts connect: 'localhost'.
bts waitForBTSReady.
test := FakeBTS.OpenBSCTest new.
test bts: bts.

test requireAnyChannel

... wait for NITB output
<0004> abis_rsl.c:223 (bts=0,trx=0,ts=0,ss=0) Timeout during deactivation! Marked as broken.

... process pending messages
stdin next
<0004> abis_rsl.c:735 (bts=0,trx=0,ts=0,ss=0) CHAN REL ACK for broken channel. Releasing it.

So the channel went from broken to unallocated.
2015-04-04 19:58:50 +02:00
Holger Hans Peter Freyther 7af5f8130f rsl: Remove unused code for channel activation
The code has been unused for a long time. Let's remove it.
2015-01-31 12:49:41 +01:00
Harald Welte a9e420e93d RSL: Change "... is back in operation" to an INFO level message 2015-01-05 14:05:32 +01:00
Harald Welte 1dcc2603e9 Don't return an error to caller if we are out of lchan on CHAN RQD
This is a normal situation under high load: The BTS is out of resources
and the BSC cannot allocate any dedicated channel.  We may send an IMM
ASS REJECT back to the MS.  All well within normal parameters, not an
error that needs to be reported back to the caller, who propagates it
all the way up to libosmo-abis.
2015-01-05 14:05:32 +01:00
Holger Hans Peter Freyther 454140e7fc lchan: Remember why a channel is broken using static strings
Remember why a channel is being marked as broken. So we can
maybe understand what happend.
2015-01-02 11:43:06 +01:00
Harald Welte 30f1f37638 Add basic support for CBCH / SMS-CB (Cell Brroadcast)
We can now configure the pyisical channel types for CBCH either in the
CCCH+SDCCH4 or in the SDCCH8 chanel combination.

Depending on whether a CBCH exists on the BTS, we also generate the SI4
with matching CBCH channel description to notify the phones of the
existance of the CBCH.

There is now a VTY command how a SMS-CB message can be sent to a given
BTS.

We do not yet have any logic at all for actual scheduling of multiple
CBCH RSL messages towards one or multiple BTSs yet, though.
2014-12-30 00:35:28 +01:00
Andreas Eversberg 723a751e5f dyn PDCH: Cleanup of rsl_chan_activate_lchan() and users
Timing advance is stored inside lchan structure, so it is removed from
arguments. This is useful, if other actions are required prior calling
rsl_chan_activate_lchan. (like deactivating PDCH first)

The "shifted TA value" that is required by BS11 is now calculated inside
rsl_chan_activate_lchan and not by each user.

[Rebased by Holger. So some hunks were skipped as the patch
depended on Jolly's HO code]
2014-08-04 08:59:16 +02:00
Daniel Willmann 8a485f0bec libbsc, osmo-bsc{, _nat}: Prevent unaligned access when casting TLVP_VAL
foo = *((uintXX_t *) TLVP_VAL(...) can lead to unaligned access. To
prevent that use tlvp_valXX_unal() to get the values.
2014-07-07 19:04:32 +02:00
Holger Hans Peter Freyther 0e4e73a891 rsl: Check if the channel is active and then start the channel release
In case we receive ERROR INDICATION and CONNECTION FAILURE we only
want to RF Channel Release the lchan once. This code is more simple
and should work as reliable as the previous commit.
2014-06-03 12:51:16 +02:00
Holger Hans Peter Freyther 1e93b79cce rsl: Avoid double channel release procedure in error conditions
When we receive an ERROR INDICATION and CONNECTION FAILURE we
might call rsl_rf_chan_release multiple times. The channel release
handling is still a bit messy and there too many paths that lead
to the call.

1.) In case we receive an ERROR INDICATION for SAPI=3. A RLL
error signal will be emitted that leads to the release of the
channel through the SMS code in case of the NITB.  The call to
rsl_rf_chan_release might be a double release.

2.) In case a CONNECTION FAILURE is received when the release
process has already been started we would unconditionally
call rsl_rf_chan_release as well.

Because the lchan state is changed by the callers of the
rsl_rf_chan_release we can not move the state checking into this
code but need to do it in the caller. The issue was seen in a trace
from Rhizomatica and I created the DoubleRelease.st to re-produce
the issue and verified that we have no duplicate RF Channel Releses.

The other option would be to introduce a new state to track
the release process and see if we have already released SAPIs
deactivated the SACCH or such. We can not simply look at these
as for a channel that fails to activate they will be null already.
2014-06-03 12:51:16 +02:00
Holger Hans Peter Freyther f0405068d8 lchan: Speculative "fix" for error and late reply
Looking at the code it seemed possible that a channel would
transition from BROKEN to NONE. Or worse from NONE to BROKEN.
Start the timer _after_ the channel has been released.
2014-06-03 12:51:16 +02:00
Holger Hans Peter Freyther ee41ecff98 rsl: Remove obsolete FIXME comment.
The lchan state is set to none either on RF Channel Release ACK
or in case of an error after the error timer has expired.
2014-05-26 08:17:35 +02:00
Holger Hans Peter Freyther 4766524d17 rsl: Add missing breaks in the code
Given that the method is only called for a traffic channels the
missing breaks didn't hurt.

Fixes: Coverity CID 1040731, CID 1040732, CID 1040733,
       CID 1040734
2014-04-04 12:17:28 +02:00
Andreas Eversberg 7d8fa3418f Add VTY option for Nokia BTS that does not send RELease CONFirm message
This option is a workarround for a bug found in Nokia InSite BTS firmware
version 3.0.0. There is no RELease CONFirm message for local end release.
Nokia MetroSite with firmware version 4.178.16 is not affected.

TS 04.06 Chapter 5.4.4.4 "Local end release procedure" states that a
confirm must be sent by layer 2 when receiving a local end release
request.

In order to correctly switch a channel (handover or assignment), local
end release is required.
2014-01-09 08:12:14 +01:00
Holger Hans Peter Freyther f0167ddfc2 hsl: Remove the support for the HSL bts from OpenBSC
The support has been implemented for an old model, we were told that
newer versions would be made incompatible with OpenBSC. Ther are
various warnings in the code and coverity has found some new ones.

Just remove the code as we don't know of anyone using this code.
2013-07-03 16:19:41 +02:00
Holger Hans Peter Freyther 2177624ca9 channels: Mark channels as broken that time out on activation/release
A channel that fails to send an ACK/NACK/REL within the four second
timeout is now marked as broken. In case the release comes in late
it will be ignored. The lchan should already been freed and for now
we don't want to trust the channel.

In the future we might want to send a "release" for a channel that
got activated ack late and just set the state to none on a channel
that is released acked late.

The late ACK and REL has been tested with two manual tests using the
fakebts. The channels remained blocked even after having received
the ACK message here. The NACK case has not been manually tested.
2013-05-02 19:36:29 +02:00
Holger Hans Peter Freyther e1145cf0f9 rsl: Properly initialize the cm structure with memset
abis_rsl.c:332:23: warning: 'memset' call operates on objects of type 'struct rsl_ie_chan_mode'
      while the size is based on a different type 'struct rsl_ie_chan_mode *'
      [-Wsizeof-pointer-memaccess]
        memset(cm, 0, sizeof(cm));
               ~~            ^~
abis_rsl.c:332:23: note: did you mean to dereference the argument to 'sizeof' (and multiply it
      by the number of elements)?
        memset(cm, 0, sizeof(cm));
                             ^~
1 warning generated.
2013-03-09 17:53:50 +01:00
Andreas Eversberg 75e13a41dc Fix of IMMIDIATE ASSIGNMENT REJECT message
The message was corrupt at several points. They are fixed now and
successfully tested.

A default T3122 timer value of 10 is defined by default now. If set to 0,
the reject message will not be sent. Note that when using existing configs
with T3122 value set to 0.
2013-02-08 08:25:17 +01:00
Harald Welte 647db848e3 add some more docbook snippets 2013-02-07 15:03:08 +01:00
Holger Hans Peter Freyther 164ee307b2 rsl: Properly parse the RLM cause from the error indication
The code predates the TLV parser and we were parsing the RLM from the
wrong offset. In general we were using the length of the TLV which
happened to be equal to the T200 indication.

After consulting the RLM cuases not every of them should generate a
BSC_RLLR_IND_ERR_IND as these are forwarded to the MSC as a SAPI reject
right now.

TLV parsing now generates this due a bug in the osmo-bts code:
abis_rsl.c:1605 (bts=0,trx=0,ts=2,ss=0) SAPI=0 <0000> abis_rsl.c:1547 (bts=0,trx=0,ts=2,ss=0) ERROR INDICATION cause=Fraeme not implemented
2013-01-16 21:07:43 +01:00
Holger Hans Peter Freyther 006e3d87e0 gsm: Do not attempt to release SAPI=0 if it was never allocated
In case of handover (but probably on RACH) we would send a RLL for
SAPI=0 even if this SAPI was never established. After we have released
all SAPI>0 locally check that SAPI=0 is established and if not release
the rf channel directly.
2012-12-26 00:20:18 +01:00
Holger Hans Peter Freyther b348939d86 lchan: Introduce T3109 handling for the release procedure
T3109 is started when the SACCH is deactivated. It is stopped when
the phones sends the DISC/UA/UM on LAPDm for the main signalling
link. In case of timeout the abnormal release procedure will be
initiated. Make sure to not issue the SACCH Deactivate twice to
avoid confusing the equipment.

This is still not fully spec compliant. In case of a timeout the
abnormal release handling will be started which involves starting
T3111+2. The error handling should be split out of the rf channel
release method, e.g. lchan_release should be called and check if
the channel release was already initiated.
2012-12-23 20:20:38 +01:00
Holger Hans Peter Freyther 638da51a78 lchan: Introduce a BROKEN state for the lchan
If the CHAN ACTIV is NACKED we set the state backto NONE. This is
problematic as our channel allocator will allocate from the front
or from the back and if the channel is early in the list it might
cause permanent failures. Introduce a BROKEN state and use it when
the channel activation is failing for an unknown reason. Copy the
cause so it can be inspected later.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 9d50a27695 lchan: Document the behavior/quirks for abnormal channel release
Deactivate the SACCH and release all SAPIs locally as of GSM 04.08. Add
documentation to the code and explain what will happen as part of the
release process.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 8582535c82 lchan: Release the lchan more quickly, align with GSM 04.08
* Release all channels with SAPI > 0 with the "local end release"
  (as of NOTE 1 of GSM 04.08).
* No need to wait for all SAPIs to be torn down and the normal
  REL_IND/REL_CONF will call rsl_handle_release and the channel
  should be released.
* Update the documentation
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 93599a2c2c rsl: Cosmetic changes to the release code
Put the idiom that sets the lchan state to none and respecting the
error state into a shared method. This way the special handling for
the abnormal case is just in one place.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 5ca825e431 rsl: Rename the reason to release_mode and use the enum value
The API with 0 and 1 as legal values is hard to understand. Use the
recently introduced enum values instead.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 1411c066cc rsl: Use LOGL_ERROR instead of LOGL_NOTICE act/deact timeouts
It is a grave error when the BTS does not respond to the ACT/DEACT
requests, use LOGL_ERROR for such conditions.
2012-12-23 20:18:17 +01:00
Harald Welte e422798866 RSL: Add basic support for CSD transparent mode
We now have a lchan->csd_mode member that determines if RSL should
activate the channel in CSD transparent services or not.  The previous
code always assumed CSD is non-transparent.

(This requires libosmocore >= eed26116c96f03c6128fac3dead9054714af6cab)
2012-08-29 16:33:54 +02:00
Harald Welte 0c1bd61bb3 pre-fix measurement reports with subscriber identity
... otherwise it's impossible to distinguish them from each other.
2012-07-02 20:13:02 +02:00
Harald Welte f25b55ec71 abis_rsl_rcvmsg(): Fix msgb memory leak in error path
Thanks to Andreas Eversberg for spotting this one.
2012-05-31 20:22:34 +02:00
Harald Welte fda74ee055 RSL add debug statements when sending RSL EST REQ and RSL REL REQ. 2012-04-26 19:43:36 +02:00
Holger Hans Peter Freyther 863dc9bc84 abis_rsl.c: Remove unused variable net.
The old BSC code had code to override the payload type, this has
been removed, remove the variable accessing it.

GCC warning:
abis_rsl.c: In function ‘ipa_rtp_pt_for_lchan’:
abis_rsl.c:1590:22: warning: unused variable ‘net’ [-Wunused-variable]
2012-02-03 20:29:00 +01:00
Holger Hans Peter Freyther 54fa2c7eab abis_rsl: The rach information was not used, introduce a signal
Introduce a SS_CCCH for the paging and the rach load. The paging
code could now start using the signal.

GCC warning:
abis_rsl.c: In function ‘rsl_rx_ccch_load’:
abis_rsl.c:1371:11: warning: variable ‘rach_access_count’ set but not used [-Wunused-but-set-variable]
abis_rsl.c:1370:11: warning: variable ‘rach_busy_count’ set but not used [-Wunused-but-set-variable]
abis_rsl.c:1369:11: warning: variable ‘rach_slot_count’ set but not used [-Wunused-but-set-variable]
2012-02-03 20:26:25 +01:00
Holger Hans Peter Freyther c6d0a17100 abis_rsl.c: Remove unused variable ts_number
GCC warning:
abis_rsl.c: In function ‘rsl_rx_chan_rqd’:
abis_rsl.c:1245:10: warning: variable ‘ts_number’ set but not used [-Wunused-but-set-variable]
2012-02-03 20:10:13 +01:00
Holger Hans Peter Freyther c0a6674614 channel: Review lchan_free calls and the state the channel is in
In case of a memory allocation failure in rsl_rx_chan_rqd we would
have left the channel in the LCHAN_S_ACT_REQ state. Move the state
change below the allocation.
2012-01-15 00:28:15 +01:00
Holger Hans Peter Freyther bbf2139fdc channel: The error timer and the lchan_deact_tmr are both running
In case a BTS does not send the RF Channel Release ACK and we are
closing the channel because of an error two timers are running to
set the state back to none.

Make lchan_deact_tmr_cb and rsl_rx_rf_chan_rel_ack behave the same
in regard to changing the state of the lchan. For the other direction
we are save, the error path will set the state to NONE and the timeout
will call lchan_free to set the channel type back to NONE, only then
the lchan may be allocated again.

The channel release procedure requires some more tweaking, some part
was started in the zecke/28c3 branch and needs to be tested/integrated
with the goal of having one common release path.
2012-01-15 00:02:54 +01:00
Andreas Eversberg 3365cd1cfe RSL: Nokia BTS reports TA in quarter-bits, not full bits.
We need to compensate accordingly...
2011-12-24 11:49:05 +01:00
Andreas Eversberg 2957de9228 RSL: BS-11 reports TA in quarter-bits, not full bits.
We need to compensate accordingly...
2011-12-16 17:45:37 +01:00
Holger Hans Peter Freyther ed999b29bc audio: From RTP point of view we can use one payload for HR/FR AMR
Remove the separation of half-rate and full-rate AMR. The used rate
can be found inside the AMR payload. The signalling of what kind of
traffic channel is used can be done with the GSM 08.08 Chosen
Channel IE in the Assignment Complete message.

This way I can use a fixed payload type in the MGCP GateWay but
have a mixed TCH/F and TCH/H config. E.g. use TCH/F FR3 for some
subscribers when connected to MSC A but use AMR5.9 on a TCH/F for
MSC B when all TCH/Hs are gone.
2011-08-22 18:23:50 +02:00
Holger Hans Peter Freyther 128892f55f audio: Remove the hardcoding of the RTP Payload
The MGCP config must be correct and use 99 for RTP AMR.
2011-08-22 18:22:44 +02:00
Pablo Neira Ayuso ed5cacb240 src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.

The main changes are:

- The directory libabis/ has been removed as it now lives in
  libosmo-abis.

- new configuration file format for nanoBTS and HSL femto, we
  need to define the virtual e1_line and attach it to the OML
  link.

- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
  BS11 and rbs2000) now use the new libosmo-abis framework.

- use r232 input driver available in libosmo-abis for bs11_config.

- use ipa_msg_recv instead of old ipaccess_read_msg function.

- delete definition of gsm_e1_subslot and input_signal_data.
  These structures now lives in libosmo-abis.

Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.

This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:

- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node

This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-19 22:38:35 +02:00
Pablo Neira Ayuso 7abecfcfc9 src: use new msg->dst pointer instead of deprecated msg->trx
This patch modifies openBSC code to use msg->dst which stores the
pointer to the signalling link structure instead of the pointer to
the transceiver structure.

This patch prepares the introduction of libosmo-abis.
2011-08-19 22:38:33 +02:00
Daniel Willmann 6fc6a12c07 libbsc: Cosmetic fix for the channel activate NACK log message 2011-08-11 17:21:24 +02:00