Commit Graph

1018 Commits

Author SHA1 Message Date
Philipp Maier 93f3102da9 rsl: improving the log output
to show more details about the payload type and the connection

Change-Id: Ifaa253e5baed5ca364dfbc046a7cb559f106bfbd
2016-10-12 10:17:43 +00:00
Philipp Maier b8b939faa9 octphy: prevent mismatch between dsp-firmware and octphy headers
in its current statue l1_oml.c does not check if the version
number in the header files (octvc1_main_version.h) matches up
the version that is reported from the DSP during startip. This
patch ads a check to make sure that the currently loaded
firmware and the headers used during compile time match. If
a mismatch is detected, osmo-bts exits immediately.

Change-Id: Icba5756517d632d53b129c5ce1a1dab4936dab91
2016-10-12 09:57:18 +00:00
Max 4ca5be766c Move copy-pasted array into shared header
Change-Id: I377ece2845830e3defab2d515f44b629ce5aed8e
2016-10-12 09:30:06 +00:00
Max 9f9b96a67b DTX: fix conversion from fn to ms
Previously FN was converted to millisecondss incorrectly due to wrong
conversion between FN and a number of voice samples. The conversion
should be based on following:
* there are 12/13 useful frames for audio in TCH
* there is 1 RTP packet per 4 frame
* there are 160 samples per RTP packet

Fixes: OS#1801
Change-Id: I9cc70cacabde98621aa892cee74f4ac461645093
2016-10-11 18:20:15 +02:00
Yves Godin c1b86d80d1 DTX: fix 1st RTP packet drop
Use "impossible" dummy value to initialize last_fn to prevent dropping
of 1st RTP frame due to timestamp jump.

Fixes: OS#1803
Change-Id: I485af21f6761048d12dc7f5552fcdd46daf786ed
2016-10-11 15:50:29 +00:00
Philipp Maier 8b39ff8bcf octopy: fixing renamed constant
The constant cOCTVC1_HW_CLOCK_SYNC_MGR_STATE_ENUM_UNUSED in header
file octvc1/hw/octvc1_hw_api.h has been renamed to
cOCTVC1_HW_CLOCK_SYNC_MGR_STATE_ENUM_IDLE. This commit adds an ifdef
decision in to code to ensure that older header files will still work.

Change-Id: I4c0b976d29689ace06741c5943434fc33ee2df14
2016-10-06 10:12:04 +00:00
Philipp Maier f5494e84e8 octphy: reintroducing multi-trx support
The multi-trx had to be removed because of build conflicts
with octphy header that lack the struct members for needed
to support multi-trx.

For details see the following revert-commits:
ed6b48e4a5
c9a1f284ac

This commit reintroduces multi trx support and ads an ifdef
decision to ensure that header files without multi-trx
support still work.

Change-Id: I7f9b2906cc149c817183745b4c96bcc7f9ebdad0
2016-10-06 09:48:02 +00:00
Max 5f2e2de84f DTX: send AMR voice alongside with ONSET
When ONSET event happens (either via Marker bit or due to unmarked
talkspurt) we should first send Onset event to L1 and than send voice
data in response to the same PH-RTS.ind.

Change-Id: I2a7b89430ca49eee4a350c5f980bd6bcbc386347
2016-09-30 19:13:08 +02:00
Max 067ef3f1ce DTX: move ONSET detection into separate function
Move code from tch.c (lc15, sysmo) into generic function which:
- check if talkspurt is happening
- cache SID if necessary or invalidate cache
- fill in CMR & CMI prefix

This also fixes the problem when SID FIRST was cached without sending
just like SID UPDATE instead of being sent right away.

Change-Id: I6c7016a54749abadeef4fd4f5b6f750b256fb916
2016-09-30 19:09:04 +02:00
Max 9959f45d90 DTX: further AMR SID cache fixes (lc15, sysmo)
* consolidate AMR CMR and CMI handling in common/amr.c
* use it in save_last_sid()
* remove dead code
* properly compute RTP payload length for AMR
* use save_last_sid() for FR & HR as well
* invalidate cached SID if SPEECH frame is received

Fixes: OS #1800, #1801
Change-Id: I5a1c1ad0b0a295a50e67775a4db85f1d331755ed
2016-09-30 18:57:00 +02:00
Max 7dffd553df DTX: move scheduling check inside repeat_last_sid
Note: this also require changes to properly link against libosmocodec -
see 2bb65be159dfdabf664fec569b343320301701b0 in libosmocore.

Change-Id: I96594cf3aa1013d505bd20069d5bf261d9a2aefb
2016-09-30 16:50:47 +02:00
Max 94fa25295f LC15: Clarify msgb ownership / fix memory leaks
This is similar to 21b020b336 which
changes the way msgb is allocated/freed in sysmobts.

Change-Id: I393828a7b1fb5927453ee25f54d605a5d3ea7087
2016-09-30 11:36:29 +02:00
Max 1559678fa2 DTX: remove misleading comment
There's no SID stored in UL direction so there's nothing to remove.

Change-Id: I3f587a66406bc6a02b859e826f4903641fcc5a15
2016-09-26 16:31:25 +02:00
Max 654175f33b DTX: check Marker bit to send ONSET to L1
If Marker bit is set than it's a talkspurt which we have to explicitly
indicate to L1 by first sending ONSET message and than actual voice
data in a separate message.

This change affect sysmobts and LC15 hw.

Change-Id: I88c41568bcb0d82699f617adc4ad192603dd1bb6
Related: OS#1750
2016-09-24 15:09:31 +02:00
Neels Hofmeyr eb08a87be5 sysmobts_mgr, lc15bts_mgr: fix tall context for telnet vty
Instead of passing the msgb ctx to telnet_init(), pass the *mgr* ctx.

Change-Id: I213fe52648a1937d8f8c1730ce787e42f0add75f
2016-09-24 03:36:22 +00:00
Philipp Maier a570e05ec8 octphy: Fixing band selection for ARFCN 0
There is now an exception for ARFCN 0 in osmocom_to_octphy_band to
distingush ARFCN 0 (E-GSM) and 1-124 (P-GSM).

Change-Id: If012f31121e9d0d45b36459807c5f290aa17374f
2016-09-24 03:25:01 +00:00
Philipp Maier e2069d968c octphy: Fixing missing payload type in ph. chan. activation
in l1_oml.c:ts_connect() the payload type (ulPayloadType) was not
configured to full-rate for PDTCHF PACCHF and PTCCHF. Older octasic
firmwares (below octsdr-2g-02.06.00-B964-alpha) will tolerate this,
newer versions will crash during channel initalitation.

Change-Id: Id2f6a439ceb063b10efc7b9d1d70bb5b29a01033
2016-09-24 03:21:27 +00:00
Max c77b574d1f lc15, sysmo: Use SID_FIRST_P1 to initiate DTX
Some phone seems to not send SID_FIRST_P2 message which seems like a
different understanding of the DTX spec. L1 accommodates for that by
using P1 to supply data for SID. Hence we should use it to initiate DTX
and ignore P2 message in case of AMR HR.

Change-Id: Iaf993b89caa0ad49b97d1c745dcaf039f867f018
2016-09-23 17:13:14 +02:00
Max 70460814ce DTX: fix SID logic
Previously receiving SID via RTP always caused it's transmission to L1
regardless of the time which might have resulted in excess traffic. Fix
this by only saving SID data and transmitting it later on as necessary
according to 3GPP TS 26.093 A.5.1.1.

Change-Id: Ifcdc5c60d0238b704a94f6778d4e00f2b087b090
Fixes: OS#1801
2016-09-23 17:03:00 +02:00
Max 527dd402c7 DTX: fix SID repeat scheduling
Previously SID retransmission was scheduled incorrectly based on GSM
frames instead of voice frames. Fix this by using GSM Fn only as elapsed
time estimation:

* move saved SID retransmission into generic function from lc15 and sysmo
specific code
* split retransmission time check into separate generic function
* compute estimation for elapsed time since last retransmission using
  GSM Fn

Change-Id: Ib054b458a7345d9ba40dba53754ca59ab099c8e8
Fixes: OS#1799
2016-09-23 16:57:05 +02:00
Max 80473a113d DTX: fix last SID saving
Previously SID was saved explicitly by each BTS model (lc15, sysmo)
instead of relying on generic function. Fix it by using generic function
and propagating necessary parameters for it.

Change-Id: Ie545212cce5ed2b3ea3228597f18a473f5e1deb4
Fixes: OS#1800
2016-09-23 14:53:46 +00:00
Neels Hofmeyr 0a05181603 heed VTY 'line vty'/'bind' command
Like most other osmo-* programs, bind the telnet VTY to the address specified
by the 'line vty'/'bind' command. This is added by vty_init(), so until now the
BTS offered this config but ignored it.

