Commit Graph

536 Commits

Author SHA1 Message Date
Álvaro Neira Ayuso 72e9bc9edb sysmobts: Move the function add_manufacturer_label_id to oml file
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-25 13:41:08 +02:00
Álvaro Neira Ayuso 399b3fe1b4 sysmobts: Move the function check_oml_msg to oml file
This patch move this function to oml and we can use in
the future for doing a sanity check to all the received
OML message.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-25 13:41:08 +02:00
Álvaro Neira Ayuso 69925cef39 sysmobts: Fix the function check_oml_msg of utils
This patch allows check the oml message correctly.
I have splitted the function in three different, one for
checking the manufacturer label ID, another for checking the
FOM and the principal which will call to the other function
for checking the OM header and all the part that I have told
before of the OML message received.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-25 13:41:08 +02:00
Holger Hans Peter Freyther 7996134d2a common: Ignore "si.valid" outside of _MAX_SYSINFO_TYPE
Limit the range from 0 to (_MAX_SYSINFO_TYPE - 1) instead of
0 to 31. This way we will never access the lchan->si.buf[] out
of bounds. This is only a theoretical issue though as the code
filling the lchan->si.buf for the SACCH will not have valid
>= _MAX_SYSINFO_TYPE. Add a small regression test to check we
still schedule all SIs.

Fixes: CID 1040765
2014-05-22 21:17:49 +02:00
Holger Hans Peter Freyther ac26607fe4 common: Remove unused gsm_time parameter from lchan_sacch_get 2014-05-22 20:42:33 +02:00
Holger Hans Peter Freyther 9d8aeab0b6 sysmobts: Avoid memleak when multiple -c arguments are passed
Rely on optarg pointing to an address that will be valid for
the run of the entire application.

Fixes: CID 1206578
2014-05-22 19:50:39 +02:00
Holger Hans Peter Freyther 44980347f3 sysmobts: Have a common prefix for the enum
Make the manuf_type_id enum have a common prefix for the
symbols.
2014-05-20 09:47:02 +02:00
Álvaro Neira Ayuso 7d36e5ed46 utils: Used the enum manuf_type_id in the parameter of add_manufacturer_id_label
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 09:47:02 +02:00
Álvaro Neira Ayuso afee0b7929 utils: Classify the OML message using the return type
Classify the OML message and return the manufacturer type
or an error. Currently ETSI, ip.access and Osmocom are known.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 09:45:36 +02:00
Álvaro Neira Ayuso f5f41e8051 sysmobts: Do not access out of bound string
One can either use "strlen(str) + 1" but not add one to the
result of the sizeof.
2014-05-20 09:43:38 +02:00
Álvaro Neira Ayuso 13a224063d sysmobts: Separate IPA and OML check into two methods
I have split the function check_oml_msg, in two functions. One for
checking if the ipa header is well-formed and in check_oml_msg,

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 09:37:30 +02:00
Harald Welte 0a1699ff8a screenrc: osmobts-mgr now needs a config file 2014-05-19 13:01:20 +02:00
Harald Welte 14c60b425f make sure osmobts-mgr.cfg file is included in tarballs 2014-05-19 12:58:31 +02:00
Harald Welte b4280963c0 Revert "sysmobts: Add support for changing the transmit power in sbts2050"
This reverts commit c64d425738.

There are unfrtunately still too many problems with this patch to be
merged at this point.
2014-05-19 11:22:38 +02:00
Harald Welte 76c309e9f7 sysmoBTS TCH: Set CMR in AMR RTP frames
Enable the previously commented-out logic to set the CMR (Codec Mode
Request) in AMR RTP frames based on the CMI (CMR Index) of the AMR
speech frame on the Um interface.

This is of course anyway the right thing to do, but also required for an
AMR receiver which doesn't have out-of-band information on the codec
mode, and which also doesn't determine the AMR codec mode based on the
size of the AMR frame (such as lcr as of current master).

