aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
AgeCommit message (Collapse)AuthorFilesLines
2015-02-05power: Make it possible to force a power levelsysmocom/0.3.0-doraHolger Hans Peter Freyther1-0/+23
Use the standard RSL commands to order a logical channel to use a fixed power level. The code is not fully verified and there was a last minute change to invoke bts_model_adjst_ms_pwr. Conflicts: tests/stubs.c
2015-02-05power/sysmobts: Add a manual ms power level controlHolger Hans Peter Freyther3-1/+28
Currently the DSP is instructed to achieve a given uplink power target but there are circumstances (e.g. EMV testing) where we need more control over it. The "manual/software/osmo" power control can only be implemented per TRX and not per lchan. Add a very very basic control that checks the MS Power used by the phone, the actual receive level and then adjust the power. The code doesn't take the history into account, if the phone can not reach the requested power level the code will be stuck (e.g. no timeout based on multiframes). It has a mode for a fixed power control but no way to set it yet. The change of the mode requires a restart of the software. Conflicts: include/osmo-bts/bts_model.h src/common/vty.c src/osmo-bts-sysmo/l1_if.c src/osmo-bts-sysmo/l1_if.h src/osmo-bts-sysmo/oml.c tests/sysmobts/sysmobts_test.c
2014-07-25amr: Avoid toggling the CMR from none and a set oneHolger Hans Peter Freyther1-0/+2
For LCR and other systems without out-of-band information we need to indicate the CMR. Not every air message will include the mode and we sent a stream that had the CMR set and not-set. This lead to the AudioCodes MGW only playing every second frame. Remember the last used mode and initialize it to _NONE when we receive the multirate config. In case of a real error we will still use AMR_CMR_NONE. The initial patch is from Harald. I have added the initialization and moving of the defines to amr.h. Manually verified by enabling AMR5.9 and looking at two RTP packages in sequence. In both cases the CMR was 2. I have looked at "amr.nb.cmr != 2" in wireshark and only found the MGCP dummy packet.
2014-05-22common: Ignore "si.valid" outside of _MAX_SYSINFO_TYPEHolger Hans Peter Freyther1-1/+1
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-22common: Remove unused gsm_time parameter from lchan_sacch_getHolger Hans Peter Freyther1-1/+1
2014-05-15abis: Separate initialization from connect for AbisHolger Hans Peter Freyther1-12/+11
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-04-19handover: Call the right function and avoid recursionHolger Hans Peter Freyther1-1/+1
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-03oml: Pass all valid state change requests to the modelJacob Erlbeck1-5/+4
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-03-27agch/pcu: Fix crash for AGCH commands queued by the PCUHolger Hans Peter Freyther1-1/+2
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 37c332e5bfdb9591a1cd3cc6746afffdb1cd13b9 and the commit d290ee029a827c870f97372b98f0dbd7d057402a. 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-26oml: Indicate the kind of object passed as the void*Holger Hans Peter Freyther1-3/+3
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-12misc: Fix the build breakage now that we have btsconfig.hHolger Hans Peter Freyther2-0/+4
Include the btsconfig.h for the PACKAGE_VERSION variable.
2014-03-10agch: Remove obsolete commentJacob Erlbeck1-1/+0
Use of configuration variables has already been implemented here, so the TODO comment is removed. Sponsored-by: On-Waves ehf
2014-03-10handover: Add generic handling for handoverAndreas Eversberg1-0/+112
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-10handover: Set basic values for handover, remember the activation reasonAndreas Eversberg5-3/+67
Introduce the handover.h/handover.c and initialize handover parameters in OML and remember the activation through RSL.
2014-03-10handover: Implement generating HANDOVER DETECTION in rsl_tx_hando_detAndreas Eversberg1-0/+22
2014-03-10handover: Introduce debug area for handover related itemsAndreas Eversberg1-0/+6
2014-03-10agch: Merge IMM.ASS.REJ if possible when enqueueingJacob Erlbeck1-0/+140
This patch implements merging of IMMEDIATE ASSIGN REJECT messages as suggested in GSM 08.58, 5.7. When a new IMM.ASS.REJ is to be appended to the AGCH queue and the last message in that queue is of the same type, the individual entries (up to 4 per message) of both messages are extracted, combined and stored back. If there are less than 5 entries, all entries fit into the old message and the new one is discarded. Otherwise, the old message will contain 4 entries and the remaining ones are stored into the new one which is then appended to the queue. Ticket: SYS#224 Sponsored-by: On-Waves ehf
2014-03-10agch: Add VTY queue management configurationJacob Erlbeck1-0/+43
This patch adds the following VTY commands to tune AGCH queue handling: agch-queue-management default agch-queue-management threshold THRES low LOW high HIGH Examples: agch-queue-management default Resets queue management to default parameters. agch-queue-management threshold 0 low 25 high 75 Start dropping at 25%, drop all messages above 75% queue length (relative to max queue length corresponding to T3126). Between low and high, drop with a probability interpolated linearly between 0 (low) and 1 (high). agch-queue-management threshold 50 low 0 high 0 Start dropping at 50% and continue until all IMM.ASS.REJ have been removed from the front (output) of the queue Sponsored-by: On-Waves ehf
2014-03-10agch: Manage AGCH queue lengthJacob Erlbeck1-9/+98
Currently, the AGCH queue length is not limited. This can lead to large delays and network malfunction if there are many IMM.ASS.REJ messages. This patch adds two features: - Don't accept msgs from the RSL layer when the queue is way too full (safety measure, mainly if bts_ccch_copy_msg() is not being called by the L1 layer, currently hard coded to 1000 messages) - Selectively drop IMM.ASS.REJ from the queue output depending on the queue length Ticket: SYS#224 Sponsored-by: On-Waves ehf
2014-03-10agch/pch: Use PCH for AGCH msgsJacob Erlbeck2-4/+16
This patch extends paging_gen_msg() by adding an output parameter is_empty that is true, if only a paging message with dummy entries has been placed into buffer. This feature is then used by bts_ccch_copy_msg() to insert an AGCH message if is_empty is true. Ticket: SYS#224 Sponsored-by: On-Waves ehf
2014-03-10agch: Add simple countersJacob Erlbeck2-0/+9
Counters are added for the following events (use VTY show to query): - Dropped IMMEDIATE ASSIGN REJECT messages - Merged IMMEDIATE ASSIGN REJECT messages - Rejected AGCH messages - Use of PCH (non-reserved) for AGCH messages - Use of AGCH (reserved) for AGCH messages Sponsored-by: On-Waves ehf
2014-03-10agch: Recalculate length limit of AGCH queueJacob Erlbeck1-1/+89
This patch adds a function bts_update_agch_max_queue_length() to compute a limit of the AGCH queue. This is based on the idea, that the AGCH queue has a limited drain rate and that CHANNEL REQUESTs must be answered within a certain time frame, given by the minimum value of T3126 (see GSM 04.08). When the AGCH queue reaches that limit, the last message would be delivered in time if there were no other delays involved (which is not the case). The calculation is based on the ratio of the number RACH slots and CCCH blocks per time: Lmax = (T + 2*S) / R_RACH * R_CCCH where T3126_min = (T + 2*S) / R_RACH R_RACH is the RACH slot rate (e.g. RACHs per multiframe) R_CCCH is the CCCH block rate (same time base like R_RACH) The value depends control_channel_desc.ccch_conf and rach_control.tx_integer (both from SYSINFO_TYPE_3) and should therefore by called at least each time after one of these is changed. For this reason, a signal callback is registered under SS_GLOBAL/S_NEW_SYSINFO which invokes bts_update_agch_max_queue_length(). Sponsored-by: On-Waves ehf Based-On: "bts: Calculate length of agch queue" by Ivan Kluchnikov <kluchnikovi@gmail.com>
2014-02-24pcu: Avoid crash when closing the PCU socketHolger Hans Peter Freyther1-1/+3
When closing the PCU socket all channels will be closed. In that case the LAPDm structures might not have been allocated. Mark the channel as LCHAN_REL_ACT_PCU to avoid going through the RSL code for sending the message. This avoids a crash when "gprs none" is selected but one still configures a PDCH and then connects/disconnects the pcu. #0 llist_del (entry=0x0) at ../include/osmocom/core/linuxlist.h:119 #1 msgb_dequeue (queue=0x400bbc58) at msgb.c:102 #2 0x40110d28 in lapd_dl_flush_tx (dl=0x400bbba0) at lapd_core.c:173 #3 0x40112cb4 in lapd_dl_reset (dl=0x400bbba0) at lapd_core.c:307 #4 0x40112d00 in lapd_dl_exit (dl=0x400bbba0) at lapd_core.c:321 #5 0x40115d80 in lapdm_entity_exit (le=<optimized out>) at lapdm.c:169 #6 0x40115d9c in lapdm_channel_exit (lc=0x400bbb94) at lapdm.c:180 #7 0x0001a334 in rsl_tx_rf_rel_ack (lchan=0x400bbb00) at rsl.c:505 #8 0x0000e908 in lchan_deactivate_sapis (lchan=0x400bbb00) at oml.c:1427 #9 sapi_queue_exeute (lchan=0x400bbb00) at oml.c:547 #10 0x0000ead0 in sapi_queue_send (lchan=<optimized out>) at oml.c:571 #11 queue_sapi_command (lchan=<optimized out>, cmd=<optimized out>) at oml.c:609 #12 queue_sapi_command (lchan=0x400bbb00, cmd=<optimized out>) at oml.c:601 #13 0x0000faf0 in enqueue_rel_marker (lchan=0x400bbb00) at oml.c:1440 #14 lchan_deactivate (lchan=0x400bbb00) at oml.c:1447 #15 0x0001004c in bts_model_rsl_chan_rel (lchan=<optimized out>) at oml.c:1647 #16 0x0001de30 in pcu_sock_close (state=0x62788) at pcu_sock.c:654 #17 0x0001e150 in pcu_sock_read (bfd=0x627a8) at pcu_sock.c:698 #18 pcu_sock_cb (bfd=0x627a8, flags=1) at pcu_sock.c:755
2014-02-24Revert "bts/vty: Use new vty_install_default() function, adjust prompts"Holger Hans Peter Freyther1-4/+35
This reverts commit bbfd21a36cdd10c3b8d83a329042d9ebfb4c5250.
2014-02-24agch: Log error if BS_AG_BLKS_RES is != 1 in SI3Jacob Erlbeck1-0/+6
Currently, the DSP is always configured with u8NbrOfAgch = 1 before SYSINFO type 3 is received. Thus using a different value for BS_AG_BLKS_RES may lead to inconsistencies and MS failing to receive paging messages properly. This patch adds a warning and error logging and should be reverted when initialisation is done in proper order. Sponsored-by: On-Waves ehf
2014-02-22agch/pch: Put CCCH message generation into commonJacob Erlbeck1-0/+22
This patch adds a common function bts_ccch_copy_msg() that provides and schedules AGCH and PCH messages. It is basically a frontend to paging_gen_msg() and bts_agch_dequeue() and contains refactored code from l1_if.c. Sponsored-by: On-Waves ehf
2014-02-22agch: Keep track of AGCH queue lengthJacob Erlbeck1-1/+7
This patch adds and updates btsb->agch_queue_length to keep track of the queue length. Sponsored-by: On-Waves ehf
2014-02-22agch/rsl: Fix msgb handling for IMMEDIATE ASSIGNJacob Erlbeck1-1/+3
Currently, the msg->data pointer is just set to the IMMEDIATE ASSIGN message and the len is adjusted accordingly. Unfortunately, this leaves l2h (pointing to the RSL header) and l3h (pointing to the FULL_IMM_ASS_INFO IE) in an undefined state (outside of [data, tail]). The code in bts.c accesses the message via msg->data. This patch sets l3h and l2h correctly. msgb_l3() will point to the start of the IMM ASS message and should be used instead of msg->data. Sponsored-by: On-Waves ehf
2014-02-22bts/vty: Use new vty_install_default() function, adjust promptsJacob Erlbeck1-35/+4
This patch removes the local 'end' and 'exit' implementations (which aren't used anyway) and uses the generic ones provided by libosmocore instead, which are enabled automatically when vty_install_default() is used. The prompt strings are modified to match those in libosmocore/openbsc. Ticket: OW#952 Sponsored-by: On-Waves ehf
2014-02-19rsl: Do not allow IPA CRCX on non traffic channelsHolger Hans Peter Freyther1-0/+5
Use 0x52 as error cause as the nanoBTS is doing the same under the situation. This has been spotted while testing handover using the VTY command for handover.
2014-02-19rsl/si: Fix resetting bits in bts->si_validJacob Erlbeck1-2/+2
Use 'var &= ~(1 << x)' to reset bits instead of 'var &= (1 << x)'. Sponsored-by: On-Waves ehf
2014-01-21common/rsl.c: Allow bts_model_rsl_chan_act() to return negative causeHarald Welte1-1/+6
If the channel couldn't be activated, the function can simply return a negated RSL_ERR_* constant which will then be propagated towards the BSC in an CHAN_ACT_NACK RSL message.
2014-01-21common/oml.c: Send OML NACK if bts_model_check_oml() returns negativeHarald Welte1-6/+4
This way, bts_model_check_oml() can return a negated NM_NACK_* constant which will then be sent as cause value in the corresponding SET_ATTR_NACK back to the BSC.
2013-12-28measurement: Speculative performance changeHolger Hans Peter Freyther1-1/+14
Most timeslots do not have eight lchan. Use the subslots_per_lchan map to reduce the number of iterations. Looking at the ARM assembly showed that no loop-unrolling was done so this could be a speed up.
2013-11-27bts: Fix crash of receiving data during the release processHolger Hans Peter Freyther1-2/+13
Release/Free the lapdm resources _after_ the channel has been fully released. Do not forward data unless the lchan is in the active state. Reading this code again, there is probably a memory leak for everytime the PCU will re-connect to the BTS. (gdb) p lchan->state $4 = LCHAN_S_REL_REQ (gdb) bt #0 lapd_dl_flush_hist (dl=0x40454894) at lapd_core.c:164 #1 0x44873b54 in lapd_rx_u (lctx=0xbe9bd5a8, msg=0x92f90) at lapd_core.c:1040 #2 lapd_ph_data_ind (msg=0x92f90, lctx=0xbe9bd5a8) at lapd_core.c:1644 #3 0x44876d50 in l2_ph_data_ind (link_id=<optimized out>, chan_nr=<optimized out>, le=<optimized out>, msg=0x92f90) at lapdm.c:637 #4 lapdm_phsap_up (oph=<optimized out>, le=<optimized out>) at lapdm.c:707 #5 0x0000c504 in handle_ph_data_ind (l1p_msg=0x97358, data_ind=0x97420, fl1=<optimized out>) at l1_if.c:774 #6 l1if_handle_ind (fl1=<optimized out>, msg=0x97358) at l1_if.c:892
2013-11-14rsl: Rename abis_rsl_sendmsg to avoid symbol clash with libosmo-abisHolger Hans Peter Freyther2-20/+20
Nicolas ended up with linker issues due abis_rsl_sendmsg being defined twice. Rename our version of the function and update the code. Patched with: @i@ expression E; @@ - abis_rsl_sendmsg(E) + abis_bts_rsl_sendmsg(E)
2013-11-05sysmobts: Do a RF mute when Radio Carrier is lockedJacob Erlbeck1-0/+5
Currently a Change Administrative State Request is just applied unconditionally to the object's state object and then acknowledged. This patch implements the special handling of setting the Radio Carriers state to LOCK or UNLOCK. This is done by passing the appropriate mute command to the L1 layer. Always all radio channels are affected, it is not possible to lock single radio channels. On success, an ACK is sent back to the bsc with the new state (based on the state passed in the callback by the L1 layer). If something went wrong or the firmware doesn't support RF mute, a NACK (REQ_NOT_GRANTED) is sent instead. Note that a NACK for such a request hasn't been sent by the BTS to the BSC yet, so (albeit it's spec conformant to do so) the BSC must be prepared to handle this correctly. Ticket: OW#976 Sponsored-by: On-Waves ehf
2013-10-25rsl/pcu: Do not send a CHAN ACT to the BSC on PCU usageHolger Hans Peter Freyther2-0/+21
The PCU is forcing the activation of a PDCH. Currently the BSC will receive a channel act ack for a channel that was not activated at all. Use the "release_reason" flag of the lchan to see if we have requested a normal activation or a silent one. It feels a bit odd to do it in the TX function but it is the most easy solution right now. I have added logging so it will not be totally silent.
2013-10-10misc: Fix resource leak when the ioctl is failingHolger Hans Peter Freyther1-2/+2
Fixes: Coverity CID 1040759
2013-10-06abis: delay l1if_reset() until OML link is establishedHarald Welte1-1/+1
2013-10-06abis: Use OML remote (BSC) address if RSL CONNECT contains no IPHarald Welte3-7/+23
This introduces a new get_signlink_remote_ip() function whcih we also use in the RSL code to determine the RTP remote address if the CRCX/MDCX contains no remote IP address IE.
2013-10-06Call e1inp_vty_init() to make abis interface accessible from VTYHarald Welte1-0/+1
It might not be particularly useful, but then there's no disadvantage either...
2013-10-06migrate away from our own abis.c code to libosmoabisHarald Welte4-452/+168
libosmoabis has a BTS-side implementation of the IPA protocol for years, and osmo-bts should have used that all the time. Unfortunately it had its own local hack, this patch is migrating to the libosmocore implementation.
2013-07-16oml: Remove the unused nofh variable from oml_mo_tx_sw_act_repHolger Hans Peter Freyther1-3/+1
The variable was assigned but nothing was done with it, just remove it for now. Fixes: Coverity CID 1040758
2013-07-09rsl: Fix the audio handling after the 'alignment' handling fixHolger Hans Peter Freyther1-26/+21
The issue got introduced in fcdba6bfaca9e016f35fc9fa826948ec74f66121 when moving from the uint32_t pointer to a plain int. The code was now like this: if (connect_ip > 0) { if (connect_ip == 0) lookup_ip_based_on_rsl ... Coverity detected this as logically dead code and it was breaking audio handling for the osmo-bsc case. Remove the tristate handling, the RSL behavior is that leaving out port/ip is like specifying it as zero. Fixes: Coverity CID 1040769
2013-06-30make oml_mo_state_init() a void functionHarald Welte1-1/+1
... so we don't get warnings about not returning anything
2013-06-30Don't send OML STATE CHANGE before OML is connectedHarald Welte2-5/+12
Instead of calling oml_mo_state_chg() [which transmits OML STATE CHG] during bts_init(), we use a new oml_mo_state_init() function which simply sets the state.
2013-06-24lapd: Fix a +ptrsize memory leak for each opened lchanHolger Hans Peter Freyther1-1/+1
The lapdm/lapd_core code needs to keep a history of messages sent. This history is not freed when lapdm_channel_reset is called and the init code will just allocate a new array. This means there is a memory leak on every released channel every time it is released.
2013-06-20rsl: fix the unaligned memory access0.3.0sysmocom/0.3.0-stableNicolas J. Bouliane1-14/+18
the armv5 can do 32bit/16bit reads only from the aligned address use tlv.h macro to copy data to local variable Signed-off-by: Nicolas J. Bouliane <nicolas.bouliane@nutaq.com>
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning