Change in osmo-msc[master]: SMPP: Don't accept password or system-id exceeding spec length

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13930 )

Change subject: SMPP: Don't accept password or system-id exceeding spec length
..


Patch Set 1: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/13930/1/src/libmsc/smpp_smsc.h
File src/libmsc/smpp_smsc.h:

https://gerrit.osmocom.org/#/c/13930/1/src/libmsc/smpp_smsc.h@16
PS1, Line 16: #define SMPP_SYS_ID_LEN   15
> Same define is defined in smpp_mirror.c, you want to fix that one too. […]
stictly speaking, that's not a bug fix.  SMPP_Mirror has no user-configurabe 
username and/or password, so unlike osmo-msc there is no situation where the 
user can configure something that will break in practise.  Having too large 
buffers is not a bug there.

So I think it's a separate cleanup that deserves a separate patch, at much 
lower priority.



--
To view, visit https://gerrit.osmocom.org/13930
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I81ef593e84bf1e15f6746386fc145495fae29354
Gerrit-Change-Number: 13930
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Fri, 10 May 2019 06:50:37 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Jenkins build is back to normal : master-osmo-sip-connector » a1=default,a2=default,a3=default,a4=default,osmocom-master-debian9 #1390

2019-05-09 Thread jenkins
See 




Build failed in Jenkins: master-osmo-sip-connector » a1=default,a2=default,a3=default,a4=default,osmocom-master-debian9 #1389

2019-05-09 Thread jenkins
See 


--
[...truncated 11.08 KB...]
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared 
libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /usr/bin/pkg-config
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.20... yes
checking for ANSI C header files... (cached) yes
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/timerfd.h usability... yes
checking sys/timerfd.h presence... yes
checking for sys/timerfd.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for library containing dlopen... -ldl
checking for library containing dlsym... -ldl
checking for backtrace in -lexecinfo... no
checking for library containing clock_gettime... none required
checking for doxygen... /usr/bin/doxygen
checking whether SYS_getrandom is declared... yes
checking if gcc supports -fvisibility=hidden... yes
checking for clock_gettime... yes
checking for localtime_r... yes
checking whether struct tm has tm_gmtoff member... yes
checking for TALLOC... yes
checking for PCSC... yes
checking for LIBGNUTLS... yes
checking whether to enable VTY/CTRL tests... no
checking whether C compiler accepts -mavx2... yes
checking whether C compiler accepts -mssse3... yes
checking whether C compiler accepts -msse4.1... yes
checking whether gcc has __builtin_cpu_supports built-in... yes
CFLAGS="-g -O2 -DBUILDING_LIBOSMOCORE -Wall"
CPPFLAGS=" -DBUILDING_LIBOSMOCORE -Wall"
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libosmocore.pc
config.status: creating libosmocodec.pc
config.status: creating libosmocoding.pc
config.status: creating libosmovty.pc
config.status: creating libosmogsm.pc
config.status: creating libosmogb.pc
config.status: creating libosmoctrl.pc
config.status: creating libosmosim.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating src/vty/Makefile
config.status: creating src/codec/Makefile
config.status: creating src/coding/Makefile
config.status: creating src/sim/Makefile
config.status: creating src/gsm/Makefile
config.status: creating src/gb/Makefile
config.status: creating src/ctrl/Makefile
config.status: creating src/pseudotalloc/Makefile
config.status: creating tests/Makefile
config.status: creating tests/atlocal
config.status: creating utils/Makefile
config.status: creating Doxyfile.core
config.status: creating Doxyfile.gsm
config.status: creating Doxyfile.vty
config.status: creating Doxyfile.codec
config.status: creating Doxyfile.coding
config.status: creating Doxyfile.gb
config.status: creating Doxyfile.ctrl
config.status: creating Makefile
config.status: creating config.h
config.status: executing tests/atconfig commands
config.status: executing depfiles commands
config.status: executing libtool commands
configure: WARNING: unrecognized options: --with-systemdsystemunitdir
+ [ -n  ]
+ make -j 8 install
echo 1.1.0.4-c9a2 > .version-t && mv .version-t .version
make  install-recursive
make[1]: Entering directory 
'
Making install in include
make[2]: Entering directory 
'

Change in osmocom-bb[master]: trxcon/trx_if.c: print error message if read() call fails

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13957 )

Change subject: trxcon/trx_if.c: print error message if read() call fails
..

trxcon/trx_if.c: print error message if read() call fails

Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
---
M src/host/trxcon/trx_if.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 91075f4..e53fab2 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -444,8 +444,10 @@
char buf[1500], *p;

len = read(ofd->fd, buf, sizeof(buf) - 1);
-   if (len <= 0)
+   if (len <= 0) {
+   LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%d\n", len);
return len;
+   }
buf[len] = '\0';

if (!!strncmp(buf, "RSP ", 4)) {
@@ -551,8 +553,10 @@
int len;

len = read(ofd->fd, buf, sizeof(buf));
-   if (len <= 0)
+   if (len <= 0) {
+   LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%d\n", len);
return len;
+   }

if (len != 158) {
LOGP(DTRXD, LOGL_ERROR, "Got data message with invalid "

--
To view, visit https://gerrit.osmocom.org/13957
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
Gerrit-Change-Number: 13957
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/trx_if.c: use ssize_t for return value of read()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13958 )

Change subject: trxcon/trx_if.c: use ssize_t for return value of read()
..

trxcon/trx_if.c: use ssize_t for return value of read()

Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
---
M src/host/trxcon/trx_if.c
1 file changed, 14 insertions(+), 13 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index e53fab2..35ad3c0 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -440,15 +440,16 @@
 {
struct trx_instance *trx = ofd->data;
struct trx_ctrl_msg *tcm;
-   int len, resp, rsp_len;
+   int resp, rsp_len;
char buf[1500], *p;
+   ssize_t read_len;

-   len = read(ofd->fd, buf, sizeof(buf) - 1);
-   if (len <= 0) {
-   LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%d\n", len);
-   return len;
+   read_len = read(ofd->fd, buf, sizeof(buf) - 1);
+   if (read_len <= 0) {
+   LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%zd\n", read_len);
+   return read_len;
}
-   buf[len] = '\0';
+   buf[read_len] = '\0';

if (!!strncmp(buf, "RSP ", 4)) {
LOGP(DTRX, LOGL_NOTICE, "Unknown message on CTRL port: %s\n", 
buf);
@@ -550,17 +551,17 @@
int8_t rssi, tn;
int16_t toa256;
uint32_t fn;
-   int len;
+   ssize_t read_len;

-   len = read(ofd->fd, buf, sizeof(buf));
-   if (len <= 0) {
-   LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%d\n", len);
-   return len;
+   read_len = read(ofd->fd, buf, sizeof(buf));
+   if (read_len <= 0) {
+   LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%zd\n", 
read_len);
+   return read_len;
}

-   if (len != 158) {
+   if (read_len != 158) {
LOGP(DTRXD, LOGL_ERROR, "Got data message with invalid "
-   "length '%d'\n", len);
+   "length '%zd'\n", read_len);
return -EINVAL;
}


--
To view, visit https://gerrit.osmocom.org/13958
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
Gerrit-Change-Number: 13958
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/trx_if.c: use read() call instead of recv()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13956 )

Change subject: trxcon/trx_if.c: use read() call instead of recv()
..

trxcon/trx_if.c: use read() call instead of recv()

According to the man page of recv(), the only difference of this
call from read() is the presence of flags. With a zero flags
argument, recv() is generally equivalent to read().

Change-Id: I6d43bbf8d52c5fbb8ee0592b7d1c1dfd2dd1548e
---
M src/host/trxcon/trx_if.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 4c10da6..91075f4 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -443,7 +443,7 @@
int len, resp, rsp_len;
char buf[1500], *p;

-   len = recv(ofd->fd, buf, sizeof(buf) - 1, 0);
+   len = read(ofd->fd, buf, sizeof(buf) - 1);
if (len <= 0)
return len;
buf[len] = '\0';
@@ -550,7 +550,7 @@
uint32_t fn;
int len;

-   len = recv(ofd->fd, buf, sizeof(buf), 0);
+   len = read(ofd->fd, buf, sizeof(buf));
if (len <= 0)
return len;


--
To view, visit https://gerrit.osmocom.org/13956
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6d43bbf8d52c5fbb8ee0592b7d1c1dfd2dd1548e
Gerrit-Change-Number: 13956
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/trx_if.c: print error message if read() call fails

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13957 )

Change subject: trxcon/trx_if.c: print error message if read() call fails
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13957
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
Gerrit-Change-Number: 13957
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 22:48:23 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13955 )

Change subject: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML
..

osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML

It seems osmo-bts-sysmo does support CBCH (Cell Broadcast), but
for some reason it doesn't report BTS_FEAT_CBCH to the BSC.

Change-Id: I42dd3f84c44c210d9255e17153372bf252f897a1
---
M src/osmo-bts-sysmo/main.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 221e8e8..ad7118a 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -76,6 +76,7 @@
exit(23);
}

+   gsm_bts_set_feature(bts, BTS_FEAT_CBCH);
gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
gsm_bts_set_feature(bts, BTS_FEAT_EGPRS);
gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);

--
To view, visit https://gerrit.osmocom.org/13955
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I42dd3f84c44c210d9255e17153372bf252f897a1
Gerrit-Change-Number: 13955
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/trx_if.c: use read() call instead of recv()

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13956 )

Change subject: trxcon/trx_if.c: use read() call instead of recv()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13956
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6d43bbf8d52c5fbb8ee0592b7d1c1dfd2dd1548e
Gerrit-Change-Number: 13956
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 22:48:12 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/trx_if.c: use ssize_t for return value of read()

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13958 )

Change subject: trxcon/trx_if.c: use ssize_t for return value of read()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13958
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
Gerrit-Change-Number: 13958
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 22:48:30 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13955 )

Change subject: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13955
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I42dd3f84c44c210d9255e17153372bf252f897a1
Gerrit-Change-Number: 13955
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 22:47:53 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: RAN_Emulation: Fix IMSI table lookup on RANAP paging

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13959 )

Change subject: RAN_Emulation: Fix IMSI table lookup on RANAP paging
..

RAN_Emulation: Fix IMSI table lookup on RANAP paging

We need to check explicitly for '== null'.  isvalue() is of no help
here, as 'null' apparently is a value in TTCN-3.

Change-Id: I4b2793937a201c5535051092d871ded6cb053f5f
---
M library/RAN_Emulation.ttcnpp
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/library/RAN_Emulation.ttcnpp b/library/RAN_Emulation.ttcnpp
index 843cc9e..9a65eb7 100644
--- a/library/RAN_Emulation.ttcnpp
+++ b/library/RAN_Emulation.ttcnpp
@@ -585,7 +585,7 @@
}
}
client := f_imsi_table_find(oct2hex(imsi), tmsi);
-   if (isvalue(client)) {
+   if (client != null) {
log("CommonRanapUnitdataCallback: IMSI/TMSI found in 
table, dispatching to ",
client);
CLIENT.send(ranap) to client;

--
To view, visit https://gerrit.osmocom.org/13959
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4b2793937a201c5535051092d871ded6cb053f5f
Gerrit-Change-Number: 13959
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: RAN_Emulation: Fix IMSI table lookup on RANAP paging

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13959 )

Change subject: RAN_Emulation: Fix IMSI table lookup on RANAP paging
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13959
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4b2793937a201c5535051092d871ded6cb053f5f
Gerrit-Change-Number: 13959
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 22:47:24 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: RAN_Emulation: Fix IMSI table lookup on RANAP paging

2019-05-09 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13959


Change subject: RAN_Emulation: Fix IMSI table lookup on RANAP paging
..

RAN_Emulation: Fix IMSI table lookup on RANAP paging

We need to check explicitly for '== null'.  isvalue() is of no help
here, as 'null' apparently is a value in TTCN-3.

Change-Id: I4b2793937a201c5535051092d871ded6cb053f5f
---
M library/RAN_Emulation.ttcnpp
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/59/13959/1

diff --git a/library/RAN_Emulation.ttcnpp b/library/RAN_Emulation.ttcnpp
index 843cc9e..9a65eb7 100644
--- a/library/RAN_Emulation.ttcnpp
+++ b/library/RAN_Emulation.ttcnpp
@@ -585,7 +585,7 @@
}
}
client := f_imsi_table_find(oct2hex(imsi), tmsi);
-   if (isvalue(client)) {
+   if (client != null) {
log("CommonRanapUnitdataCallback: IMSI/TMSI found in 
table, dispatching to ",
client);
CLIENT.send(ranap) to client;

--
To view, visit https://gerrit.osmocom.org/13959
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b2793937a201c5535051092d871ded6cb053f5f
Gerrit-Change-Number: 13959
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 


Change in osmocom-bb[master]: trxcon/trx_if.c: use read() call instead of recv()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13956


Change subject: trxcon/trx_if.c: use read() call instead of recv()
..

trxcon/trx_if.c: use read() call instead of recv()

According to the man page of recv(), the only difference of this
call from read() is the presence of flags. With a zero flags
argument, recv() is generally equivalent to read().

Change-Id: I6d43bbf8d52c5fbb8ee0592b7d1c1dfd2dd1548e
---
M src/host/trxcon/trx_if.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/56/13956/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 4c10da6..91075f4 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -443,7 +443,7 @@
int len, resp, rsp_len;
char buf[1500], *p;

-   len = recv(ofd->fd, buf, sizeof(buf) - 1, 0);
+   len = read(ofd->fd, buf, sizeof(buf) - 1);
if (len <= 0)
return len;
buf[len] = '\0';
@@ -550,7 +550,7 @@
uint32_t fn;
int len;

-   len = recv(ofd->fd, buf, sizeof(buf), 0);
+   len = read(ofd->fd, buf, sizeof(buf));
if (len <= 0)
return len;


--
To view, visit https://gerrit.osmocom.org/13956
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d43bbf8d52c5fbb8ee0592b7d1c1dfd2dd1548e
Gerrit-Change-Number: 13956
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/trx_if.c: print error message if read() call fails

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13957


Change subject: trxcon/trx_if.c: print error message if read() call fails
..

trxcon/trx_if.c: print error message if read() call fails

Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
---
M src/host/trxcon/trx_if.c
1 file changed, 6 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/57/13957/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 91075f4..e53fab2 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -444,8 +444,10 @@
char buf[1500], *p;

len = read(ofd->fd, buf, sizeof(buf) - 1);
-   if (len <= 0)
+   if (len <= 0) {
+   LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%d\n", len);
return len;
+   }
buf[len] = '\0';

if (!!strncmp(buf, "RSP ", 4)) {
@@ -551,8 +553,10 @@
int len;

len = read(ofd->fd, buf, sizeof(buf));
-   if (len <= 0)
+   if (len <= 0) {
+   LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%d\n", len);
return len;
+   }

if (len != 158) {
LOGP(DTRXD, LOGL_ERROR, "Got data message with invalid "

--
To view, visit https://gerrit.osmocom.org/13957
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
Gerrit-Change-Number: 13957
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/trx_if.c: use ssize_t for return value of read()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13958


Change subject: trxcon/trx_if.c: use ssize_t for return value of read()
..

trxcon/trx_if.c: use ssize_t for return value of read()

Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
---
M src/host/trxcon/trx_if.c
1 file changed, 14 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/58/13958/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index e53fab2..35ad3c0 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -440,15 +440,16 @@
 {
struct trx_instance *trx = ofd->data;
struct trx_ctrl_msg *tcm;
-   int len, resp, rsp_len;
+   int resp, rsp_len;
char buf[1500], *p;
+   ssize_t read_len;

-   len = read(ofd->fd, buf, sizeof(buf) - 1);
-   if (len <= 0) {
-   LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%d\n", len);
-   return len;
+   read_len = read(ofd->fd, buf, sizeof(buf) - 1);
+   if (read_len <= 0) {
+   LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%zd\n", read_len);
+   return read_len;
}
-   buf[len] = '\0';
+   buf[read_len] = '\0';

if (!!strncmp(buf, "RSP ", 4)) {
LOGP(DTRX, LOGL_NOTICE, "Unknown message on CTRL port: %s\n", 
buf);
@@ -550,17 +551,17 @@
int8_t rssi, tn;
int16_t toa256;
uint32_t fn;
-   int len;
+   ssize_t read_len;

-   len = read(ofd->fd, buf, sizeof(buf));
-   if (len <= 0) {
-   LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%d\n", len);
-   return len;
+   read_len = read(ofd->fd, buf, sizeof(buf));
+   if (read_len <= 0) {
+   LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%zd\n", 
read_len);
+   return read_len;
}

-   if (len != 158) {
+   if (read_len != 158) {
LOGP(DTRXD, LOGL_ERROR, "Got data message with invalid "
-   "length '%d'\n", len);
+   "length '%zd'\n", read_len);
return -EINVAL;
}


--
To view, visit https://gerrit.osmocom.org/13958
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
Gerrit-Change-Number: 13958
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmo-bts[master]: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13955 )

Change subject: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML
..


Patch Set 1:

I have very limited experience with sysmoBTS, neither I can test CBCH on it. 
Looking at the model specific implementation, I see some CBCH related core 
bits, so I assume it's somehow supported...


--
To view, visit https://gerrit.osmocom.org/13955
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I42dd3f84c44c210d9255e17153372bf252f897a1
Gerrit-Change-Number: 13955
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-CC: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 20:52:50 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-bts[master]: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13955


Change subject: osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML
..

osmo-bts-sysmo: fix: indicate BTS_FEAT_CBCH support on OML

It seems osmo-bts-sysmo does support CBCH (Cell Broadcast), but
for some reason it doesn't report BTS_FEAT_CBCH to the BSC.

Change-Id: I42dd3f84c44c210d9255e17153372bf252f897a1
---
M src/osmo-bts-sysmo/main.c
1 file changed, 1 insertion(+), 0 deletions(-)



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

diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 221e8e8..ad7118a 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -76,6 +76,7 @@
exit(23);
}

+   gsm_bts_set_feature(bts, BTS_FEAT_CBCH);
gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
gsm_bts_set_feature(bts, BTS_FEAT_EGPRS);
gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);

--
To view, visit https://gerrit.osmocom.org/13955
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I42dd3f84c44c210d9255e17153372bf252f897a1
Gerrit-Change-Number: 13955
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmo-msc[master]: libmsc/gsm_04_11.c: properly handle TP-User-Data-Length

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13655 )

Change subject: libmsc/gsm_04_11.c: properly handle TP-User-Data-Length
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/13655
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4b08db7665e854a045129e7695e2bdf296df1688
Gerrit-Change-Number: 13655
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Max 
Gerrit-Comment-Date: Thu, 09 May 2019 20:27:45 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-msc[master]: call_leg: document the parent_event_* items

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13946 )

Change subject: call_leg: document the parent_event_* items
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13946
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib099178a0f6ab218646c67c0e7a3d360c81af684
Gerrit-Change-Number: 13946
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 20:18:53 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13953 )

Change subject: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()
..

libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

It was noticed that SCCP_RAN_MSG_RESET_ACK message is not freed after
sending. Since ran_peer_rx_reset() calls sccp_ran_down_l2_cl(), which
then calls osmo_sccp_user_sap_down_nofree(), which doesn't free the
message buffer (what's clear from its name).

  OsmoMSC# show talloc-context application full filter msgb
  full talloc report on 'osmo_msc' (total  20155 bytes in  88 blocks)
msgb  contains   4640 bytes in   5 blocks (ref 0)
  bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)
  bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)
  bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)