We also move the entire CMR generation into the #ifdef section
which is only compiled-in if we do _not_ use the RTP mode of L1.
2014-05-18 22:31:45 +02:00
Álvaro Neira Ayuso c64d425738 sysmobts: Add support for changing the transmit power in sbts2050
Make the sysmobts-mgr send a manufacturer O&M message with the power
reduction we want the sysmobts to apply. The sysmobts will handle
this message and set the new tx output power. An ACK/NACK will be
send as a response to the power reduction.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-18 09:42:49 +02:00
Álvaro Neira Ayuso c5fedd24c9 sysmobts-mgr: Add VTY support for configuring it
This patch allows to configure the warning temperature threshold,
the severe temperature threshold of the board and the PA and the
actions like the relative value power that we want to reduce the
transmit power to and the part that we want to switch off or not.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-18 09:42:08 +02:00
Álvaro Neira Ayuso c6ab90b270 sysmobts: Add beginnings of an OML router and create Failure Messages in the sysmobts-manager
Make the sysmobts listen for OML messages on a Unix Domain Socket.
Messages passing a sanity check will be forwarded to the BSC.

In case the sysmobts-mgr detects a temperature above or below
temperature threshold an OML failure message will be sent
to the BTS.

[moved confinfo into the #ifdef BUILD_SBTS2050]

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-18 09:41:29 +02:00
Harald Welte 73d9d3af6c sysmobts: Support DSP API >= 3.8.1 (u8MaxCellSize) 2014-05-17 10:04:44 +02:00
Holger Hans Peter Freyther d75c648871 abis: Separate initialization from connect for Abis
Initialize the libosmo-abis VTY nodes more early so we can parse
the config file that was created by "write". Introduce abis_init
to initialize the libosmo-abis and modify abis_open to re-use an
existing line. Update the comments. This has only been tried with
the sysmobts-remote on x86. A TCP connection is opened toward the
configured BSC.

Fixes: SYS#285
2014-05-15 14:18:26 +02:00
Álvaro Neira Ayuso 8b5b993d29 sysmobts: Fix compiler warning about missing declaration
Include utils.h to have a declaration of sysmobts_get_nominal_power,

l1_if.c: In function 'l1if_activate_rf':
l1_if.c:1144:6: warning: implicit declaration of function
'sysmobts_get_nominal_power' [-Wimplicit-function-declaration]

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-15 10:21:43 +02:00
Álvaro Neira Ayuso 9ed6b95c90 osmo-bts-sysmo/utils.c: Added a function for calculate the power transmitter
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-04-29 12:08:28 +02:00
Holger Hans Peter Freyther 3e5b6db2d2 handover: Call the right function and avoid recursion
Fix a brown paper bag bug and call the right method. The above was
an infinite recursion. The stack didn't overflow as the compiler
optimized the tail-recursion and coverity didn't complain either.

The issue was introduced in the last minutes before the merge
when I renamed "reset_handover" to "handover_reset" to follow
the object_verb approach throughout the handover.c code. While
doing that I sadly replaced reset_handover with handover_frame
and not handover_reset.
2014-04-19 19:22:22 +02:00
Holger Hans Peter Freyther d59bbd16a7 sysmobts: Add log message in case the channel activation fails 2014-04-07 20:33:04 +02:00
Holger Hans Peter Freyther f547bee878 rsl: Use unique values for the call to rsl_tx_chan_act_nack
This way we can easily find the place in the code that is responsible
for the NACK.
2014-04-07 20:30:12 +02:00
Jacob Erlbeck 57a4d121c4 oml: Pass all valid state change requests to the model
Currently ADM state change request that tries to set the
administrative state to the current value are immediately ACK'ed.
Beside the caching problem, this could lead the protocol
inconsistencies if two such requests are sent one after the other and
the second arrives before the procedure of the first has finished.

This patch removes the shortcut in oml_rx_chg_adm_state() which
immediately called oml_mo_statechg_ack(mo).

Ticket: OW#1132
Sponsored-by: On-Waves ehf
2014-04-03 12:46:03 +02:00
Holger Hans Peter Freyther 0859795878 sysmobts: Fix build for the v1 of the sysmobts 2014-03-29 19:27:54 +01:00
Holger Hans Peter Freyther 14ff925555 agch/pcu: Fix crash for AGCH commands queued by the PCU
The dequeue code assumed that msg->l3h is a valid pointer but in
the case of the PCU socket it was a null pointer. This lead to
memcpy copying a lot more than 23 bytes which ultimately lead to
a crash. The issue was introduced in the git commits
37c332e5bf and the commit
d290ee029a.

use msg->l3h = msgb_put(msg, len) to make sure that there is a
valid L3 pointer for the message.

 (gdb) bt
 #0  0x419d6384 in memcpy () from /tmp/ow/lib/libc.so.6
 #1  0x0001894c in bts_ccch_copy_msg (bts=0x62248, out_buf=0x62248 "p\025\003", gt=0x1,
    is_ag_res=100684) at bts.c:572
 #2  0x0000c958 in handle_ph_readytosend_ind (rts_ind=<optimized out>, fl1=0x62e78)
     at l1_if.c:515
 #3  l1if_handle_ind (fl1=0x62e78, msg=0x8bb08) at l1_if.c:920
 #4  0x000147e8 in read_dispatch_one (queue=<optimized out>, msg=0x8bb08, fl1h=<optimized out>)
    at l1_transp_hw.c:190
 #5  l1if_fd_cb (ofd=0x62f04, what=<optimized out>) at l1_transp_hw.c:224
 #6  0x41b9d028 in osmo_select_main (polling=<optimized out>) at select.c:158
 #7  0x0000b204 in main (argc=<optimized out>, argv=<optimized out>) at main.c:384

