[PATCH] libosmo-sccp[master]: osmo-stp: Fix process termination on SIGINT+SIGTERM

2017-08-31 Thread Harald Welte

Review at  https://gerrit.osmocom.org/3757

osmo-stp: Fix process termination on SIGINT+SIGTERM

In commit eed8c1bfae1d151e135b574d83ed295d36ad8b44 we introduced
some singal handling code for (among others) SIGINT and SIGTERM.

This code causes the process to hang rather than terminate, as it
only dispatches a signal that nobody handles yet in libosmo-sccp.

Until a proper implementation is made, let's terminate the process
as expected.

Change-Id: Iff79c8ac0b347660333912c9258073a013ea799b
---
M stp/stp_main.c
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/57/3757/1

diff --git a/stp/stp_main.c b/stp/stp_main.c
index 8e3282c..a33045a 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -134,8 +134,11 @@
switch (signal) {
case SIGINT:
case SIGTERM:
+   /* FIXME: handle the signal somewhere else and gracefully shut 
down
+* SIGTRAN links
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
-   sleep(1);
+   sleep(1); */
+   exit(0);
break;
case SIGABRT:
osmo_generate_backtrace();

-- 
To view, visit https://gerrit.osmocom.org/3757
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff79c8ac0b347660333912c9258073a013ea799b
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-trx[master]: Use release helper from libosmocore

2017-08-31 Thread Max

Patch Set 2:

Would be pretty cool if you could give it a try next time you want to make 
OsmoTRX release :)

-- 
To view, visit https://gerrit.osmocom.org/3717
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ieb843923d8f534654413be695f2b5f0c87b75520
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Tom Tsou 
Gerrit-HasComments: No


[MERGED] osmo-trx[master]: Use release helper from libosmocore

2017-08-31 Thread Max
Max has submitted this change and it was merged.

Change subject: Use release helper from libosmocore
..


Use release helper from libosmocore

See
https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release
for details.

Change-Id: Ieb843923d8f534654413be695f2b5f0c87b75520
Related: OS#1861
---
M Makefile.am
M configure.ac
2 files changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Tom Tsou: Looks good to me, approved
  Harald Welte: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/Makefile.am b/Makefile.am
index 56cb4ba..5cf1a45 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,6 +39,7 @@
COPYING \
README
 
+@RELMAKE@
 
 dox: FORCE
doxygen doxconfig
diff --git a/configure.ac b/configure.ac
index 8cfd25d..43b5403 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,10 @@
 dnl Linux kernel KBuild style compile messages
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
+dnl include release helper
+RELMAKE='-include osmo-release.mk'
+AC_SUBST([RELMAKE])
+
 AM_PROG_AS
 AC_PROG_CXX
 AX_CXX_COMPILE_STDCXX_11

-- 
To view, visit https://gerrit.osmocom.org/3717
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieb843923d8f534654413be695f2b5f0c87b75520
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Tom Tsou 


osmo-trx[master]: Use release helper from libosmocore

2017-08-31 Thread Tom Tsou

Patch Set 2: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/3717
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ieb843923d8f534654413be695f2b5f0c87b75520
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou 
Gerrit-HasComments: No


[PATCH] osmo-gsm-tester[master]: Reserve ARFCN dynamically based on BTS band support

2017-08-31 Thread Pau Espin Pedrol
Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3731

to look at the new patch set (#2).

Reserve ARFCN dynamically based on BTS band support

Instead of statically specifying a band for a BTS to use, declare a list
of supported bands for each BTS.

At the time of BTS object creation, ask the BTS for band support and try
to dynamically reserve an ARFCN resource which is compatible with any of
the bands supported by the BTS. All this happens transparently to the
test.

Still, the test may want to use a specific band / arfcn. In this case, a
test can use suite.reserve_arfcn(band, arfcn) to reserve a specific
band/arfcn and pass that to the BTS at creation time, which will then
use that one instead of trying to find a suitable one.

It is left as future work to support BTs with multiple TRX, in which
case several arfcn must be reserved. It should not be that difficult,
mostly using "times: X" where X is the amount of trx, changing the API
to use a list of arfcns and the configure() methods of the BTS.

Related: OS#2230

Change-Id: I6fb5d95bed1fa50c3deaf62a7a6df3cb276bc3c9
---
M example/default-suites.conf
M example/defaults.conf
M example/resources.conf
A example/scenarios/band-1900.conf
M selftest/conf/resources.conf
M selftest/resource_test.ok
M selftest/suite_test.ok
M selftest/suite_test/resources.conf
M src/osmo_gsm_tester/bts_osmotrx.py
M src/osmo_gsm_tester/bts_sysmo.py
M src/osmo_gsm_tester/resource.py
M src/osmo_gsm_tester/schema.py
M src/osmo_gsm_tester/suite.py
A suites/register/register_band_1900.py
A suites/register/suite.conf
15 files changed, 147 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/31/3731/2

diff --git a/example/default-suites.conf b/example/default-suites.conf
index 1e8d47a..7fc97d3 100644
--- a/example/default-suites.conf
+++ b/example/default-suites.conf
@@ -7,3 +7,4 @@
 - smpp
 - aoip_smpp
 - aoip_encryption:cipher-a50+cipher-a51
+- register:band-1900
diff --git a/example/defaults.conf b/example/defaults.conf
index 082f159..36718f9 100644
--- a/example/defaults.conf
+++ b/example/defaults.conf
@@ -34,7 +34,6 @@
   osmobsc_bts_type: sysmobts
   trx_list:
   - max_power_red: 0
-arfcn: 868
 timeslot_list:
 - phys_chan_config: CCCH+SDCCH4
 - phys_chan_config: SDCCH8
diff --git a/example/resources.conf b/example/resources.conf
index e7e64ee..3d95e60 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -12,14 +12,14 @@
   type: osmo-bts-sysmo
   ipa_unit_id: 1
   addr: 10.42.42.114
-  band: GSM-1800
+  bands: ['GSM-850', 'GSM-900', 'GSM-1800', 'GSM-1900']
   ciphers: ['a5 0', 'a5 1', 'a5 3']
 
 - label: Ettus B200
   type: osmo-bts-trx
   ipa_unit_id: 6
   addr: 10.42.42.50
-  band: GSM-1800
+  bands: ['GSM-1800', 'GSM-1900']
   launch_trx: true
   ciphers: ['a5 0', 'a5 1']
 
@@ -27,7 +27,7 @@
   type: osmo-bts-trx
   ipa_unit_id: 7
   addr: 10.42.42.51
-  band: GSM-1800
+  bands: ['GSM-1800']
   trx_remote_ip: 10.42.42.112
   ciphers: ['a5 0', 'a5 1']
 
diff --git a/example/scenarios/band-1900.conf b/example/scenarios/band-1900.conf
new file mode 100644
index 000..956c8db
--- /dev/null
+++ b/example/scenarios/band-1900.conf
@@ -0,0 +1,4 @@
+resources:
+  bts:
+  - bands:
+- GSM-1900
diff --git a/selftest/conf/resources.conf b/selftest/conf/resources.conf
index 51f5a72..b8e9945 100644
--- a/selftest/conf/resources.conf
+++ b/selftest/conf/resources.conf
@@ -12,7 +12,7 @@
   type: osmo-bts-sysmo
   ipa_unit_id: 1
   addr: 10.42.42.114
-  band: GSM-1800
+  bands: ['GSM-850', 'GSM-900', 'GSM-1800', 'GSM-1900']
   ciphers:
   - 'a5 0'
   - 'a5 1'
@@ -21,7 +21,7 @@
   type: osmo-bts-trx
   ipa_unit_id: 6
   addr: 10.42.42.50
-  band: GSM-1800
+  bands: ['GSM-1800']
   launch_trx: true
   ciphers:
   - 'a5 0'
@@ -31,7 +31,7 @@
   type: osmo-bts-trx
   ipa_unit_id: 7
   addr: 10.42.42.51
-  band: GSM-1800
+  bands: ['GSM-1800']
   trx_remote_ip: 10.42.42.112
   ciphers:
   - 'a5 0'
diff --git a/selftest/resource_test.ok b/selftest/resource_test.ok
index 88ff588..38b38d4 100644
--- a/selftest/resource_test.ok
+++ b/selftest/resource_test.ok
@@ -46,16 +46,16 @@
{'_hash': 'dc9ce027a257da087f31a5bc1ee6b4abd2637369',
 'arfcn': '548',
 'band': 'GSM-1900'}],