Let's free it after sending (or in case of error).

Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
---
M src/libmsc/ran_peer.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c
index ac2bb4f..40040a2 100644
--- a/src/libmsc/ran_peer.c
+++ b/src/libmsc/ran_peer.c
@@ -140,11 +140,15 @@
if (sccp_ran_down_l2_cl(rp->sri, &rp->peer_addr, reset_ack)) {
LOG_RAN_PEER(rp, LOGL_ERROR, "Failed to send RESET ACKNOWLEDGE 
message\n");
ran_peer_state_chg(rp, RAN_PEER_ST_WAIT_RX_RESET);
+   msgb_free(reset_ack);
return;
}

LOG_RAN_PEER(rp, LOGL_INFO, "Sent RESET ACKNOWLEDGE\n");

+   /* sccp_ran_down_l2_cl() doesn't free msgb */
+   msgb_free(reset_ack);
+
ran_peer_state_chg(rp, RAN_PEER_ST_READY);
 }


--
To view, visit https://gerrit.osmocom.org/13953
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
Gerrit-Change-Number: 13953
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in libosmo-sccp[master]: osmo-stp: register VTY commands for talloc context introspection

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13954


Change subject: osmo-stp: register VTY commands for talloc context introspection
..

osmo-stp: register VTY commands for talloc context introspection

Change-Id: Id0789c4946929b783c54220de439958001f94992
---
M stp/stp_main.c
1 file changed, 1 insertion(+), 0 deletions(-)



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

diff --git a/stp/stp_main.c b/stp/stp_main.c
index e7f4f38..aa77e61 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -180,6 +180,7 @@
osmo_ss7_vty_init_sg(tall_stp_ctx);
osmo_sccp_vty_init();
osmo_fsm_vty_add_cmds();
+   osmo_talloc_vty_add_cmds();

rc = vty_read_config_file(cmdline_config.config_file, NULL);
if (rc < 0) {

--
To view, visit https://gerrit.osmocom.org/13954
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0789c4946929b783c54220de439958001f94992
Gerrit-Change-Number: 13954
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmo-msc[master]: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13953 )

Change subject: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()
..


Patch Set 1: Code-Review+2

excellent, this code is from before I started calling _nonfree(), forgot about 
that one...


--
To view, visit https://gerrit.osmocom.org/13953
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
Gerrit-Change-Number: 13953
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 20:00:59 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13953


Change subject: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()
..

libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

It was noticed that SCCP_RAN_MSG_RESET_ACK message is not freed after
sending. Since ran_peer_rx_reset() calls sccp_ran_down_l2_cl(), which
then calls osmo_sccp_user_sap_down_nofree(), which doesn't free the
message buffer (what's clear from its name).

  OsmoMSC# show talloc-context application full filter msgb
  full talloc report on 'osmo_msc' (total  20155 bytes in  88 blocks)
msgb  contains   4640 bytes in   5 blocks (ref 0)
  bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)
  bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)
  bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)

Let's free it after sending (or in case of error).

Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
---
M src/libmsc/ran_peer.c
1 file changed, 4 insertions(+), 0 deletions(-)



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

diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c
index ac2bb4f..40040a2 100644
--- a/src/libmsc/ran_peer.c
+++ b/src/libmsc/ran_peer.c
@@ -140,11 +140,15 @@
if (sccp_ran_down_l2_cl(rp->sri, &rp->peer_addr, reset_ack)) {
LOG_RAN_PEER(rp, LOGL_ERROR, "Failed to send RESET ACKNOWLEDGE 
message\n");
ran_peer_state_chg(rp, RAN_PEER_ST_WAIT_RX_RESET);
+   msgb_free(reset_ack);
return;
}

LOG_RAN_PEER(rp, LOGL_INFO, "Sent RESET ACKNOWLEDGE\n");

+   /* sccp_ran_down_l2_cl() doesn't free msgb */
+   msgb_free(reset_ack);
+
ran_peer_state_chg(rp, RAN_PEER_ST_READY);
 }


--
To view, visit https://gerrit.osmocom.org/13953
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
Gerrit-Change-Number: 13953
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in libosmocore[master]: Add MO-FALLBACK-VALUE SGsAP IE

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13952 )

Change subject: Add MO-FALLBACK-VALUE SGsAP IE
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13952
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia2460af9673818d375e28c67f1631b5f7eacdaeb
Gerrit-Change-Number: 13952
Gerrit-PatchSet: 2
Gerrit-Owner: Omar Ramadan 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 18:07:55 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmocore[master]: Add MO-FALLBACK-VALUE SGsAP IE

2019-05-09 Thread Omar Ramadan
Omar Ramadan has uploaded this change for review. ( 
https://gerrit.osmocom.org/13952


Change subject: Add MO-FALLBACK-VALUE SGsAP IE
..

Add MO-FALLBACK-VALUE SGsAP IE

In testing against a particular EPC, the SGsAP-SERVICE-REQUEST can contain a MO 
fallback value TLV with T 0xF1

Change-Id: Ia2460af9673818d375e28c67f1631b5f7eacdaeb
---
M include/osmocom/gsm/protocol/gsm_29_118.h
M src/gsm/gsm29118.c
2 files changed, 3 insertions(+), 0 deletions(-)



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

diff --git a/include/osmocom/gsm/protocol/gsm_29_118.h 
b/include/osmocom/gsm/protocol/gsm_29_118.h
index cfe772a..9adb90f 100644
--- a/include/osmocom/gsm/protocol/gsm_29_118.h
+++ b/include/osmocom/gsm/protocol/gsm_29_118.h
@@ -73,6 +73,7 @@
SGSAP_IE_UE_EMM_MODE= 0x25,
SGSAP_IE_ADDL_PAGING_INDICATORS = 0x26,
SGSAP_IE_TMSI_BASED_NRI_CONT= 0x27,
+   SGSAP_IE_MO_FALLBACK_VALUE  = 0xf1,
 };
 extern const struct value_string sgsap_iei_names[];
 static inline const char *sgsap_iei_name(enum sgsap_iei iei) {
diff --git a/src/gsm/gsm29118.c b/src/gsm/gsm29118.c
index 56e7473..2c02b2f 100644
--- a/src/gsm/gsm29118.c
+++ b/src/gsm/gsm29118.c
@@ -89,6 +89,7 @@
{ SGSAP_IE_UE_EMM_MODE, "UE-EMM-MODE" },
{ SGSAP_IE_ADDL_PAGING_INDICATORS,  "ADDL-PAGING-INDICATORS" },
{ SGSAP_IE_TMSI_BASED_NRI_CONT, "TMSI-BASED-NRI-CONT" },
+   { SGSAP_IE_MO_FALLBACK_VALUE,   "MO-FALLBACK-VALUE" },
{ 0, NULL }
 };

@@ -179,6 +180,7 @@
[SGSAP_IE_UE_EMM_MODE]  = { TLV_TYPE_TLV },
[SGSAP_IE_ADDL_PAGING_INDICATORS]={ TLV_TYPE_TLV },
[SGSAP_IE_TMSI_BASED_NRI_CONT]  = { TLV_TYPE_TLV },
+   [SGSAP_IE_MO_FALLBACK_VALUE]= { TLV_TYPE_TLV },
},
 };


--
To view, visit https://gerrit.osmocom.org/13952
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2460af9673818d375e28c67f1631b5f7eacdaeb
Gerrit-Change-Number: 13952
Gerrit-PatchSet: 1
Gerrit-Owner: Omar Ramadan 


Change in libosmocore[master]: Add MO-FALLBACK-VALUE SGsAP IE

2019-05-09 Thread Omar Ramadan
Omar Ramadan has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/13952 )

Change subject: Add MO-FALLBACK-VALUE SGsAP IE
..

Add MO-FALLBACK-VALUE SGsAP IE

In testing against a particular EPC, the SGsAP-SERVICE-REQUEST
can contain a MO fallback value TLV with T 0xF1

Change-Id: Ia2460af9673818d375e28c67f1631b5f7eacdaeb
---
M include/osmocom/gsm/protocol/gsm_29_118.h
M src/gsm/gsm29118.c
2 files changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/52/13952/2
--
To view, visit https://gerrit.osmocom.org/13952
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia2460af9673818d375e28c67f1631b5f7eacdaeb
Gerrit-Change-Number: 13952
Gerrit-PatchSet: 2
Gerrit-Owner: Omar Ramadan 
Gerrit-CC: Jenkins Builder (102)


Change in osmo-msc[master]: make msc_a_vsub() and others NULL-safe

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13939 )

Change subject: make msc_a_vsub() and others NULL-safe
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13939
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Icd146ae512236a09cad080ed3eb85944e8f5cee4
Gerrit-Change-Number: 13939
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 16:58:35 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: no HO call forwarding if no RTP stream

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13940 )

Change subject: no HO call forwarding if no RTP stream
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13940
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia223c2e20e625879ab71fc5c8afd0305fd224c58
Gerrit-Change-Number: 13940
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 16:58:59 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13941 )

Change subject: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13941
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6dfe5b98fb9e884c2dde61d603832dafceb12123
Gerrit-Change-Number: 13941
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 16:59:40 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence

2019-05-09 Thread Alexander Chemeris
Alexander Chemeris has posted comments on this change. ( 
https://gerrit.osmocom.org/13723 )

Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. 
sequence
..


Patch Set 5:

> > I would appreciate if you remove comparison [...]
 >
 > We also discussed this at OsmoDevCon with Harald, and as it turns
 > out, modern compilers can perfectly optimize out this comparison
 > (i.e. the cmp instruction), since it's a static function and the
 > synch. sequences are defined as a static array. We've compiled
 > OsmoBTS with clang-8 and checked the results using 'objdump -d -S'.
 >
 > However, it doesn't mean that I'm against removing the comparison.
 > This is simply not the main problem at the moment. Thanks again for
 > your comments and tips, the initial version of this change was much
 > worse from performance point of view...

Great. I don't have much experience with modern compilers.

Just curious - have you checked whether gcc is optimizing it as well? And which 
compiler is used to build Osmocom builds?


--
To view, visit https://gerrit.osmocom.org/13723
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284
Gerrit-Change-Number: 13723
Gerrit-PatchSet: 5
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-CC: Max 
Gerrit-Comment-Date: Thu, 09 May 2019 17:03:56 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-msc[master]: ran_a_make_handover_request(): allow no encryption

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13938 )

Change subject: ran_a_make_handover_request(): allow no encryption
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13938
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb83ab2a8b6148b457224687ffada2dff4c3204f
Gerrit-Change-Number: 13938
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 16:58:22 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmocore[master]: fix typo in FSM description

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13951 )

Change subject: fix typo in FSM description
..

fix typo in FSM description

Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4
---
M src/fsm.c
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/fsm.c b/src/fsm.c
index c32767b..882a2b4 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -47,15 +47,15 @@
  *  The general idea is that all actions performed within one state are
  *  located at one position in the code (the state's action function),
  *  as opposed to the 'message-centric' view of e.g. the existing
- *  state machines of the LAPD(m) coe, where there is one message for
- *  eahc possible event (primitive), and the function then needs to
+ *  state machines of the LAPD(m) core, where there is one message for
+ *  each possible event (primitive), and the function then needs to
  *  concern itself on how to handle that event over all possible states.
  *
  *  For each state, there is a bit-mask of permitted input events for
  *  this state, as well as a bit-mask of permitted new output states to
  *  which the state can change.  Furthermore, there is a function
  *  pointer implementing the actual handling of the input events
- *  occurring whilst in thta state.
+ *  occurring whilst in that state.
  *
  *  Furthermore, each state offers a function pointer that can be
  *  executed just before leaving a state, and another one just after
@@ -84,7 +84,7 @@
  *  NOTICE level is used for all other subscribers.
  *
  *  In order to attach private state to the \ref osmo_fsm_inst, it
- *  offers an opaque priv pointer.
+ *  offers an opaque private pointer.
  *
  * \file fsm.c */


--
To view, visit https://gerrit.osmocom.org/13951
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4
Gerrit-Change-Number: 13951
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in libosmocore[master]: fix typo in FSM description

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13951 )

Change subject: fix typo in FSM description
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13951
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4
Gerrit-Change-Number: 13951
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 16:57:14 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13723 )

Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. 
sequence
..


Patch Set 5:

> I would appreciate if you remove comparison [...]

We also discussed this at OsmoDevCon with Harald, and as it turns out, modern 
compilers can perfectly optimize out this comparison (i.e. the cmp 
instruction), since it's a static function and the synch. sequences are defined 
as a static array. We've compiled OsmoBTS with clang-8 and checked the results 
using 'objdump -d -S'.

However, it doesn't mean that I'm against removing the comparison. This is 
simply not the main problem at the moment. Thanks again for your comments and 
tips, the initial version of this change was much worse from performance point 
of view...


--
To view, visit https://gerrit.osmocom.org/13723
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284
Gerrit-Change-Number: 13723
Gerrit-PatchSet: 5
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-CC: Max 
Gerrit-Comment-Date: Thu, 09 May 2019 16:47:49 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: fix typo in FSM description

2019-05-09 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/13951


Change subject: fix typo in FSM description
..

fix typo in FSM description

Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4
---
M src/fsm.c
1 file changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/13951/1

diff --git a/src/fsm.c b/src/fsm.c
index c32767b..882a2b4 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -47,15 +47,15 @@
  *  The general idea is that all actions performed within one state are
  *  located at one position in the code (the state's action function),
  *  as opposed to the 'message-centric' view of e.g. the existing
- *  state machines of the LAPD(m) coe, where there is one message for
- *  eahc possible event (primitive), and the function then needs to
+ *  state machines of the LAPD(m) core, where there is one message for
+ *  each possible event (primitive), and the function then needs to
  *  concern itself on how to handle that event over all possible states.
  *
  *  For each state, there is a bit-mask of permitted input events for
  *  this state, as well as a bit-mask of permitted new output states to
  *  which the state can change.  Furthermore, there is a function
  *  pointer implementing the actual handling of the input events
- *  occurring whilst in thta state.
+ *  occurring whilst in that state.
  *
  *  Furthermore, each state offers a function pointer that can be
  *  executed just before leaving a state, and another one just after
@@ -84,7 +84,7 @@
  *  NOTICE level is used for all other subscribers.
  *
  *  In order to attach private state to the \ref osmo_fsm_inst, it
- *  offers an opaque priv pointer.
+ *  offers an opaque private pointer.
  *
  * \file fsm.c */


--
To view, visit https://gerrit.osmocom.org/13951
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4
Gerrit-Change-Number: 13951
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 


Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence

2019-05-09 Thread Alexander Chemeris
Alexander Chemeris has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13723 )

Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. 
sequence
..

osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence

Thanks to both TC_rach_content and TC_rach_count TTCN-3 test cases,
it was discovered that there are possible collisions when trying
to decode a regular 8-bit Access Burst as an 11-bit one. This is
exactly what we are doing in rx_rach_fn():

  - calling gsm0503_rach_ext_decode_ber() first,
  - if it failed, falling-back to gsm0503_rach_decode_ber().

With default BSIC=63, the following 8-bit RA values are being
misinterpreted as 11-bit Access Bursts:

  Successfully decoded 8-bit (0x00) RACH as 11-bit (0x): bsic=0x3f
  Successfully decoded 8-bit (0xbe) RACH as 11-bit (0x0388): bsic=0x3f
  Successfully decoded 8-bit (0xcf) RACH as 11-bit (0x0036): bsic=0x3f

According to 3GPP TS 05.02, section 5.2.7, there are two alternative
synch. (training) sequences for Access Bursts: TS1 & TS2. By default,
TS0 synch. sequence is used, unless explicitly stated otherwise
(see 3GPP TS 04.60).

According to 3GPP TS 04.60, section 11.2.5a, the EGPRS capability
can be indicated by the MS using one of the alternative training
sequences (i.e. TS1 or TS2) and the 11-bit RACH coding scheme.

In other words, knowing the synch. sequence of a received Access
Burst would allow to decide whether it's extended (11-bit)
or a regular (8-bit) one. As a result, we would avoid possible
collisions and save some CPU power.

Unfortunately, due to the limitations of the current TRXD protocol,
there is no easy way to expose such information from the transceiver.
A proper solution would be to extend the TRX protocol, but for now,
let's do the synch. sequence detection in rx_rach_fn(). As soon as
the TRX protocol is extended with info about the synch. sequence,
this code would serve for the backwards-compatibility.

This change makes the both TC_rach_content and TC_rach_count happy,
as well as the new TC_pcu_ext_rach_content() test case aimed to
verify extended (11-bit) Access Burst decoding.

Related (TTCN-3) I8fe156aeac9de3dc1e71a4950821d4942ba9a253
Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284
Related: OS#1854
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 123 insertions(+), 42 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, approved; Verified
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 32bdb98..ade3cff 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -22,6 +22,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -709,72 +710,152 @@
  * RX on uplink (indication to upper layer)
  */