(gdb) p *msg
$12 = {list = {next = 0x100100, prev = 0x200200}, {dst = 0x0, trx = 0x0}, lchan = 0x0,
  l1h = 0x0, l2h = 0x0, l3h = 0x0, l4h = 0x0, cb = {0, 0, 0, 0, 0}, data_len = 23, len = 23,
  head = 0x8572c "-\006?\020\r\340*q\224#", tail = 0x85743 "",
  data = 0x8572c "-\006?\020\r\340*q\224#", _data = 0x8572c "-\006?\020\r\340*q\224#"}
2014-03-27 09:19:24 +01:00
Holger Hans Peter Freyther 64a4327c34 sysmobts: Apply the potentially new max_power_red on the TRX
In case the max power reduction has been changed through OML,
let us call the l1if_set_txpower routine to update the nominal
power. This has been manually verified with both BTS #1 and #57.

./bsc_control.py -d localhost -p 4249 -s bts.0.trx.0.max-power-reduction 0

The above command and GNUradio have been used to determine if
the power level has changed at all.

Fixes: SYS#268
2014-03-26 18:05:41 +01:00
Holger Hans Peter Freyther a276b98236 oml: Indicate the kind of object passed as the void*
These routines do not pass the gsm_abis_mo and parsing the FOM
header of the msg does not seem to be a good idea either. Pass
in the OML object so that the model code can determine what the
void pointer is.
2014-03-26 18:01:55 +01:00
Holger Hans Peter Freyther 71d98050f3 sysmobts: Honor power reduction on older sysmoBTSv2 hardware
Older hardware didn't have the external attentuator that was used
to control the wanted output power. So starting from the git commit
3c8ff3c70b older hardware was always
transmitting with 23 dBm regardless of the power reduction.

Remember the hardware revision returned by the SystemInformation
primitive, postpone the call to l1if_activate_rf until we know
the board revision.

Manually verified on BTS #1 and #57. On BTS#1 the external
attenuator has not been configured and on BTS#57 it was.
2014-03-26 17:49:06 +01:00
Holger Hans Peter Freyther 83dc54fb95 systemd: Provide the pcu direct mode 2014-03-21 19:28:13 +01:00
Holger Hans Peter Freyther ae2473c2ca systemd: Do not restart with a broken config file or such
Only restart in case of a crash or the exit(42) when the OML/RSL
link is going down.
2014-03-21 18:10:12 +01:00
Holger Hans Peter Freyther fb067905d5 sysmobts: Add a magic number to the hLayer2 to differentiate it
The DSP/FPGA appears to report bogus PhDataInd with hlayer2 == 0.
Currently this would match the TRX==0,TS==0 and SS=0 and then we
report bad measurement reports. Add a magic number to the lower
eight bit of the hLayer2 to differentiate valid numbers.