- 'bts': [{'_hash': 'f153f466355087b1a838a7aaa8f6f707de1e8925',
+ 'bts': [{'_hash': 'fefeacfa23e2be8b5a0239fafa46a99a30ccbf57',
   'addr': '10.42.42.114',
-  'band': 'GSM-1800',
+  'bands': ['GSM-850', 'GSM-900', 'GSM-1800', 'GSM-1900'],
   'ciphers': ['a5 0', 'a5 1'],
   'ipa_unit_id': '1',
   'label': 'sysmoBTS 1002',
   'type': 'osmo-bts-sysmo'},
  {'_hash': '3343d4cf95efae02644ecb5870417c26830107dc',
   'addr': '10.42.42.50',
-  'band': 'GSM-1800',
+  'bands': ['GSM-1800'],
   'ciphers': ['a5 0', 'a5 1'],
   'ipa_unit_id': '6',
 

[PATCH] osmo-gsm-tester[master]: Add cipher cfg param for modem and bts

2017-08-31 Thread Pau Espin Pedrol
Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3723

to look at the new patch set (#3).

Add cipher cfg param for modem and bts

This parameter is contains a list of supported encryption ciphers by the
modem or bts setting it. It is so far not directly/automatically used
inside osmo-gsm-tester code, but can be useful to create scenarios for
tests that require specific ciphering modes.
For instance, aoip_encryption suite contains tests that require a BTS and
a modem that supports a5 0 and a5 1, otherwise tests will fail.

Change-Id: Ic0e368843a6e58bd3eeef36d2c0a7501296f0f3e
---
M example/default-suites.conf
M example/resources.conf
A example/scenarios/cipher-a50.conf
A example/scenarios/cipher-a51.conf
M src/osmo_gsm_tester/resource.py
M src/osmo_gsm_tester/schema.py
6 files changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/23/3723/3

diff --git a/example/default-suites.conf b/example/default-suites.conf
index 0198486..1e8d47a 100644
--- a/example/default-suites.conf
+++ b/example/default-suites.conf
@@ -6,4 +6,4 @@
 - aoip_sms:trx-sysmocell5000
 - smpp
 - aoip_smpp
-- aoip_encryption
+- aoip_encryption:cipher-a50+cipher-a51
diff --git a/example/resources.conf b/example/resources.conf
index f190c2f..e7e64ee 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -13,6 +13,7 @@
   ipa_unit_id: 1
   addr: 10.42.42.114
   band: GSM-1800
+  ciphers: ['a5 0', 'a5 1', 'a5 3']
 
 - label: Ettus B200
   type: osmo-bts-trx
@@ -20,6 +21,7 @@
   addr: 10.42.42.50
   band: GSM-1800
   launch_trx: true
+  ciphers: ['a5 0', 'a5 1']
 
 - label: sysmoCell 5000
   type: osmo-bts-trx
@@ -27,6 +29,7 @@
   addr: 10.42.42.51
   band: GSM-1800
   trx_remote_ip: 10.42.42.112
+  ciphers: ['a5 0', 'a5 1']
 
 arfcn:
   - arfcn: 512
@@ -56,21 +59,25 @@
   imsi: '90170009031'
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'xor'
+  ciphers: ['a5 0', 'a5 1']
 
 - label: sierra_2
   path: '/sierra_2'
   imsi: '90170009029'
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'xor'
+  ciphers: ['a5 0', 'a5 1']
 
 - label: gobi_0
   path: '/gobi_0'
   imsi: '90170009030'
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'xor'
+  ciphers: ['a5 0', 'a5 1']
 
 - label: gobi_3
   path: '/gobi_3'
   imsi: '90170009032'
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'xor'
+  ciphers: ['a5 0', 'a5 1']
diff --git a/example/scenarios/cipher-a50.conf 
b/example/scenarios/cipher-a50.conf
new file mode 100644
index 000..d4a2e46
--- /dev/null
+++ b/example/scenarios/cipher-a50.conf
@@ -0,0 +1,7 @@
+resources:
+  bts:
+  - ciphers:
+- 'a5 0'
+  modem:
+  - ciphers:
+- 'a5 0'
diff --git a/example/scenarios/cipher-a51.conf 
b/example/scenarios/cipher-a51.conf
new file mode 100644
index 000..c84cd96
--- /dev/null
+++ b/example/scenarios/cipher-a51.conf
@@ -0,0 +1,7 @@
+resources:
+  bts:
+  - ciphers:
+- 'a5 1'
+  modem:
+  - ciphers:
+- 'a5 1'
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index da543f7..4f43bfc 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -56,6 +56,7 @@
 'bts[].band': schema.BAND,
 'bts[].trx_remote_ip': schema.IPV4,
 'bts[].launch_trx': schema.BOOL_STR,
+'bts[].ciphers[]': schema.CIPHER,
 'bts[].trx_list[].hw_addr': schema.HWADDR,
 'bts[].trx_list[].net_device': schema.STR,
 'arfcn[].arfcn': schema.INT,
@@ -65,6 +66,7 @@
 'modem[].imsi': schema.IMSI,
 'modem[].ki': schema.KI,
 'modem[].auth_algo': schema.AUTH_ALGO,
+'modem[].ciphers[]': schema.CIPHER,
 }
 
 WANT_SCHEMA = util.dict_add(
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index 2da80cd..91ad883 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -66,6 +66,11 @@
 return
 raise ValueError('Unknown Authentication Algorithm: %r' % val)
 
+def cipher(val):
+if val in ('a5 0', 'a5 1', 'a5 2', 'a5 3', 'a5 4', 'a5 5', 'a5 6', 'a5 7'):
+return
+raise ValueError('Unknown Cipher value: %r' % val)
+
 INT = 'int'
 STR = 'str'
 BOOL_STR = 'bool_str'
@@ -76,6 +81,7 @@
 KI = 'ki'
 MSISDN = 'msisdn'
 AUTH_ALGO = 'auth_algo'
+CIPHER = 'cipher'
 SCHEMA_TYPES = {
 INT: int,
 STR: str,
@@ -87,6 +93,7 @@
 KI: ki,
 MSISDN: msisdn,
 AUTH_ALGO: auth_algo,
+CIPHER: cipher,
 }
 
 def validate(config, schema):

-- 
To view, visit https://gerrit.osmocom.org/3723
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic0e368843a6e58bd3eeef36d2c0a7501296f0f3e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels 

osmo-gsm-tester[master]: contrib: Add scripts to build osmo-pcu

2017-08-31 Thread Pau Espin Pedrol

Patch Set 1:

Jobs have been added:
https://jenkins.osmocom.org/jenkins/view/osmo-gsm-tester/job/osmo-gsm-tester_build-osmo-pcu-sysmo/
https://jenkins.osmocom.org/jenkins/view/osmo-gsm-tester/job/osmo-gsm-tester_build-osmo-pcu/

Other jobs have been modified to take the tar.gz from them, and trigger when 
they build, etc.

-- 
To view, visit https://gerrit.osmocom.org/3756
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I90e7d2a79fb4ab7cc7fae5f3a1287a2e5bb748ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-gsm-tester[master]: contrib: Add scripts to build osmo-pcu

2017-08-31 Thread Pau Espin Pedrol

Review at  https://gerrit.osmocom.org/3756

contrib: Add scripts to build osmo-pcu

Change-Id: I90e7d2a79fb4ab7cc7fae5f3a1287a2e5bb748ab
---
A contrib/jenkins-build-osmo-pcu-sysmo.sh
A contrib/jenkins-build-osmo-pcu.sh
2 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/56/3756/1

diff --git a/contrib/jenkins-build-osmo-pcu-sysmo.sh 
b/contrib/jenkins-build-osmo-pcu-sysmo.sh
new file mode 100755
index 000..b912252
--- /dev/null
+++ b/contrib/jenkins-build-osmo-pcu-sysmo.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e -x
+
+poky="/opt/poky/1.5.4"
+. "$poky/environment-setup-armv5te-poky-linux-gnueabi"
+
+# Cross-compilation: all installations need to be put in the sysmo SDK sysroot
+export DESTDIR="$poky/sysroots/armv5te-poky-linux-gnueabi"
+
+base="$PWD"
+name="osmo-pcu-sysmo"
+prefix="/usr/local/jenkins-build/inst-$name"
+prefix_real="$DESTDIR$prefix"
+. "$(dirname "$0")/jenkins-build-common.sh"
+
+build_repo libosmocore --disable-pcsc --disable-doxygen
+build_repo osmo-pcu --enable-sysmocom-dsp
+
+create_bin_tgz
diff --git a/contrib/jenkins-build-osmo-pcu.sh 
b/contrib/jenkins-build-osmo-pcu.sh
new file mode 100755
index 000..7953875
--- /dev/null
+++ b/contrib/jenkins-build-osmo-pcu.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e -x
+base="$PWD"
+name="osmo-pcu"
+. "$(dirname "$0")/jenkins-build-common.sh"
+
+build_repo libosmocore --disable-pcsc --disable-doxygen
+build_repo osmo-pcu
+
+create_bin_tgz

-- 
To view, visit https://gerrit.osmocom.org/3756
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I90e7d2a79fb4ab7cc7fae5f3a1287a2e5bb748ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-gsm-manuals[master]: Allow easily disabling GFDL references

2017-08-31 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/3736/1/OsmoPCU/osmopcu-usermanual.adoc
File OsmoPCU/osmopcu-usermanual.adoc:

Line 28: ifdef::gfdl-enabled[]
why do we need this?  If we build a complete Osmocom manual, it will always be 
under GFDL.


-- 
To view, visit https://gerrit.osmocom.org/3736
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2489726ad2e90301bceadfada926e31ae0f85986
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-bts[master]: trx: avoid deactivating lchan on LCHAN_REL_ACT_REACT

2017-08-31 Thread Max

Patch Set 6:

The problem is that -oct, -lc15, -sysmo activate CCCH automatically in 
opstart_compl() before receiving SI3. As far as I understood it just a hack due 
to lack of proper FSM-based implementation of OML. The LCHAN_REL_ACT_REACT and 
activation/deactivation was introduced specifically to workaround this hack. 
The idea is that it'll be removed eventually - when OML is re-written based on 
osmo_fsm and we do not need auto-activation hack anymore.

-- 
To view, visit https://gerrit.osmocom.org/3067
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I20b89ba1e43d1414180b083cd1e085eeffe5d513
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Tom Tsou 
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: trx: avoid deactivating lchan on LCHAN_REL_ACT_REACT

2017-08-31 Thread Max
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3067

to look at the new patch set (#6).

trx: avoid deactivating lchan on LCHAN_REL_ACT_REACT

* do not deactivate lchan when called with LCHAN_REL_ACT_REACT
* add fixme comment

It's unclear yet if any special steps are required for osmo-bts-trx so
let's just make it compatible with setups [1] using BS_AG_BLKS_RES != 1
for now.

Background: CCCH is auto activated by some OsmoBTS - before we receive
SI3, see 4a8582846281322e8d7dfc577b18767cf35c24d1. To accommodate for
that we deactivate CCCH in common/rsl.c, which triggers BTS-model
specific callback sapi_deactivate_cb() which updates parameters and
activates it again.

In case of osmo-bts-trx there is no auto-activation and (seems to be) no
need in special interaction with hw to activate channel (no
lchan_activate()) hence we can just skip entire
deactivate/setup/activate again routine.

[1] "channel-descrption bs-ag-blks-res N" in OpenBSC config file.

Related: OS#1575
Change-Id: I20b89ba1e43d1414180b083cd1e085eeffe5d513
---
M include/osmo-bts/rsl.h
M src/osmo-bts-trx/l1_if.c
2 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/67/3067/6

diff --git a/include/osmo-bts/rsl.h b/include/osmo-bts/rsl.h
index d5d0f1a..ddd756e 100644
--- a/include/osmo-bts/rsl.h
+++ b/include/osmo-bts/rsl.h
@@ -9,7 +9,7 @@
LCHAN_REL_ACT_RSL,
LCHAN_REL_ACT_PCU,
LCHAN_REL_ACT_OML,
-   LCHAN_REL_ACT_REACT,
+   LCHAN_REL_ACT_REACT, /* remove once auto-activation hack is removed 
from opstart_compl() */
 };
 
 #define LCHAN_FN_DUMMY 0x
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index c629a61..3c11dfd 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -109,6 +109,12 @@
struct phy_instance *pinst = trx_phy_instance(lchan->ts->trx);
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
+   if (lchan->rel_act_kind == LCHAN_REL_ACT_REACT) {
+   lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
+   /* FIXME: perform whatever is needed (if any) to set proper 
PCH/AGCH allocation according to
+  3GPP TS 44.018 Table 10.5.2.11.1 using 
num_agch(lchan->ts->trx, "TRX L1"); function */
+   return 0;
+   }
/* set lchan inactive */
lchan_set_state(lchan, LCHAN_S_NONE);
 

-- 
To view, visit https://gerrit.osmocom.org/3067
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I20b89ba1e43d1414180b083cd1e085eeffe5d513
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou 


[PATCH] osmo-pcu[master]: Support receiving SI13 from BTS

2017-08-31 Thread Max
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3753

to look at the new patch set (#2).

Support receiving SI13 from BTS

* store SI13 in BTS struct
* check and handle BCCH SAPI
* bundle direct-phy related code together to simplify modifications

Change-Id: I610a93ce23725b182ec14e3507331295bd542f74
Related: OS#2400
---
M src/bts.h
M src/osmo-bts-litecell15/lc15_l1_if.c
M src/osmo-bts-sysmo/sysmo_l1_if.c
M src/pcu_l1_if.cpp
M src/pcu_main.cpp
M src/pcu_vty.h
6 files changed, 38 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/3753/2

diff --git a/src/bts.h b/src/bts.h
index b1fb8cc..d65cd2f 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 }
 
 #include "poll_controller.h"
@@ -212,7 +213,8 @@
uint8_t alpha, gamma;
uint8_t egprs_enabled;
uint32_t dl_tbf_idle_msec; /* hold time for idle DL TBFs */
-
+   uint8_t si13[GSM_MACBLOCK_LEN];
+   bool si13_is_set;
/* 0 to support resegmentation in DL, 1 for no reseg */
uint8_t dl_arq_type;
 
diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c 
b/src/osmo-bts-litecell15/lc15_l1_if.c
index c82ddba..37b7f78 100644
--- a/src/osmo-bts-litecell15/lc15_l1_if.c
+++ b/src/osmo-bts-litecell15/lc15_l1_if.c
@@ -29,6 +29,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/src/osmo-bts-sysmo/sysmo_l1_if.c b/src/osmo-bts-sysmo/sysmo_l1_if.c
index 9170972..1c5ecc9 100644
--- a/src/osmo-bts-sysmo/sysmo_l1_if.c
+++ b/src/osmo-bts-sysmo/sysmo_l1_if.c
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 50e181e..6d94850 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -163,9 +163,9 @@
 void pcu_l1if_tx_pdtch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn,
uint32_t fn, uint8_t block_nr)
 {
+#ifdef ENABLE_DIRECT_PHY
struct gprs_rlcmac_bts *bts = bts_main_data();
 
-#ifdef ENABLE_DIRECT_PHY
if (bts->trx[trx].fl1h) {
l1if_pdch_req(bts->trx[trx].fl1h, ts, 0, fn, arfcn, block_nr,
msg->data, msg->len);
@@ -245,21 +245,27 @@
return pdch->rcv_block(data, len, fn, meas);
 }
 
+static int pcu_rx_data_ind_bcch(uint8_t *data, uint8_t len)
+{
+   struct gprs_rlcmac_bts *bts = bts_main_data();
+
+   if (len != GSM_MACBLOCK_LEN) {
+   LOGP(DL1IF, LOGL_ERROR, "Received PCU data indication with SI13 
with unexpected length %u\n", len);
+   return -EINVAL;
+   }
+
+   memcpy(bts->si13, data, GSM_MACBLOCK_LEN);
+   bts->si13_is_set = true;
+
+   return 0;
+}
+
 static int pcu_rx_data_ind(struct gsm_pcu_if_data *data_ind)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
int rc;
pcu_l1_meas meas;
-   meas.set_rssi(data_ind->rssi);
-#ifndef ENABLE_DIRECT_PHY
-   /* convert BER to % value */
-   meas.set_ber(data_ind->ber10k / 100);
-   meas.set_bto(data_ind->ta_offs_qbits);
-   meas.set_link_qual(data_ind->lqual_cb / 10);
-   LOGP(DL1IF, LOGL_DEBUG, "Data indication with raw measurements "
-"received: BER10k = %d, BTO = %d, Q = %d\n", data_ind->ber10k,
-data_ind->ta_offs_qbits, data_ind->lqual_cb);
-#endif
+
LOGP(DL1IF, LOGL_DEBUG, "Data indication received: sapi=%d arfcn=%d "
"block=%d data=%s\n", data_ind->sapi,
data_ind->arfcn, data_ind->block_nr,
@@ -267,10 +273,22 @@
 
switch (data_ind->sapi) {
case PCU_IF_SAPI_PDTCH:
+   meas.set_rssi(data_ind->rssi);
+#ifndef ENABLE_DIRECT_PHY
+   /* convert BER to % value */
+   meas.set_ber(data_ind->ber10k / 100);
+   meas.set_bto(data_ind->ta_offs_qbits);
+   meas.set_link_qual(data_ind->lqual_cb / 10);
+   LOGP(DL1IF, LOGL_DEBUG, "Data indication with raw measurements 
received: BER10k = %d, BTO = %d, Q = %d\n",
+data_ind->ber10k, data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
+#endif
rc = pcu_rx_data_ind_pdtch(data_ind->trx_nr, data_ind->ts_nr,
data_ind->data, data_ind->len, data_ind->fn,
);
break;
+   case PCU_IF_SAPI_BCCH:
+   rc = pcu_rx_data_ind_bcch(data_ind->data, data_ind->len);
+   break;
default:
LOGP(DL1IF, LOGL_ERROR, "Received PCU data indication with "
"unsupported sapi %d\n", data_ind->sapi);
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index e909b75..b7574f9 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -183,6 +183,7 @@
bts->n3103 = 4;
bts->n3105 = 8;
bts->alpha = 0; /* a = 0.0 */
+   bts->si13_is_set = false;
bts->ms_idle_sec = 60; /* slightly above 

[PATCH] osmo-pcu[master]: Move gsmtap and accounting into separate function

2017-08-31 Thread Max

Review at  https://gerrit.osmocom.org/3755

Move gsmtap and accounting into separate function

Change-Id: I3609da1850244f25bd4611c9d25795ca379d6325
---
M src/gprs_rlcmac_sched.cpp
1 file changed, 31 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/55/3755/1

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 42f0308..e059ae1 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -307,6 +307,34 @@
return msg;
 }
 
+static inline void tap_n_acc(const struct msgb *msg, const struct 
gprs_rlcmac_bts *bts, uint8_t trx, uint8_t ts,
+uint32_t fn, enum pcu_gsmtap_category cat)
+{
+   if (!msg)
+   return;
+
+   switch(cat) {
+   case PCU_GSMTAP_C_DL_CTRL:
+   bts->bts->rlc_sent_control();
+   bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_CTRL, false, trx, ts, 
GSMTAP_CHANNEL_PACCH, fn, msg->data,
+ msg->len);
+   break;
+   case PCU_GSMTAP_C_DL_DATA_GPRS:
+   bts->bts->rlc_sent();
+   /* FIXME: distinguish between GPRS and EGPRS */
+   bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DATA_GPRS, false, trx, 
ts, GSMTAP_CHANNEL_PDTCH, fn, msg->data,
+ msg->len);
+   break;
+   case PCU_GSMTAP_C_DL_DUMMY:
+   bts->bts->rlc_sent_dummy();
+   bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DUMMY, false, trx, ts, 
GSMTAP_CHANNEL_PACCH, fn, msg->data,
+ msg->len);
+   break;
+   default:
+   break;
+   }
+}
+
 int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
uint8_t trx, uint8_t ts,
 uint32_t fn, uint8_t block_nr)
@@ -356,29 +384,19 @@
/* Prio 1: select control message */
msg = sched_select_ctrl_msg(trx, ts, fn, block_nr, pdch, ul_ass_tbf,
dl_ass_tbf, ul_ack_tbf);
-   if (msg) {
-   bts->bts->rlc_sent_control();
-   bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_CTRL, false, trx, ts, 
GSMTAP_CHANNEL_PACCH, fn, msg->data, msg->len);
-   }
+   tap_n_acc(msg, bts, trx, ts, fn, PCU_GSMTAP_C_DL_CTRL);
 
/* Prio 2: select data message for downlink */
if (!msg) {
msg = sched_select_downlink(bts, trx, ts, fn, block_nr, pdch);
-   if (msg) {
-   bts->bts->rlc_sent();
-   /* FIXME: distinguish between GPRS and EGPRS */
-   bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DATA_GPRS, false, 
trx, ts, GSMTAP_CHANNEL_PDTCH, fn, msg->data, msg->len);
-   }
+   tap_n_acc(msg, bts, trx, ts, fn, PCU_GSMTAP_C_DL_DATA_GPRS);
}
 
/* Prio 3: send dummy contol message */
if (!msg) {
/* increase counter */
msg = sched_dummy();
-   if (msg) {
-   bts->bts->rlc_sent_dummy();
-   bts->bts->send_gsmtap(PCU_GSMTAP_C_DL_DUMMY, false, 
trx, ts, GSMTAP_CHANNEL_PACCH, fn, msg->data, msg->len);
-   }
+   tap_n_acc(msg, bts, trx, ts, fn, PCU_GSMTAP_C_DL_DUMMY);
}
 
if (!msg)

-- 
To view, visit https://gerrit.osmocom.org/3755
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3609da1850244f25bd4611c9d25795ca379d6325
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 


[PATCH] osmo-bts[master]: Support sending SI13 to PCU

2017-08-31 Thread Max

Review at  https://gerrit.osmocom.org/3754

Support sending SI13 to PCU

* explicitly set SAPI when sending data_ind to PCU
* drop unused receiving code for BCCH SAPI
* send SI13 when PCU is connected
* send SI13 when new SI is received

Change-Id: I9e83ef792585aa962f99897d9973cef12f186bcf
Related: OS#2400
---
M include/osmo-bts/pcu_if.h
M src/common/l1sap.c
M src/common/pcu_sock.c
M src/common/rsl.c
4 files changed, 32 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/54/3754/1

diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index a020c05..ba3873e 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -6,6 +6,7 @@
 extern int pcu_direct;
 
 int pcu_tx_info_ind(void);
+int pcu_tx_si13(const struct gsm_bts *bts);
 int pcu_tx_rts_req(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,
uint16_t arfcn, uint8_t block_nr);
 int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 21d9dc6..1b3a3ad 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct gsm_lchan *get_lchan_by_chan_nr(struct gsm_bts_trx *trx,
   unsigned int chan_nr)
@@ -1013,7 +1014,7 @@
if (len == 0)
return -EINVAL;
if (L1SAP_IS_PTCCH(fn)) {
-   pcu_tx_data_ind(>ts[tn], 1, fn,
+   pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PTCCH, fn,
0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
data, len, rssi, data_ind->ber10k,
data_ind->ta_offs_qbits,
@@ -1023,7 +1024,7 @@
if (pr_info != PRES_INFO_BOTH)
return 0;
/* PDTCH / PACCH frame handling */
-   pcu_tx_data_ind(>ts[tn], 0, fn, 0 /* ARFCN */,
+   pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 
/* ARFCN */,
L1SAP_FN2MACBLOCK(fn), data, len, rssi, 
data_ind->ber10k,
data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
}
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index a4ddc05..0a9ba2d 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -322,7 +322,7 @@
return pcu_sock_send(_gsmnet, msg);
 }
 
-int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,
+int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t sapi, uint32_t fn,
uint16_t arfcn, uint8_t block_nr, uint8_t *data, uint8_t len,
int8_t rssi, uint16_t ber10k, int16_t bto, int16_t lqual)
 {
@@ -332,9 +332,8 @@
struct gsm_bts *bts = ts->trx->bts;
struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
 
-   LOGP(DPCU, LOGL_DEBUG, "Sending data indication: is_ptcch=%d arfcn=%d "
-   "block=%d data=%s\n", is_ptcch, arfcn, block_nr,
-   osmo_hexdump(data, len));
+   LOGP(DPCU, LOGL_DEBUG, "Sending data indication: sapi=%s arfcn=%d 
block=%d data=%s\n",
+sapi_string[sapi], arfcn, block_nr, osmo_hexdump(data, len));
 
if (lqual / 10 < btsb->min_qual_norm) {
LOGP(DPCU, LOGL_DEBUG, "Link quality %"PRId16" is below 
threshold %f, dropping packet\n",
@@ -348,7 +347,7 @@
pcu_prim = (struct gsm_pcu_if *) msg->data;
data_ind = _prim->u.data_ind;
 
-   data_ind->sapi = (is_ptcch) ? PCU_IF_SAPI_PTCCH : PCU_IF_SAPI_PDTCH;
+   data_ind->sapi = sapi;
data_ind->rssi = rssi;
data_ind->fn = fn;
data_ind->arfcn = arfcn;
@@ -488,16 +487,6 @@
osmo_hexdump(data_req->data, data_req->len));
 
switch (data_req->sapi) {
-   case PCU_IF_SAPI_BCCH:
-   if (data_req->len == 23) {
-   bts->si_valid |= (1 << SYSINFO_TYPE_13);
-   memcpy(bts->si_buf[SYSINFO_TYPE_13], data_req->data,
-   data_req->len);
-   } else {
-   bts->si_valid &= ~(1 << SYSINFO_TYPE_13);
-   }
-   osmo_signal_dispatch(SS_GLOBAL, S_NEW_SYSINFO, bts);
-   break;
case PCU_IF_SAPI_PCH:
if (msg_type == PCU_IF_MSG_PAG_REQ) {
/* FIXME: Add function to schedule paging request.
@@ -546,6 +535,21 @@
return rc;
 }
 
+int pcu_tx_si13(const struct gsm_bts *bts)
+{
+   /* the SI is per-BTS so it doesn't matter which TRX we use */
+   struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, 0);
+
+   /* The low-level data like FN, ARFCN etc will be ignored but we have to 
set lqual high enough to bypass
+  the check at lower levels */
+   int rc = pcu_tx_data_ind(>ts[0], PCU_IF_SAPI_BCCH, 0, 0, 

[PATCH] osmo-pcu[master]: Support receiving SI13 from BTS

2017-08-31 Thread Max

Review at  https://gerrit.osmocom.org/3753

Support receiving SI13 from BTS

* store SI13 in BTS struct
* check and handle BCCH SAPI
* bundle direct-phy related code together to simplify modifications

Change-Id: I610a93ce23725b182ec14e3507331295bd542f74
Related: OS#2400
---
M src/bts.h
M src/pcu_l1_if.cpp
M src/pcu_main.cpp
M src/pcu_vty.h
4 files changed, 34 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/3753/1

diff --git a/src/bts.h b/src/bts.h
index b1fb8cc..d65cd2f 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 }
 
 #include "poll_controller.h"
@@ -212,7 +213,8 @@
uint8_t alpha, gamma;
uint8_t egprs_enabled;
uint32_t dl_tbf_idle_msec; /* hold time for idle DL TBFs */
-
+   uint8_t si13[GSM_MACBLOCK_LEN];
+   bool si13_is_set;
/* 0 to support resegmentation in DL, 1 for no reseg */
uint8_t dl_arq_type;
 
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 50e181e..6d94850 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -163,9 +163,9 @@
 void pcu_l1if_tx_pdtch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn,
uint32_t fn, uint8_t block_nr)
 {
+#ifdef ENABLE_DIRECT_PHY
struct gprs_rlcmac_bts *bts = bts_main_data();
 
-#ifdef ENABLE_DIRECT_PHY
if (bts->trx[trx].fl1h) {
l1if_pdch_req(bts->trx[trx].fl1h, ts, 0, fn, arfcn, block_nr,
msg->data, msg->len);
@@ -245,21 +245,27 @@
return pdch->rcv_block(data, len, fn, meas);
 }
 
+static int pcu_rx_data_ind_bcch(uint8_t *data, uint8_t len)
+{
+   struct gprs_rlcmac_bts *bts = bts_main_data();
+
+   if (len != GSM_MACBLOCK_LEN) {
+   LOGP(DL1IF, LOGL_ERROR, "Received PCU data indication with SI13 
with unexpected length %u\n", len);
+   return -EINVAL;
+   }
+
+   memcpy(bts->si13, data, GSM_MACBLOCK_LEN);
+   bts->si13_is_set = true;
+
+   return 0;
+}
+
 static int pcu_rx_data_ind(struct gsm_pcu_if_data *data_ind)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
int rc;
pcu_l1_meas meas;
-   meas.set_rssi(data_ind->rssi);
-#ifndef ENABLE_DIRECT_PHY
-   /* convert BER to % value */
-   meas.set_ber(data_ind->ber10k / 100);
-   meas.set_bto(data_ind->ta_offs_qbits);
-   meas.set_link_qual(data_ind->lqual_cb / 10);
-   LOGP(DL1IF, LOGL_DEBUG, "Data indication with raw measurements "
-"received: BER10k = %d, BTO = %d, Q = %d\n", data_ind->ber10k,
-data_ind->ta_offs_qbits, data_ind->lqual_cb);
-#endif
+
LOGP(DL1IF, LOGL_DEBUG, "Data indication received: sapi=%d arfcn=%d "
"block=%d data=%s\n", data_ind->sapi,
data_ind->arfcn, data_ind->block_nr,
@@ -267,10 +273,22 @@
 
switch (data_ind->sapi) {
case PCU_IF_SAPI_PDTCH:
+   meas.set_rssi(data_ind->rssi);
+#ifndef ENABLE_DIRECT_PHY
+   /* convert BER to % value */
+   meas.set_ber(data_ind->ber10k / 100);
+   meas.set_bto(data_ind->ta_offs_qbits);
+   meas.set_link_qual(data_ind->lqual_cb / 10);
+   LOGP(DL1IF, LOGL_DEBUG, "Data indication with raw measurements 
received: BER10k = %d, BTO = %d, Q = %d\n",
+data_ind->ber10k, data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
+#endif
rc = pcu_rx_data_ind_pdtch(data_ind->trx_nr, data_ind->ts_nr,
data_ind->data, data_ind->len, data_ind->fn,
);
break;
+   case PCU_IF_SAPI_BCCH:
+   rc = pcu_rx_data_ind_bcch(data_ind->data, data_ind->len);
+   break;
default:
LOGP(DL1IF, LOGL_ERROR, "Received PCU data indication with "
"unsupported sapi %d\n", data_ind->sapi);
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index e909b75..b7574f9 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -183,6 +183,7 @@
bts->n3103 = 4;
bts->n3105 = 8;
bts->alpha = 0; /* a = 0.0 */
+   bts->si13_is_set = false;
bts->ms_idle_sec = 60; /* slightly above T3314 (default 44s, 24.008, 
11.2.2) */
bts->cs_adj_enabled = 1;
bts->cs_adj_upper_limit = 33; /* Decrease CS if the error rate is above 
*/
diff --git a/src/pcu_vty.h b/src/pcu_vty.h
index c00b882..a075350 100644
--- a/src/pcu_vty.h
+++ b/src/pcu_vty.h
@@ -1,6 +1,7 @@
 #ifndef _PCU_VTY_H
 #define _PCU_VTY_H
 
+#include 
 #include 
 #include 
 

-- 
To view, visit https://gerrit.osmocom.org/3753
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I610a93ce23725b182ec14e3507331295bd542f74
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 


libosmocore[master]: Makefile.am: fix missing LTLDFLAGS for libosmocoding

2017-08-31 Thread Max

Patch Set 1: Code-Review+1

-- 
To view, visit https://gerrit.osmocom.org/3752
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Idf677825ff642d50bea43c7f970810783e864fdd
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[PATCH] openbsc[master]: abis: fix unaligned memory access

2017-08-31 Thread Max
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3750

to look at the new patch set (#3).

abis: fix unaligned memory access

* replace pointer arithmetic and direct assignment with struct
  modification and function call to prevent unaligned memory
  access on arm
* remove redundant functions
* constify function parameter

Change-Id: Ie8a3107c22cd7f3682fac037e04a50ef3ea9171c
Fixes: OS#2472
---
M openbsc/include/openbsc/abis_nm.h
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libbsc/abis_nm.c
M openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
M openbsc/src/libcommon/gsm_data.c
5 files changed, 15 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/50/3750/3

diff --git a/openbsc/include/openbsc/abis_nm.h 
b/openbsc/include/openbsc/abis_nm.h
index db2a659..658e2bb 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -157,7 +157,7 @@
uint8_t *attr, uint8_t attr_len);
 int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, 
 uint32_t ip, uint16_t port, uint8_t stream);
-void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts);
+void abis_nm_ipaccess_cgi(uint8_t *buf, const struct gsm_bts *bts, bool 
rac_lac_override);
 int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf);
 const char *ipacc_testres_name(uint8_t res);
 
diff --git a/openbsc/include/openbsc/gsm_data.h 
b/openbsc/include/openbsc/gsm_data.h
index 4035b39..995ffea 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -558,8 +558,6 @@
 const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
 int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode);
 
-int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
-void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
 struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
 
 int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index cf20d7c..80e4183 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -2783,12 +2783,20 @@
 attr, attr_len);
 }
 
-void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts)
+void abis_nm_ipaccess_cgi(uint8_t *buf, const struct gsm_bts *bts, bool 
rac_lac_override)
 {
-   /* we simply reuse the GSM48 function and overwrite the RAC
-* with the Cell ID */
-   gsm48_ra_id_by_bts(buf, bts);
-   *((uint16_t *)(buf + 5)) = htons(bts->cell_identity);
+   struct gprs_ra_id raid;
+
+   raid.mcc = bts->network->country_code;
+   raid.mnc = bts->network->network_code;
+   raid.lac = bts->location_area_code;
+   raid.rac = bts->gprs.rac;
+
+   gsm48_construct_ra(buf, );
+
+   /* FIXME: we try to overwrite the RAC (1 byte) with the Cell ID (2 
bytes) so we also override part of LAC?! */
+   if (rac_lac_override)
+   osmo_store16be(bts->cell_identity, buf + 5);
 }
 
 void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked)
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c 
b/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
index 473e1ca..42575a0 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
@@ -101,7 +101,7 @@
 
msgb_tv_put(msgb, NM_ATT_BSIC, bts->bsic);
 
-   abis_nm_ipaccess_cgi(buf, bts);
+   abis_nm_ipaccess_cgi(buf, bts, true);
msgb_tl16v_put(msgb, NM_ATT_IPACC_CGI, 7, buf);
 
return msgb;
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index f1049e9..f6e775b 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -335,23 +335,6 @@
return bts;
 }
 