+/* 3GPP TS 05.02, section 5.2.7 */
+#define RACH_EXT_TAIL_LEN  8
+#define RACH_SYNCH_SEQ_LEN 41
+
+enum rach_synch_seq_t {
+   RACH_SYNCH_SEQ_UNKNOWN = -1,
+   RACH_SYNCH_SEQ_TS0, /* GSM, GMSK (default) */
+   RACH_SYNCH_SEQ_TS1, /* EGPRS, 8-PSK */
+   RACH_SYNCH_SEQ_TS2, /* EGPRS, GMSK */
+   RACH_SYNCH_SEQ_NUM
+};
+
+static struct value_string rach_synch_seq_names[] = {
+   { RACH_SYNCH_SEQ_UNKNOWN,   "UNKNOWN" },
+   { RACH_SYNCH_SEQ_TS0,   "TS0: GSM, GMSK" },
+   { RACH_SYNCH_SEQ_TS1,   "TS1: EGPRS, 8-PSK" },
+   { RACH_SYNCH_SEQ_TS2,   "TS2: EGPRS, GMSK" },
+   { 0, NULL },
+};
+
+static enum rach_synch_seq_t rach_get_synch_seq(sbit_t *bits, int *best_score)
+{
+   sbit_t *synch_seq_burst = bits + RACH_EXT_TAIL_LEN;
+   enum rach_synch_seq_t seq = RACH_SYNCH_SEQ_TS0;
+   int score[RACH_SYNCH_SEQ_NUM] = { 0 };
+   int max_score = INT_MIN;
+   int i, j;
+
+   /* 3GPP TS 05.02, section 5.2.7 "Access burst (AB)", synch. sequence 
bits */
+   static const char synch_seq_ref[RACH_SYNCH_SEQ_NUM][RACH_SYNCH_SEQ_LEN] 
= {
+   [RACH_SYNCH_SEQ_TS0] = 
"01001011000110011010101000000",
+   [RACH_SYNCH_SEQ_TS1] = 
"01010100100011100010001001101",
+   [RACH_SYNCH_SEQ_TS2] = 
"111000100111010101101101101110111",
+   };
+
+   /* Get a multiplier for j-th bit of i-th synch. sequence */
+#define RACH_SYNCH_SEQ_MULT \
+   (synch_seq_ref[i][j] == '1' ? -1 : 1)
+
+   /* For each synch. sequence, count the bit match score. Since we deal 
with
+* soft-bits (-127...127), we sum the absolute values of matching ones,
+* and subtract the absolute values of different ones, so the resulting
+* score is more accurate than it could be with hard-bits. */
+   for (i = 0; i < RACH_SYNCH_SEQ_NUM; i++) {
+   for (j = 0; j < RACH_SYNCH_SEQ_LEN; j++)
+   score[i] += RACH_SYNCH_SEQ_MULT * synch_seq_burst[j];
+
+   /* Keep the maximum value updated */
+

Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence

2019-05-09 Thread Alexander Chemeris
Alexander Chemeris has posted comments on this change. ( 
https://gerrit.osmocom.org/13723 )

Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. 
sequence
..


Patch Set 4:

> I really appreciate all the comments, and will consider yet not
 > addressed ones as the points of further improvements, but now I
 > really need to move this fix forward. It's really annoying to see
 > 11-bit Access Bursts decoded as 8-bit ones, and vice versa. Adding
 > my CR+2 & V+1 for now, going to merge in a few hours (unless
 > anybody has any strong objections).

I would appreciate if you remove comparison from the weight calculation code as 
we discussed. You'd be surprised how many RACHs can a BTS get in a congested 
situation.


--
To view, visit https://gerrit.osmocom.org/13723
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284
Gerrit-Change-Number: 13723
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-CC: Max 
Gerrit-Comment-Date: Thu, 09 May 2019 16:22:14 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ccid-firmware[master]: finish implementing sim-iccid

2019-05-09 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/13950


Change subject: finish implementing sim-iccid
..

finish implementing sim-iccid

Change-Id: I71b5832703a60c0c967fa2c6bc0eec56883962c5
---
M sysmoOCTSIM/main.c
1 file changed, 38 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/50/13950/1

diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 327ac6d..6ab8bc8 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -658,13 +658,47 @@

// select MF
printf("(%d) SELECT MF\r\n", slotnr);
-   // write SELECT MF APDU
-   const uint8_t select_mf_header[] = {0xa0, 0xa4, 0x00, 0x00, 0x02};
-   const uint8_t select_mf_data[] = {0x3f, 0x00};
-   int rc = slot_tpdu_xfer(slotnr, select_mf_header, 
(uint8_t*)select_mf_data, ARRAY_SIZE(select_mf_data), true); // transfer TPDU
+   const uint8_t select_header[] = {0xa0, 0xa4, 0x00, 0x00, 0x02}; // see 
TS 102.221 sec. 11.1.1
+   const uint8_t select_data_mf[] = {0x3f, 0x00}; // see TS 102.221 sec. 
13.1
+   int rc = slot_tpdu_xfer(slotnr, select_header, 
(uint8_t*)select_data_mf, ARRAY_SIZE(select_data_mf), true); // transfer TPDU
if (ERR_NONE != rc) {
printf("error while SELECT MF (errno = %d)\r\n", rc);
}
+   // ignore response data
+
+   // select EF_ICCID
+   printf("(%d) SELECT EF_ICCID\r\n", slotnr);
+   const uint8_t select_data_ef_iccid[] = {0x2f, 0xe2}; // see TS 102.221 
sec. 13.2
+   rc = slot_tpdu_xfer(slotnr, select_header, 
(uint8_t*)select_data_ef_iccid, ARRAY_SIZE(select_data_ef_iccid), true); // 
transfer TPDU
+   if (ERR_NONE != rc) {
+   printf("error while SELECT EF_ICCID (errno = %d)\r\n", rc);
+   }
+   // ignore response data
+
+   // read EF_ICCID
+   printf("(%d) READ EF_ICCID\r\n", slotnr);
+   uint8_t iccid[10];
+   uint8_t read_binary[] = {0xa0, 0xb0, 0x00, 0x00, ARRAY_SIZE(iccid)}; // 
see TS 102.221 sec. 11.1.3
+   rc = slot_tpdu_xfer(slotnr, read_binary, iccid, ARRAY_SIZE(iccid), 
false); // transfer TPDU
+   if (ERR_NONE != rc) {
+   printf("error while READ ICCID (errno = %d)\r\n", rc);
+   }
+   // ignore response data
+
+   printf("(%d) ICCID: ", slotnr);
+   for (uint8_t i = 0; i < ARRAY_SIZE(iccid); i++) {
+   uint8_t nibble = iccid[i] & 0xf;
+   if (0xf == nibble) {
+   break;
+   }
+   printf("%x", nibble);
+   nibble = iccid[i] >> 4;
+   if (0xf == nibble) {
+   break;
+   }
+   printf("%x", nibble);
+   }
+   printf("\r\n");

// disable LED
settings.led = false;

--
To view, visit https://gerrit.osmocom.org/13950
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71b5832703a60c0c967fa2c6bc0eec56883962c5
Gerrit-Change-Number: 13950
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 


Change in osmo-bts[master]: README.md: remove OS#1865 from 'Known limitations'

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13741 )

Change subject: README.md: remove OS#1865 from 'Known limitations'
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13741
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibc9db360be1380abaa9eef4bdf6e9a6d251670da
Gerrit-Change-Number: 13741
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 15:33:33 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: add function to transfer TPDU

2019-05-09 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/13949


Change subject: add function to transfer TPDU
..

add function to transfer TPDU

this function takes care of reading and writing the complete TPDU
to the card.

note: the sim-iccid command uses this function, but still only to
select MF.

Change-Id: I50c90f3697580a4c93220a3e09cc33ec85889814
---
M sysmoOCTSIM/main.c
1 file changed, 184 insertions(+), 83 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/49/13949/1

diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 11849c7..327ac6d 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -226,7 +226,183 @@

// set baud rate
uint32_t baudrate = (freq * d) / f; // calculate actual baud rate
-   return slot_set_baudrate(slotnr, baudrate); // // set baud rate
+   return slot_set_baudrate(slotnr, baudrate); // set baud rate
+}
+
+/** write data to card
+ *  @param[in] slotnr slot number on which to send data
+ *  @param[in] data data to be transmitted
+ *  @param[in] length length of data to be transmitted
+ *  @return error code
+ */
+static int slot_card_write(uint8_t slotnr, const uint8_t* data, uint16_t 
length)
+{
+   // input checks
+   ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors));
+   if (0 == length || NULL == data) {
+   return ERR_INVALID_ARG;
+   }
+
+   struct usart_async_descriptor* sim = SIM_peripheral_descriptors[slotnr];
+   ((Sercom *)sim->device.hw)->USART.CTRLB.bit.RXEN = 0; // disable 
receive (to avoid the echo back)
+   SIM_tx_count[slotnr] = false; // reset TX complete
+   for (uint16_t i = 0; i < length; i++) { // transmit data
+   while(!usart_async_is_tx_empty(sim)); // wait for previous byte 
to be transmitted (WARNING blocking)
+   if (1 != io_write(&sim->io, &data[i], 1)) { // put but in 
transmit buffer
+   return ERR_IO;
+   }
+   }
+   while (!SIM_tx_count[slotnr]); // wait until transmission is complete 
(WARNING blocking)
+   ((Sercom *)sim->device.hw)->USART.CTRLB.bit.RXEN = 1; // enable receive 
again
+
+   return ERR_NONE;
+}
+
+/** read data from card
+ *  @param[in] slotnr slot number on which to send data
+ *  @param[out] data buffer for read data to be stored
+ *  @param[in] length length of data to be read
+ *  @param[in] wt Waiting Time in ETU
+ *  @return error code
+ *  TODO fix WT/ETU duration
+ */
+static int slot_card_read(uint8_t slotnr, uint8_t* data, uint16_t length, 
uint32_t wt)
+{
+   // input checks
+   ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors));
+   if (0 == length || NULL == data) {
+   return ERR_INVALID_ARG;
+   }
+
+   struct usart_async_descriptor* sim = SIM_peripheral_descriptors[slotnr];
+
+   ((Sercom *)sim->device.hw)->USART.CTRLB.bit.RXEN = 1; // ensure RX is 
enabled
+   uint32_t timeout = wt; // reset waiting time
+   for (uint16_t i = 0; i < length; i++) { // read all data
+   while (timeout && !usart_async_is_rx_not_empty(sim)) { // 
verify if data is present
+   delay_us(149); // wait for 1 ETU (372 / 1 / 2.5 MHz = 
148.8 us)
+   timeout--;
+   }
+   if (0 == timeout) { // timeout reached
+   return ERR_TIMEOUT;
+   }
+   timeout = wt; // reset waiting time
+   if (1 != io_read(&sim->io, &data[i], 1)) { // read one byte
+   return ERR_IO;
+   }
+   }
+
+   return ERR_NONE;
+}
+
+/** transfer TPDU
+ *  @param[in] slotnr slot number on which to transfer the TPDU
+ *  @param[in] header TPDU header to send
+ *  @param[io] data TPDU data to transfer
+ *  @param[in] data_length length of TPDU data to transfer
+ *  @param[in] write if the data should be written (true) or read (false)
+ * TODO fix WT
+ * TODO the data length can be deduce from the header
+ */
+static int slot_tpdu_xfer(uint8_t slotnr, const uint8_t* header, uint8_t* 
data, uint16_t data_length, bool write)
+{
+   // input checks
+   ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors));
+   if (NULL == header || (data_length > 0 && NULL == data)) {
+   return ERR_INVALID_ARG;
+   }
+
+   int rc;
+   struct usart_async_descriptor* sim = 
SIM_peripheral_descriptors[slotnr]; // get USART peripheral
+   usart_async_flush_rx_buffer(sim); // flush RX buffer to start from 
scratch
+
+   // send command header
+   printf("(%d) TPDU: ", slotnr);
+   for (uint8_t i = 0; i < 5; i++) {
+   printf("%02x ", header[i]);
+   }
+   rc = slot_card_write(slotnr, header, 5); // transmit header
+   if (ERR_NONE != rc) {
+   printf("error in command header transmit (errno = %d)\r\n", rc);
+  

Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13723 )

Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. 
sequence
..


Patch Set 4: Verified+1 Code-Review+2

I really appreciate all the comments, and will consider yet not addressed ones 
as the points of further improvements, but now I really need to move this fix 
forward. It's really annoying to see 11-bit Access Bursts decoded as 8-bit 
ones, and vice versa. Adding my CR+2 & V+1 for now, going to merge in a few 
hours (unless anybody has any strong objections).


--
To view, visit https://gerrit.osmocom.org/13723
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284
Gerrit-Change-Number: 13723
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-CC: Max 
Gerrit-Comment-Date: Thu, 09 May 2019 15:32:27 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sgsn[master]: libgtp: don't call sgsn_pdp_ctx_free() w/o MM ctx

2019-05-09 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/13929 )

Change subject: libgtp: don't call sgsn_pdp_ctx_free() w/o MM ctx
..


Patch Set 2: Code-Review-1

I think the problem lies somewhere else. IMHO: Calling free() w/o MM ctx is 
fine.


--
To view, visit https://gerrit.osmocom.org/13929
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I184dcce27b26104c61d80b2d910388d5d3323def
Gerrit-Change-Number: 13929
Gerrit-PatchSet: 2
Gerrit-Owner: Keith Whyte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Keith Whyte 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Comment-Date: Thu, 09 May 2019 15:35:06 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13948 )

Change subject: trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()
..

trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()

Since we only set both ARFCN and TDMA frame number of the DL info
header, other fields remain uninitialized. Let's memset() them.

Change-Id: Ib39c333f1724fefa5d8bd8a2315b77a5612f7fa9
---
M src/host/trxcon/l1ctl.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Vadim Yanitskiy: Looks good to me, approved



diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 9cd5fe6..e6f8f82 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -244,6 +244,8 @@
return -ENOMEM;

dl = put_dl_info_hdr(msg, NULL);
+   memset(dl, 0x00, sizeof(*dl));
+
dl->band_arfcn = htons(band_arfcn);
dl->frame_nr = htonl(fn);


--
To view, visit https://gerrit.osmocom.org/13948
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib39c333f1724fefa5d8bd8a2315b77a5612f7fa9
Gerrit-Change-Number: 13948
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/12613 )

Change subject: trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()
..

trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()

This would allow to abstract both L1CTL and TRX interfaces
from each other in the upcoming refactoring.

Change-Id: I74a23c73b03bad822272b9cfe76c2501666912b7
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl.h
M src/host/trxcon/sched_lchan_rach.c
3 files changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Vadim Yanitskiy: Looks good to me, approved



diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 653ddf3..9cd5fe6 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -233,7 +233,8 @@
return l1ctl_link_send(l1l, msg);
 }

-int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn)
+int l1ctl_tx_rach_conf(struct l1ctl_link *l1l,
+   uint16_t band_arfcn, uint32_t fn)
 {
struct l1ctl_info_dl *dl;
struct msgb *msg;
@@ -243,8 +244,7 @@
return -ENOMEM;

dl = put_dl_info_hdr(msg, NULL);
-
-   dl->band_arfcn = htons(l1l->trx->band_arfcn);
+   dl->band_arfcn = htons(band_arfcn);
dl->frame_nr = htonl(fn);

return l1ctl_link_send(l1l, msg);
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index ca8c0be..48bbe09 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -22,4 +22,5 @@
uint8_t *l2, size_t l2_len, bool traffic);
 int l1ctl_tx_dt_conf(struct l1ctl_link *l1l,
struct l1ctl_info_dl *data, bool traffic);
-int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn);
+int l1ctl_tx_rach_conf(struct l1ctl_link *l1l,
+   uint16_t band_arfcn, uint32_t fn);
diff --git a/src/host/trxcon/sched_lchan_rach.c 
b/src/host/trxcon/sched_lchan_rach.c
index 58e86ae..565d693 100644
--- a/src/host/trxcon/sched_lchan_rach.c
+++ b/src/host/trxcon/sched_lchan_rach.c
@@ -175,7 +175,7 @@
}

/* Confirm RACH request */
-   l1ctl_tx_rach_conf(trx->l1l, fn);
+   l1ctl_tx_rach_conf(trx->l1l, trx->band_arfcn, fn);

/* Forget processed primitive */
sched_prim_drop(lchan);

--
To view, visit https://gerrit.osmocom.org/12613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I74a23c73b03bad822272b9cfe76c2501666912b7
Gerrit-Change-Number: 12613
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13948 )

Change subject: trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13948
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib39c333f1724fefa5d8bd8a2315b77a5612f7fa9
Gerrit-Change-Number: 13948
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 15:16:37 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/12613 )

Change subject: trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/12613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I74a23c73b03bad822272b9cfe76c2501666912b7
Gerrit-Change-Number: 12613
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 15:14:35 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and inter-MSC Han...

2019-05-09 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/13947 )

Change subject: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and 
inter-MSC Handover tests")
..


Patch Set 1:

> the problem here is that it might fix 'latest' USSD tests, but it
 > will break tests on 'master'

@neels let's fix all the old tests, before looking what's wrong in the new 
tests.


--
To view, visit https://gerrit.osmocom.org/13947
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iadbc37105fa67cf6383fb63b86ed653ccc7bddf7
Gerrit-Change-Number: 13947
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Comment-Date: Thu, 09 May 2019 15:14:23 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmocom-bb[master]: trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13948


Change subject: trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()
..

trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()

Since we only set both ARFCN and TDMA frame number of the DL info
header, other fields remain uninitialized. Let's memset() them.

Change-Id: Ib39c333f1724fefa5d8bd8a2315b77a5612f7fa9
---
M src/host/trxcon/l1ctl.c
1 file changed, 2 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/48/13948/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 9cd5fe6..e6f8f82 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -244,6 +244,8 @@
return -ENOMEM;

dl = put_dl_info_hdr(msg, NULL);
+   memset(dl, 0x00, sizeof(*dl));
+
dl->band_arfcn = htons(band_arfcn);
dl->frame_nr = htonl(fn);


--
To view, visit https://gerrit.osmocom.org/13948
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib39c333f1724fefa5d8bd8a2315b77a5612f7fa9
Gerrit-Change-Number: 13948
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmocom-bb[master]: trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()

2019-05-09 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/12613

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

Change subject: trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()
..

trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()

This would allow to abstract both L1CTL and TRX interfaces
from each other in the upcoming refactoring.

Change-Id: I74a23c73b03bad822272b9cfe76c2501666912b7
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl.h
M src/host/trxcon/sched_lchan_rach.c
3 files changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/13/12613/3
--
To view, visit https://gerrit.osmocom.org/12613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I74a23c73b03bad822272b9cfe76c2501666912b7
Gerrit-Change-Number: 12613
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and inter-MSC Han...

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13947 )

Change subject: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and 
inter-MSC Handover tests")
..


Patch Set 1: Code-Review-1

the problem here is that it might fix 'latest' USSD tests, but it will break 
tests on 'master'


--
To view, visit https://gerrit.osmocom.org/13947
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iadbc37105fa67cf6383fb63b86ed653ccc7bddf7
Gerrit-Change-Number: 13947
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Thu, 09 May 2019 14:52:14 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: libmsc/gsm_04_08.c: refactor CM Service Request parsing

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13907 )

Change subject: libmsc/gsm_04_08.c: refactor CM Service Request parsing
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/13907
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6e7454d7a6f63fd5a0e12fb90d8c58688da0951e
Gerrit-Change-Number: 13907
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:47:54 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-msc[master]: call_leg: document the parent_event_* items

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13946 )