Change-Id: Ic4ab32aee08d8a779adeb9943892de0c828c7b3d
2016-09-22 07:04:54 +02:00
Neels Hofmeyr b4969cc915 log causing rx event for lchan_lookup errors
Add log_name to lchan_lookup() and pass such from the various RSL rx events
that call it to validate the RSL chan_nr.

Change-Id: I0d9923f47ac655b204169eec302d607412d5754d
2016-09-19 02:12:23 +00:00
Neels Hofmeyr a91b2d9691 log: sysmo,lc15: tweak log about sapi_cmds queue
The osmo-bts log used to say this a lot:

DL1C <0006> oml.c:758 (bts=0,trx=0,ts=0,ss=1) End of queue encountered. Now empty? 1

- Move this to DEBUG level instead of NOTICE.

- Tweak wording and logic so it says one of:
  [...] End of SAPI cmd queue encountered. Queue is now empty.
  [...] End of SAPI cmd queue encountered. More pending.

Change-Id: I5a46c90d016cee9b50f32db2af568765d3cb74cc
2016-09-17 09:58:27 +00:00
bhargava ac84afa409 Update parameters in osmo-bts-sysmo for 11bit RACH
Based on the indication from L1, number of bits in RACH and burst
type is determined. Appropriate parameters are filled in osmo-bts-sysmo
These parameters are sent to osmo-pcu for processing of the RACH.

Change-Id: I93831ddfb3f31b637e6a576f23a9bb4557758582
2016-09-14 01:17:33 +00:00
Neels Hofmeyr d44f0772f9 dyn TS: if PCU is not connected, allow operation as TCH
Before this patch, Osmocom style TCH/F_TCH/H_PDCH dyn TS were paralyzed if no
PCU was running. The state of the dyn TS would lock up in the PDCH activation
phase since the PCU never completed the process.

Make more robust, i.e. don't concern the BSC with PDCH activation failures.
This matches the way plain PDCH TS work: besides declaring the TS as PDCH, the
BSC is not involved and is not told about errors.

During PDCH deactivation, still wait for the PCU to tear down the PDTCH SAPIs,
but in case no PCU is connected, send a rel ack right away.

Thus, the BSC will happily switch Osmocom style dynamic timeslots to and from
PDCH mode, using the dyn TS as voice channels as needed, and not caring about
possible PDCH failures. GPRS starts working right away as soon as a PCU
connects, regardless of dyn TS having been used for voice any number of times,
and without another switchover needed.

In detail:

In rsl_rx_chan_activ(), upon receiving a PDCH activation, send an RSL chan act
ack right away, unconditionally (with an explaining comment). Do not concern
the Abis link with PDCH activation failures.

Since we're acking right away now, drop the chan act ack that would follow
after the PCU activation: as before dyn TS, only send acks and nacks for
rel_act_kind == LCHAN_REL_ACT_RSL (PDCH runs as LCHAN_REL_ACT_PCU).

In dyn_ts_pdch_release, indicate that the PCU is not connected by means of
returning 1. In rsl_rx_rf_chan_rel(), use this indicator to send a rel ack
right away if the PCU is not connected.

Change-Id: I2a0b9730197786b99ff3bc1f08c75f7d279cb1f7
2016-09-09 06:45:27 +00:00
Neels Hofmeyr 3cc91746a3 octphy: fix build with OCTSDR-OPENBSC-02.07.00-B708: name changed
There was an apparent change of name from
 cOCTVC1_HW_CLOCK_SYNC_MGR_STATE_ENUM_IDLE
to
 cOCTVC1_HW_CLOCK_SYNC_MGR_STATE_ENUM_UNUSED
in:

git://git.osmocom.org/octphy-2g-headers
commit 953a258aadf18c05e8128a339f15b1c5bb377cfd
"Import headers from OCTSDR-OPENBSC-02.07.00-B708.tgz"