Addresses:
<0004> measurement.c:97 (bts=0,trx=0,ts=0,ss=0) measurement during state: NONE
<0004> measurement.c:102 (bts=0,trx=0,ts=0,ss=0) no space for uplink measurement
2014-03-16 14:23:37 +01:00
Holger Hans Peter Freyther 3e317ea4f0 sysmobts: Change the order to follow the RX handling code 2014-03-16 14:21:41 +01:00
Holger Hans Peter Freyther b45c8a6b6c sysmobts: Improve the log message and print the hLayer2 we don't know 2014-03-16 14:21:41 +01:00
Álvaro Neira Ayuso 2dca8f37e5 misc/sysmobts_misc: function for switching off/on and requesting status power
I have extended the principal function that we use for requesting
information to the microcontroller for switching off/on the board
and the PA. And I have extended it for requesting the power status
information of the board and the PA.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-16 14:21:41 +01:00
Álvaro Neira Ayuso 4b614a0246 misc/sysmobts_mgr: Added new header created in the configure
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-12 21:38:18 +01:00
Holger Hans Peter Freyther bd26784362 misc: Ignore some of the new configure and test files 2014-03-12 16:54:19 +01:00
Holger Hans Peter Freyther 4e3aa93681 misc/sysmobts: Another small change to help in finding the header
We could have a dedicated configure/cflag for the header files
but for now search in the standard directories.
2014-03-12 16:51:27 +01:00
Holger Hans Peter Freyther 06387d89e8 misc: Fix the build breakage now that we have btsconfig.h
Include the btsconfig.h for the PACKAGE_VERSION variable.
2014-03-12 16:40:07 +01:00
Álvaro Neira Ayuso e030dfd443 misc/sysmobts_misc.c: Read temperature from microcontroller
Add function for requesting the temperature information to the
microcontroller. I have added a function that we can extend
for requesting more information but in this case we only need to
know the temperature.
I have added to a microcontroller temperature handling function
in the manager for monitoring this information.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-12 16:27:38 +01:00
Jacob Erlbeck 21104720f7 agch: Remove obsolete comment
Use of configuration variables has already been implemented here, so
the TODO comment is removed.

Sponsored-by: On-Waves ehf
2014-03-10 14:04:29 +01:00
Holger Hans Peter Freyther b26b8fc776 sysmobts: Do a RF mute at initialization when the RC is locked
Currently a locked cell is actively broadcasting when it is being
bootstrapped after the lock.

This patch adds an initial update of the RF mute state when the TRX
is initialized.

Ticket: OW#1131
Sponsored-by: On-Waves ehf
2014-03-10 14:00:21 +01:00
Holger Hans Peter Freyther 9c4a524444 handover,sysmobts: Handle handover in the sysmobts code
When the lchan was activated for handover configure it to wait
for a RACH burst. On release make sure to always release the
RACH SAPI (in case it has been allocated). On the first frame
inform handover.c about it and forward the received access burst
to the handover layer.

Using an E71 it was possible to make a handover for SDCCH and
TCH/F from a nanoBTS but also from itself to itself. The vty
commands of OpenBSC and the silent-call have been used for that.
I didn't verify audio handling so far.
2014-03-10 13:38:07 +01:00
Holger Hans Peter Freyther bb76d816da handover,sysmobts: Handle idle needed for preparation of rach handling 2014-03-10 13:38:07 +01:00
Holger Hans Peter Freyther cfce4d65f2 handover,sysmobts: Refactor the parsing/handling of the access delay 2014-03-10 13:38:07 +01:00
Andreas Eversberg 00b4e064ff handover: Add generic handling for handover
The BTS layer needs to inform the handover code when an access
burst has been received. In turn the handover layer will ask the
bts to modify the channel, it will schedule the physical information
inform the BSC with the HANDOVER DETECTION and waits for the BTS
layer to inform it about the first received frame to stop a timer.
2014-03-10 13:38:07 +01:00
Andreas Eversberg 8ade45e795 handover: Set basic values for handover, remember the activation reason
Introduce the handover.h/handover.c and initialize handover parameters
in OML and remember the activation through RSL.
2014-03-10 13:38:07 +01:00
Andreas Eversberg 3058854535 handover: Implement generating HANDOVER DETECTION in rsl_tx_hando_det 2014-03-10 13:38:07 +01:00