Change subject: call_leg: document the parent_event_* items
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13946
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib099178a0f6ab218646c67c0e7a3d360c81af684
Gerrit-Change-Number: 13946
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:47:15 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: call_leg: remove unused event MSC_EV_CALL_LEG_RTP_RELEASED

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13945 )

Change subject: call_leg: remove unused event MSC_EV_CALL_LEG_RTP_RELEASED
..


Patch Set 1: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/13945/1/src/libmsc/msc_a.c
File src/libmsc/msc_a.c:

https://gerrit.osmocom.org/#/c/13945/1/src/libmsc/msc_a.c@a568
PS1, Line 568:
:D



--
To view, visit https://gerrit.osmocom.org/13945
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6b2fc1225c960fa2f7c46adf241520217a07821c
Gerrit-Change-Number: 13945
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:45:07 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: no HO call forwarding if no RTP stream

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13940 )

Change subject: no HO call forwarding if no RTP stream
..


Patch Set 1: Code-Review+1

Fine with me in general.


--
To view, visit https://gerrit.osmocom.org/13940
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia223c2e20e625879ab71fc5c8afd0305fd224c58
Gerrit-Change-Number: 13940
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:40:30 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: output 50 MHz for RMII

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13780 )

Change subject: output 50 MHz for RMII
..

output 50 MHz for RMII

in hardware revision 2 the Ethernet PHY RMII_CLOCK input clock is
connected to the MCU pin PA10.
GCLK4 of the MCU now outputs the required 50 MHz clock on this pin.
the same clock is re-used for UART debug to generate the 921600
bps baud rate.

Change-Id: Id3a3dee15c3986536b0623d0f39ca62e94acd1fd
---
M sysmoOCTSIM/atmel_start_config.atstart
M sysmoOCTSIM/atmel_start_pins.h
M sysmoOCTSIM/config/hpl_gclk_config.h
M sysmoOCTSIM/config/peripheral_clk_config.h
M sysmoOCTSIM/driver_init.c
5 files changed, 63 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/atmel_start_config.atstart 
b/sysmoOCTSIM/atmel_start_config.atstart
index 4fda2f8..6357a74 100644
--- a/sysmoOCTSIM/atmel_start_config.atstart
+++ b/sysmoOCTSIM/atmel_start_config.atstart
@@ -702,7 +702,7 @@
   gclk_arch_gen_3_runstdby: false
   gclk_arch_gen_4_enable: true
   gclk_arch_gen_4_idc: false
-  gclk_arch_gen_4_oe: false
+  gclk_arch_gen_4_oe: true
   gclk_arch_gen_4_oov: false
   gclk_arch_gen_4_runstdby: false
   gclk_arch_gen_5_enable: true
@@ -748,7 +748,7 @@
   gclk_gen_3_div: 1
   gclk_gen_3_div_sel: false
   gclk_gen_3_oscillator: 32kHz External Crystal Oscillator (XOSC32K)
-  gclk_gen_4_div: 1
+  gclk_gen_4_div: 2
   gclk_gen_4_div_sel: false
   gclk_gen_4_oscillator: Digital Phase Locked Loop (DPLL1)
   gclk_gen_5_div: 5
@@ -1462,6 +1462,16 @@
 mode: Peripheral IO
 user_label: SIM2_IO
 configuration: null
+  RMII_CLOCK:
+name: PA10
+definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA10
+mode: Advanced
+user_label: RMII_CLOCK
+configuration:
+  pad_direction: Out
+  pad_function: M
+  pad_initial_level: Low
+  pad_pull_config: 'Off'
   SIMCLK_20MHZ:
 name: PA11
 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA11
diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h
index 0264736..7cbaed5 100644
--- a/sysmoOCTSIM/atmel_start_pins.h
+++ b/sysmoOCTSIM/atmel_start_pins.h
@@ -31,6 +31,7 @@
 #define SIM5_INT GPIO(GPIO_PORTA, 3)
 #define SIM0_IO GPIO(GPIO_PORTA, 4)
 #define SIM2_IO GPIO(GPIO_PORTA, 9)
+#define RMII_CLOCK GPIO(GPIO_PORTA, 10)
 #define SIMCLK_20MHZ GPIO(GPIO_PORTA, 11)
 #define SIM1_IO GPIO(GPIO_PORTA, 16)
 #define VB0 GPIO(GPIO_PORTA, 20)
diff --git a/sysmoOCTSIM/config/hpl_gclk_config.h 
b/sysmoOCTSIM/config/hpl_gclk_config.h
index 71c26e1..81a1f03 100644
--- a/sysmoOCTSIM/config/hpl_gclk_config.h
+++ b/sysmoOCTSIM/config/hpl_gclk_config.h
@@ -349,7 +349,7 @@
 //  Indicates whether Output Enable is enabled or not
 //  gclk_arch_gen_4_oe
 #ifndef CONF_GCLK_GEN_4_OE
-#define CONF_GCLK_GEN_4_OE 0
+#define CONF_GCLK_GEN_4_OE 1
 #endif

 //  Output Off Value
@@ -378,7 +378,7 @@
 // Generic clock generator 4 division <0x-0x>
 //  gclk_gen_4_div
 #ifndef CONF_GCLK_GEN_4_DIV
-#define CONF_GCLK_GEN_4_DIV 1
+#define CONF_GCLK_GEN_4_DIV 2
 #endif
 // 
 // 
diff --git a/sysmoOCTSIM/config/peripheral_clk_config.h 
b/sysmoOCTSIM/config/peripheral_clk_config.h
index 4bff6ff..2ae1f63 100644
--- a/sysmoOCTSIM/config/peripheral_clk_config.h
+++ b/sysmoOCTSIM/config/peripheral_clk_config.h
@@ -641,7 +641,7 @@
  * \brief SERCOM7's Core Clock frequency
  */
 #ifndef CONF_GCLK_SERCOM7_CORE_FREQUENCY
-#define CONF_GCLK_SERCOM7_CORE_FREQUENCY 1
+#define CONF_GCLK_SERCOM7_CORE_FREQUENCY 5000
 #endif

 /**
diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c
index 0b6b190..1233d02 100644
--- a/sysmoOCTSIM/driver_init.c
+++ b/sysmoOCTSIM/driver_init.c
@@ -503,6 +503,53 @@

gpio_set_pin_function(SIM5_INT, GPIO_PIN_FUNCTION_OFF);

+   // GPIO on PA10
+
+   gpio_set_pin_direction(RMII_CLOCK,
+  //  Pin direction
+  //  pad_direction
+  //  Off
+  //  In
+  //  Out
+  GPIO_DIRECTION_OUT);
+
+   gpio_set_pin_level(RMII_CLOCK,
+  //  Initial level
+  //  pad_initial_level
+  //  Low
+  //  High
+  false);
+
+   gpio_set_pin_pull_mode(RMII_CLOCK,
+  //  Pull configuration
+  //  pad_pull_config
+  //  Off
+  //  Pull-up
+  //  Pull-down
+  GPIO_PULL_OFF);
+
+   gpio_set_pin_function(RMII_CLOCK,
+ //  Pin function
+ // 

Change in osmo-ccid-firmware[master]: add function to set baudrate

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13845 )

Change subject: add function to set baudrate
..

add function to set baudrate

it will set the GCLK as SERCOM core clock with the lowest baud
rate error and set the closest baud rate in the SERCOM peripheral.

Change-Id: I01db273f4c8170a4942049653c575010b93296ce
---
M sysmoOCTSIM/main.c
1 file changed, 78 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 47d1cd1..70099e1 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -18,12 +18,14 @@

 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

 #include "atmel_start.h"
 #include "atmel_start_pins.h"
+#include "config/hpl_gclk_config.h"

 #include "i2c_bitbang.h"
 #include "octsim_i2c.h"
@@ -39,6 +41,21 @@
 {
 }

+/** possible clock sources for the SERCOM peripheral
+ *  warning: the definition must match the GCLK configuration
+ */
+static const uint8_t sercom_glck_sources[] = {GCLK_PCHCTRL_GEN_GCLK2_Val, 
GCLK_PCHCTRL_GEN_GCLK4_Val, GCLK_PCHCTRL_GEN_GCLK6_Val};
+
+/** possible clock frequencies in MHz for the SERCOM peripheral
+ *  warning: the definition must match the GCLK configuration
+ */
+static const double sercom_glck_freqs[] = {100E6 / CONF_GCLK_GEN_2_DIV, 100E6 
/ CONF_GCLK_GEN_4_DIV, 120E6 / CONF_GCLK_GEN_6_DIV};
+
+/** the GCLK ID for the SERCOM SIM peripherals
+ *  @note: used as index for PCHCTRL
+ */
+static const uint8_t SIM_peripheral_GCLK_ID[] = {SERCOM0_GCLK_ID_CORE, 
SERCOM1_GCLK_ID_CORE, SERCOM2_GCLK_ID_CORE, SERCOM3_GCLK_ID_CORE, 
SERCOM4_GCLK_ID_CORE, SERCOM5_GCLK_ID_CORE, SERCOM6_GCLK_ID_CORE, 
SERCOM7_GCLK_ID_CORE};
+
 static void board_init()
 {
int i;
@@ -81,6 +98,66 @@
return slotnr;
 }

+/** change baud rate of card slot
+ *  @param[in] slotnr slot number for which the baud rate should be set
+ *  @param[in] baudrate baud rate in bps to set
+ *  @return if the baud rate has been set, else a parameter is out of range
+ */
+static bool slot_set_baudrate(uint8_t slotnr, uint32_t baudrate)
+{
+   ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors));
+
+   // calculate the error corresponding to the clock sources
+   uint16_t bauds[ARRAY_SIZE(sercom_glck_freqs)];
+   double errors[ARRAY_SIZE(sercom_glck_freqs)];
+   for (uint8_t i = 0; i < ARRAY_SIZE(sercom_glck_freqs); i++) {
+   double freq = sercom_glck_freqs[i]; // remember possible SERCOM 
frequency
+   uint32_t min = freq / (2 * (255 + 1)); // calculate the minimum 
baud rate for this frequency
+   uint32_t max = freq / (2 * (0 + 1)); // calculate the maximum 
baud rate for this frequency
+   if (baudrate < min || baudrate > max) { // baud rate it out of 
supported range
+   errors[i] = NAN;
+   } else {
+   uint16_t baud = round(freq / (2 * baudrate) - 1);
+   bauds[i] = baud;
+   double actual = freq / (2 * (baud + 1));
+   errors[i] = fabs(1.0 - (actual / baudrate));
+   }
+   }
+
+   // find the smallest error
+   uint8_t best = ARRAY_SIZE(sercom_glck_freqs);
+   for (uint8_t i = 0; i < ARRAY_SIZE(sercom_glck_freqs); i++) {
+   if (isnan(errors[i])) {
+   continue;
+   }
+   if (best >= ARRAY_SIZE(sercom_glck_freqs)) {
+   best = i;
+   } else if (errors[i] < errors[best]) {
+   best = i;
+   }
+   }
+   if (best >= ARRAY_SIZE(sercom_glck_freqs)) { // found no clock 
supporting this baud rate
+   return false;
+   }
+
+   // set clock and baud rate
+   struct usart_async_descriptor* slot = 
SIM_peripheral_descriptors[slotnr]; // get slot
+   if (NULL == slot) {
+   return false;
+   }
+   printf("(%u) switching SERCOM clock to GCLK%u (freq = %lu kHz) and baud 
rate to %lu bps (baud = %u)\r\n", slotnr, (best + 1) * 2, 
(uint32_t)(round(sercom_glck_freqs[best] / 1000)), baudrate, bauds[best]);
+   while (!usart_async_is_tx_empty(slot)); // wait for transmission to 
complete (WARNING no timeout)
+   usart_async_disable(slot); // disable SERCOM peripheral
+   hri_gclk_clear_PCHCTRL_reg(GCLK, SIM_peripheral_GCLK_ID[slotnr], (1 << 
GCLK_PCHCTRL_CHEN_Pos)); // disable clock for this peripheral
+   while (hri_gclk_get_PCHCTRL_reg(GCLK, SIM_peripheral_GCLK_ID[slotnr], 
(1 << GCLK_PCHCTRL_CHEN_Pos))); // wait until clock is really disabled
+   // it does not seem we need to completely disable the peripheral using 
hri_mclk_clear_APBDMASK_SERCOMn_bit
+   hri_gclk_write_PCHCTRL_reg(GCLK, SIM_peripheral_GCLK_ID[slotnr], 
sercom_glck_sources[best] | (1 << GCLK_PCH

Change in osmo-msc[master]: add DUSSD logging category

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13942 )

Change subject: add DUSSD logging category
..


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/13942/1/include/osmocom/msc/debug.h
File include/osmocom/msc/debug.h:

https://gerrit.osmocom.org/#/c/13942/1/include/osmocom/msc/debug.h@25
PS1, Line 25: DUSSD
Let's rather call it DSS. We're actually dealing with Supplementary Services, 
and USSD is just a "structured" kind of them.



--
To view, visit https://gerrit.osmocom.org/13942
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id7e04c9f5088334cd5ec6cfdb6a9b3a2a7e7fda0
Gerrit-Change-Number: 13942
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:38:26 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: configure GCLK for ISO baud rates

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13781 )

Change subject: configure GCLK for ISO baud rates
..

configure GCLK for ISO baud rates

the SERCOMM clock triplet 0.5 MHz (100 MHz / 200),
7.0588 MHz (120 MHz / 17), and 50 MHz (100 MHz / 2) allows to
generate all possible ISO 7816 baud rates (from
F = 2048 / D = 1 @ f = 2.5 MHz -> 1220 bps to
F = 372 / D = 64 @ f = 20 MHz -> 3.4 Mbps) with a maximum baud
rate error of 2.57 %, for available SIM clocks 2.5, 5, 10, 20 MHz.
2.57% means a bit more than quarter a bit might be wrong after the
11 bits ISO transmission (still less than half a bit).
This triplet is one of the optimum when 3 clocks are used.
An additional clock would be required for higher accuracy.

The 50 MHz clock is re-used from the RMII clock output.

Change-Id: I2c69848582e49031fa6453f535a2bf1408f8e22e
---
M sysmoOCTSIM/atmel_start_config.atstart
M sysmoOCTSIM/config/hpl_gclk_config.h
M sysmoOCTSIM/config/peripheral_clk_config.h
3 files changed, 17 insertions(+), 17 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/atmel_start_config.atstart 
b/sysmoOCTSIM/atmel_start_config.atstart
index 6357a74..3854fb5 100644
--- a/sysmoOCTSIM/atmel_start_config.atstart
+++ b/sysmoOCTSIM/atmel_start_config.atstart
@@ -666,7 +666,7 @@
   enable_gclk_gen_3: true
   enable_gclk_gen_4: true
   enable_gclk_gen_5: true
-  enable_gclk_gen_6: false
+  enable_gclk_gen_6: true
   enable_gclk_gen_7: false
   enable_gclk_gen_8: false
   enable_gclk_gen_9: false
@@ -710,7 +710,7 @@
   gclk_arch_gen_5_oe: true
   gclk_arch_gen_5_oov: false
   gclk_arch_gen_5_runstdby: false
-  gclk_arch_gen_6_enable: false
+  gclk_arch_gen_6_enable: true
   gclk_arch_gen_6_idc: false
   gclk_arch_gen_6_oe: false
   gclk_arch_gen_6_oov: false
@@ -742,7 +742,7 @@
   gclk_gen_1_div: 1
   gclk_gen_1_div_sel: false
   gclk_gen_1_oscillator: Digital Frequency Locked Loop (DFLL48M)
-  gclk_gen_2_div: 30
+  gclk_gen_2_div: 200
   gclk_gen_2_div_sel: false
   gclk_gen_2_oscillator: Digital Phase Locked Loop (DPLL1)
   gclk_gen_3_div: 1
@@ -754,9 +754,9 @@
   gclk_gen_5_div: 5
   gclk_gen_5_div_sel: false
   gclk_gen_5_oscillator: Digital Phase Locked Loop (DPLL1)
-  gclk_gen_6_div: 1
+  gclk_gen_6_div: 17
   gclk_gen_6_div_sel: false
-  gclk_gen_6_oscillator: External Crystal Oscillator 8-48MHz (XOSC1)
+  gclk_gen_6_oscillator: Digital Phase Locked Loop (DPLL0)
   gclk_gen_7_div: 1
   gclk_gen_7_div_sel: false
   gclk_gen_7_oscillator: External Crystal Oscillator 8-48MHz (XOSC1)
diff --git a/sysmoOCTSIM/config/hpl_gclk_config.h 
b/sysmoOCTSIM/config/hpl_gclk_config.h
index 81a1f03..158fc93 100644
--- a/sysmoOCTSIM/config/hpl_gclk_config.h
+++ b/sysmoOCTSIM/config/hpl_gclk_config.h
@@ -226,7 +226,7 @@
 // Generic clock generator 2 division <0x-0x>
 //  gclk_gen_2_div
 #ifndef CONF_GCLK_GEN_2_DIV
-#define CONF_GCLK_GEN_2_DIV 30
+#define CONF_GCLK_GEN_2_DIV 200
 #endif
 // 
 // 
@@ -463,7 +463,7 @@
 //  Indicates whether generic clock 6 configuration is enabled or not
 //  enable_gclk_gen_6
 #ifndef CONF_GCLK_GENERATOR_6_CONFIG
-#define CONF_GCLK_GENERATOR_6_CONFIG 0
+#define CONF_GCLK_GENERATOR_6_CONFIG 1
 #endif

 //  Generic Clock Generator Control
@@ -480,7 +480,7 @@
 //  This defines the clock source for generic clock generator 6
 //  gclk_gen_6_oscillator
 #ifndef CONF_GCLK_GEN_6_SOURCE
-#define CONF_GCLK_GEN_6_SOURCE GCLK_GENCTRL_SRC_XOSC1
+#define CONF_GCLK_GEN_6_SOURCE GCLK_GENCTRL_SRC_DPLL0
 #endif

 //  Run in Standby
@@ -522,7 +522,7 @@
 //  Indicates whether Generic Clock Generator Enable is enabled or not
 //  gclk_arch_gen_6_enable
 #ifndef CONF_GCLK_GEN_6_GENEN
-#define CONF_GCLK_GEN_6_GENEN 0
+#define CONF_GCLK_GEN_6_GENEN 1
 #endif
 // 

@@ -530,7 +530,7 @@
 // Generic clock generator 6 division <0x-0x>
 //  gclk_gen_6_div
 #ifndef CONF_GCLK_GEN_6_DIV
-#define CONF_GCLK_GEN_6_DIV 1
+#define CONF_GCLK_GEN_6_DIV 17
 #endif
 // 
 // 