-void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts)
-{
-   raid->mcc = bts->network->country_code;
-   raid->mnc = bts->network->network_code;
-   raid->lac = bts->location_area_code;
-   raid->rac = bts->gprs.rac;
-}
-
-int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts)
-{
-   struct gprs_ra_id raid;
-
-   gprs_ra_id_by_bts(, bts);
-
-   return gsm48_construct_ra(buf, );
-}
-
 int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char 
**argv)
 {
int ret;

-- 
To view, visit https://gerrit.osmocom.org/3750
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie8a3107c22cd7f3682fac037e04a50ef3ea9171c
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[PATCH] openbsc[master]: abis: fix unaligned memory access

2017-08-31 Thread Max
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/3750

to look at the new patch set (#2).

abis: fix unaligned memory access

* replace pointer arithmetic with struct use to prevent unaligned memory
  access on arm
* remove redundant functions
* constify function parameter

Change-Id: Ie8a3107c22cd7f3682fac037e04a50ef3ea9171c
Fixes: OS#2472
---
M openbsc/include/openbsc/abis_nm.h
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libbsc/abis_nm.c
M openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
M openbsc/src/libcommon/gsm_data.c
5 files changed, 15 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/50/3750/2

diff --git a/openbsc/include/openbsc/abis_nm.h 
b/openbsc/include/openbsc/abis_nm.h
index db2a659..658e2bb 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -157,7 +157,7 @@
uint8_t *attr, uint8_t attr_len);
 int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, 
 uint32_t ip, uint16_t port, uint8_t stream);