In order to build octphy with these headers, apply the same rename in
osmo-bts-octphy/*.

Change-Id: Ic07055860035a7c1b83ab923817423eeb39f33d3
2016-09-06 15:41:10 +02:00
Neels Hofmeyr c9a1f284ac octphy: fix build: Revert "octphy: add support for multiple trx ids"
This reverts commit c4fc00d851, except: we keep
the part that sets the trx_id in bts_model_phy_instance_set_defaults().

Theoretically, this patch makes a lot of sense, but in order to be able to
build osmo-bts-octphy until the headers version is clarified, revert use of
usCentreArfcn:

Above commit uses an usCentreArfcn member that is never defined in the history
of our octphy-2g-headers.git. This usCentreArfcn does exist in a code snapshot
OCTSDR-2G-02.05.00-B780-DEBUG, which is not (yet?) publicly available.

Also, the current headers version is apparently 02.07, though the octasic
version numbers have been known to cause confusion among osmocom folks.

This along with one other revert fixes this build problem:

make[3]: Entering directory '/n/s/octphy/git/osmo-bts/src/osmo-bts-octphy'
  CC       l1_oml.o
l1_oml.c: In function ‘l1if_trx_open’:
l1_oml.c:1350:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
   oc->Config.usCentreArfcn = plink->u.octphy.center_arfcn;
             ^
l1_oml.c:1352:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
   oc->Config.usCentreArfcn = trx->arfcn;
             ^
In file included from ../../include/osmo-bts/logging.h:5:0,
                 from l1_oml.c:33:
l1_oml.c:1365:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
   oc->Config.usCentreArfcn, oc->Config.usTsc, oc->RfConfig.ulRxGainDb,
             ^

Change-Id: Ic643709e8fb3df2d66337190ed1f07fd230d7dca
2016-09-06 15:40:09 +02:00
Neels Hofmeyr ed6b48e4a5 octphy: fix build: Revert "octphy: fix for multiple trx with more than 1 dsp"
This reverts commit 06968beab9.

Theoretically, this patch makes a lot of sense, but in order to be able to
build osmo-bts-octphy until the headers version is clarified, revert use of
usCentreArfcn:

Above commit uses an usCentreArfcn member that is never defined in the history
of our octphy-2g-headers.git. This usCentreArfcn does exist in a code snapshot
OCTSDR-2G-02.05.00-B780-DEBUG, which is not (yet?) publicly available.

Also, the current headers version is apparently 02.07, though the octasic
version numbers have been known to cause confusion among osmocom folks.

This along with one other revert fixes this build problem:

make[3]: Entering directory '/n/s/octphy/git/osmo-bts/src/osmo-bts-octphy'
  CC       l1_oml.o
l1_oml.c: In function ‘l1if_trx_open’:
l1_oml.c:1350:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
   oc->Config.usCentreArfcn = plink->u.octphy.center_arfcn;
             ^
l1_oml.c:1352:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
   oc->Config.usCentreArfcn = trx->arfcn;
             ^
In file included from ../../include/osmo-bts/logging.h:5:0,
                 from l1_oml.c:33:
l1_oml.c:1365:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
   oc->Config.usCentreArfcn, oc->Config.usTsc, oc->RfConfig.ulRxGainDb,
             ^

Change-Id: I222766f6961f5f35aa3651e2907e3e908fe9a66e
2016-09-06 15:28:44 +02:00
Neels Hofmeyr bf6bae2b23 common/rsl: move decision whether to chan act ack/nack to common function
Prepare for a dyn TS patch that needs to call rsl_tx_chan_act_ack() directly
without the rel_act_kind decision.

Add function rsl_tx_chan_act_acknack() to wrap rsl_tx_chan_act_ack() and
rsl_tx_chan_act_nack(). Move the decision whether to drop the ack/nack, based
on lchan->rel_act_kind, to the new function, losing some code dup.

Change all callers to use the new function; drop the two older ones from rsl.h
and make them static.

Note: for nack, the exception for dyn TS in PDCH mode was missing
(rsl_tx_chan_act_nack() had only the rel_act_kind != LCHAN_REL_ACT_RSL
condition, but should also have had the dyn TS exception as in
rsl_tx_chan_act_ack()). I already know that this exception will again be
removed in an upcoming commit, but for patch readability it logically makes
sense to add it here. To easily include the nack case, drop the check for which
pchan the dyn TS is operating as, because a rel_act_kind == LCHAN_REL_ACT_PCU
implies that it is either already in or trying to become PDCH mode.

Change-Id: I57ba60c670730c6d7877a6a9b96ece0a7679a0bb
2016-09-02 04:12:16 +02:00
Neels Hofmeyr 8a148613b4 Fix ip.access style dyn PDCH, broken in 37af36e85e
Commit "sysmo,lc15: ts_connect_as(): log error also for pchan_as == TCH/F_PDCH"
introduced a check for TCH/F_PDCH intended only for TCH/F_TCH/H_PDCH. It looked
correct, but TCH/F_PDCH startup was designed differently:

For TCH/F_PDCH, the idea was to look it up in pchan_to_logChComb[] and obtain
the TCH/F channel combination, so that TCH/F_PDCH first initialize as TCH/F.
So pchan was in fact intended to be passed as TCH/F_PDCH.

For Osmocom TCH/F_TCH/H_PDCH, we've in the meantime added a ts_opstart()
function that makes this decision explicitly. So, instead of reverting the
erratic commit, add TCH/F_PDCH to ts_opstart(), for both sysmo and lc15.

In ts_opstart(), move to a switch statement to resolve the actual pchan to use
for ts_connect_as().

Drop TCH/F_PDCH and TCH/F_TCH/H_PDCH from pchan_to_logChComb[] and comment.

Change-Id: I376b92a06f4cbe943c1c913dea7487fac53a7d08
2016-08-30 12:38:04 +00:00
Neels Hofmeyr 4dfc3da96b dyn TS: sysmo,lc15: ph_data_req: fix PDCH mode detection
Though this patch theoretically makes a lot of sense, it is not entirely clear
why dyn TS are working without it. Committing due to common sense, not to fix
any actual breakage.

Change-Id: I6136cb42a4d627ebefc963eb5321fadfe63cca4b
2016-08-30 07:35:48 +00:00
Neels Hofmeyr 9faaf4ecf0 cosmetic: common ts_is_pdch()
Have one common ts_is_pdch(), placed in lchan.c, since this file is pretty
empty and pretty close to ts. Publish in gsm_data.h.

Remove the if-style implementation from l1sap.c, and instead implement in a
switch statement.

This prepares for upcoming ts_is_pdch() usage in ph_data_req() for sysmo and
lc15.

Change-Id: Ib78d663fdbac5a1d7053f1b9d543649b66da00e2
2016-08-30 07:35:47 +00:00
Neels Hofmeyr 3b2e5de3ae dyn TS: measurement: use correct nr of subslots, rm code dup
In measurement.c, fix the number of sublots for TCH/F_TCH/H_PDCH, by using
ts_subslots() from gsm_data_shared.c. The local dup of subslots_per_pchan[] is
no longer needed. (depends on recent commit to openbsc.git for ts_sublots())

Change-Id: I9d9df470c49487bffd56dde42c7bec0da2f50642
2016-08-30 07:35:47 +00:00
Neels Hofmeyr 988f634c97 log: l1sap: add 0x to hex output of chan_nr, 5 times
Change-Id: I187a74fd255dbdfb9bfb1e32786031a66f013efb
2016-08-27 12:31:32 +00:00
bhargava e77bcaecb6 Change interface in osmo-bts for 11 bit RACH
Interface structure between osmo-bts and osmo-pcu is updated with the
parameters to differentiate the type of RACH and further support 11 bit
RACH. The function prototype and definitions are changed accordingly.
Interface version number is increased.

Change-Id: I4f4c501b2d86d77c78de32a84b1804172ffb6f4d
2016-08-27 01:20:46 +00:00
Max 43d082e6f1 sysmo: ts_connect: log channel combination name instead of number
Change-Id: Ife11cfdb0f83d56ed61e66286a79b7c3a000cce5
2016-08-21 14:02:30 +00:00
Neels Hofmeyr 55c46022e1 sysmo: fix dyn TS: Revert "Activate PTCCH UL" [in sysmobts]
This reverts commit 53d792c3b0.
See http://osmocom.org/issues/1796

The commit caused this error for PDCH TS with SysmoBTS:

DL1P <0007> l1_if.c:164 Tx L1 prim MPH-ACTIVATE.req
DL1C <0006> oml.c:811 Error activating L1 SAPI PTCCH on TS 7: Invalid parameter
DL1C <0006> oml.c:1089 (bts=0,trx=0,ts=7,ss=0) act failed mark broken due status: -4

Plain PDCH TS show this error but continue to function despite the SAPI
activation failure.

As a side effect, the SAPI activation failure breaks dynamic TS. GPRS
initially works, but the broken status prevents transitions to TCH/* modes
in the BSC:

DRLL <0000> chan_alloc.c:355 Failed to allocate TCH_H channel
DRSL <0004> abis_rsl.c:1656 BTS 0 CHAN RQD: no resources for TCH_H 0x45

Since the commit only enabled PTCCH UL in sysmobts, no other BTS models are
affected. Notice that lc15 still has PTCCH UL disabled all the while, before
and after this commit and its revert.

Also note that PTCCH DL is and has been enabled without problems (see
further above in sapi_dir_pdtch_sapis[]). This is only about PTCCH UL.

Related: OS#1796
Change-Id: Ia59d95c75a8a5d3bd596f55cd1dc0906a6a95f7f
2016-08-12 12:07:04 +00:00
Neels Hofmeyr 37af36e85e sysmo,lc15: ts_connect_as(): log error also for pchan_as == TCH/F_PDCH
Change-Id: I76c868a1e70af16268a6fa42dc736cf0b288ecdb
2016-08-10 18:06:20 +02:00
Neels Hofmeyr 63849ebf71 dyn TS: measurement.c: replace fixme with comment
Change-Id: I04668f6f01a48157a98c6326a9ee48982a09ee62
2016-08-10 18:06:20 +02:00
Neels Hofmeyr 67a056c122 dyn TS: complete for TRX
Apply similar fixes as for TCH/F_PDCH also for TCH/F_TCH/H_PDCH:

Detect dyn TS in PDCH mode in ts_is_pdch().

In trx_set_ts(), enhance the "if (TCH_F_PDCH)" to a switch statement including
both dynamic channel types. Adjust the comment to include both kinds.

Change-Id: I6669739cd08780cd9ffb9451cdae9f6b9704c4fe
2016-08-10 18:06:20 +02:00
Mike McTernan ef8e2ef681 osmo-bts-trx: log decoder bit errors as DEBUG, not NOTICE
It is not an exceptional situation if the air-interface is experiencing
non-recoverable decoding errors.  At bad signal conditions and/or
interference, this is perfectly normal.  Let's use DEBUG instead of
NOTICE log level.

Change-Id: Ifd39c53ec22f57cdb5299e5d76ff6ff1482d3beb
2016-08-08 17:46:34 +00:00
Mike McTernan b7cdd381d6 osmo-bts-trx: Fix PCS1900 operation
As the ARFCN numbers in DCS (1800) and PCS (1900) are not unique,
we need to specify the band in the upper bits of the ARFCN value before
calling gsm_arfcn2freq10().

Change-Id: I637b76bc1fc749eed8e364412d76606589991c02
2016-08-08 17:45:25 +00:00
Max 4b76a323b3 Fill measurements data for L1SAP
Fill in values for BER, BTO, Link quality in L1SAP and send them to
PCU. Note: this increases the version of BTS <-> PCU protocol. It also
requires corresponding changes in libosmocore.

All BTS models provide measurements data unless direct DSP access for
PCU is enabled. For BTS-specific notes see below.

Octphy: conversion from sSNRDb to Link Quality uses formulae which works
in practice instead of what's documented for sSNRDb value. Subject to
change in future revisions.

TRX: C / I link quality estimator is not computed.

Change-Id: Ic9693a044756fb1c7bd2ff3cfa0db042c3c4e01c
Related: OS#1616
2016-08-08 17:41:27 +00:00
Tom Tsou d6920df630 trx: Fix coverity BER calculation NULL dereference
Allow output of encoded bit count or error count on BER calculation
without requiring both pointers to exist.

Change-Id: I2c78fa6a92a3b3da4aad8f70353e5a43451b0aa5
Fixes: Coverity CID 137963
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-28 11:48:25 -07:00
Neels Hofmeyr af3443385b dyn PDCH: trx l1_if.c: drop fixme, add comment
Change-Id: Ib240f21f4d460524767f4273fc9077617d1ffb43
2016-07-28 17:58:40 +02:00
Neels Hofmeyr 0d4b37d641 dyn PDCH: complete for trx: implement bts_model_ts_[dis]connect()
bts_model_ts_disconnect() has nothing to do.

bts_model_ts_connect() merely sets the new pchan on the ts.

Change-Id: Ieb66935d6efc26854e95d238e810c4f8b16cfa88
2016-07-28 17:58:05 +02:00
Neels Hofmeyr 45d3bbfb44 dyn PDCH: trx l1_if.c: factor out trx_set_ts_as_pchan() from trx_set_ts()
To be able to set a specific pchan type for dynamic channels, have the
trx_set_ts_as_pchan() function with an explicit pchan argument instead of
using ts->pchan.

Keep trx_set_ts() as a thin wrapper to use ts->pchan directly.

Change-Id: I9eeef05d2a6763f86a5b89ee7c3b4211f6736e4d
2016-07-28 17:58:05 +02:00
Neels Hofmeyr 576071d6ca dyn TS, dyn PDCH: common/l1sap.c: properly notice PDCH
In l1sap_ph_rts_ind(), l1sap_ph_data_ind() and to_gsmtap(), the decision
to handle a TS as PDCH was still missing for dynamic TS.

It is not yet clear why this did not impact functionality for dynamic timeslots
on other BTS models. AFAICT they should not work without this patch, but in
fact they do. It would be nice to clarify this some day.

Change-Id: I7b873a089a3de70d980885a7539cb91997464743
2016-07-28 17:58:05 +02:00
Max 5069c1c518 octphy: fix build
The error was introduced in 61372a20de.

Change-Id: I9585eec018b88c5d0548a0a55fa4130bb26aa5b6
2016-07-28 09:52:53 +00:00
Max 108b60faba Fix dsp tracing at phy config
Due to missing runtime cmd patching DSP tracing was not possible at phy
level of config file. No it is possible to specify it as follows:

...
phy 0
 instance 0
  dsp-trace-flag debug
  dsp-trace-flag mph_cnf
...

Change-Id: Ibbbf81d2c4b5d3adbcbc1f08a844d262e603e571
2016-07-28 09:38:04 +00:00
Vadim Yanitskiy ba656fff91 pcu_sock: use osmo_sock_unix_init() from libosmocore
Since the osmo_unixsock_listen() was moved to libosmocore
it would be better to use the library's implementation
instead of reinventing the wheel again.

Change-Id: Id5828649d44ef11e70946793696b0d689d6b35e3
2016-07-28 09:29:03 +00:00
Neels Hofmeyr 2b34ae32cf fix comment in common/l1sap.c, function name changed
Change was in 334df9441a
"cosmetic: clarify TCH/F_PDCH related naming and comments"

Change-Id: If3e353ea5796ee129bdd95e5f954e6c141cffec8
2016-07-28 06:31:24 +00:00
Max 53d792c3b0 Activate PTCCH UL
So far PTCCH was activated for DL but not for UL. Fix it.

Change-Id: I4fb5ecdfff1a6b8e8d77f561a9cf780f8e116f4d
Related: OS#1545
2016-07-28 06:21:21 +00:00
Tom Tsou dab54b9178 trx: Enable EGPRS handling through burst lengths
Existing interfaces are coded with the implicit expectation of using
a burst sequence length of 148, which is constant with GSM and GPRS.
That changes with EGPRS, where the burst length may be 444 due to
the use of 8-PSK instead of GMSK modulation.

Setup the interface to accept and return a length value with the
burst sequence. This allows 444 length bit vectors to/from the
EGPRS decoder/encoder. Length is explicitly used as a identifier for
8-PSK vs. GMSK modulated sequences.

Change-Id: I90b46b46b11b6ce280e7f8232d5a2fccec2d4f18
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-28 06:18:12 +00:00
Tom Tsou 9407e644b0 trx: Add EGPRS coding and decoding procedures
Handles uplink decoding and downlink encoding procedures for MCS 1-9.
Includes Type 1, 2, and 3 headers and tables from 3GPP TS 44.060 in
order to independently recover coding and puncturing scheme (CPS)
parameters for each coded message.

Change-Id: I0f059ae34c6f36179553cbc972f8becf8179eb55
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-28 06:18:12 +00:00
Neels Hofmeyr e07ba54d62 dyn TS: sysmo,lc15: chan_nr_by_sapi(): add missing assertion
Addition of GSM_PCHAN_TCH_F_TCH_H_PDCH should have added these assertions.
They clarify that only 'real' pchan types are expected in this function.

Change-Id: Ifd4b6820861ef716237e7eeed149b2add9e7d485
2016-07-27 16:24:52 +02:00
Neels Hofmeyr a888e95efa log typo: trx_sched_set_pchan()
Change-Id: Icdb193ec6dbb95cf0c3e441c196b309aa599efe6
2016-07-27 16:24:47 +02:00
Neels Hofmeyr dd34540ce4 comment typo: common/l1sap.c
Change-Id: I053766452ee01bed6136a9742551c664666a7989
2016-07-27 16:22:46 +02:00
Neels Hofmeyr 7b186adb0a dyn TS: implement litecell15 specifics
For chan_nr_by_sapi(), add GSM_PCHAN_TCH_F_TCH_H_PDCH to pick_pchan().

Add GSM_PCHAN_TCH_F_TCH_H_PDCH to pchan_to_logChComb[] for first pchan
initialization.

In ts_connect_as(), make sure that callers pass proper "real world" pchan
types, i.e. reject the "meta" GSM_PCHAN_TCH_F_TCH_H_PDCH pchan constant.

In ts_opstart(), connect as PCHAN_NONE since we will only know the desired
pchan when the first RSL chan activ is received.

Add GSM_PCHAN_TCH_F_TCH_H_PDCH to lchan_to_GsmL1_SubCh_t(), by using its
current "real" pchan mode.

Call cb_ts_[dis]connected() unconditionally, i.e. not only for TCH_F_PDCH when
a pending flag is set. The cb_ts_[dis]connected() will be a no-op if the pchan
type is not dynamic.

Change-Id: Ie30323f968da25027045c42a7ae7f1e70ca711ae
2016-07-25 22:13:44 +02:00
Neels Hofmeyr b0f77ce685 lc15/oml.c: rename ts_connect() to ts_opstart()
ts_connect() is only called during OPSTART. Name it such because a special
case for OPSTART will be added there for dyn TS.

Change-Id: Iba6880d94142096a8371b08f7404035912cadbb0
2016-07-25 22:13:44 +02:00
Neels Hofmeyr 090a41f897 dyn TS: implement SysmoBTS specifics
For chan_nr_by_sapi(), add GSM_PCHAN_TCH_F_TCH_H_PDCH to pick_pchan().

Add GSM_PCHAN_TCH_F_TCH_H_PDCH to pchan_to_logChComb[] for first pchan
initialization.

In ts_connect_as(), make sure that callers pass proper "real world" pchan
types, i.e. reject the "meta" GSM_PCHAN_TCH_F_TCH_H_PDCH pchan constant.

In ts_opstart(), connect as PCHAN_NONE since we will only know the desired
pchan when the first RSL chan activ is received.

Add GSM_PCHAN_TCH_F_TCH_H_PDCH to lchan_to_GsmL1_SubCh_t(), by using its
current "real" pchan mode.

Call cb_ts_[dis]connected() unconditionally, i.e. not only for TCH_F_PDCH when
a pending flag is set. The cb_ts_[dis]connected() will be a no-op if the pchan
type is not dynamic.

Change-Id: Iaffd2fc0aa9fc6c4a2acbc534ce6384392e0635b
2016-07-25 22:13:44 +02:00
Neels Hofmeyr 78458a3811 sysmo/oml.c: rename ts_connect() to ts_opstart()
ts_connect() is only called during OPSTART. Name it such because a special
case for OPSTART will be added there for dyn TS.

Change-Id: I09cc81e79661e8084aeebf8132435c207b2cf422
2016-07-25 22:13:44 +02:00
Neels Hofmeyr 21ffe07894 dyn TS: common TCH/F_TCH/H_PDCH implementation
common/l1sap: For dyn TS, the BSC will issue RSL Chan Activ requests with a
non-standard chan_nr. While the rest of the code now understands that, the L1
phy will not. Translate to standard PDCH (== TCH/F).

common/oml: use dyn TS' current pchan mode for lchans config.

common/pcu_sock: detect desired PDCH mode of dyn TS.

common/rsl: implement reconnection chain of a TS for changing its pchan:

* rsl_rx_chan_activ():
** Add dyn_pchan_from_chan_nr() to derive the requested pchan from the RSL
   chan_nr IE.
** Notice the need for a pchan change and invoke dyn_ts_l1_reconnect() (s.b.)
** Make Chan Mode IE presence optional, because the non-standard PDCH
   activation message is simpler and does not require it.
** Do PDCH activation via PCU.

* Add dyn_ts_l1_reconnect(): store state and disconnect the L1 channel;
  then wait for cb_ts_disconnected().

* Add osmo_dyn_ts_disconnected() to cb_ts_disconnected():
  verify state and connect with the new pchan type; then wait for
  cb_ts_connected().

* Add osmo_dyn_ts_connected() to cb_ts_connected(), which re-issues
  the cached chan activation message from before disconnecting the L1 channel.

* Also send an rf chan rel/act ack for dyn TS upon PDCH de/act via PCU.

* Add dyn_ts_pdch_release(): on channel release of a dyn TS in PDCH mode,
  release via the PCU. Call from rsl_rx_rd_chan_rel().

Change-Id: I463bb6b4e57674f091c3badba9257374961c52c7
2016-07-25 22:13:44 +02:00
Neels Hofmeyr 6e656748b7 code dup: join [rsl_]lchan_lookup() from libbsc and osmo-bts
lchan_lookup in openbsc abis_rsl.c and rsl_lchan_lookup() rsl.c are the
same code, except for the log context, which is only set in abis_rsl.c.
The common code was factored out to gsm_data_shared.c in openbsc.git.

Use the *rc return code argument to keep the logging part in the newly
introduced thin wrapper lchan_lookup() in common/rsl.c. This also removes code
dup for logging

The rsl_lchan_lookup() implementation is removed from osmo-bts, so a recent
openbsc is needed to build this.

Change-Id: Ibc469b75e31560271be8633d524366442d27e6fb
2016-07-25 22:13:44 +02:00
Tom Tsou 73cb583e51 trx: Add EGPRS tables, sequences, and mappings
Includes EGPRS specific convolutional codes, interleaving tables
and functions, burst mappings, training sequences, and parity
checks from 3GPP TS 44.060 needed to handle MCS codings 1-9.

Change-Id: Ie270398dd7a72f282ba53e646853d8de1eabee93
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-25 18:36:29 +00:00
Neels Hofmeyr c9582ac2d7 prepare dyn TS: split/replace conf_lchans_for_pchan()
Move the actual switch from static conf_lchans_for_pchan() into new 'public'
function conf_lchans_as_pchan(), adding an explicit pchan argument. This allows
passing a non-trivial pchan, for dynamic TS.

conf_lchans_as_pchan() now takes a pchan argument, so distinguish the naming
and drop the 'for_pchan' from conf_lchans_for_pchan(), which takes only a ts
argument.

Change-Id: I8e458501fff5503c243512aeb3469c12b1f2bbc4
2016-07-25 15:22:06 +00:00
Neels Hofmeyr c57304b65e dyn PDCH: code dup: use conf_lchans_as_pchan()
For ip.access dyn PDCH, call conf_lchans_as_pchan() instead of dup'ing the
pchan-to-lchan switch.

Change-Id: I979828e08953e83ae579a347334536f52939faf0
2016-07-25 15:22:06 +00:00
Neels Hofmeyr 334df9441a cosmetic: clarify TCH/F_PDCH related naming and comments
We're about to introduce a new kind of dynamic channel, which will also use
parts of the ip.access mode dyn PDCH code paths. Make sure the general parts
have general names and mark ip.access specific parts as such.

Rename dyn_pdch_ts_[dis]connected() to cb_ts_[dis]connected().
Rename dyn_pdch_complete to ipacc_dyn_pdch_complete().
From cb_ts_[dis]connected(), factor out the current code into static
functions ipacc_dyn_pdch_[dis]connected() -- this will make sense once the
new dynamic kind is added to cb_ts_[dis]connected().

Change-Id: I7da5b7cb7b48572671f50e0dec97d9eec3083df1
2016-07-25 16:38:18 +02:00
Neels Hofmeyr 290c7d954f cosmetic: pcu_sock.c: rename ts_is_pdch() to ts_should_be_pdch()
The function checks whether to switch a TS to/from PDCH, not whether it already
is PDCH.

Change-Id: Ib4036445d09792636bb2f1a8a665b6b28f32e1a0
2016-07-25 16:38:18 +02:00
Neels Hofmeyr 7f1365c05e fix compiler warning: msg_utils.c: fn_chk() constify arg
The only caller dtx_sched_optional() passes const arrays and a warning was
issued.

Change-Id: I18e0788ef96489d2116a60cae57bd516fe6eae8e
2016-07-25 16:38:18 +02:00
Neels Hofmeyr 2479ef4133 info log: l1sap.c: add '0x' to hex output
Change-Id: If29895de238e586b8298d84b6f0b41e08bea8c91
2016-07-25 16:38:18 +02:00
Neels Hofmeyr ae65ccd0b2 error log: rsl.c: typo x2
Change-Id: I285fdff8260f008d856b9cda811e9fbb936893eb
2016-07-25 16:38:18 +02:00
Neels Hofmeyr 8a2f026cf0 doc: move dyn_pdch.msc to osmo-gsm-manuals.git
Also remove related cruft: .gitignore, msc-README and adjust an in-code
comment that referenced dyn_pdch.msc.

Change-Id: Ie41a453bb5070c1f18793f646dc053a978f43fba
2016-07-25 16:35:53 +02:00
Max 4355021b8a sysmobts: dump PRACH and PTCCH parameters
Change-Id: I6b833b21d2bbbd45dfed6a094a674359762d02b7
Related: OS#1545
2016-07-16 21:00:53 +00:00
Neels Hofmeyr 2ed03cd640 osmo-bts-trx: init OML only once by sending AVSTATE_OK with OPSTATE_ENABLED
When receiving an OPSTART for the BTS object, also set the availability state
to OK.

Before, the availability would remain at NM_AVSTATE_DEPENDENCY, which caused an
unfortunate chain reaction resulting in osmo-bts-trx going through the
initialization sequence twice:

  BTS    BSC
   |<-----|   SITE_MANAGER OPSTART
 n |----->|   BTS state change: OPSTATE_DISABLED, AVSTATE_DEPENDENCY
 o |      |     This signals to nm_statechg_event() in bts_ipaccess_nanobts.c
 r |      |     to (a) Set BTS Attributes and (b) send BTS OPSTART
 m |<-----|   Set BTS Attributes (a)
 a |      |     When osmo-bts-trx receives a Set BTS Attributes, it sends
 l |----->|   CHANNEL state change: OPSTATE_DISABLED  x8
   |      |     This signals the BSC to Set CHANNEL Attributes and OPSTART
 i |<-----|   Set CHANNEL Attributes  x8
 n |<-----|   CHANNEL OPSTART  x8
 i |----->|   CHANNEL state change: OPSTATE_ENABLED, AVSTATE_OK  x8
 t |      |
   |<-----|   BTS OPSTART (b)
   |      |     osmo-bts-trx immediately replies with:
   |----->|   BTS state change: OPSTATE_ENABLED, AVSTATE_DEPENDENCY
   |      |     Unfortunately, availability is left at DEPENDENCY,
   |      |     and the NM_OC_BTS case in nm_statechg_event() only
   |      |     checks for availability, not for the opstate.
   |      |     Hence nm_statechg_event() again feels inclined to
   |      |     to (a) Set BTS Attributes and (b) send BTS OPSTART,
   |      |
 --+------+----- This is where the second round starts
   |      |
 s |<-----|   Set BTS Attributes (a)
 e |      |     When osmo-bts-trx receives a Set BTS Attributes, it sends
 c |----->|   CHANNEL state change: OPSTATE_DISABLED  x8
 o |      |     All channels are disabled again, and then re-launched:
 n |<-----|   Set CHANNEL Attributes  x8
 d |<-----|   CHANNEL OPSTART  x8
   |----->|   CHANNEL state change: OPSTATE_ENABLED, AVSTATE_OK  x8
   |      |
 i |<-----|   BTS OPSTART (b)
 n |      |     osmo-bts-trx again sets the OPSTATE_ENABLED, but since
 i |      |     this time it was already enabled, no further state change
 t |      |     is sent back to the BSC.

This nightmare pivots on two hinges:

1. osmo-bts-trx fails to set BTS availability to AVSTATE_OK.
2. nm_statechg_event() fails to heed the OPSTATE_ENABLED of the BTS state
   change.

Note, the configured channels from the first round were not actually taken
down, only the OML OPSTATE_DISABLED were sent.

In this commit, fix the osmo-bts-trx side: send AVSTATE_OK for the BTS object
upon sending OPSTATE_ENABLED, so that only the part marked "normal init" above
is run.

This change applies the same fix to other OML objects, which should make sense
in the same manner, within the current hackish OML implementation:
* NM_OC_BTS
* NM_OC_SITE_MANAGER
* NM_OC_BASEB_TRANSC
* NM_OC_GPRS_NSE
* NM_OC_GPRS_CELL
* NM_OC_GPRS_NSVC

This means that the NM_OC_CHANNEL case just above is identical, and thus
collapse NM_OC_CHANNEL onto the other cases. Drop the comments from
NM_OC_CHANNEL since they merely rephrase the commands themselves.

See OS#1770 for BTS and NITB logs.

Fixes: OS#1770

Change-Id: I08aa861f6100568c79750f4fbc9a32e1557b9304
2016-07-14 03:40:50 +02:00
Neels Hofmeyr cff0d44e53 log: osmo-bts-trx: change PDTCH block logs to DEBUG level
Many erratic PDTCH blocks are expected. To not bloat the log,
notifications for this should be on debug level.

See http://lists.osmocom.org/pipermail/openbsc/2016-June/009457.html
(Thu, 30 Jun 2016 01:49:33 +0300 / Alexander Chemeris
<alexander.chemeris@gmail.com> / Re: GPRS on osmo-trx not working)

Change-Id: Ie318248aa2b8de455174e72a63c602c7aeae312c
2016-07-09 19:52:18 +00:00
Neels Hofmeyr b8f5f4e176 log: osmo-bts-trx: change access burst logs to DEBUG level
Many erratic bursts are expected. To not bloat the log, notifications for this
should be on debug level.

See http://lists.osmocom.org/pipermail/openbsc/2016-July/009482.html
(Tue, 5 Jul 2016 15:38:27 -0700 / Tom Tsou <tom@tsou.cc>
/ Re: osmo-bts-trx error logs -- was: GPRS on osmo-trx not working)

Change-Id: If591c087ba8fd48564139e32930050ee8ab07001
2016-07-09 19:50:50 +00:00
Neels Hofmeyr b151301c6c cosmetic: osmo-bts-trx: add comment, fix comment typo
Change-Id: Iea62bd98954d0219ba597613cea6db63f7a6b396
2016-07-09 19:50:50 +00:00
Holger Hans Peter Freyther 1c1b0e843d sysmobts: Fix eeprom padding before gpg key
Correct the too short padding I introduced in the commit
a55b166c6c. The result needs to
be 121 and not 120. Add static asserts to make sure it does
not happen again.

Change-Id: I3da7f3b8d3c8e12deb8b805cd15ff52a103d4e56
2016-07-07 13:51:00 +00:00
Max e3edc17426 Mark array as static const
Change-Id: Ia70519c8f10d55084b53acb68e57debc70549246
2016-07-05 14:48:26 +02:00
Max d5f95c308b TRX: add Uplink DTX support for FR/HR
* detect SID and set RTP Marker accordingly (emulate ONSET events)
* set proper FN in TCH_IND
* detect speech pause and do not send dummy 'bad' frames during that
  time

Change-Id: Id518e5c667df7773c281effb9e75b66bf898f6fc
Related: OS#1750
2016-06-27 09:37:11 +00:00
Max bb1e3b089b Remove duplicated nibble shift code
Those functions are now part of libosmocore.

Change-Id: Iab3206e3b41caff23f656a727605032df9798953
2016-06-24 10:47:59 +02:00
Max c03d3ae7af DTXu: move copy-pasted code to common part
Abstract code for checking/setting lchan's UL SID flag and RTP Marker
into generic function and use it for LC15 and sysmoBTS.

Change-Id: Ica5392e92bab29164711163e7b01adb174272883
Related: OS#1750
2016-06-23 20:01:02 +00:00
Max 5c0d88e69d Make get_lchan_by_chan_nr globally available
* Remove static qualifier
* Remove duplicated code - use generic function instead

Change-Id: I37a312648771f58d3087471083cfcebbd97ccf1d
2016-06-23 20:00:44 +00:00
Neels Hofmeyr 4fa641d7b2 fix compiler warning: remove unused variable 'i' in calib_verify()
Change-Id: Iea6bc47182d021523285aea8d3f6a93ee4eec0eb
2016-06-23 19:58:47 +00:00
Neels Hofmeyr 64e3813b06 fix compiler warning: remove useless 'static' storage class for struct decl
Change-Id: I4d5d11dd89449e4c9315f963576265bccad7e68c
2016-06-23 19:58:47 +00:00
Neels Hofmeyr 9797a72cd7 fix compiler warnings: include bts_model.h in phy_link.c
The file calls bts_model_* API which was yet undeclared.

Change-Id: Ib6b30d125906c3abae518fb76da3a158885e3354
2016-06-23 19:58:47 +00:00
Neels Hofmeyr 99642656a0 vty: install orphaned trx nominal power command
The cfg_trx_nominal_power_cmd added 12 days ago in
58e4e18206 was floating.
Actually add it to the TRX_NODE.

Change-Id: I89d638b2e2bb1fb9baeabe566035ff171f4bfad0
2016-06-22 23:33:36 +00:00
Neels Hofmeyr c2874c4360 dyn PDCH: safeguard: exit if nothing pending in dyn_pdch_ts_disconnected()
The function would currently only be called in cases where one of the if
branches catches on, but for safety's and clarity's sake, don't ts_connect
using as_pchan if no reconnect is pending.

Change-Id: I52c34065254e902bb80662fc04540901b36cb4c3
2016-06-22 23:31:06 +00:00
Neels Hofmeyr 3f919171ef dyn PDCH: lc15: complete for litecell15-bts: implement bts_model_ts_*()
Analogous to 63b296bdd9 on osmo-bts-sysmo.

Implement bts_model_ts_disconnect() by sending an MphDisconnect message to L1.
Pass a disconnect callback to invoke dyn_pdch_ts_disconnected() in
common/rsl.c.

Implement bts_model_ts_connect() by calling ts_connect_as(). Pass a connect cb
to invoke dyn_pdch_connected() in common/rsl.c.

Change-Id: I8c8c3244c726fd6055cedb22ee11706994ff9cd4
2016-06-22 23:26:15 +00:00
Neels Hofmeyr a4c6802315 dyn PDCH: lc15: handle TCH/F_PDCH init like TCH/F
Analogous to 57fc1124e1 on osmo-bts-sysmo.

Change-Id: If65c5a86cbc1b5556b71de8a6744d92113fbbcba
2016-06-22 23:26:07 +00:00
Neels Hofmeyr 0eaa27a6be dyn PDCH: lc15: add ts_connect_as(), absorbing ts_connect() guts
Analogous to 294fbe104b on osmo-bts-sysmo.

For upcoming dyn PDCH switching, I want to be able to set the pchan dynamically
upon ts_connect() and not continue with OPSTART ACK, but with the dyn PDCH.

Thus recoin ts_connect(ts) to ts_connect_as(ts, pchan, cb) and leave
ts_connect() as a thin wrapper to leave init code unchanged.

Change-Id: I7a27193168f83e8c40b6e54d1842f4502d0475e5
2016-06-22 23:26:01 +00:00
Neels Hofmeyr 037dcfe981 dyn PDCH: lc15: chan_nr_by_sapi(): handle TCH/F_PDCH according to ts->flags
Analogous to 0d10f0e482 on osmo-bts-sysmo.

According to the PDCH Active flag, handle a TS as TCH/F or PDCH.

Change-Id: I0c97b360136f76bdae8d70d06af9a31fdf75c1ba
2016-06-22 23:25:54 +00:00
Neels Hofmeyr 380a2e6d90 lc15: add L3 handle to l1prim messages
Analogous to 7158c2ed08 in osmo-bts-sysmo.

Place a layer 3 handle into GSM L1 messages to better match up confirmations to
respective requests. This handle is a uint32_t transparently returned in the
confirmation messages, so a match-up is easy to add.

So far, a GSM L1 confirmation message received for a preceding L1 Request was
matched only by the prim_id. That meant that only one instance of the same
primitive could be waiting for a confirmation at any given time, or the
responses would get mixed up: the struct wait_l1_conf instances entered into
the fl1h->wlc_list queue would be returned to a possibly mismatching
confirmation handler. (Seen during testing of dyn pdch switching.)

Send the hLayer3 handle out via prim_init(), using new static functions to
produce handles on different scopes:

* l1p_handle_for_trx()
* l1p_handle_for_ts()
* l1p_handle_for_lchan()

(These could possibly move to a more general .h/.c file later.)

Remember the hLayer3 handle in

* struct wait_l1_conf.

Match the incoming confirmations' and stored hLayer3 handles up in, and remove
a now obsolete comment from:

* is_prim_compat()

Since the hLayer3 members are at different byte offsets in
GsmL1_Prim_t.u.*, use large switch statements to set/get the value:

* In prim_init(), extend existing switch statement to set in GsmL1_Prim_t.
* Add l1p_get_hLayer3() to retrieve from GsmL1_Prim_t (could possibly move to a
more general .h/.c file later).

Note that some messages are already using the hLayer3 handle, and will
overwrite it after calling prim_init(), so those are not affected.

Change-Id: I17f95ba744c3e944a2241809106506f8dd1b24f0
2016-06-22 23:25:43 +00:00
Neels Hofmeyr ccb1148717 fix lc15 build: put src/common/libbts.a left of -losmogsm
When switching to the gsm_chan_t_names string list from libosmogsm,
libosmogsm actually became a dependency of the local libbts.a.

The breaking change is in openbsc.git 29048b2a80b5865ffc41fa4401113c5826227e23
and came in here because gsm_data_shared.h is included from openbsc.

Change-Id: I70e5735fc2a212305182d46a7e8485d0199ade7b
2016-06-22 23:25:27 +00:00
Max 724412a49a Clarify logging message
Change-Id: I3c7be592f4cbdd553f07c4a7084478706a7bd644
Related: OS#1648
2016-06-22 23:24:43 +00:00
Max f0d6d6ba02 Use error values instead of number for RSL error
Change-Id: I0aa695c42a4399828fb8e9c08c905870175b7149
2016-06-21 17:52:01 +02:00
Max dd084e6e57 Use libosmocodec functions for AMR
Switch to using libosmocodec functions as a preparation step for DTX
support as they expose necessary bits.

Change-Id: Ie7423032fd06779d78876182ee63538d98906328
Related: OS#1750
2016-06-21 17:24:50 +02:00
Max 61372a20de Move copy-pasted code into common part
Related: OS#1750
Change-Id: Ic4342eaf7e32a0e9a5f2b16dd196a1f5f03152a9
2016-06-18 11:35:12 +00:00
Max c3fb0dcc8c DTX: add support for AMR/HR
Change-Id: Id744b67904011eb328b24c46a645b3eb53525c04
Fixes: OS#1562
2016-06-18 11:34:51 +00:00
Neels Hofmeyr 274d29bedd debug log: log TS pchan type on connect
A whitespace error is fixed along the way.

Change-Id: Iff373ba934937435a175ed3a5d9cfb6f2514735d
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 7efc2f3c5b debug log: log lchan state transitions
Change-Id: Id20f61ef535f4ea049da6579e41eb98f31238d23
2016-06-17 15:50:48 +00:00
Neels Hofmeyr b231e0f6cd error log: two minor clarifications
Change-Id: I95e4331f51f650d5077eb3a8f897f754d5d2b779
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 63b296bdd9 dyn PDCH: complete for sysmo-bts: implement bts_model_ts_*()
Implement bts_model_ts_disconnect() by sending an MphDisconnect message to L1.
Pass a disconnect callback to invoke dyn_pdch_ts_disconnected() in
common/rsl.c.

Implement bts_model_ts_connect() by calling ts_connect_as(). Pass a connect cb
to invoke dyn_pdch_connected() in common/rsl.c.

Change-Id: I61709fdf6b093689a6d3a046f67db6d02f1296ae
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 57fc1124e1 dyn PDCH: sysmo: handle TCH/F_PDCH init like TCH/F
Change-Id: Ic62921e17c55aeb26235b70a8325d6fea1716cef
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 294fbe104b dyn PDCH: sysmo-bts/oml.c: add ts_connect_as(), absorbing ts_connect() guts
For upcoming dyn PDCH switching, I want to be able to set the pchan dynamically
upon ts_connect() and not continue with OPSTART ACK, but with the dyn PDCH.

Thus recoin ts_connect(ts) to ts_connect_as(ts, pchan, cb) and leave
ts_connect() as a thin wrapper to leave init code unchanged.

Change-Id: I09cc794cb424e17411e608c65f2b68e2f2544e07
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 24a31cfe43 dyn PDCH: implement main dyn PDCH logic in common/
React on IPAC PDCH ACT and DEACT messages and invoke the PCU and bts_model_ts_*
APIs to effect switchover. The dyn PDCH interaction is described in the comment
to rsl_rx_dyn_pdch(), the main entry point for PDCH switchover.

In case the bts_model_ts_* are not implemented (or return other errors),
reply with an IPAC PDCH ACT/DEACT NACK.

Add callbacks that mark steps in the PDCH switchover process,
dyn_pdch_ts_disconnected(), dyn_pdch_ts_connected() and dyn_pdch_complete().

Add hooks in l1sap.c on channel activation and release confirmation, to call
dyn PDCH callbacks.

BTS dyn PDCH implementations should invoke dyn_pdch_ts_disconnected() and
dyn_pdch_ts_connected() when bts_model_ts_disconnect() or
bts_model_ts_connect() are called, respectively. (upcoming for sysmoBTS)

Change-Id: Id2f5f77121a65d6c14eac127b3d4fb50e97a77ab
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 0d10f0e482 dyn PDCH: chan_nr_by_sapi(): handle TCH/F_PDCH according to ts->flags
According to the PDCH Active flag, handle a TS as TCH/F or PDCH.

Change-Id: I06ca26a99f052c6a2ae953fe355fd1196f66e501
2016-06-17 15:50:47 +00:00
Neels Hofmeyr f8bf95fa6b dyn PDCH: pcu_tx_info_ind(): handle TCH/F_PDCH in PDCH mode
Introduce a static function to encapsulate the decision whether a TS is
used for PDCH. Depending on the ts->flags, handle a TCH/F_PDCH TS exactly like
a standard PDCH TS.

Change-Id: Ic72fd06ecc99609823efa3edcf773007cc514b5b
2016-06-17 15:50:47 +00:00
Neels Hofmeyr e6cc04827a dyn PDCH: conf_lchans_for_pchan(): handle TCH/F_PDCH
Depending on the PDCH active flag, handle a TCH/F_PDCH like TCH/F or PDCH.

Change-Id: Ifc5561f8e2db172bb692ba26bdeae2fd675d6ec5
2016-06-17 15:50:47 +00:00
Neels Hofmeyr 9375aa9a68 dyn PDCH: add bts_model_ts_connect() and _disconnect() stubs
Enhance bts_model_ API in preparation of dyn PDCH switching. These will be used
to re-connect a TCH/F_PDCH TS in a different mode: either as TCH/F or as PDCH.

All implementations so far return -ENOTSUP, and thus will cause a IPAC PDCH ACT
or DEACT *NACK* to be sent to the BSC as soon as these messages are handled.

Also add stubs in tests.

Change-Id: I21e60c028a1333431c3ed000f788b654d1170b0d
2016-06-17 15:50:47 +00:00
Neels Hofmeyr 6b60611a4d fix compiler warning: add missing case (PHY_LINK_CONNECTING)
Change-Id: I7979e10551023c1f52f04b4e93ea1706cf0bef39
2016-06-17 15:34:48 +00:00
Neels Hofmeyr bc9c42663d fix compiler warning: printf format for sizeof()
Change-Id: Id600c5a34ab261736f7595ab2e36e3a30d434175
2016-06-17 15:34:42 +00:00
Neels Hofmeyr 3686005180 add missing DSUM entry to bts_log_info_cat
This allows setting the 'sum' log level to debug in osmo-bts.cfg.

Change-Id: I1fe1a483f07f0384815f01877f86ffc192052f72
2016-06-17 15:32:03 +00:00
Neels Hofmeyr a8168271eb dyn PDCH: cosmetic: lchan_to_GsmL1_SubCh_t(): add case for TCH_F_PDCH
It is cosmetic since the 'default:' case already caught TCH_F_PDCH, but it's
good to mention all expected pchans explicitly.

Change-Id: I5aef84209e46c9288f6adf0730178fe08f26764f
2016-06-17 04:26:20 +02:00
Neels Hofmeyr e951042475 dyn PDCH: rsl rx dchan: also log ip.access message names
Before, only standard ABIS RSL message names were logged, add ip.access
specific ones.

The IPAC_PDCH_ACT and _DEACT msgs are received with an ABIS_RSL_MDISC_DED_CHAN
discriminator, and not with _MDISC_IPACCESS like the others. Thus rsl_rx_dchan()
should be able to log ip.access message types properly.

Change-Id: I9db6826b515bf565fc7ae24fc0760b60928cc89f
2016-06-17 04:24:57 +02:00
Neels Hofmeyr 65efa691f8 oml, Set Chan Attr: treat unknown PCHAN types as error
Change-Id: Id79585993df15362ba0e1271d03302597182ceff
2016-06-17 01:31:03 +00:00
Neels Hofmeyr 6ab1ed580d fix typo in error message ('at lEast')
Change-Id: I6ac3606157dc6c81ed17cd6d26227da8ae26c49f
2016-06-17 01:30:08 +00:00
Neels Hofmeyr 703c2d6eb8 pcu_sock: add pcu_connected() to query PCU availability
Will be used in upcoming dyn PDCH switching.

Change-Id: I8031089ad5e9cb9690ca7e22facc53438f28e12a
2016-06-17 01:24:25 +00:00
Max ecd5bc2aef TRX: Add vty command to power on/off transceiver
Add vty command (under "phy X instance Y" hierarchy) to manually send
POWERON or POWEROFF command. It's useful for debugging issues related to
BTS/TRX initialization.

Change-Id: I6dfebaf118cdf5ad144516b2b839b17350a73ce4
Related: OS#1648
2016-06-16 13:39:42 +00:00
Max 7cc3c3156e Fix OML activation
Previously software activation could have been reported multiple times
which broke proper BTS init. Introduce guard variable to ensure
reporting happens only once.

Note: this is just minimal workaround - ideally proper OML state machine
should be implemented.

Change-Id: Ifffbdb756bc5d2864f985c01a3299b839c4de7af
Related: OS#1648
2016-06-16 12:43:44 +02:00
Minh-Quang Nguyen 58e4e18206 LC15: TRX nominal TX power can be used from EEPROM or from BTS configuration
Change-Id: I173f4126cea41959d48def07bff25fcd29894b7e
2016-06-15 09:45:02 +00:00
Minh-Quang Nguyen cbbce0be09 LC15: Hardware changes:
- Change system devices path
- Remove obsoleted sensors and add new sensors
- Change TRX and sensors numbering to 0,1 instead of 1,2 (JFD)

Change-Id: I5172daf68d3145a6398e37df87df21b0e5affe42
2016-06-15 09:44:58 +00:00
Minh-Quang Nguyen d0d2c9217a LC15: Bring back DSP trace argument
Change-Id: I822651d9ba4959ce5885a2c0362f1ea583b724da
2016-06-15 09:44:51 +00:00
Neels Hofmeyr 7158c2ed08 sysmo: add L3 handle to l1prim messages
Place a layer 3 handle into GSM L1 messages to better match up confirmations to
respective requests. This handle is a uint32_t transparently returned in the
confirmation messages, so a match-up is easy to add.

So far, a GSM L1 confirmation message received for a preceding L1 Request was
matched only by the prim_id. That meant that only one instance of the same
primitive could be waiting for a confirmation at any given time, or the
responses would get mixed up: the struct wait_l1_conf instances entered into
the fl1h->wlc_list queue would be returned to a possibly mismatching
confirmation handler. (Seen during testing of dyn pdch switching.)

Send the hLayer3 handle out via prim_init(), using new static functions to
produce handles on different scopes:

* l1p_handle_for_trx()
* l1p_handle_for_ts()
* l1p_handle_for_lchan()

(These could possibly move to a more general .h/.c file later.)

Remember the hLayer3 handle in

* struct wait_l1_conf.

Match the incoming confirmations' and stored hLayer3 handles up in, and remove
a now obsolete comment from:

* is_prim_compat()

Since the hLayer3 members are at different byte offsets in
GsmL1_Prim_t.u.*, use large switch statements to set/get the value:

* In prim_init(), extend existing switch statement to set in GsmL1_Prim_t.
* Add l1p_get_hLayer3() to retrieve from GsmL1_Prim_t (could possibly move to a
  more general .h/.c file later).

Change-Id: Ie4533c6cbc160318917e7a672ab6f9a848f01d1b
2016-06-15 09:30:24 +00:00
Holger Hans Peter Freyther a55b166c6c sysmobts: Add the barebox boot state reservation
We are using up to 48 (actually only 8) bytes to manage the boot
state of the device. Add it to the eeprom reservation. It turns out
the current padding was too large (37 + 84 don't end at 120).

Change-Id: I4c1de5925577f1d0b7b5cc08529642ffa333d7de
2016-06-15 09:33:23 +02:00
Minh-Quang Nguyen 3f3f34ba52 common/abis.c: fix 100% CPU usage after disconnecting OML/RSL link (Bug #1703)
Change-Id: I24605b8a6d4e778a3280ffba8bc1fc7a284ce12d
2016-06-14 21:57:57 +00:00
Max a10ac248c6 DTXu: mark beginning of speech burst in RTP
Set Marker bit in RTP header to mark the beginning of talkspurt.

Change-Id: I3dd70ad8ff94356e3c3cc5458255f6c23534783e
Related: OS#1562
2016-06-14 10:19:13 +00:00
Max 60970056c8 DTXd: store/repeat last SID
Store last SID received over RTP and repeat is if necessary (no new SID
or SPEECH frames) according to codec-specific scheduling rules.

Related: OS#1563
Copy-paster from I4d23846a27d3dbd2a6e75e481c1efcdb2a85f305 for LC15.

Change-Id: I29acea6e8bbf426330ce52554a48afb5d2ef1679
2016-06-14 10:18:59 +00:00
Max 8ecadc66ce DTXd: store/repeat last SID
Store last SID received over RTP and repeat is if necessary (no new SID
or SPEECH frames) according to codec-specific scheduling rules.

Change-Id: I4d23846a27d3dbd2a6e75e481c1efcdb2a85f305
Related: OS#1563
2016-06-14 10:18:59 +00:00
Max 9302abe054 Fix debug output
Previously frame number was not saved in case of PRIM_TCH rendering many
debug statements with g_time useless.

Copy-paste from ef30f50d5d.

Change-Id: I952b39458d921622d5964cbdcc2f4e45ff9ea951
2016-06-14 10:18:59 +00:00
Jason DSouza 45e97ac59a Close TRX session before opening new one
This fixes the unstable behavior (BTS loosing subscribers after some
time) in case previous run of osmo-bts was interrupted (with ctrl+c for
example).

Change-Id: Ie2119b0b566d01f0e70b38c8a149fecb47def38d
2016-06-14 10:18:43 +00:00
Max 3a1f1b8e91 octphy: Use the app. info. defaults as base
Similar to 91565b2d51 use default
initializers.

Change-Id: Ib813249f4295b034eb65658e3f43b4fe86862cf0
Fixes: Os#1642
2016-06-13 14:56:44 +02:00
Max 4582222757 Use libosmocodec for AMR RTP
Use libosmocodec function to parse RTP with AMR payload in sysmoBTS and
LC15. This replaces "manual" parsing of AMR frame with function covered
by test suite and makes adding DTXd support easier.

Related: OS#1563
Change-Id: I1464f9a12e3f92926d03d5dd5d18e8f0f7206dd9
Reviewed-on: https://gerrit.osmocom.org/204
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-12 15:43:19 +00:00
Max c1586388dc Add DTXd support for sysmoBTS and LC15
* set/clear DTXd activity indicator for measurement reporting
* set DTXd status based on information from RSL

Related: OS#1563
Change-Id: I148a75725c4e5089b6f2da6e9adcbe94170d3257
Depends-On: I4a033b03fcd0deb4db7a38273b5407511dbf1d6c
Reviewed-on: https://gerrit.osmocom.org/220
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-12 15:42:34 +00:00
Max 51bfebec39 Fix RTP timestamps in case of DTX
Compute RTP user_ts adjustment based on the difference between current
and previous FN instead of hard-coded value.

Change-Id: If1677ddcf754b29990ff7cd846e11c32e3d30b33
Related: OS#1562
Reviewed-on: https://gerrit.osmocom.org/196
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-07 15:32:39 +00:00
Max ef30f50d5d Fix debug output
Previously frame number was not saved in case of PRIM_TCH rendering many
debug statements with g_time useless.

Change-Id: Ib8d8c919862d0de8e2ebf7753c2592e0d91b09c5
Reviewed-on: https://gerrit.osmocom.org/195
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-05 09:35:23 +00:00
Max 201b424b73 Use libosmocore function for uplink measurements
Related: OS#1563
Change-Id: Ide47e8e69e0d2d5859c5249b22f4bad22c18aa57
Reviewed-on: https://gerrit.osmocom.org/108
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-31 11:58:08 +00:00
Daniel Laszlo Sitzer 0778cd488a octphy: Update outdated config param name in error message.
Change-Id: I45b8bc09c9aabacc5b908450fe574b5802b88be8
Reviewed-on: https://gerrit.osmocom.org/129
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-31 09:30:55 +00:00
Max 21fc6e45fb LC15: properly initialize unmapped phy instances
Fixes: OS#1665
2016-03-22 19:38:39 +01:00
Max 925fcf48ed LC15: add stubs for phy link/instance defaults 2016-03-22 19:37:03 +01:00
Max 06968beab9 octphy: fix for multiple trx with more than 1 dsp
Explicitly store and use "center" arfcn used by each dsp (1 dsp
corresponds to 1 phy link).
2016-03-21 17:20:11 +01:00
Max c4fc00d851 octphy: add support for multiple trx ids 2016-03-18 15:30:30 +01:00
Max 3044a26d71 octphy: use octasic's routines for debug output 2016-03-18 15:29:54 +01:00
Max b857f27704 Fix typo in error message 2016-03-17 18:23:55 +01:00
Max 9591b6c253 octphy: add missing include to fix the build 2016-03-17 16:23:07 +01:00
Max b2b1112a6e Add explicit check for SI2quater index and count
Right now we do not support multiple SI2quater messages, so return error
if either index or count is non-zero.
2016-03-17 13:50:31 +01:00
Max f3ee66207d Fix SI2ter scheduling
According to 3GPP TS 05.02 § 6.3.1.3 SI2ter messages should be scheduled
in FN with TC=4 only if SI2bis messages are also available.
2016-03-17 13:48:16 +01:00
Holger Hans Peter Freyther 0be80aa2d1 octphy: Enable TCH/H mode and begin testing
Upcoming releases will support TCH/H and we should start to test
the DSP->RTP code.
2016-03-16 09:17:04 +01:00