diff --git a/sysmoOCTSIM/config/peripheral_clk_config.h 
b/sysmoOCTSIM/config/peripheral_clk_config.h
index 2ae1f63..f794792 100644
--- a/sysmoOCTSIM/config/peripheral_clk_config.h
+++ b/sysmoOCTSIM/config/peripheral_clk_config.h
@@ -81,7 +81,7 @@
  * \brief SERCOM0's Core Clock frequency
  */
 #ifndef CONF_GCLK_SERCOM0_CORE_FREQUENCY
-#define CONF_GCLK_SERCOM0_CORE_FREQUENCY 333
+#define CONF_GCLK_SERCOM0_CORE_FREQUENCY 50
 #endif

 /**
@@ -161,7 +161,7 @@
  * \brief SERCOM1's Core Clock frequency
  */
 #ifndef CONF_GCLK_SERCOM1_CORE_FREQUENCY
-#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 333
+#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 50
 #endif

 /**
@@ -241,7 +241,7 @@
  * \brief SERCOM2's Core Clock frequency
  */
 #ifndef CONF_GCLK_SERCOM2_CORE_FREQUE

Change in osmo-ccid-firmware[master]: add slot_set_isorate to the baud rate using ISO 7816 values

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13847 )

Change subject: add slot_set_isorate to the baud rate using ISO 7816 values
..

add slot_set_isorate to the baud rate using ISO 7816 values

Change-Id: I604f72bb28944962aee055e6d88a435827f79bec
---
M sysmoOCTSIM/main.c
1 file changed, 55 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 70099e1..a895c14 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -30,6 +30,7 @@
 #include "i2c_bitbang.h"
 #include "octsim_i2c.h"
 #include "ncn8025.h"
+#include "iso7816_3.h"

 #include "command.h"

@@ -158,6 +159,57 @@
return true;
 }

+/** change ISO baud rate of card slot
+ *  @param[in] slotnr slot number for which the baud rate should be set
+ *  @param[in] clkdiv can clock divider
+ *  @param[in] f clock rate conversion integer F
+ *  @param[in] d baud rate adjustment factor D
+ *  @return if the baud rate has been set, else a parameter is out of range
+ */
+static bool slot_set_isorate(uint8_t slotnr, enum ncn8025_sim_clkdiv clkdiv, 
uint16_t f, uint8_t d)
+{
+   // input checks
+   ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors));
+   if (clkdiv != SIM_CLKDIV_1 && clkdiv != SIM_CLKDIV_2 && clkdiv != 
SIM_CLKDIV_4 && clkdiv != SIM_CLKDIV_8) {
+   return false;
+   }
+   if (!iso7816_3_valid_f(f)) {
+   return false;
+   }
+   if (!iso7816_3_valid_d(d)) {
+   return false;
+   }
+
+   // set clockdiv
+   struct ncn8025_settings settings;
+   ncn8025_get(slotnr, &settings);
+   if (settings.clkdiv != clkdiv) {
+   settings.clkdiv = clkdiv;
+   ncn8025_set(slotnr, &settings);
+   }
+
+   // calculate desired frequency
+   uint32_t freq = 2000UL; // maximum frequency
+   switch (clkdiv) {
+   case SIM_CLKDIV_1:
+   freq /= 1;
+   break;
+   case SIM_CLKDIV_2:
+   freq /= 2;
+   break;
+   case SIM_CLKDIV_4:
+   freq /= 4;
+   break;
+   case SIM_CLKDIV_8:
+   freq /= 8;
+   break;
+   }
+
+   // set baud rate
+   uint32_t baudrate = (freq * d) / f; // calculate actual baud rate
+   return slot_set_baudrate(slotnr, baudrate); // // set baud rate
+}
+
 DEFUN(sim_status, cmd_sim_status, "sim-status", "Get state of specified 
NCN8025")
 {
struct ncn8025_settings settings;
@@ -322,10 +374,12 @@
// TODO wait some time for card to be completely deactivated
usart_async_flush_rx_buffer(SIM_peripheral_descriptors[slotnr]); // 
flush RX buffer to start from scratch

-   slot_set_baudrate(slotnr, 250 / (372 / 1)); // set USART baud rate 
to match the interface (f = 2.5 MHz) and card default settings (Fd = 372, Dd = 
1)
+
// set clock to lowest frequency (20 MHz / 8 = 2.5 MHz)
// note: according to ISO/IEC 7816-3:2006 section 5.2.3 the minimum 
value is 1 MHz, and maximum is 5 MHz during activation
settings.clkdiv = SIM_CLKDIV_8;
+   // set USART baud rate to match the interface (f = 2.5 MHz) and card 
default settings (Fd = 372, Dd = 1)
+   slot_set_isorate(slotnr, settings.clkdiv, ISO7816_3_DEFAULT_FD, 
ISO7816_3_DEFAULT_DD);
// set card voltage to 3.0 V (the most supported)
// note: according to ISO/IEC 7816-3:2006 no voltage should damage the 
card, and you should cycle from low to high
settings.vsel = SIM_VOLT_3V0;

--
To view, visit https://gerrit.osmocom.org/13847
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I604f72bb28944962aee055e6d88a435827f79bec
Gerrit-Change-Number: 13847
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 


Change in osmo-msc[master]: libmsc/gsm_04_08.c: clarify IMEI rejection in gsm48_rx_mm_serv_req()

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13944 )

Change subject: libmsc/gsm_04_08.c: clarify IMEI rejection in 
gsm48_rx_mm_serv_req()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13944
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I65277aee1f52a8b4fd4b970e992482bbadd94d39
Gerrit-Change-Number: 13944
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 14:37:56 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: libmsc/gsm_04_08.c: fix: print proper length value

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13906 )

Change subject: libmsc/gsm_04_08.c: fix: print proper length value
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13906
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2bfebce6d017be834bfe7628ffa2b341eb82c11c
Gerrit-Change-Number: 13906
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 14:38:09 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: add ISO 7816-3 definitions and utilities

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13846 )

Change subject: add ISO 7816-3 definitions and utilities
..

add ISO 7816-3 definitions and utilities

Change-Id: Ice4eba380126ff92089b71d0ea328b0110f7ffec
---
M sysmoOCTSIM/gcc/Makefile
A sysmoOCTSIM/iso7816_3.c
A sysmoOCTSIM/iso7816_3.h
3 files changed, 225 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile
index 5d21cb0..cf0484c 100644
--- a/sysmoOCTSIM/gcc/Makefile
+++ b/sysmoOCTSIM/gcc/Makefile
@@ -83,6 +83,7 @@
 octsim_i2c.o \
 ncn8025.o \
 command.o \
+iso7816_3.o \
 hpl/osc32kctrl/hpl_osc32kctrl.o \
 driver_init.o \
 hal/src/hal_usart_async.o \
@@ -132,6 +133,7 @@
 "octsim_i2c.o" \
 "ncn8025.o" \
 "command.o" \
+"iso7816_3.o" \
 "hpl/osc32kctrl/hpl_osc32kctrl.o" \
 "driver_init.o" \
 "hal/src/hal_usart_async.o" \
@@ -188,7 +190,8 @@
 "octsim_i2c.d" \
 "ncn8025.d" \
 "command.d" \
-"hal/src/hal_cache.d" \
+"iso7816_3.d" \
+"hal/src/halcache.d" \
 "hal/src/hal_sleep.d" \
 "hal/utils/src/utils_ringbuffer.d" \
 "hpl/sercom/hpl_sercom.d" \
diff --git a/sysmoOCTSIM/iso7816_3.c b/sysmoOCTSIM/iso7816_3.c
new file mode 100644
index 000..f7262fb
--- /dev/null
+++ b/sysmoOCTSIM/iso7816_3.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+*/
+#include 
+#include 
+
+#include "utils.h"
+#include "iso7816_3.h"
+
+const uint16_t iso7816_3_fi_table[16] = {
+   372, 372, 558, 744, 1116, 1488, 1860, 0,
+   0, 512, 768, 1024, 1536, 2048, 0, 0
+};
+
+const uint32_t iso7816_3_fmax_table[16] = {
+   400, 500, 600, 800, 1200, 1600, 2000, 0,
+   0, 500, 750, 1000, 1500, 2000, 0, 0
+};
+
+const uint8_t iso7816_3_di_table[16] = {
+   0, 1, 2, 4, 8, 16, 32, 64,
+   12, 20, 0, 0, 0, 0, 0, 0,
+};
+
+/* all values are based on the Elementary Time Unit (ETU), defined in ISO/IEC 
7816-3 section 7.1
+ * this is the time required to transmit a bit, and is calculated as follows: 
1 ETU = (F / D) x (1 / f) where:
+ * - F is the clock rate conversion integer
+ * - D is the baud rate adjustment factor
+ * - f is the clock frequency
+ * the possible F, f(max), and D values are defined in ISO/IEC 7816-3 table 7 
and 8
+ * - the initial value for F (after reset) is Fd = 372
+ * - the initial value for D (after reset) is Dd = 1
+ * - the initial maximum frequency f(max) is 5 MHz
+ * the card must measure the ETU based on the clock signal provided by the 
reader
+ * one ETU (e.g. 1 bit) takes F/D clock cycles, which the card must count
+ *
+ * the card can indicate an alternative set of supported values Fi (with 
corresponding f(max)) and Di for higher baud rate in TA1 in the ATR (see 
ISO/IEC 7816-3 section 8.3)
+ * these values are selected according to ISO/IEC 7816-3 section 6.3.1:
+ * - card in specific mode: they are enforced if TA2 is present (the reader 
can deactivate the card if it does not support these values)
+ * - card in negotiable mode:
+ * -- they can be selected by the reader using the Protocol and Parameters 
Selection (PPS) procedure
+ * -- the first offered protocol and default values are used when no PPS is 
started
+ *
+ * PPS is done with Fd and Dd (see ISO/IEC 7816-3 section 9)
+ * the reader can propose any F and D values between from Fd to Fi, and from 
Dd to Di (Fi and Di are indicated in TA1)
+ * the in PPS agreed values F and D are called Fn and Dn and are applied after 
a successful exchange, corresponding to PPS1_Response bit 5
+ *
+ * the F and D values must be provided to the SAM3S USART peripheral (after 
reset and PPS)
+ */
+
+bool iso7816_3_valid_f(uint16_t f)
+{
+   if (0 == f) {
+   return false;
+   }
+   uint8_t i = 0;
+   for (i = 0; i < ARRAY_SIZE(iso7816_3_fi_table) && iso7816_3_fi_table[i] 
!= f; i++);
+   return (i < ARRAY_SIZE(iso7816_3_fi_table) && iso7816_3_fi_table[i] == 
f);
+}
+
+bool iso7816_3_valid_d(uint8_t d)
+{
+   if (0 == d) {
+   return false;
+   }
+   uint8_t i = 0;
+   for (i = 0; i < ARRAY_S

Change in osmo-ccid-firmware[master]: add async library with ring on TX

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13677 )

Change subject: add async library with ring on TX
..


Patch Set 11: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13677
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6
Gerrit-Change-Number: 13677
Gerrit-PatchSet: 11
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 14:37:20 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 73 insertions(+), 22 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index b0949f3..6fa25cf 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -81,7 +81,7 @@
unsigned int i = 0;

/* yield CPU after maximum of 10 received characters */
-   while (usart_sync_is_rx_not_empty(&UART_debug) && (i < 10)) {
+   while (usart_async_is_rx_not_empty(&UART_debug) && (i < 10)) {
int c = getchar();
if (c < 0)
return;
diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c
index 726129d..8a50925 100644
--- a/sysmoOCTSIM/driver_init.c
+++ b/sysmoOCTSIM/driver_init.c
@@ -32,6 +32,9 @@
 /*! The buffer size for USART */
 #define SIM6_BUFFER_SIZE 16

+/*! The buffer size for USART */
+#define UART_DEBUG_BUFFER_SIZE 32
+
 struct usart_async_descriptor SIM0;
 struct usart_async_descriptor SIM1;
 struct usart_async_descriptor SIM2;
@@ -48,7 +51,9 @@
 static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE];
 static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE];

-struct usart_sync_descriptor UART_debug;
+struct usart_async_descriptor UART_debug;
+
+static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE];

 /**
  * \brief USART Clock initialization function
@@ -309,7 +314,26 @@
SIM6_PORT_init();
 }

-void UART_debug_PORT_init(void)
+/**
+ * \brief USART Clock initialization function
+ *
+ * Enables register interface and peripheral clock
+ */
+void UART_debug_CLOCK_init()
+{
+
+   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, 
CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
+   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, 
CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
+
+   hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK);
+}
+
+/**
+ * \brief USART pinmux initialization function
+ *
+ * Set each required pin to USART functionality
+ */
+void UART_debug_PORT_init()
 {

gpio_set_pin_function(UART_TX, PINMUX_PB30C_SERCOM7_PAD0);
@@ -317,18 +341,15 @@
gpio_set_pin_function(UART_RX, PINMUX_PB31C_SERCOM7_PAD1);
 }

-void UART_debug_CLOCK_init(void)
-{
-   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, 
CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
-   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, 
CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
-
-   hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK);
-}
-
+/**
+ * \brief USART initialization function
+ *
+ * Enables USART peripheral, clocks and initializes USART driver
+ */
 void UART_debug_init(void)
 {
UART_debug_CLOCK_init();
-   usart_sync_init(&UART_debug, SERCOM7, (void *)NULL);
+   usart_async_init(&UART_debug, SERCOM7, UART_DEBUG_buffer, 
UART_DEBUG_BUFFER_SIZE, (void *)NULL);
UART_debug_PORT_init();
 }
 
diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h
index d809db8..9d009b9 100644
--- a/sysmoOCTSIM/driver_init.h
+++ b/sysmoOCTSIM/driver_init.h
@@ -40,8 +40,7 @@
 extern struct usart_async_descriptor SIM4;
 extern struct usart_async_descriptor SIM5;
 extern struct usart_async_descriptor SIM6;
-
-extern struct usart_sync_descriptor UART_debug;
+extern struct usart_async_descriptor UART_debug;

 void SIM0_PORT_init(void);
 void SIM0_CLOCK_init(void);
diff --git a/sysmoOCTSIM/hpl/sercom/hpl_sercom.c 
b/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
index b14e720..f235115 100644
--- a/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
+++ b/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
@@ -177,6 +177,8 @@

 static struct _usart_async_device *_sercom6_dev = NULL;

+static struct _usart_async_device *_sercom7_dev = NULL;
+
 static uint8_t _get_sercom_index(const void *const hw);
 static uint8_t _sercom_get_irq_num(const void *const hw);
 static 

Change in osmo-ccid-firmware[master]: UART_debug now uses the async library with tx ring

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13678 )

Change subject: UART_debug now uses the async library with tx ring
..

UART_debug now uses the async library with tx ring

Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
5 files changed, 13 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index 6fa25cf..454cd2f 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -81,7 +81,7 @@
unsigned int i = 0;
 
/* yield CPU after maximum of 10 received characters */
-   while (usart_async_is_rx_not_empty(&UART_debug) && (i < 10)) {
+   while (usart_async_rings_is_rx_not_empty(&UART_debug) && (i < 10)) {
int c = getchar();
if (c < 0)
return;
diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c
index 8a50925..0b6b190 100644
--- a/sysmoOCTSIM/driver_init.c
+++ b/sysmoOCTSIM/driver_init.c
@@ -33,7 +33,7 @@
 #define SIM6_BUFFER_SIZE 16

 /*! The buffer size for USART */
-#define UART_DEBUG_BUFFER_SIZE 32
+#define UART_DEBUG_BUFFER_SIZE 256

 struct usart_async_descriptor SIM0;
 struct usart_async_descriptor SIM1;
@@ -51,9 +51,10 @@
 static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE];
 static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE];

-struct usart_async_descriptor UART_debug;
+struct usart_async_rings_descriptor UART_debug;