-void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts);
+void abis_nm_ipaccess_cgi(uint8_t *buf, const struct gsm_bts *bts, bool 
rac_lac_override);
 int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf);
 const char *ipacc_testres_name(uint8_t res);
 
diff --git a/openbsc/include/openbsc/gsm_data.h 
b/openbsc/include/openbsc/gsm_data.h
index 4035b39..995ffea 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -558,8 +558,6 @@
 const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
 int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode);
 
-int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
-void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
 struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
 
 int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index cf20d7c..80e4183 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -2783,12 +2783,20 @@
 attr, attr_len);
 }
 
-void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts)
+void abis_nm_ipaccess_cgi(uint8_t *buf, const struct gsm_bts *bts, bool 
rac_lac_override)
 {
-   /* we simply reuse the GSM48 function and overwrite the RAC
-* with the Cell ID */
-   gsm48_ra_id_by_bts(buf, bts);
-   *((uint16_t *)(buf + 5)) = htons(bts->cell_identity);
+   struct gprs_ra_id raid;
+
+   raid.mcc = bts->network->country_code;
+   raid.mnc = bts->network->network_code;
+   raid.lac = bts->location_area_code;
+   raid.rac = bts->gprs.rac;
+
+   gsm48_construct_ra(buf, );
+
+   /* FIXME: we try to overwrite the RAC (1 byte) with the Cell ID (2 
bytes) so we also override part of LAC?! */
+   if (rac_lac_override)
+   osmo_store16be(bts->cell_identity, buf + 5);
 }
 
 void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked)
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c 
b/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
index 473e1ca..42575a0 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts_omlattr.c
@@ -101,7 +101,7 @@
 