-static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE];
+static uint8_t UART_DEBUG_buffer_rx[UART_DEBUG_BUFFER_SIZE];
+static uint8_t UART_DEBUG_buffer_tx[UART_DEBUG_BUFFER_SIZE];

 /**
  * \brief USART Clock initialization function
@@ -349,7 +350,7 @@
 void UART_debug_init(void)
 {
UART_debug_CLOCK_init();
-   usart_async_init(&UART_debug, SERCOM7, UART_DEBUG_buffer, 
UART_DEBUG_BUFFER_SIZE, (void *)NULL);
+   usart_async_rings_init(&UART_debug, SERCOM7, UART_DEBUG_buffer_rx, 
UART_DEBUG_BUFFER_SIZE, UART_DEBUG_buffer_tx, UART_DEBUG_BUFFER_SIZE, (void 
*)NULL);
UART_debug_PORT_init();
 }

diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h
index 9d009b9..6c4f3a1 100644
--- a/sysmoOCTSIM/driver_init.h
+++ b/sysmoOCTSIM/driver_init.h
@@ -21,15 +21,9 @@
 #include 
 #include 

-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #include 
+#include 
+#include 

 #include "hal_usb_device.h"

@@ -40,7 +34,7 @@
 extern struct usart_async_descriptor SIM4;
 extern struct usart_async_descriptor SIM5;
 extern struct usart_async_descriptor SIM6;
-extern struct usart_async_descriptor UART_debug;
+extern struct usart_async_rings_descriptor UART_debug;

 void SIM0_PORT_init(void);
 void SIM0_CLOCK_init(void);
diff --git a/sysmoOCTSIM/manual_test.c b/sysmoOCTSIM/manual_test.c
index 526414a..d6852bc 100644
--- a/sysmoOCTSIM/manual_test.c
+++ b/sysmoOCTSIM/manual_test.c
@@ -203,7 +203,7 @@
int c;

do {
-   } while (!usart_async_is_rx_not_empty(&UART_debug));
+   } while (!usart_async_rings_is_rx_not_empty(&UART_debug));

c = getchar();
if (c < 0)
diff --git a/sysmoOCTSIM/stdio_start.c b/sysmoOCTSIM/stdio_start.c
index e2fb0c2..8a15c88 100644
--- a/sysmoOCTSIM/stdio_start.c
+++ b/sysmoOCTSIM/stdio_start.c
@@ -9,13 +9,13 @@
 #include "atmel_start.h"
 #include "stdio_start.h"

-static void UART_debug_rx_cb(const struct usart_async_descriptor *const 
io_descr)
+static void UART_debug_rx_cb(const struct usart_async_rings_descriptor *const 
io_descr)
 {
 }

 void stdio_redirect_init(void)
 {
-   usart_async_register_callback(&UART_debug, USART_ASYNC_RXC_CB, 
UART_debug_rx_cb); // if no callback function is registered receive won't work, 
even if the callback does nothing
-   usart_async_enable(&UART_debug);
+   usart_async_rings_register_callback(&UART_debug, USART_ASYNC_RXC_CB, 
UART_debug_rx_cb); // if no callback function is registered receive won't work, 
even if the callback does nothing
+   usart_async_rings_enable(&UART_debug);
stdio_io_init(&UART_debug.io);
 }

--
To view, visit https://gerrit.osmocom.org/13678
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc
Gerrit-Change-Number: 13678
Gerrit-PatchSet: 11
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: add async library with ring on TX

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13677 )

Change subject: add async library with ring on TX
..

add async library with ring on TX

the standard async library expected the caller to wait until the
transmission was complete (by counting using the transmit callback
or checking using usart_async_get_status) before freeing/reusing
the memory holding the data to be transmitted.
this is not practical when using stdio on top of the peripheral
since printf returns directly and reuses the memory.
the new USART async library has a ring buffer for the data to be
transmitted (similar to the data being received).

WARNING: write is blocking when the TX buffer is full.
this prevents loosing data.

Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6
---
M sysmoOCTSIM/gcc/Makefile
A sysmoOCTSIM/hal/include/hal_usart_async_rings.h
A sysmoOCTSIM/hal/src/hal_usart_async_rings.c
3 files changed, 770 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile
index 2575c35..5d21cb0 100644
--- a/sysmoOCTSIM/gcc/Makefile
+++ b/sysmoOCTSIM/gcc/Makefile
@@ -86,6 +86,7 @@
 hpl/osc32kctrl/hpl_osc32kctrl.o \
 driver_init.o \
 hal/src/hal_usart_async.o \
+hal/src/hal_usart_async_rings.o \
 hpl/sercom/hpl_sercom.o \
 hal/utils/src/utils_ringbuffer.o \
 hal/src/hal_gpio.o \
@@ -134,6 +135,7 @@
 "hpl/osc32kctrl/hpl_osc32kctrl.o" \
 "driver_init.o" \
 "hal/src/hal_usart_async.o" \
+"hal/src/hal_usart_async_rings.o" \
 "hpl/sercom/hpl_sercom.o" \
 "hal/utils/src/utils_ringbuffer.o" \
 "hal/src/hal_gpio.o" \
@@ -178,6 +180,7 @@
 "driver_init.d" \
 "stdio_redirect/gcc/read.d" \
 "hal/src/hal_usart_async.d" \
+"hal/src/hal_usart_async_rings.d" \
 "hpl/osc32kctrl/hpl_osc32kctrl.d" \
 "main.d" \
 "manual_test.d" \
diff --git a/sysmoOCTSIM/hal/include/hal_usart_async_rings.h 
b/sysmoOCTSIM/hal/include/hal_usart_async_rings.h
new file mode 100644
index 000..c66e21c
--- /dev/null
+++ b/sysmoOCTSIM/hal/include/hal_usart_async_rings.h
@@ -0,0 +1,341 @@
+/**
+ * \file
+ *
+ * \brief USART related functionality declaration.
+ *
+ * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
+ * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

+ *
+ * \asf_license_start
+ *
+ * \page License
+ *
+ * Subject to your compliance with these terms, you may use Microchip
+ * software and any derivatives exclusively with Microchip products.
+ * It is your responsibility to comply with third party license terms 
applicable
+ * to your use of third party software (including open source software) that
+ * may accompany Microchip software.
+ *
+ * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
+ * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
+ * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
+ * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
+ * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
+ * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
+ * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
+ * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT
+ * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
+ * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
+ * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
+ *
+ * \asf_license_stop
+ *
+ */
+
+#ifndef _HAL_USART_ASYNC_RINGS_H_INCLUDED
+#define _HAL_USART_ASYNC_RINGS_H_INCLUDED
+
+#include "hal_io.h"
+#include 
+#include 
+
+/**
+ * \addtogroup doc_driver_hal_usart_async
+ *
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief USART descriptor
+ *
+ * The USART descriptor forward declaration.
+ */
+struct usart_async_rings_descriptor;
+
+/**
+ * \brief USART callback type
+ */
+typedef void (*usart_rings_cb_t)(const struct usart_async_rings_descriptor 
*const descr);
+
+/**
+ * \brief USART callback types
+ */
+enum usart_async_rings_callback_type { USART_ASYNC_RINGS_RXC_CB, 
USART_ASYNC_RINGS_TXC_CB, USART_ASYNC_RINGS_ERROR_CB };
+
+/**
+ * \brief USART callbacks
+ */
+struct usart_async_rings_callbacks {
+   usart_rings_cb_t tx_done;
+   usart_rings_cb_t rx_done;
+   usart_rings_cb_t error;
+};
+
+/** \brief USART status
+ *  Status descriptor holds the current status of transfer.
+ */
+struct usart_async_rings_status {
+   /** Status flags */
+   uint32_t flags;
+   /** Number of characters transmitted */
+   uint16_t txcnt;
+   /** Number of characters receviced */
+   uint16_t rxcnt;
+};
+
+/**
+ * \brief Asynchronous USART descriptor structure
+ */
+struct usart_async_rings_descriptor {
+   struct io_descriptor io;
+   struct _usart_async_device   device;
+

Change in osmo-ccid-firmware[master]: UART_debug now uses the async library with tx ring

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13678 )

Change subject: UART_debug now uses the async library with tx ring
..


Patch Set 11: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13678
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc
Gerrit-Change-Number: 13678
Gerrit-PatchSet: 11
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 14:37:23 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..


Patch Set 9: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 9
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Thu, 09 May 2019 14:37:02 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and inter-MSC Han...

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13947 )

Change subject: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and 
inter-MSC Handover tests")
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13947
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iadbc37105fa67cf6383fb63b86ed653ccc7bddf7
Gerrit-Change-Number: 13947
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Thu, 09 May 2019 14:35:42 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13941 )

Change subject: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM
..


Patch Set 1: Code-Review+2

(2 comments)

https://gerrit.osmocom.org/#/c/13941/1/include/osmocom/msc/transaction.h
File include/osmocom/msc/transaction.h:

https://gerrit.osmocom.org/#/c/13941/1/include/osmocom/msc/transaction.h@173
PS1, Line 173: deserves its own logging subsystem
ACK!


https://gerrit.osmocom.org/#/c/13941/1/src/libmsc/transaction.c
File src/libmsc/transaction.c:

https://gerrit.osmocom.org/#/c/13941/1/src/libmsc/transaction.c@149
PS1, Line 149: trans->log_subsys = trans_log_subsys(trans);
Good optimization.



--
To view, visit https://gerrit.osmocom.org/13941
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6dfe5b98fb9e884c2dde61d603832dafceb12123
Gerrit-Change-Number: 13941
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:34:08 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: no HO call forwarding if no RTP stream

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13940 )

Change subject: no HO call forwarding if no RTP stream
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13940/1/src/libmsc/msc_ho.c
File src/libmsc/msc_ho.c:

https://gerrit.osmocom.org/#/c/13940/1/src/libmsc/msc_ho.c@546
PS1, Line 546: rtp_to_ran = cl ? cl->rtp[RTP_TO_RAN] : NULL;
> Assigning NULL to 'rtp_to_ran' doesn't make sense anymore. […]
makes sense to me. I could do this:

  if (!cl) {
  error...
  }

  if (!cl->rtp[RTP_TO_RAN]) {
  error...
  }

instead I just

  rtp_to_ran = pointer or NULL
  if (!rtp_to_ran) {
error...
  }

so it saves one if()

YMMV, but nothing wrong with this, right?



--
To view, visit https://gerrit.osmocom.org/13940
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia223c2e20e625879ab71fc5c8afd0305fd224c58
Gerrit-Change-Number: 13940
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 14:31:52 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-msc[master]: call_leg: remove unused event MSC_EV_CALL_LEG_RTP_RELEASED

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13945


Change subject: call_leg: remove unused event MSC_EV_CALL_LEG_RTP_RELEASED
..

call_leg: remove unused event MSC_EV_CALL_LEG_RTP_RELEASED

The event is actually never dispatched and useless, because when an RTP stream
releases, the call_leg terminates directly anyway (which wasn't apparent when
starting to design the call_leg FSM yet).

Change-Id: I6b2fc1225c960fa2f7c46adf241520217a07821c
---
M include/osmocom/msc/call_leg.h
M include/osmocom/msc/msc_roles.h
M src/libmsc/call_leg.c
M src/libmsc/msc_a.c
M src/libmsc/msc_i.c
M src/libmsc/msc_t.c
6 files changed, 8 insertions(+), 45 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/45/13945/1

diff --git a/include/osmocom/msc/call_leg.h b/include/osmocom/msc/call_leg.h
index b8126e8..61107ee 100644
--- a/include/osmocom/msc/call_leg.h
+++ b/include/osmocom/msc/call_leg.h
@@ -36,7 +36,6 @@

uint32_t parent_event_rtp_addr_available;
uint32_t parent_event_rtp_complete;
-   uint32_t parent_event_rtp_released;

/* For internal MNCC, if RTP addresses for endpoints become assigned by 
the MGW, implicitly notify the other
 * call leg's RTP_TO_CN side rtp_stream with 
rtp_stream_remote_addr_available(). */
@@ -58,15 +57,13 @@
 struct call_leg *call_leg_alloc(struct osmo_fsm_inst *parent_fi,
uint32_t parent_event_term,
uint32_t parent_event_rtp_addr_available,
-   uint32_t parent_event_rtp_complete,
-   uint32_t parent_event_rtp_released);
+   uint32_t parent_event_rtp_complete);

 void call_leg_reparent(struct call_leg *cl,
   struct osmo_fsm_inst *parent_fi,
   uint32_t parent_event_term,
   uint32_t parent_event_rtp_addr_available,
-  uint32_t parent_event_rtp_complete,
-  uint32_t parent_event_rtp_released);
+  uint32_t parent_event_rtp_complete);

 int call_leg_local_bridge(struct call_leg *cl1, uint32_t call_id1, struct 
gsm_trans *trans1,
  struct call_leg *cl2, uint32_t call_id2, struct 
gsm_trans *trans2);
diff --git a/include/osmocom/msc/msc_roles.h b/include/osmocom/msc/msc_roles.h
index a1fab2f..b22bc7b 100644
--- a/include/osmocom/msc/msc_roles.h
+++ b/include/osmocom/msc/msc_roles.h
@@ -148,7 +148,6 @@

MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE,
MSC_EV_CALL_LEG_RTP_COMPLETE,
-   MSC_EV_CALL_LEG_RTP_RELEASED,
MSC_EV_CALL_LEG_TERM,

/* MNCC has told us to RTP_CREATE, but local RTP port has not yet been 
set up.
diff --git a/src/libmsc/call_leg.c b/src/libmsc/call_leg.c
index cb7e6ea..1b7db2b 100644
--- a/src/libmsc/call_leg.c
+++ b/src/libmsc/call_leg.c
@@ -67,8 +67,7 @@
 struct call_leg *call_leg_alloc(struct osmo_fsm_inst *parent_fi,
uint32_t parent_event_term,
uint32_t parent_event_rtp_addr_available,
-   uint32_t parent_event_rtp_complete,
-   uint32_t parent_event_rtp_released)
+   uint32_t parent_event_rtp_complete)
 {
struct call_leg *cl;
struct osmo_fsm_inst *fi = osmo_fsm_inst_alloc_child(&call_leg_fsm, 
parent_fi, parent_event_term);
@@ -82,7 +81,6 @@
.fi = fi,
.parent_event_rtp_addr_available = 
parent_event_rtp_addr_available,
.parent_event_rtp_complete = parent_event_rtp_complete,
-   .parent_event_rtp_released = parent_event_rtp_released,
};

return cl;
@@ -92,8 +90,7 @@
   struct osmo_fsm_inst *new_parent_fi,
   uint32_t parent_event_term,
   uint32_t parent_event_rtp_addr_available,
-  uint32_t parent_event_rtp_complete,
-  uint32_t parent_event_rtp_released)
+  uint32_t parent_event_rtp_complete)
 {
LOG_CALL_LEG(cl, LOGL_DEBUG, "Reparenting from parent %s to parent 
%s\n",
 cl->fi->proc.parent->name, new_parent_fi->name);
@@ -101,7 +98,6 @@
talloc_steal(new_parent_fi, cl->fi);
cl->parent_event_rtp_addr_available = parent_event_rtp_addr_available;
cl->parent_event_rtp_complete = parent_event_rtp_complete;
-   cl->parent_event_rtp_released = parent_event_rtp_released;
 }

 static int call_leg_fsm_timer_cb(struct osmo_fsm_inst *fi)
diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index 5baed54..77dd43d 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -546,28 +546,15 @@

 static void msc_a_cleanup_rtp_streams(struct msc_a *msc_a, uint32_t event, 
void *data)
 {
-   struct rtp_st

Change in osmo-msc[master]: call_leg: document the parent_event_* items

2019-05-09 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13946 )

Change subject: call_leg: document the parent_event_* items
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13946
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib099178a0f6ab218646c67c0e7a3d360c81af684
Gerrit-Change-Number: 13946
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-CC: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 14:27:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and inter-MSC Han...

2019-05-09 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/13947


Change subject: Revert partial of 0ac6315212a3 ("msc: add inter-BSC and 
inter-MSC Handover tests")
..

Revert partial of 0ac6315212a3 ("msc: add inter-BSC and inter-MSC Handover 
tests")

Commit 0ac6315212a breaks all related GSUP SS tests because it require
all GSUP SS packages to have a OSMO_GSUP_MESSAGE_CLASS_USSD IE.

Change-Id: Iadbc37105fa67cf6383fb63b86ed653ccc7bddf7
---
M library/GSUP_Types.ttcn
1 file changed, 0 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/47/13947/1

diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index 73f4562..7e26e19 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -1091,20 +1091,14 @@
tr_GSUP_IE_SessionId(sid),
tr_GSUP_IE_SessionState(state)
};
-   var integer last_idx := 3;

/* Optional SS payload */
if (istemplatekind(ss, "*")) {
ies[3] := *;
-   last_idx := last_idx + 1;
} else if (not istemplatekind(ss, "omit")) {
ies[3] := tr_GSUP_IE_SSInfo(ss);
-   last_idx := last_idx + 1;
}

-   ies[last_idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
-   last_idx := last_idx + 1;
-
return ies;
 }


--
To view, visit https://gerrit.osmocom.org/13947
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadbc37105fa67cf6383fb63b86ed653ccc7bddf7
Gerrit-Change-Number: 13947
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 


Change in osmo-msc[master]: call_leg: document the parent_event_* items

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13946


Change subject: call_leg: document the parent_event_* items
..

call_leg: document the parent_event_* items

Change-Id: Ib099178a0f6ab218646c67c0e7a3d360c81af684
---
M include/osmocom/msc/call_leg.h
M src/libmsc/call_leg.c
2 files changed, 9 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/46/13946/1

diff --git a/include/osmocom/msc/call_leg.h b/include/osmocom/msc/call_leg.h
index 61107ee..d8380f5 100644
--- a/include/osmocom/msc/call_leg.h
+++ b/include/osmocom/msc/call_leg.h
@@ -34,6 +34,7 @@
/* Array indexed by enum rtp_direction. */
enum mgcp_connection_mode crcx_conn_mode[2];

+   /* Events dispatched to the parent fi, see call_leg_alloc() doc. */
uint32_t parent_event_rtp_addr_available;
uint32_t parent_event_rtp_complete;
 
diff --git a/src/libmsc/call_leg.c b/src/libmsc/call_leg.c
index 1b7db2b..46405bc 100644
--- a/src/libmsc/call_leg.c
+++ b/src/libmsc/call_leg.c
@@ -64,6 +64,14 @@
OSMO_ASSERT( osmo_fsm_register(&call_leg_fsm) == 0 );
 }

+/* Allocate a call leg FSM instance as child of an arbitrary other FSM 
instance.
+ * The call leg FSM dispatches events to its parent FSM instance on specific 
events:
+ * - parent_event_term: dispatch this to the parent FI when the call leg 
terminates (call ended, either planned or by
+ *   failure).
+ * - parent_event_rtp_addr_available: one of the rtp_stream instances managed 
by the call leg has received an RTP
+ *   address from the MGW. The struct rtp_stream instance is passed as data 
argument for the event dispatch.
+ * - parent_event_rtp_complete: one of the rtp_stream instances entered the 
RTP_STREAM_ST_ESTABLISHED state.
+ */
 struct call_leg *call_leg_alloc(struct osmo_fsm_inst *parent_fi,
uint32_t parent_event_term,
uint32_t parent_event_rtp_addr_available,

--
To view, visit https://gerrit.osmocom.org/13946
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib099178a0f6ab218646c67c0e7a3d360c81af684
Gerrit-Change-Number: 13946
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-ccid-firmware[master]: add debug command to communicate with card

2019-05-09 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13943

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

Change subject: add debug command to communicate with card
..

add debug command to communicate with card

currently the sim-iccid command only selects MF.
this is a proof of concept for card communication.
the transmission/reception must be generalized to avoid copying
the code multiple times.

IMPORTANT: the sim-iccid commands only works after the sim-atr
command, which sets up the cards correctly

Change-Id: Icbcde783143694afce23af6e3f26bcd7a9a13b85
---
M sysmoOCTSIM/main.c
1 file changed, 145 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/43/13943/3
--
To view, visit https://gerrit.osmocom.org/13943
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icbcde783143694afce23af6e3f26bcd7a9a13b85
Gerrit-Change-Number: 13943
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-msc[master]: libmsc/gsm_04_08.c: clarify IMEI rejection in gsm48_rx_mm_serv_req()

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13944


Change subject: libmsc/gsm_04_08.c: clarify IMEI rejection in 
gsm48_rx_mm_serv_req()
..

libmsc/gsm_04_08.c: clarify IMEI rejection in gsm48_rx_mm_serv_req()

Change-Id: I65277aee1f52a8b4fd4b970e992482bbadd94d39
---
M src/libmsc/gsm_04_08.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/44/13944/1

diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 418ee2a..68b12c0 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -765,7 +765,8 @@
case GSM_MI_TYPE_IMEI:
if (req->cm_service_type == GSM48_CMSERV_EMERGENCY) {
/* We don't do emergency calls by IMEI */
-   LOG_MSC_A(msc_a, LOGL_NOTICE, "Tx CM SERVICE REQUEST 
REJECT\n");
+   LOG_MSC_A(msc_a, LOGL_NOTICE, "Tx CM SERVICE REQUEST 
REJECT: "
+ "emergency services by IMEI are not 
supported\n");
return msc_gsm48_tx_mm_serv_rej(msc_a, 
GSM48_REJECT_IMEI_NOT_ACCEPTED);
}
/* fall-through for non-emergency setup */

--
To view, visit https://gerrit.osmocom.org/13944
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65277aee1f52a8b4fd4b970e992482bbadd94d39
Gerrit-Change-Number: 13944
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmo-msc[master]: libmsc/gsm_04_08.c: fix: print proper length value

2019-05-09 Thread Vadim Yanitskiy
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13906

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

Change subject: libmsc/gsm_04_08.c: fix: print proper length value
..

libmsc/gsm_04_08.c: fix: print proper length value

Since in parse_umts_auth_resp() we are checking the length of
GSM48_IE_AUTH_RES_EXT TLV, we need to print its length, but
not the length of the whole L3.

Change-Id: I2bfebce6d017be834bfe7628ffa2b341eb82c11c
---
M src/libmsc/gsm_04_08.c
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/06/13906/3
--
To view, visit https://gerrit.osmocom.org/13906
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2bfebce6d017be834bfe7628ffa2b341eb82c11c
Gerrit-Change-Number: 13906
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: add async library with ring on TX

2019-05-09 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13677

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

Change subject: add async library with ring on TX
..

add async library with ring on TX

the standard async library expected the caller to wait until the
transmission was complete (by counting using the transmit callback
or checking using usart_async_get_status) before freeing/reusing
the memory holding the data to be transmitted.
this is not practical when using stdio on top of the peripheral
since printf returns directly and reuses the memory.
the new USART async library has a ring buffer for the data to be
transmitted (similar to the data being received).

WARNING: write is blocking when the TX buffer is full.
this prevents loosing data.

Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6
---
M sysmoOCTSIM/gcc/Makefile
A sysmoOCTSIM/hal/include/hal_usart_async_rings.h
A sysmoOCTSIM/hal/src/hal_usart_async_rings.c
3 files changed, 770 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/77/13677/11
--
To view, visit https://gerrit.osmocom.org/13677
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6
Gerrit-Change-Number: 13677
Gerrit-PatchSet: 11
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-09 Thread Kévin Redon
Kévin Redon has posted comments on this change. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..


Patch Set 9:

> I still don't like the fact that this looses serial output pretty
 > much all the time (e.g. if you type 'help' at the command line).

fixed in https://gerrit.osmocom.org/#/c/osmo-ccid-firmware/+/13677/ patchset 
10. the new async lib with tx buffer is now blocking when the buffer is full.
I did not implemented a warning for buffer "overflow", but the buffer is 
already quite large and I saw it blocking only with very large text (e.g. help).


--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 9
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Thu, 09 May 2019 13:39:27 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ccid-firmware[master]: add debug command to communicate with card

2019-05-09 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/13943


Change subject: add debug command to communicate with card
..

add debug command to communicate with card

currently the read-iccid command only selects MF.
this is a proof of concept for card communication.
the transmission/reception must be generalized to avoid copying
the code multiple times.

Change-Id: Icbcde783143694afce23af6e3f26bcd7a9a13b85
---
M sysmoOCTSIM/main.c
1 file changed, 145 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/43/13943/1

diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index a895c14..11849c7 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -38,10 +38,28 @@
 // TODO for now SIM7 is not present because used for debug
 static struct usart_async_descriptor* SIM_peripheral_descriptors[] = {&SIM0, 
&SIM1, &SIM2, &SIM3, &SIM4, &SIM5, &SIM6, NULL};

+/** number of bytes transmitted on the SIM peripheral */
+static volatile bool SIM_tx_count[8];
+
 static void SIM_rx_cb(const struct usart_async_descriptor *const io_descr)
 {
 }

+/** called when the transmission is complete
+ *  e.g. this is when the byte has been sent and there is no data to transmit 
anymore
+ */
+static void SIM_tx_cb(const struct usart_async_descriptor *const io_descr)
+{
+   // find slotnr for corresponding USART
+   uint8_t slotnr;
+   for (slotnr = 0; slotnr < ARRAY_SIZE(SIM_peripheral_descriptors) && 
SIM_peripheral_descriptors[slotnr] != io_descr; slotnr++);
+
+   // set flag
+   if (slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)) {
+   SIM_tx_count[slotnr] = true;
+   }
+}
+
 /** possible clock sources for the SERCOM peripheral
  *  warning: the definition must match the GCLK configuration
  */
@@ -80,6 +98,7 @@
continue;
}
usart_async_register_callback(SIM_peripheral_descriptors[i], 
USART_ASYNC_RXC_CB, SIM_rx_cb); // required for RX to work, even if the 
callback does nothing
+   usart_async_register_callback(SIM_peripheral_descriptors[i], 
USART_ASYNC_TXC_CB, SIM_tx_cb); // to count the number of bytes transmitted 
since we are using it asynchronously
usart_async_enable(SIM_peripheral_descriptors[i]);
}
 }
@@ -360,7 +379,7 @@
// check if card is present (and read current settings)
ncn8025_get(slotnr, &settings);
if (!settings.simpres) {
-   printf("no card present in slot %d, aborting\r\n", slotnr);
+   printf("(%d) error: no card present\r\n", slotnr);
return;
}

@@ -406,19 +425,19 @@
}
// verify if one byte has been received
if (!usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) {
-   printf("card in slot %d is not responding, aborting\r\n", 
slotnr);
+   printf("(%d) error: card not responsive\r\n", slotnr);
return;
}

// read ATR (just do it until there is no traffic anymore)
-   // TODO the ATR should be parsed to read the right number of bytes
+   // TODO the ATR should be parsed to read the right number of bytes, 
instead we just wait until to end of WT
printf("(%d) ATR: ", slotnr);
uint8_t atr_byte;
while (usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) 
{
if (1 == io_read(&SIM_peripheral_descriptors[slotnr]->io, 
&atr_byte, 1)) {
printf("%02x ", atr_byte);
}
-   uint16_t wt = 9600; // waiting time in ETU
+   uint16_t wt = ISO7816_3_DEFAULT_WT; // waiting time in ETU
while (wt && 
!usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) {
delay_us(149); // wait for 1 ETU (372 / 1 / 2.5 MHz = 
148.8 us)
wt--;
@@ -426,9 +445,127 @@
}
printf("\r\n");

-   /* disable VCC and LED, re-enable RST */
-   settings.cmdvcc = false;
-   settings.rstin = true;
+   /* disable LED */
+   settings.led = false;
+   ncn8025_set(slotnr, &settings);
+}
+
+DEFUN(sim_iccid, cmd_sim_iccid, "sim-iccid", "Read ICCID from SIM card")
+{
+   struct ncn8025_settings settings;
+   int slotnr = validate_slotnr(argc, argv, 1);
+
+   if (slotnr < 0 || slotnr >= ARRAY_SIZE(SIM_peripheral_descriptors) || 
NULL == SIM_peripheral_descriptors[slotnr]) {
+   return;
+   }
+
+   // read current settings and check if card is present and powered
+   ncn8025_get(slotnr, &settings);
+   if (!settings.simpres) {
+   printf("(%d) error: no card present\r\n", slotnr);
+   return;
+   }
+   if (!settings.cmdvcc) {
+   printf("(%d) error: card not powered\r\n", slotnr);
+   return;
+   }
+ 

Change in osmo-ccid-firmware[master]: add async library with ring on TX

2019-05-09 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13677

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

Change subject: add async library with ring on TX
..

add async library with ring on TX

the standard async library expected the caller to wait until the
transmission was complete (by counting using the transmit callback
or checking using usart_async_get_status) before freeing/reusing
the memory holding the data to be transmitted.
this is not practical when using stdio on top of the peripheral
since printf returns directly and reuses the memory.
the new USART async library has a ring buffer for the data to be
transmitted (similar to the data being received).

WARNING: write is blocking when the TX buffer is full.
this prevents loosing data.

Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6
---
M sysmoOCTSIM/gcc/Makefile
A sysmoOCTSIM/hal/include/hal_usart_async_rings.h
A sysmoOCTSIM/hal/src/hal_usart_async_rings.c
3 files changed, 768 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/77/13677/10
--
To view, visit https://gerrit.osmocom.org/13677
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6
Gerrit-Change-Number: 13677
Gerrit-PatchSet: 10
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-msc[master]: add DUSSD logging category

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13942


Change subject: add DUSSD logging category
..

add DUSSD logging category

Change-Id: Id7e04c9f5088334cd5ec6cfdb6a9b3a2a7e7fda0
---
M include/osmocom/msc/debug.h
M include/osmocom/msc/transaction.h
M src/libmsc/gsm_09_11.c
M src/osmo-msc/msc_main.c
M tests/msc_vlr/msc_vlr_test_ss.err
M tests/msc_vlr/msc_vlr_tests.c
6 files changed, 23 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/42/13942/1

diff --git a/include/osmocom/msc/debug.h b/include/osmocom/msc/debug.h
index 28ba482..8802360 100644
--- a/include/osmocom/msc/debug.h
+++ b/include/osmocom/msc/debug.h
@@ -22,5 +22,6 @@
DIUCS,
DBSSAP,
DSGS,
+   DUSSD,
Debug_LastEntry,
 };
diff --git a/include/osmocom/msc/transaction.h 
b/include/osmocom/msc/transaction.h
index 6b82390..bd20153 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -168,10 +168,7 @@
case TRANS_SMS:
return DLSMS;
case TRANS_USSD:
-   /* FIXME: traditionally (before LOG_TRANS() was added in 
I2e60964d7a3c06d051debd1c707051a0eb3101ba /
-* ff7074a0c7b62025473d8f1a950905ac2cb2f31c), all USSD logging 
happened on DMM. Instead, it probably
-* deserves its own logging subsystem. */
-   return DMM;
+   return DUSSD;
default:
break;
}
diff --git a/src/libmsc/gsm_09_11.c b/src/libmsc/gsm_09_11.c
index 984cc53..b211641 100644
--- a/src/libmsc/gsm_09_11.c
+++ b/src/libmsc/gsm_09_11.c
@@ -271,7 +271,7 @@

if (msc_a) {
struct gsm_network *net = msc_a_net(msc_a);
-   LOG_MSC_A_CAT(msc_a, DMM, LOGL_DEBUG, "Paging succeeded\n");
+   LOG_MSC_A_CAT(msc_a, DUSSD, LOGL_DEBUG, "Paging succeeded\n");

/* Assign connection */
msc_a_get(msc_a, MSC_A_USE_NC_SS);
@@ -297,7 +297,7 @@
/* Count established network-initiated NC SS/USSD sessions */
rate_ctr_inc(&net->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_ESTABLISHED]);
} else {
-   LOG_MSC_A_CAT(msc_a, DMM, LOGL_DEBUG, "Paging expired\n");
+   LOG_MSC_A_CAT(msc_a, DUSSD, LOGL_DEBUG, "Paging expired\n");

/* TODO: inform HLR about this failure */

diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index e101d89..2c2cc26 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -480,8 +480,11 @@
.description = "SGs Interface (SGsAP)",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
-
-
+   [DUSSD] = {
+   .name = "DUSSD",
+   .description = "Supplementary Services",
+   .enabled = 1, .loglevel = LOGL_NOTICE,
+   },
 };

 static int filter_fn(const struct log_context *ctx, struct log_target *tar)
diff --git a/tests/msc_vlr/msc_vlr_test_ss.err 
b/tests/msc_vlr/msc_vlr_test_ss.err
index 2030715..a409abf 100644
--- a/tests/msc_vlr/msc_vlr_test_ss.err
+++ b/tests/msc_vlr/msc_vlr_test_ss.err
@@ -173,12 +173,12 @@
 DBSSAP 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 RAN decode: DTAP
 DRLL 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 Dispatching 04.08 message: NCSS GSM0480_MTYPE_REGISTER
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 + NCSS: now used by 3 
(attached,active-conn,NCSS)
-DMM trans(NCSS IMSI-90170004620:MSISDN-46071 callref-0x2001 tid-8) New 
transaction
+DUSSD trans(NCSS IMSI-90170004620:MSISDN-46071 callref-0x2001 tid-8) 
New transaction
 DREF 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 + nc_ss: now used by 3 (cm_service_ss,rx_from_ms,nc_ss)
 DMSC 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 Received Event MSC_A_EV_TRANSACTION_ACCEPTED
 DMSC 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 state_chg to MSC_A_ST_COMMUNICATING
 DREF 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
 - cm_service_ss: now used by 2 (rx_from_ms,nc_ss)
-DMM trans(NCSS IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ 
callref-0x2001 tid-8) Received SS/USSD msg GSM0480_MTYPE_REGISTER
+DUSSD trans(NCSS IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ 
callref-0x2001 tid-8) Received SS/USSD msg GSM0480_MTYPE_REGISTER
 GSUP --> HLR: OSMO_GSUP_MSGT_PROC_SS_REQUEST: 
2001080971004026f0300420013101013515a11302010102013b300b04010f0406aa510c061b010a0103
 DREF 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
 - rx_from_ms: now used by 1 (nc_ss)
 <-- GSUP rx OSMO_GSUP_MSGT_PROC_SS_REQUEST: 

Change in osmo-msc[master]: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13941


Change subject: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM
..

LOG_TRANS: store subsys in trans, unify USSD logging back to DMM

Instead of calling trans_log_subsys() for each LOG_TRANS() log line, rather
store in trans->log_subsys once on trans_alloc() and use that.

Do not fall back to the RAN's own subsystem (DBSSAP / DIUCS), it makes little
sense and may cause logging to switch subsystems depending on the RAN state.

In trans_log_subsys(), add missing switch cases:

- Log silent call transactions also on CC.
- Log USSD on DMM.

About USSD: we currently have no dedicated USSD logging category. As a result,
after LOG_TRANS() was introduced [1], USSD logged on DBSSAP/DIUCS or DMSC,
depending on whether a RAN was associated with the trans or not. Before that
change, USSD always logged on DMM, so, until we have a separate logging
category for USSD, consistenly use DMM again.

[1] in I2e60964d7a3c06d051debd1c707051a0eb3101ba / 
ff7074a0c7b62025473d8f1a950905ac2cb2f31c

Related: coverity CID 198453
Change-Id: I6dfe5b98fb9e884c2dde61d603832dafceb12123
---
M include/osmocom/msc/transaction.h
M src/libmsc/transaction.c
M tests/msc_vlr/msc_vlr_test_ss.err
3 files changed, 18 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/41/13941/1

diff --git a/include/osmocom/msc/transaction.h 
b/include/osmocom/msc/transaction.h
index 99aca55..6b82390 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -27,7 +27,7 @@
 ##args)

 #define LOG_TRANS(trans, level, fmt, args...) \
-LOG_TRANS_CAT(trans, trans_log_subsys(trans), level, fmt, ##args)
+LOG_TRANS_CAT(trans, (trans)->log_subsys, level, fmt, ##args)

 enum bridge_state {
BRIDGE_STATE_NONE,
@@ -60,6 +60,8 @@

/* What kind of transaction */
enum trans_type type;
+   /* Which category to log on, for LOG_TRANS(). */
+   int log_subsys;

/* The current transaction ID */
uint8_t transaction_id;
@@ -161,13 +163,17 @@
return DMSC;
switch (trans->type) {
case TRANS_CC:
+   case TRANS_SILENT_CALL:
return DCC;
case TRANS_SMS:
return DLSMS;
+   case TRANS_USSD:
+   /* FIXME: traditionally (before LOG_TRANS() was added in 
I2e60964d7a3c06d051debd1c707051a0eb3101ba /
+* ff7074a0c7b62025473d8f1a950905ac2cb2f31c), all USSD logging 
happened on DMM. Instead, it probably
+* deserves its own logging subsystem. */
+   return DMM;
default:
break;
}
-   if (trans->msc_a)
-   return trans->msc_a->c.ran->log_subsys;
return DMSC;
 }
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index b909cd8..d6f8c3b 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -146,6 +146,7 @@
.callref = callref,
.net = net,
};
+   trans->log_subsys = trans_log_subsys(trans);
vlr_subscr_get(vsub, trans_vsub_use(type));
llist_add_tail(&trans->entry, &net->trans_list);

diff --git a/tests/msc_vlr/msc_vlr_test_ss.err 
b/tests/msc_vlr/msc_vlr_test_ss.err
index 5592488..2030715 100644
--- a/tests/msc_vlr/msc_vlr_test_ss.err
+++ b/tests/msc_vlr/msc_vlr_test_ss.err
@@ -173,12 +173,12 @@
 DBSSAP 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 RAN decode: DTAP
 DRLL 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 Dispatching 04.08 message: NCSS GSM0480_MTYPE_REGISTER
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 + NCSS: now used by 3 
(attached,active-conn,NCSS)
-DMSC trans(NCSS IMSI-90170004620:MSISDN-46071 callref-0x2001 tid-8) 
New transaction
+DMM trans(NCSS IMSI-90170004620:MSISDN-46071 callref-0x2001 tid-8) New 
transaction
 DREF 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 + nc_ss: now used by 3 (cm_service_ss,rx_from_ms,nc_ss)
 DMSC 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 Received Event MSC_A_EV_TRANSACTION_ACCEPTED
 DMSC 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_AUTHENTICATED}:
 state_chg to MSC_A_ST_COMMUNICATING
 DREF 
msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
 - cm_service_ss: now used by 2 (rx_from_ms,nc_ss)
-DBSSAP trans(NCSS IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ 
callref-0x2001 tid-8) Received SS/USSD msg GSM0480_MTYPE_REGISTER
+DMM trans(NCSS IMSI-90170004620:MSISDN-46071:GERAN-A:CM_SERVICE_REQ 
callref-0x2001 tid-8) Received SS/USSD msg GSM0480_MTYPE_REGISTER
 GSUP --> HLR: OSM

Change in osmo-msc[master]: no HO call forwarding if no RTP stream

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13940 )

Change subject: no HO call forwarding if no RTP stream
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13940/1/src/libmsc/msc_ho.c
File src/libmsc/msc_ho.c:

https://gerrit.osmocom.org/#/c/13940/1/src/libmsc/msc_ho.c@546
PS1, Line 546: rtp_to_ran = cl ? cl->rtp[RTP_TO_RAN] : NULL;
Assigning NULL to 'rtp_to_ran' doesn't make sense anymore.
Maybe, we should rather check cl == NULL?



--
To view, visit https://gerrit.osmocom.org/13940
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia223c2e20e625879ab71fc5c8afd0305fd224c58
Gerrit-Change-Number: 13940
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 12:38:22 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-msc[master]: make msc_a_vsub() and others NULL-safe

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13939 )

Change subject: make msc_a_vsub() and others NULL-safe
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13939
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Icd146ae512236a09cad080ed3eb85944e8f5cee4
Gerrit-Change-Number: 13939
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 12:35:20 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: ran_a_make_handover_request(): allow no encryption

2019-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13938 )