msgb_tv_put(msgb, NM_ATT_BSIC, bts->bsic);
 
-   abis_nm_ipaccess_cgi(buf, bts);
+   abis_nm_ipaccess_cgi(buf, bts, true);
msgb_tl16v_put(msgb, NM_ATT_IPACC_CGI, 7, buf);
 
return msgb;
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index f1049e9..f6e775b 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -335,23 +335,6 @@
return bts;
 }
 
-void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts)
-{
-   raid->mcc = bts->network->country_code;
-   raid->mnc = bts->network->network_code;
-   raid->lac = bts->location_area_code;
-   raid->rac = bts->gprs.rac;
-}
-
-int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts)
-{
-   struct gprs_ra_id raid;
-
-   gprs_ra_id_by_bts(, bts);
-
-   return gsm48_construct_ra(buf, );
-}
-
 int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char 
**argv)
 {
int ret;

-- 
To view, visit https://gerrit.osmocom.org/3750
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie8a3107c22cd7f3682fac037e04a50ef3ea9171c
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[PATCH] libosmocore[master]: Makefile.am: fix missing LTLDFLAGS for libosmocoding

2017-08-31 Thread Vadim Yanitskiy

Review at  https://gerrit.osmocom.org/3752

Makefile.am: fix missing LTLDFLAGS for libosmocoding

Despite the libosmocoding.map is preset since the library release,
one was not used in a proper way. The LTLDFLAGS were missing, so
let's add them.

Change-Id: Idf677825ff642d50bea43c7f970810783e864fdd
---
M configure.ac
M src/coding/Makefile.am
2 files changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/52/3752/1

diff --git a/configure.ac b/configure.ac
index 5821ad3..33c151e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,7 @@
 esac
 AC_SUBST(LTLDFLAGS_OSMOGB)
 AC_SUBST(LTLDFLAGS_OSMOGSM)
+AC_SUBST(LTLDFLAGS_OSMOCODING)
 
 dnl checks for header files
 AC_HEADER_STDC
diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am
index 06e55e5..dcbbd8f 100644
--- a/src/coding/Makefile.am
+++ b/src/coding/Makefile.am
@@ -22,6 +22,7 @@
gsm0503_parity.c \
gsm0503_coding.c
 libosmocoding_la_LDFLAGS = \
+   $(LTLDFLAGS_OSMOCODING) \
-version-info \
$(LIBVERSION) \
-no-undefined \

-- 
To view, visit https://gerrit.osmocom.org/3752
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf677825ff642d50bea43c7f970810783e864fdd
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


[PATCH] pysim[master]: Support writing SMSP for sysmoUSIM-SJS1

2017-08-31 Thread daniel

Review at  https://gerrit.osmocom.org/3751

Support writing SMSP for sysmoUSIM-SJS1

Change-Id: I6cbf69be3d410c18a509b98a63cb69bab74a528a
---
M pySim/cards.py
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/51/3751/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 925c5e6..9f678ab 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -459,6 +459,9 @@
# write EF.IMSI
data, sw = self._scc.update_binary('6f07', enc_imsi(p['imsi']))
 
+   # EF.SMSP
+   r = self._scc.select_file(['3f00', '7f10'])
+   data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 
104), force_len=True)
 
 
def erase(self):

-- 
To view, visit https://gerrit.osmocom.org/3751
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cbf69be3d410c18a509b98a63cb69bab74a528a
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: daniel