Change subject: ran_a_make_handover_request(): allow no encryption
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13938
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb83ab2a8b6148b457224687ffada2dff4c3204f
Gerrit-Change-Number: 13938
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 09 May 2019 12:34:42 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: no HO call forwarding if no RTP stream

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13940


Change subject: no HO call forwarding if no RTP stream
..

no HO call forwarding if no RTP stream

Fixes: coverity CID 198447
Related: OS#3992 (does not fix, just related)
Change-Id: Ia223c2e20e625879ab71fc5c8afd0305fd224c58
---
M src/libmsc/msc_ho.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/40/13940/1

diff --git a/src/libmsc/msc_ho.c b/src/libmsc/msc_ho.c
index 9d130c5..3a4258c 100644
--- a/src/libmsc/msc_ho.c
+++ b/src/libmsc/msc_ho.c
@@ -552,6 +552,11 @@
return -EINVAL;
}

+   if (!rtp_to_ran) {
+   msc_ho_failed(msc_a, GSM0808_CAUSE_EQUIPMENT_FAILURE, 
"Unexpected: no RTP stream is set up\n");
+   return -EINVAL;
+   }
+
/* Backup old cell's RTP IP:port and codec data */
msc_a->ho.old_cell.ran_remote_rtp = rtp_to_ran->remote;
msc_a->ho.old_cell.codec = rtp_to_ran->codec;

--
To view, visit https://gerrit.osmocom.org/13940
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia223c2e20e625879ab71fc5c8afd0305fd224c58
Gerrit-Change-Number: 13940
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-msc[master]: make msc_a_vsub() and others NULL-safe

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13939


Change subject: make msc_a_vsub() and others NULL-safe
..

make msc_a_vsub() and others NULL-safe

Fixes: coverity CID 198451
Change-Id: Icd146ae512236a09cad080ed3eb85944e8f5cee4
---
M src/libmsc/msc_a.c
M src/libmsc/msc_i.c
M src/libmsc/msc_t.c
3 files changed, 10 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/39/13939/1

diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index 675f932..5baed54 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -73,16 +73,22 @@

 struct vlr_subscr *msc_a_vsub(const struct msc_a *msc_a)
 {
+   if (!msc_a)
+   return NULL;
return msub_vsub(msc_a->c.msub);
 }

 struct msc_i *msc_a_msc_i(const struct msc_a *msc_a)
 {
+   if (!msc_a)
+   return NULL;
return msub_msc_i(msc_a->c.msub);
 }

 struct msc_t *msc_a_msc_t(const struct msc_a *msc_a)
 {
+   if (!msc_a)
+   return NULL;
return msub_msc_t(msc_a->c.msub);
 }

diff --git a/src/libmsc/msc_i.c b/src/libmsc/msc_i.c
index 6badba6..05df9cb 100644
--- a/src/libmsc/msc_i.c
+++ b/src/libmsc/msc_i.c
@@ -332,6 +332,8 @@

 struct vlr_subscr *msc_i_vsub(const struct msc_i *msc_i)
 {
+   if (!msc_i)
+   return NULL;
return msub_vsub(msc_i->c.msub);
 }

diff --git a/src/libmsc/msc_t.c b/src/libmsc/msc_t.c
index ec5531f..c6bba47 100644
--- a/src/libmsc/msc_t.c
+++ b/src/libmsc/msc_t.c
@@ -902,6 +902,8 @@

 struct vlr_subscr *msc_t_vsub(const struct msc_t *msc_t)
 {
+   if (!msc_t)
+   return NULL;
return msub_vsub(msc_t->c.msub);
 }


--
To view, visit https://gerrit.osmocom.org/13939
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd146ae512236a09cad080ed3eb85944e8f5cee4
Gerrit-Change-Number: 13939
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-msc[master]: ran_a_make_handover_request(): allow no encryption

2019-05-09 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13938


Change subject: ran_a_make_handover_request(): allow no encryption
..

ran_a_make_handover_request(): allow no encryption

Fixes: coverity CID 198454
Change-Id: Ifb83ab2a8b6148b457224687ffada2dff4c3204f
---
M src/libmsc/ran_msg_a.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/38/13938/1

diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c
index 2e498a2..ba0990d 100644
--- a/src/libmsc/ran_msg_a.c
+++ b/src/libmsc/ran_msg_a.c
@@ -1068,7 +1068,8 @@

.speech_version_used = n->speech_version_used,

-   .chosen_encryption_algorithm_serving = 
n->geran.chosen_encryption->alg_id,
+   .chosen_encryption_algorithm_serving =
+   n->geran.chosen_encryption ? 
n->geran.chosen_encryption->alg_id : 0,

.old_bss_to_new_bss_info_raw = n->old_bss_to_new_bss_info_raw,
.old_bss_to_new_bss_info_raw_len = 
n->old_bss_to_new_bss_info_raw_len,

--
To view, visit https://gerrit.osmocom.org/13938
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb83ab2a8b6148b457224687ffada2dff4c3204f
Gerrit-Change-Number: 13938
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-msc[master]: comment: apply function renames to message cycle explanation

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13934 )

Change subject: comment: apply function renames to message cycle explanation
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13934
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I742fb4844ac8a9ad76f59883ae9447eb8819b82d
Gerrit-Change-Number: 13934
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 11:45:57 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: msc: Don't require protocolExtensions in RANAP Paging

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13935 )

Change subject: msc: Don't require protocolExtensions in RANAP Paging
..

msc: Don't require protocolExtensions in RANAP Paging

We were using '?' for the protocolExtensions in RANAP messages,
which required that such extensions existed.  In reality, we want
to use '*' which accepts paging messages whether or not there
are any protocolExtensions present.  As this is the default in
all our RANAP receive template, callers don't even need to specify
it.

This should fix all Iu paging related test failures in MSC_Tests*.ttcn

Change-Id: If22e16ecb301c86b9073ffde0af9e03bc85fbcc7
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 1cec69c..9fc0616 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -766,7 +766,7 @@
if (g_pars.ran_is_geran) {
BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
} else {
-   BSSAP.receive(tr_RANAP_Paging(cs_domain, 
imsi_hex2oct(g_pars.imsi), ?));
+   BSSAP.receive(tr_RANAP_Paging(cs_domain, 
imsi_hex2oct(g_pars.imsi)));
}
 }

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 3a6711b..52aa685 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -2127,7 +2127,7 @@
setverdict(fail, "paging seems not to stop!");
mtc.stop;
}
-   [not pars.ran_is_geran] 
BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi), ?)) {
+   [not pars.ran_is_geran] 
BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi))) {
setverdict(fail, "paging seems not to stop!");
mtc.stop;
}
@@ -3070,7 +3070,7 @@
[pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)) {
setverdict(pass);
}
-   [not pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, 
imsi_hex2oct(g_pars.imsi), ?)) {
+   [not pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, 
imsi_hex2oct(g_pars.imsi))) {
setverdict(pass);
}
/* We don't expect anything else */
@@ -3677,7 +3677,7 @@
[g_pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)); {
setverdict(pass);
}
-   [not g_pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, 
imsi_hex2oct(g_pars.imsi), ?)) {
+   [not g_pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, 
imsi_hex2oct(g_pars.imsi))) {
setverdict(pass);
}
[] SGsAP.receive {

--
To view, visit https://gerrit.osmocom.org/13935
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If22e16ecb301c86b9073ffde0af9e03bc85fbcc7
Gerrit-Change-Number: 13935
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: msc: Permit optional authentication before reject/timeout

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13936 )

Change subject: msc: Permit optional authentication before reject/timeout
..

msc: Permit optional authentication before reject/timeout

Tests like TC_lu_imsi_reject, TC_lu_imsi_timeout_gsup and
TC_cmserv_imsi_unknown all expected a reject straight in response
to the LU REQ / CM SERV REQ.  However, the MSC may very well decide
to perform authentication beforehand.  It's an implementation
detail when a MSC/VLR performs authentication, so the tests should
be tolerant to this.

This primarily shows up in 3G/Iu/RANAP related tests, as authentication
is mandatory there.

Change-Id: Icdd3f34eca08092703ab2ba9a8e755e2d609a59b
---
M msc/MSC_Tests.ttcn
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 52aa685..e1e5088 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -583,6 +583,7 @@

f_create_gsup_expect(hex2str(g_pars.imsi));
f_cl3_or_initial_ue(l3_lu);
+   f_mm_auth();
GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));
GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 23));
alt {
@@ -612,6 +613,7 @@

f_create_gsup_expect(hex2str(g_pars.imsi));
f_cl3_or_initial_ue(l3_lu);
+   f_mm_auth();
GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));
/* Normally the HLR would need to respond here, but we decide to force 
a timeout here */
alt {
@@ -678,6 +680,7 @@

/* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */
f_cl3_or_initial_ue(l3_info);
+   f_mm_auth();

timer T := 10.0;
T.start;

--
To view, visit https://gerrit.osmocom.org/13936
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icdd3f34eca08092703ab2ba9a8e755e2d609a59b
Gerrit-Change-Number: 13936
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-msc[master]: comment: apply function renames to message cycle explanation

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13934 )

Change subject: comment: apply function renames to message cycle explanation
..

comment: apply function renames to message cycle explanation

The misnomed 'nas_decode' and 'nas_encode' APIs have been renamed to
'ran_decode' and 'ran_encode', which was forgotten in the large comment
explaining the message path in sccp_ran.h. Apply the rename there.

Change-Id: I742fb4844ac8a9ad76f59883ae9447eb8819b82d
---
M include/osmocom/msc/sccp_ran.h
1 file changed, 12 insertions(+), 12 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/msc/sccp_ran.h b/include/osmocom/msc/sccp_ran.h
index b7da314..f190d91 100644
--- a/include/osmocom/msc/sccp_ran.h
+++ b/include/osmocom/msc/sccp_ran.h
@@ -13,17 +13,17 @@
  *  msc_a_up_l3()
msc_a_tx_dtap_to_i(dtap_msgb)
  *   ^|
  *   |v
- *  msc_a_nas_decode_cb(struct nas_dec_msg)  
msc_a_nas_enc(struct nas_enc_msg)
+ *  msc_a_ran_decode_cb(struct ran_dec_msg)  
msc_a_ran_enc(struct ran_enc_msg)
  *   ^^.  |
  *   |  -Decode NAS-  |   .  NAS  v
- *   ||  .   
ran_infra[type]->nas_encode(struct nas_enc_msg)
- *  nas_a_decode_l2()nas_iu_decode_l2() . |
  |
+ *   ||  .   
ran_infra[type]->ran_encode(struct ran_enc_msg)
+ *  ran_a_decode_l2()ran_iu_decode_l2() . |
  |
  *   ^^.  v
  v
- *   ||   .  
nas_a_encode()nas_iu_encode()
- *  ran_infra[type]->nas_dec_l2() |
  |
+ *   ||   .  
ran_a_encode()ran_iu_encode()
+ *  ran_infra[type]->ran_dec_l2() |
  |
  *   ^| -Encode 
BSSAP/RANAP- |
  *   |v
  v
- *  msc_a_nas_dec()   
msub_tx_an_apdu(from MSC_ROLE_A to MSC_ROLE_I)
+ *  msc_a_ran_dec()   
msub_tx_an_apdu(from MSC_ROLE_A to MSC_ROLE_I)
  *   ^|
  *   | MSC-A  v
  *. msc_a FSM .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . msc_a FSM .  
.  .  .  .  .  .  .  .  .
@@ -78,12 +78,12 @@
  *
  * MSC-A:
  * - Receives MSC_A_EV_FROM_I_COMPLETE_LAYER_3 AN-APDU, notices an_proto 
indicating BSSAP or RANAP.
- * - Passes L2 message to ran_infra[]->nas_dec_l2(), which decodes the BSSAP 
or RANAP.
- * - contained information is passed to msc_a_nas_decode_cb().
+ * - Passes L2 message to ran_infra[]->ran_dec_l2(), which decodes the BSSAP 
or RANAP.
+ * - contained information is passed to msc_a_ran_decode_cb().
  * - which msc_a starts Complete-L3 and VLR procedures,
  * - associates msub with a vlr_subscr,
  * - sends DTAP requests back down by calling msc_a_tx_dtap_to_i() (possibly 
other more specialized tx functions)
- * - according to ran_infra[]->nas_encode(), the nas_enc_msg gets encoded as 
BSSAP or RANAP.
+ * - according to ran_infra[]->ran_encode(), the ran_enc_msg gets encoded as 
BSSAP or RANAP.
  * - passes as AN-APDU to MSC-I in 
MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST signal.
  *
  * MSC-I, receiving AN-APDU from local MSC-A:
@@ -147,10 +147,10 @@
  *
  *   MSC-A role:
  *   - Receives MSC_A_EV_FROM_I_PROCESS_ACCESS_SIGNALLING_REQUEST, notices 
an_proto indicating BSSAP or RANAP.
- *   - Passes L2 message to ran_infra[]->nas_dec_l2(), which decodes the BSSAP 
or RANAP.
- *   - contained information is passed to msc_a_nas_decode_cb().
+ *   - Passes L2 message to ran_infra[]->ran_dec_l2(), which decodes the BSSAP 
or RANAP.
+ *   - contained information is passed to msc_a_ran_decode_cb().
  *   - sends DTAP requests back down by calling msc_a_tx_dtap_to_i() (possibly 
other more specialized tx functions)
- *   - according to ran_infra[]->nas_encode(), the nas_enc_msg gets encoded as 
BSSAP or RANAP.
+ *   - according to ran_infra[]->ran_encode(), the ran_enc_msg gets encoded as 
BSSAP or RANAP.
  *   - passes as AN-APDU to MSC-I in 
MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST signal.
  *
  *   MSC-I-Remote:

--
To view, visit https:/

Change in osmo-ttcn3-hacks[master]: msc: Don't require protocolExtensions in RANAP Paging

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13935 )

Change subject: msc: Don't require protocolExtensions in RANAP Paging
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13935
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If22e16ecb301c86b9073ffde0af9e03bc85fbcc7
Gerrit-Change-Number: 13935
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 11:45:19 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: msc: Permit optional authentication before reject/timeout

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13936 )

Change subject: msc: Permit optional authentication before reject/timeout
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13936
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Icdd3f34eca08092703ab2ba9a8e755e2d609a59b
Gerrit-Change-Number: 13936
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 09 May 2019 11:45:27 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: msc: Permit optional authentication before reject/timeout

2019-05-09 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13936


Change subject: msc: Permit optional authentication before reject/timeout
..

msc: Permit optional authentication before reject/timeout

Tests like TC_lu_imsi_reject, TC_lu_imsi_timeout_gsup and
TC_cmserv_imsi_unknown all expected a reject straight in response
to the LU REQ / CM SERV REQ.  However, the MSC may very well decide
to perform authentication beforehand.  It's an implementation
detail when a MSC/VLR performs authentication, so the tests should
be tolerant to this.

This primarily shows up in 3G/Iu/RANAP related tests, as authentication
is mandatory there.

Change-Id: Icdd3f34eca08092703ab2ba9a8e755e2d609a59b
---
M msc/MSC_Tests.ttcn
1 file changed, 3 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/36/13936/1

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 52aa685..e1e5088 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -583,6 +583,7 @@

f_create_gsup_expect(hex2str(g_pars.imsi));
f_cl3_or_initial_ue(l3_lu);
+   f_mm_auth();
GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));
GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 23));
alt {
@@ -612,6 +613,7 @@

f_create_gsup_expect(hex2str(g_pars.imsi));
f_cl3_or_initial_ue(l3_lu);
+   f_mm_auth();
GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));
/* Normally the HLR would need to respond here, but we decide to force 
a timeout here */
alt {
@@ -678,6 +680,7 @@

/* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */
f_cl3_or_initial_ue(l3_info);
+   f_mm_auth();

timer T := 10.0;
T.start;

--
To view, visit https://gerrit.osmocom.org/13936
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdd3f34eca08092703ab2ba9a8e755e2d609a59b
Gerrit-Change-Number: 13936
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 


Change in osmo-ttcn3-hacks[master]: msc: Separate as_GSUP_SAI from f_mm_auth

2019-05-09 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13937


Change subject: msc: Separate as_GSUP_SAI from f_mm_auth
..

msc: Separate as_GSUP_SAI from f_mm_auth

In some cases we might want to match on (and perform) the GSUP
SEND AUTH INFO without also expecting/performing a MM authentication
on the Iu/A interface.  Hence it makes sense to split those two.

Change-Id: I7b298d589930bab976b478ac84553a6352f25c93
---
M msc/BSC_ConnectionHandler.ttcn
1 file changed, 24 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/37/13937/1

diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 9fc0616..93a311e 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -379,34 +379,39 @@
return l3_info;
 }

+altstep as_GSUP_SAI() runs on BSC_ConnHdlr {
+var GSUP_IE auth_tuple;
+[] GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)) {
+   if (g_pars.use_umts_aka) {
+   g_pars.vec := f_gen_auth_vec_3g();
+   auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand,
+   g_pars.vec.sres,
+   g_pars.vec.kc,
+   g_pars.vec.ik,
+   g_pars.vec.ck,
+   g_pars.vec.autn,
+   
g_pars.vec.res));
+   GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
+   } else {
+   g_pars.vec := f_gen_auth_vec_2g();
+   auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(g_pars.vec.rand,
+   g_pars.vec.sres,
+   g_pars.vec.kc));
+   GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
+   }
+   }
+}
+
 function f_mm_auth() runs on BSC_ConnHdlr
 {
if (g_pars.net.expect_auth) {
-   var GSUP_IE auth_tuple;
-   GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi));
-
+   as_GSUP_SAI();
if (g_pars.use_umts_aka) {
-   g_pars.vec := f_gen_auth_vec_3g();
-   auth_tuple := 
valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand,
-   
g_pars.vec.sres,
-   
g_pars.vec.kc,
-   
g_pars.vec.ik,
-   
g_pars.vec.ck,
-   
g_pars.vec.autn,
-   
g_pars.vec.res));
-   GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
-

BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ_3G(g_pars.vec.rand, 
g_pars.vec.autn)));
var OCT4 res := substr(g_pars.vec.res, 0, 4);
var OCT4 xres := substr(g_pars.vec.res, 4, 4);

BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_3G(res, xres)));
} else {
-   g_pars.vec := f_gen_auth_vec_2g();
-   auth_tuple := 
valueof(ts_GSUP_IE_AuthTuple2G(g_pars.vec.rand,
-   
g_pars.vec.sres,
-   
g_pars.vec.kc));
-   GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
-

BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(g_pars.vec.rand)));

BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G(g_pars.vec.sres)));
}

--
To view, visit https://gerrit.osmocom.org/13937
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b298d589930bab976b478ac84553a6352f25c93
Gerrit-Change-Number: 13937
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 


  1   2   >