[MERGED] libosmo-netif[master]: osmux: Use correct log category DLMUX

2018-03-07 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmux: Use correct log category DLMUX
..


osmux: Use correct log category DLMUX

Change-Id: I77f4593941207689f714d15304dcce40b21d4bd8
---
M src/osmux.c
1 file changed, 27 insertions(+), 27 deletions(-)

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



diff --git a/src/osmux.c b/src/osmux.c
index 88674a7..a0563d2 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -89,12 +89,12 @@
   osmuxh->ctr + 1));
goto next;
default:
-   LOGP(DLMIB, LOGL_ERROR, "Discarding unsupported Osmux 
FT %d\n",
+   LOGP(DLMUX, LOGL_ERROR, "Discarding unsupported Osmux 
FT %d\n",
 osmuxh->ft);
return NULL;
}
if (!osmo_amr_ft_valid(osmuxh->amr_ft)) {
-   LOGP(DLMIB, LOGL_ERROR, "Discarding bad AMR FT %d\n",
+   LOGP(DLMUX, LOGL_ERROR, "Discarding bad AMR FT %d\n",
 osmuxh->amr_ft);
return NULL;
}
@@ -103,14 +103,14 @@
sizeof(struct osmux_hdr);
 
if (len > msg->len) {
-   LOGP(DLMIB, LOGL_ERROR, "Discarding malformed "
+   LOGP(DLMUX, LOGL_ERROR, "Discarding malformed "
"OSMUX message\n");
return NULL;
}
 
msgb_pull(msg, len);
} else if (msg->len > 0) {
-   LOGP(DLMIB, LOGL_ERROR,
+   LOGP(DLMUX, LOGL_ERROR,
"remaining %d bytes, broken osmuxhdr?\n", msg->len);
}
 
@@ -195,7 +195,7 @@
 
osmo_rtp_snprintf(buf, sizeof(buf), msg);
buf[sizeof(buf)-1] = '\0';
-   LOGP(DLMIB, LOGL_DEBUG, "to BTS: %s\n", buf);
+   LOGP(DLMUX, LOGL_DEBUG, "to BTS: %s\n", buf);
}
 #endif
llist_add_tail(>list, list);
@@ -234,7 +234,7 @@
if (rtph == NULL)
return -1;
 
-   LOGP(DLMIB, LOGL_ERROR, "too many messages for this RTP "
+   LOGP(DLMUX, LOGL_ERROR, "too many messages for this RTP "
"ssrc=%u\n", rtph->ssrc);
return -1;
}
@@ -292,7 +292,7 @@
batch->osmuxh = osmuxh;
} else {
if (batch->osmuxh->ctr == 0x7) {
-   LOGP(DLMIB, LOGL_ERROR, "cannot add msg=%p, "
+   LOGP(DLMUX, LOGL_ERROR, "cannot add msg=%p, "
 "too many messages for this RTP ssrc=%u\n",
 state->msg, state->rtph->ssrc);
return 0;
@@ -354,12 +354,12 @@
struct osmux_circuit *circuit;
 
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "Now building batch\n");
+   LOGP(DLMUX, LOGL_DEBUG, "Now building batch\n");
 #endif
 
batch_msg = msgb_alloc(batch_size, "osmux");
if (batch_msg == NULL) {
-   LOGP(DLMIB, LOGL_ERROR, "Not enough memory\n");
+   LOGP(DLMUX, LOGL_ERROR, "Not enough memory\n");
return NULL;
}
 
@@ -387,7 +387,7 @@
 
osmo_rtp_snprintf(buf, sizeof(buf), cur);
buf[sizeof(buf)-1] = '\0';
-   LOGP(DLMIB, LOGL_DEBUG, "to BSC-NAT: %s\n", buf);
+   LOGP(DLMUX, LOGL_DEBUG, "to BSC-NAT: %s\n", buf);
 #endif
 
state.rtph = osmo_rtp_get_hdr(cur);
@@ -396,7 +396,7 @@
 
if (ctr == 0) {
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "add osmux header\n");
+   LOGP(DLMUX, LOGL_DEBUG, "add osmux header\n");
 #endif
state.add_osmux_hdr = 1;
}
@@ -417,7 +417,7 @@
struct osmux_batch *batch = (struct osmux_batch *)h->internal_data;
 
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "invoking delivery function\n");
+   LOGP(DLMUX, LOGL_DEBUG, "invoking delivery function\n");
 #endif
batch_msg = osmux_build_batch(batch, h->batch_size, h->batch_factor);
if (!batch_msg)
@@ -440,7 +440,7 @@
struct osmux_in_handle *h = data;
 
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "osmux_batch_timer_expired\n");
+   LOGP(DLMUX, LOGL_DEBUG, "osmux_batch_timer_expired\n");
 #endif
osmux_xfrm_input_deliver(h);
 }
@@ -462,7 +462,7 @@
 
/* The AMR payload does not fit with what we expect */
if (osmo_amr_bytes(amrh->ft) != amr_payload_len) {
-   LOGP(DLMIB, LOGL_ERROR,
+   

libosmo-netif[master]: osmux: Use correct log category DLMUX

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I77f4593941207689f714d15304dcce40b21d4bd8
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-bsc[master]: cosmetic: hodec2: log nr of neighbors in meas report

2018-03-07 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: cosmetic: hodec2: log nr of neighbors in meas report
..


cosmetic: hodec2: log nr of neighbors in meas report

Rationale: explicitly indicate the case of zero neighbors.

Change-Id: I09ddfd5b09883ec0124fe485346d9ed26de454e8
---
M src/libbsc/handover_decision_2.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/libbsc/handover_decision_2.c b/src/libbsc/handover_decision_2.c
index 0135020..615bc0a 100644
--- a/src/libbsc/handover_decision_2.c
+++ b/src/libbsc/handover_decision_2.c
@@ -1127,7 +1127,8 @@
 
if (log_check_level(DHODEC, LOGL_DEBUG)) {
int i;
-   LOGPHOLCHAN(lchan, LOGL_DEBUG, "MEASUREMENT REPORT\n");
+   LOGPHOLCHAN(lchan, LOGL_DEBUG, "MEASUREMENT REPORT (%d 
neighbors)\n",
+   mr->num_cell);
for (i = 0; i < mr->num_cell; i++) {
struct gsm_meas_rep_cell *mrc = >cell[i];
LOGPHOLCHAN(lchan, LOGL_DEBUG,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I09ddfd5b09883ec0124fe485346d9ed26de454e8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bsc[master]: gsm48_parse_meas_rep(): set num_cell=0 if no neighbor cells ...

2018-03-07 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: gsm48_parse_meas_rep(): set num_cell=0 if no neighbor cells are 
reported
..


gsm48_parse_meas_rep(): set num_cell=0 if no neighbor cells are reported

Set mr->num_cell to 0 if the bits reflect 0x7, which means that no neighbor
cell measurements are enclosed in the report.

The code in gsm48_parse_meas_rep() acknowledges that, but nevertheless left
num_cell == 7, and evaluating code commonly runs into the mistake of assuming
that actually seven neighbors are being reported on, like:

 MEASUREMENT REPORT
   0: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   1: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   2: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   3: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   4: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   5: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   6: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0

There are only up to 6 slots for neighbors, the above listing actually printed
7, because num_cell == 7, which is a potential segfault.  (sometimes it printed
uninitialized values instead of 0)

We could fix all meas rep consumers to know what num_cell == 7 means, but
instead setting it to 0 trivially fixes all of them.

Change-Id: Ie12210660a04f2d664ddc92e7ad7fc39ee474180
---
M src/libbsc/gsm_04_08_utils.c
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/src/libbsc/gsm_04_08_utils.c b/src/libbsc/gsm_04_08_utils.c
index 3004e5d..b75b42f 100644
--- a/src/libbsc/gsm_04_08_utils.c
+++ b/src/libbsc/gsm_04_08_utils.c
@@ -551,8 +551,11 @@
rep->dl.sub.rx_qual = (data[2] >> 1) & 0x7;
 
rep->num_cell = ((data[3] >> 6) & 0x3) | ((data[2] & 0x01) << 2);
-   if (rep->num_cell < 1 || rep->num_cell > 6)
+   if (rep->num_cell < 1 || rep->num_cell > 6) {
+   /* There are no neighbor cell reports present. */
+   rep->num_cell = 0;
return 0;
+   }
 
/* an encoding nightmare in perfection */
mrc = >cell[0];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie12210660a04f2d664ddc92e7ad7fc39ee474180
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bsc[master]: cosmetic: typo in log: handover_decision2.c: 'measuements'

2018-03-07 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: cosmetic: typo in log: handover_decision2.c: 'measuements'
..


cosmetic: typo in log: handover_decision2.c: 'measuements'

Change-Id: I8a92a03feb7dbef2bb008016310ec243226a7c7a
---
M src/libbsc/handover_decision_2.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/libbsc/handover_decision_2.c b/src/libbsc/handover_decision_2.c
index 615bc0a..467a19d 100644
--- a/src/libbsc/handover_decision_2.c
+++ b/src/libbsc/handover_decision_2.c
@@ -1167,7 +1167,7 @@
 MEAS_REP_DL_RXQUAL_FULL : 
MEAS_REP_DL_RXQUAL_SUB,
 ho_get_hodec2_rxqual_avg_win(bts->ho));
if (av_rxlev < 0 && av_rxqual < 0) {
-   LOGPHOLCHAN(lchan, LOGL_INFO, "Skipping, Not enough recent 
measuements\n");
+   LOGPHOLCHAN(lchan, LOGL_INFO, "Skipping, Not enough recent 
measurements\n");
return;
}
if (av_rxlev >= 0) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a92a03feb7dbef2bb008016310ec243226a7c7a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bsc[master]: cosmetic: hodec2: log nr of neighbors in meas report

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I09ddfd5b09883ec0124fe485346d9ed26de454e8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bsc[master]: gsm48_parse_meas_rep(): set num_cell=0 if no neighbor cells ...

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie12210660a04f2d664ddc92e7ad7fc39ee474180
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bsc[master]: cosmetic: typo in log: handover_decision2.c: 'measuements'

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8a92a03feb7dbef2bb008016310ec243226a7c7a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bsc[master]: handover_test: explicitly wrap abis_rsl_sendmsg()

2018-03-07 Thread Harald Welte

Patch Set 1:

I didn't argue against the patch, I just argued against the claim that this was 
new, unexpected or undefined ;)

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I05ce33a4e42bc82b9ce5060e2f811033f5a1f8d8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-bsc[master]: handover_test: explicitly wrap abis_rsl_sendmsg()

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I05ce33a4e42bc82b9ce5060e2f811033f5a1f8d8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-trx[master]: Build Transceiver52M/common as an .la lib

2018-03-07 Thread Vadim Yanitskiy

Patch Set 1:

(3 comments)

In general, looks good.

Regarding to the $(top_builddir), this could be done
in a separate change...

https://gerrit.osmocom.org/#/c/7148/1/Transceiver52M/arm/Makefile.am
File Transceiver52M/arm/Makefile.am:

Line 12: libarch_la_LIBADD = ../common/libarch_common.la
Why not to use $(top_builddir) here?


https://gerrit.osmocom.org/#/c/7148/1/Transceiver52M/common/Makefile.am
File Transceiver52M/common/Makefile.am:

Line 4: libarch_common_la_LIBADD =
Probably, this var will remain empty for long time.
Do we really need this?


https://gerrit.osmocom.org/#/c/7148/1/Transceiver52M/x86/Makefile.am
File Transceiver52M/x86/Makefile.am:

Line 7: libarch_la_LIBADD = ../common/libarch_common.la
Also $(top_builddir)?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I81bb4251d18fce978d27849b621b20f541caab0b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-trx[master]: Makefile.am: Avoid using subdir if arch is not required

2018-03-07 Thread Vadim Yanitskiy

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-bsc[master]: handover_test: explicitly wrap abis_rsl_sendmsg()

2018-03-07 Thread Neels Hofmeyr

Patch Set 1:

> It works as both the function caller and the function itself are in the same 
> .c/.o file.

In this case the function caller is somewhere deep in libbsc, and it is calling 
a function originally defined somewhere deep in libosmo-abis. We are putting 
another definition that function in the local file, in the hope that the libbsc 
caller is diverted to the local function instead of libosmo-abis. Feels lucky 
to me, in the sense that the symbol is only pulled from the libosmo-abis 
library if it doesn't exist in the current ... erm ... "scope". Does it still 
work if libosmo-abis and libbsc both appear before the main.o on the linking 
cmdline? I'm not familiar with that.

Even if that magic works and it's only me not knowing about it, I still think 
it adds clarity if we *explicitly* wrap it?

BTW, so, if I by accident pick an already existing function name in my main.c, 
I silently override the other definition in the linking? Scary :) -- though I 
think I saw the compiler complaining about multiple definitions of the same 
function on occasions.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I05ce33a4e42bc82b9ce5060e2f811033f5a1f8d8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


libasn1c[master]: configure: add --enable-werror

2018-03-07 Thread Neels Hofmeyr

Patch Set 1:

> Why do you need each of this?
 > -Wno-error=deprecated -Wno-error=deprecated-declarations
 > -Wno-error=cpp

it's all explained in the commit log as well as the ./configure --help

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibcc8238584a585434b39a046cd2d7e18ddaf7f8c
Gerrit-PatchSet: 1
Gerrit-Project: libasn1c
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-bsc[master]: cosmetic: typo in log: handover_decision2.c: 'measuements'

2018-03-07 Thread Neels Hofmeyr

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

cosmetic: typo in log: handover_decision2.c: 'measuements'

Change-Id: I8a92a03feb7dbef2bb008016310ec243226a7c7a
---
M src/libbsc/handover_decision_2.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/51/7151/1

diff --git a/src/libbsc/handover_decision_2.c b/src/libbsc/handover_decision_2.c
index 615bc0a..467a19d 100644
--- a/src/libbsc/handover_decision_2.c
+++ b/src/libbsc/handover_decision_2.c
@@ -1167,7 +1167,7 @@
 MEAS_REP_DL_RXQUAL_FULL : 
MEAS_REP_DL_RXQUAL_SUB,
 ho_get_hodec2_rxqual_avg_win(bts->ho));
if (av_rxlev < 0 && av_rxqual < 0) {
-   LOGPHOLCHAN(lchan, LOGL_INFO, "Skipping, Not enough recent 
measuements\n");
+   LOGPHOLCHAN(lchan, LOGL_INFO, "Skipping, Not enough recent 
measurements\n");
return;
}
if (av_rxlev >= 0) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a92a03feb7dbef2bb008016310ec243226a7c7a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: gsm48_parse_meas_rep(): set num_cell=0 if no neighbor cells ...

2018-03-07 Thread Neels Hofmeyr

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

gsm48_parse_meas_rep(): set num_cell=0 if no neighbor cells are reported

Set mr->num_cell to 0 if the bits reflect 0x7, which means that no neighbor
cell measurements are enclosed in the report.

The code in gsm48_parse_meas_rep() acknowledges that, but nevertheless left
num_cell == 7, and evaluating code commonly runs into the mistake of assuming
that actually seven neighbors are being reported on, like:

 MEASUREMENT REPORT
   0: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   1: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   2: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   3: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   4: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   5: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0
   6: arfcn=0 bsic=0 neigh_idx=0 rxlev=0 flags=0

There are only up to 6 slots for neighbors, the above listing actually printed
7, because num_cell == 7, which is a potential segfault.  (sometimes it printed
uninitialized values instead of 0)

We could fix all meas rep consumers to know what num_cell == 7 means, but
instead setting it to 0 trivially fixes all of them.

Change-Id: Ie12210660a04f2d664ddc92e7ad7fc39ee474180
---
M src/libbsc/gsm_04_08_utils.c
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/49/7149/1

diff --git a/src/libbsc/gsm_04_08_utils.c b/src/libbsc/gsm_04_08_utils.c
index 3004e5d..b75b42f 100644
--- a/src/libbsc/gsm_04_08_utils.c
+++ b/src/libbsc/gsm_04_08_utils.c
@@ -551,8 +551,11 @@
rep->dl.sub.rx_qual = (data[2] >> 1) & 0x7;
 
rep->num_cell = ((data[3] >> 6) & 0x3) | ((data[2] & 0x01) << 2);
-   if (rep->num_cell < 1 || rep->num_cell > 6)
+   if (rep->num_cell < 1 || rep->num_cell > 6) {
+   /* There are no neighbor cell reports present. */
+   rep->num_cell = 0;
return 0;
+   }
 
/* an encoding nightmare in perfection */
mrc = >cell[0];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie12210660a04f2d664ddc92e7ad7fc39ee474180
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: cosmetic: hodec2: log nr of neighbors in meas report

2018-03-07 Thread Neels Hofmeyr

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

cosmetic: hodec2: log nr of neighbors in meas report

Rationale: explicitly indicate the case of zero neighbors.

Change-Id: I09ddfd5b09883ec0124fe485346d9ed26de454e8
---
M src/libbsc/handover_decision_2.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/7150/1

diff --git a/src/libbsc/handover_decision_2.c b/src/libbsc/handover_decision_2.c
index 0135020..615bc0a 100644
--- a/src/libbsc/handover_decision_2.c
+++ b/src/libbsc/handover_decision_2.c
@@ -1127,7 +1127,8 @@
 
if (log_check_level(DHODEC, LOGL_DEBUG)) {
int i;
-   LOGPHOLCHAN(lchan, LOGL_DEBUG, "MEASUREMENT REPORT\n");
+   LOGPHOLCHAN(lchan, LOGL_DEBUG, "MEASUREMENT REPORT (%d 
neighbors)\n",
+   mr->num_cell);
for (i = 0; i < mr->num_cell; i++) {
struct gsm_meas_rep_cell *mrc = >cell[i];
LOGPHOLCHAN(lchan, LOGL_DEBUG,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09ddfd5b09883ec0124fe485346d9ed26de454e8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[MERGED] osmo-msc[master]: a_iface: fix BSSMAP reset handling

2018-03-07 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: a_iface: fix BSSMAP reset handling
..


a_iface: fix BSSMAP reset handling

When osmo-msc restarts it looses all information about the BSC. The
BSC will not be aware of the reboot and on the next communication
attemt it will notice that something is wrong and start the reset
procedure on his side. osmo-msc will receive the reset messages
and send a reset.

The reset is received. Osmo-msc detects that no context information
is created yet. The context is created. Then it is checked if the
UNITTDATA message that came in is a reset. If it is one. Nothing
happens. The UNITTDATA is passed on and triggers the RESET-ACK
some layers above. Unfortunately by the current code this also
means that no reset FSM is created and therefore a_reset_conn_ready()
can never be true. Which means it will also drop any legitimate
reset from the BSC in the future.

- Ensure that the reset FSM is always created when a new BSC
  context is created

- Make sure that reset related traffic always passes so that
  the higher layers can handle the procedure properly

Change-Id: I3fdcec5dbeaa0e21fd6a92568a623faa368239be
---
M src/libmsc/a_iface.c
1 file changed, 17 insertions(+), 15 deletions(-)

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



diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 86c2e04..79b1b4c 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -478,7 +478,7 @@
bsc_ctx->reset = a_reset_alloc(bsc_ctx, bsc_name, a_reset_cb, bsc_ctx, 
already_connected);
 }
 
-/* determine if given msg is a BSSMAP RESET (true) or not (false) */
+/* determine if given msg is BSSMAP RESET related (true) or not (false) */
 static bool bssmap_is_reset(struct msgb *msg)
 {
struct bssmap_header *bs = (struct bssmap_header *)msgb_l2(msg);
@@ -490,6 +490,9 @@
return false;
 
if (msg->l2h[sizeof(*bs)] == BSS_MAP_MSG_RESET)
+   return true;
+
+   if (msg->l2h[sizeof(*bs)] == BSS_MAP_MSG_RESET_ACKNOWLEDGE)
return true;
 
return false;
@@ -555,26 +558,25 @@
 
case OSMO_PRIM(OSMO_SCU_PRIM_N_UNITDATA, PRIM_OP_INDICATION):
/* Handle inbound UNITDATA */
+
+   /* Get BSC context, create a new one if necessary */
a_conn_info.bsc = 
get_bsc_context_by_sccp_addr(_prim->u.unitdata.calling_addr);
if (!a_conn_info.bsc) {
/* We haven't heard from this BSC before, allocate it */
a_conn_info.bsc = 
add_bsc(_prim->u.unitdata.called_addr,

_prim->u.unitdata.calling_addr, scu);
-   /* if this not an inbound RESET, trigger an outbound 
RESET */
-   if (!bssmap_is_reset(oph->msg)) {
-   LOGP(DBSSAP, LOGL_NOTICE, "Ignoring 
N-UNITDATA.ind(%s), BSC not reset yet\n",
-   msgb_hexdump_l2(oph->msg));
-   a_start_reset(a_conn_info.bsc, false);
-   break;
-   }
-   } else {
-   /* This BSC is already known to us, check if we have 
been through reset yet */
-   if (a_reset_conn_ready(a_conn_info.bsc->reset) == 
false) {
-   LOGP(DBSSAP, LOGL_NOTICE, "Ignoring 
N-UNITDATA.ind(%s), BSC not reset yet\n",
-   msgb_hexdump_l2(oph->msg));
-   break;
-   }
+   /* Make sure that reset procedure is started */
+   a_start_reset(a_conn_info.bsc, false);
}
+
+   /* As long as we are in the reset phase, only reset related 
BSSMAP messages may pass
+* beond here. */
+   if (!bssmap_is_reset(oph->msg) && 
a_reset_conn_ready(a_conn_info.bsc->reset) == false) {
+   LOGP(DBSSAP, LOGL_NOTICE, "Ignoring N-UNITDATA.ind(%s), 
BSC not reset yet\n",
+msgb_hexdump_l2(oph->msg));
+   break;
+   }
+
DEBUGP(DBSSAP, "N-UNITDATA.ind(%s)\n", 
msgb_hexdump_l2(oph->msg));
a_sccp_rx_udt(scu, _conn_info, oph->msg);
break;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3fdcec5dbeaa0e21fd6a92568a623faa368239be
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


osmo-ttcn3-hacks[master]: MSC_Tests: Add testcase TC_cr_before_reset

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1d7575e5bec9edabcc832c754d19dc5ba489861a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: MSC_Tests: Add testcase TC_cr_before_reset

2018-03-07 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: MSC_Tests: Add testcase TC_cr_before_reset
..


MSC_Tests: Add testcase TC_cr_before_reset

This testcase triggers a bug in the BSSMAP reset logic that tricks
the MSC into a deadlock situation. The bug can only be triggered on
a freshly started MSC, otherwise the testcase will not have any
effect at all. That's why it its important that this is the first
testcase to be executed. If the IUT (MSC) is still affected by the
bug. It will enter the deadlog situation and all subsequent testcases
should fail until the IUT (MSC) is restarted. The matching real-life
scenario would be that the MSC restarts. The BSC is not informed by
the restart, so it continues to make connections (which fail) until
it notices that the MSC was down and the execution of a BSSMAP reset
procedure is required.

See also Gerrit Change Id:
I3fdcec5dbeaa0e21fd6a92568a623faa368239be

Closes: OS#4120
Change-Id: I1d7575e5bec9edabcc832c754d19dc5ba489861a
---
M msc/MSC_Tests.ttcn
1 file changed, 66 insertions(+), 0 deletions(-)

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



diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 976cf0d..cecee69 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -63,6 +63,16 @@
port IPA_CTRL_PT GSUP_IPA_EVENT;
/* VTY to MSC */
port TELNETasp_PT MSCVTY;
+
+   /* A port to directly send BSSAP messages. This port is used for
+* tests that require low level access to sen arbitrary BSSAP
+* messages. Run f_init_bssap_direct() to connect and initialize */
+   port BSSAP_CODEC_PT BSSAP_DIRECT;
+
+   /* When BSSAP messages are directly sent, then the connection
+* handler is not active, which means that also no guard timer is
+* set up. The following timer will serve as a replacement */
+   timer Tguard_direct := 60.0;
 }
 
 modulepar {
@@ -89,6 +99,14 @@
};
 }
 
+/* altstep for the global guard timer (only used when BSSAP_DIRECT
+ * is used for communication */
+private altstep as_Tguard_direct() runs on MTC_CT {
+   [] Tguard_direct.timeout {
+   setverdict(fail, "Tguard timeout");
+   self.stop;
+   }
+}
 
 function f_init_mncc(charstring id) runs on MTC_CT {
id := id & "-MNCC";
@@ -170,6 +188,18 @@
f_vty_config(MSCVTY, "network", "authentication optional");
f_vty_config(MSCVTY, "msc", "assign-tmsi");
f_vty_config(MSCVTY, "network", "encryption a5 0");
+}
+
+/* Initialize for a direct connection to BSSAP. This function is an alternative
+ * to f_init() when the high level functions of the BSC_ConnectionHandler are
+ * not needed. */
+function f_init_bssap_direct() runs on MTC_CT {
+   f_bssap_init(g_bssap, mp_bssap_cfg, "MSC_Test", omit);
+   connect(g_bssap.vc_SCCP:SCCP_SP_PORT, self:BSSAP_DIRECT);
+
+   /* Start guard timer and activate it as default */
+   Tguard_direct.start
+   activate(as_Tguard_direct());
 }
 
 template PDU_BSSAP ts_BSSAP_BSSMAP := {
@@ -1599,6 +1629,41 @@
vc_conn.done;
 }
 
+testcase TC_cr_before_reset() runs on MTC_CT {
+   timer T := 4.0;
+   var boolean reset_ack_seen := false;
+   f_init_bssap_direct();
+
+   /* Make a blind connection attemt, to trigger the deadlock condition */
+   BSSAP_DIRECT.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, 1, omit));
+
+   /* Send a BSSMAP reset */
+   BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
+   T.start
+   alt {
+   [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, 
tr_BSSMAP_ResetAck)) {
+   reset_ack_seen := true;
+   repeat;
+   }
+
+   /* Acknowledge MSC sided reset requests */
+   [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) {
+   BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, ts_BSSMAP_ResetAck));
+   repeat;
+   }
+
+   /* Ignore all other messages (e.g CR from the connection request) */
+   [] BSSAP_DIRECT.receive { repeat }
+
+   /* If we got no BSSMAP RESET ACK back, then the MSC entered the
+* deadlock situation. The MSC is then unable to respond to any
+* further BSSMAP RESET or any other sort of traffic. */
+   [reset_ack_seen == true] T.timeout { setverdict(pass) }
+   [reset_ack_seen == false] T.timeout {
+   setverdict(fail, "no BSSMAP RESET ACK seen!");
+   }
+   }   
+}
 
 
 
@@ -1616,6 +1681,7 @@
 
 
 control {
+   execute( TC_cr_before_reset() );
execute( TC_lu_imsi_noauth_tmsi() );
execute( TC_lu_imsi_noauth_notmsi() );
execute( TC_lu_imsi_reject() );

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

osmo-msc[master]: a_iface: fix BSSMAP reset handling

2018-03-07 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3fdcec5dbeaa0e21fd6a92568a623faa368239be
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


osmo-trx[master]: Makefile.am: Avoid using subdir if arch is not required

2018-03-07 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-trx[master]: Build Transceiver52M/common as an .la lib

2018-03-07 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I81bb4251d18fce978d27849b621b20f541caab0b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-trx[master]: Makefile.am: Avoid using subdir if arch is not required

2018-03-07 Thread Pau Espin Pedrol

Makefile.am: Avoid using subdir if arch is not required

There's no need in going a level deeper if we already know nothing's
going to be done. This way we also get cleaner make outputs.

Reference: 
https://www.gnu.org/software/automake/manual/html_node/Conditional-Subdirectories.html#Conditional-Subdirectories

Related: OS#3029

Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
---
M Transceiver52M/Makefile.am
M Transceiver52M/arm/Makefile.am
M Transceiver52M/x86/Makefile.am
3 files changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/46/7146/3

diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 3c1b86c..187a335 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -24,7 +24,11 @@
 AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/common
 AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
 
-SUBDIRS = arm x86
+if ARCH_ARM
+SUBDIRS = arm
+else
+SUBDIRS = x86
+endif
 
 if USRP1
 AM_CPPFLAGS += $(USRP_CFLAGS)
diff --git a/Transceiver52M/arm/Makefile.am b/Transceiver52M/arm/Makefile.am
index 0b959be..6b0b992 100644
--- a/Transceiver52M/arm/Makefile.am
+++ b/Transceiver52M/arm/Makefile.am
@@ -1,4 +1,3 @@
-if ARCH_ARM
 if ARCH_ARM_A15
 ARCH_FLAGS = -mfpu=neon-vfpv4
 else
@@ -20,4 +19,3 @@
scale_neon.S \
mult.c \
mult_neon.S
-endif
diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am
index 45aa629..5d84f85 100644
--- a/Transceiver52M/x86/Makefile.am
+++ b/Transceiver52M/x86/Makefile.am
@@ -1,4 +1,3 @@
-if !ARCH_ARM
 AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common
 
 noinst_LTLIBRARIES = libarch.la
@@ -29,4 +28,3 @@
../common/convert_base.c \
convert.c \
convolve.c
-endif

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


[PATCH] osmo-trx[master]: Build Transceiver52M/common as an .la lib

2018-03-07 Thread Pau Espin Pedrol

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

Build Transceiver52M/common as an .la lib

Stop picking files from that directory on different places as it causes
dependency issues during make distclean/maintainer-clean.

Fixes: OS#3029

Change-Id: I81bb4251d18fce978d27849b621b20f541caab0b
---
M Transceiver52M/Makefile.am
M Transceiver52M/arm/Makefile.am
A Transceiver52M/common/Makefile.am
M Transceiver52M/x86/Makefile.am
M configure.ac
5 files changed, 25 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/48/7148/1

diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 187a335..9424b8e 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -24,10 +24,11 @@
 AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/common
 AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
 
+SUBDIRS = common
 if ARCH_ARM
-SUBDIRS = arm
+SUBDIRS += arm
 else
-SUBDIRS = x86
+SUBDIRS += x86
 endif
 
 if USRP1
@@ -58,8 +59,7 @@
Transceiver.cpp \
ChannelizerBase.cpp \
Channelizer.cpp \
-   Synthesis.cpp \
-   common/fft.c
+   Synthesis.cpp
 
 libtransceiver_la_SOURCES = \
$(COMMON_SOURCES) \
@@ -83,12 +83,7 @@
Resampler.h \
ChannelizerBase.h \
Channelizer.h \
-   Synthesis.h \
-   common/convolve.h \
-   common/convert.h \
-   common/scale.h \
-   common/mult.h \
-   common/fft.h
+   Synthesis.h
 
 osmo_trx_SOURCES = osmo-trx.cpp
 osmo_trx_LDADD = \
diff --git a/Transceiver52M/arm/Makefile.am b/Transceiver52M/arm/Makefile.am
index 6b0b992..11098c6 100644
--- a/Transceiver52M/arm/Makefile.am
+++ b/Transceiver52M/arm/Makefile.am
@@ -9,8 +9,9 @@
 
 noinst_LTLIBRARIES = libarch.la
 
+libarch_la_LIBADD = ../common/libarch_common.la
+
 libarch_la_SOURCES = \
-   ../common/convolve_base.c \
convert.c \
convert_neon.S \
convolve.c \
diff --git a/Transceiver52M/common/Makefile.am 
b/Transceiver52M/common/Makefile.am
new file mode 100644
index 000..e8b8f44
--- /dev/null
+++ b/Transceiver52M/common/Makefile.am
@@ -0,0 +1,16 @@
+AM_CFLAGS = -Wall -std=gnu99
+
+noinst_LTLIBRARIES = libarch_common.la
+libarch_common_la_LIBADD =
+
+noinst_HEADERS = \
+convolve.h \
+convert.h \
+scale.h \
+mult.h \
+fft.h
+
+libarch_common_la_SOURCES = \
+convolve_base.c \
+convert_base.c \
+fft.c
diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am
index 5d84f85..a87bd04 100644
--- a/Transceiver52M/x86/Makefile.am
+++ b/Transceiver52M/x86/Makefile.am
@@ -4,7 +4,7 @@
 noinst_LTLIBRARIES += libarch_sse_3.la
 noinst_LTLIBRARIES += libarch_sse_4_1.la
 
-libarch_la_LIBADD =
+libarch_la_LIBADD = ../common/libarch_common.la
 
 # SSE 3 specific code
 if HAVE_SSE3
@@ -24,7 +24,5 @@
 endif
 
 libarch_la_SOURCES = \
-   ../common/convolve_base.c \
-   ../common/convert_base.c \
convert.c \
convolve.c
diff --git a/configure.ac b/configure.ac
index 916cf18..bade799 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,7 @@
 CommonLibs/Makefile \
 GSM/Makefile \
 Transceiver52M/Makefile \
+Transceiver52M/common/Makefile \
 Transceiver52M/arm/Makefile \
 Transceiver52M/x86/Makefile \
 tests/Makefile \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81bb4251d18fce978d27849b621b20f541caab0b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-trx[master]: Makefile.am: Avoid using subdir if arch is not required

2018-03-07 Thread Pau Espin Pedrol

Patch Set 2: Code-Review-1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-msc[master]: a_iface: fix BSSMAP reset handling

2018-03-07 Thread dexter

Patch Set 3:

> Please make sure we have a test case for this in the BSC_Tests.ttcn
 > suite. Sounds like an easy enough condition to test for?

There is now a TTCN3 test that triggers the bug. See #7147

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3fdcec5dbeaa0e21fd6a92568a623faa368239be
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: MSC_Tests: Add testcase TC_cr_before_reset

2018-03-07 Thread dexter

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

MSC_Tests: Add testcase TC_cr_before_reset

This testcase triggers a bug in the BSSMAP reset logic that tricks
the MSC into a deadlock situation. The bug can only be triggered on
a freshly started MSC, otherwise the testcase will not have any
effect at all. That's why it its important that this is the first
testcase to be executed. If the IUT (MSC) is still affected by the
bug. It will enter the deadlog situation and all subsequent testcases
should fail until the IUT (MSC) is restarted. The matching real-life
scenario would be that the MSC restarts. The BSC is not informed by
the restart, so it continues to make connections (which fail) until
it notices that the MSC was down and the execution of a BSSMAP reset
procedure is required.

See also Gerrit Change Id:
I3fdcec5dbeaa0e21fd6a92568a623faa368239be

Closes: OS#4120
Change-Id: I1d7575e5bec9edabcc832c754d19dc5ba489861a
---
M msc/MSC_Tests.ttcn
1 file changed, 66 insertions(+), 0 deletions(-)


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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 976cf0d..cecee69 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -63,6 +63,16 @@
port IPA_CTRL_PT GSUP_IPA_EVENT;
/* VTY to MSC */
port TELNETasp_PT MSCVTY;
+
+   /* A port to directly send BSSAP messages. This port is used for
+* tests that require low level access to sen arbitrary BSSAP
+* messages. Run f_init_bssap_direct() to connect and initialize */
+   port BSSAP_CODEC_PT BSSAP_DIRECT;
+
+   /* When BSSAP messages are directly sent, then the connection
+* handler is not active, which means that also no guard timer is
+* set up. The following timer will serve as a replacement */
+   timer Tguard_direct := 60.0;
 }
 
 modulepar {
@@ -89,6 +99,14 @@
};
 }
 
+/* altstep for the global guard timer (only used when BSSAP_DIRECT
+ * is used for communication */
+private altstep as_Tguard_direct() runs on MTC_CT {
+   [] Tguard_direct.timeout {
+   setverdict(fail, "Tguard timeout");
+   self.stop;
+   }
+}
 
 function f_init_mncc(charstring id) runs on MTC_CT {
id := id & "-MNCC";
@@ -170,6 +188,18 @@
f_vty_config(MSCVTY, "network", "authentication optional");
f_vty_config(MSCVTY, "msc", "assign-tmsi");
f_vty_config(MSCVTY, "network", "encryption a5 0");
+}
+
+/* Initialize for a direct connection to BSSAP. This function is an alternative
+ * to f_init() when the high level functions of the BSC_ConnectionHandler are
+ * not needed. */
+function f_init_bssap_direct() runs on MTC_CT {
+   f_bssap_init(g_bssap, mp_bssap_cfg, "MSC_Test", omit);
+   connect(g_bssap.vc_SCCP:SCCP_SP_PORT, self:BSSAP_DIRECT);
+
+   /* Start guard timer and activate it as default */
+   Tguard_direct.start
+   activate(as_Tguard_direct());
 }
 
 template PDU_BSSAP ts_BSSAP_BSSMAP := {
@@ -1599,6 +1629,41 @@
vc_conn.done;
 }
 
+testcase TC_cr_before_reset() runs on MTC_CT {
+   timer T := 4.0;
+   var boolean reset_ack_seen := false;
+   f_init_bssap_direct();
+
+   /* Make a blind connection attemt, to trigger the deadlock condition */
+   BSSAP_DIRECT.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, 1, omit));
+
+   /* Send a BSSMAP reset */
+   BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
+   T.start
+   alt {
+   [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, 
tr_BSSMAP_ResetAck)) {
+   reset_ack_seen := true;
+   repeat;
+   }
+
+   /* Acknowledge MSC sided reset requests */
+   [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) {
+   BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, ts_BSSMAP_ResetAck));
+   repeat;
+   }
+
+   /* Ignore all other messages (e.g CR from the connection request) */
+   [] BSSAP_DIRECT.receive { repeat }
+
+   /* If we got no BSSMAP RESET ACK back, then the MSC entered the
+* deadlock situation. The MSC is then unable to respond to any
+* further BSSMAP RESET or any other sort of traffic. */
+   [reset_ack_seen == true] T.timeout { setverdict(pass) }
+   [reset_ack_seen == false] T.timeout {
+   setverdict(fail, "no BSSMAP RESET ACK seen!");
+   }
+   }   
+}
 
 
 
@@ -1616,6 +1681,7 @@
 
 
 control {
+   execute( TC_cr_before_reset() );
execute( TC_lu_imsi_noauth_tmsi() );
execute( TC_lu_imsi_noauth_notmsi() );
execute( TC_lu_imsi_reject() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d7575e5bec9edabcc832c754d19dc5ba489861a

[PATCH] osmo-gsm-tester[master]: ms: Create a cumulative distribution function class

2018-03-07 Thread Holger Freyther
Hello Pau Espin Pedrol, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6230

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

ms: Create a cumulative distribution function class

We are using the CDF to decide which percentage of the jobs should
be running at a given point. The x-axis is time and the y-axis the
percentage of how many jobs should be running.

There are three functions to do this. The first one is a constant
which would result in everything being started right now, one to
start them linearly and the last (formula from Qt/3rdparty) to first
accelerate and decelerate slowly.

Change-Id: I9e3064f4c3c4c7af5d3491f850090516e541f4d3
---
A selftest/cdf_test.ok
A selftest/cdf_test.py
A src/osmo_ms_driver/__init__.py
A src/osmo_ms_driver/cdf.py
4 files changed, 265 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/30/6230/6

diff --git a/selftest/cdf_test.ok b/selftest/cdf_test.ok
new file mode 100644
index 000..aa753e4
--- /dev/null
+++ b/selftest/cdf_test.ok
@@ -0,0 +1,57 @@
+Testing the immediate CDF
+Done True
+1 1.0 False
+Testing linear with duration
+Done False
+0.0 0.0 True
+Done False
+0.2 0.2 True
+Done False
+0.4 0.4 True
+Done False
+0.6 0.6 True
+Done False
+0.8 0.8 True
+Done True
+1.0 1.0 True
+Testing linear with duration scaled
+Done False
+0.0 0.0 True
+0.0 0.0 True
+Done False
+0.2 0.2 True
+200 200 True
+Done False
+0.4 0.4 True
+400 400 True
+Done False
+0.6 0.6 True
+600 600 True
+Done False
+0.8 0.8 True
+800 800 True
+Done True
+1.0 1.0 True
+100 100 True
+Testing in_out
+0.5 0.5 True
+0.87 0.87 True
+0.9 0.9 True
+0.95 0.95 True
+1.0 1.0 True
+Testing ease In and Out
+Done False
+0.0 0.0 True
+0.0 0.0 True
+Done False
+5.0 5.0 True
+0.1 0.1 True
+Done False
+10.0 10.0 True
+0.5 0.5 True
+Done False
+15.0 15.0 True
+0.8 0.8 True
+Done True
+20.0 20 True
+1.0 1.0 True
diff --git a/selftest/cdf_test.py b/selftest/cdf_test.py
new file mode 100755
index 000..282ea75
--- /dev/null
+++ b/selftest/cdf_test.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+
+from osmo_ms_driver import cdf
+from datetime import timedelta
+
+
+def print_fuzzy_compare(want, expe, len=3):
+want_str = str(want)[0:len]
+expe_str = str(expe)[0:len]
+print(want_str, expe_str, want_str == expe_str)
+
+
+def check_steps(a, steps, fun):
+print("Done", a.is_done())
+for step in steps:
+# Verify we can step
+
+# Compare and step once
+fun(a, step)
+if a.is_done():
+break
+a.step_once()
+print("Done", a.is_done())
+
+def compare_value(a, step):
+print_fuzzy_compare(a.current_value(), step)
+
+def compare_scaled_value(a, val):
+(step, scale) = val
+print_fuzzy_compare(a.current_value(), step)
+print_fuzzy_compare(a.current_scaled_value(), scale)
+
+def compare_x_value(a, val):
+(x, step) = val
+print(a._x, x, x == a._x)
+print_fuzzy_compare(a.current_value(), step)
+
+def testImmediate():
+print("Testing the immediate CDF")
+a = cdf.immediate()
+print("Done", a.is_done())
+print_fuzzy_compare(a.current_value(), 1.0)
+
+
+def testLinearWithDuration():
+print("Testing linear with duration")
+a = cdf.linear_with_duration(timedelta(seconds=10), 
step_size=timedelta(seconds=2))
+steps = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
+check_steps(a, steps, compare_value)
+
+print("Testing linear with duration scaled")
+a = cdf.linear_with_duration(timedelta(seconds=10), 
step_size=timedelta(seconds=2))
+a.set_target(1000)
+steps = [(0.0, 0.0), (0.2, 200), (0.4, 400), (0.6, 600), (0.8, 800), (1.0, 
1)]
+check_steps(a, steps, compare_scaled_value)
+
+def testInOut():
+print("Testing in_out")
+print_fuzzy_compare(cdf._in_out(0.5), 0.5, 3)
+print_fuzzy_compare(cdf._in_out(0.75), 0.875, 4)
+print_fuzzy_compare(cdf._in_out(0.8), 0.92, 3)
+print_fuzzy_compare(cdf._in_out(0.85), 0.955, 4)
+print_fuzzy_compare(cdf._in_out(1.0), 1.0, 3)
+
+def testEaseInOutDuration():
+print("Testing ease In and Out")
+a = cdf.ease_in_out_duration(duration=timedelta(seconds=20), 
step_size=timedelta(seconds=5))
+steps = [(0.0, 0.0), (5.0, 0.125), (10.0, 0.5), (15.0, 0.875), (20, 1.0)]
+check_steps(a, steps, compare_x_value)
+
+testImmediate()
+testLinearWithDuration()
+testInOut()
+testEaseInOutDuration()
diff --git a/src/osmo_ms_driver/__init__.py b/src/osmo_ms_driver/__init__.py
new file mode 100644
index 000..d3c1590
--- /dev/null
+++ b/src/osmo_ms_driver/__init__.py
@@ -0,0 +1,29 @@
+# osmo_gsm_tester: automated cellular network hardware tests
+#
+# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH
+#
+# Authors: D. Lazlo Sitzer 
+#  Neels Hofmeyr 
+#
+# 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 

osmo-gsm-tester[master]: ms: Create a cumulative distribution function class

2018-03-07 Thread Holger Freyther

Patch Set 5:

> Thanks for moving the tests to the existing test system. It seems
 > however the new test is not being run in jenkins. Running it
 > locally (make check) in my PC actually shows it's missing exec
 > permission on the file (I don't know why jenkins doesn't fail). you
 > need to +x it.

Sorry about that. I wrote it in an airplane but didn't have ofono installed and 
couldn't run the tests (it didn't seem possible to just run a single test). I 
am surprised by the _prep import?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e3064f4c3c4c7af5d3491f850090516e541f4d3
Gerrit-PatchSet: 5
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-gsm-tester[master]: ms: Create a cumulative distribution function class

2018-03-07 Thread Pau Espin Pedrol

Patch Set 5: Code-Review-1

Thanks for moving the tests to the existing test system. It seems however the 
new test is not being run in jenkins. Running it locally (make check) in my PC 
actually shows it's missing exec permission on the file (I don't know why 
jenkins doesn't fail). you need to +x it.

Also, I had to apply the following changes locally to have it working, please 
add them and re-submit. Once you have it working, also run:
cd selftest && ./cdf_test.py > cdf_test.ok
To have the expected output in a file, otherwise it's not checked.

diff --git a/selftest/cdf_test.py b/selftest/cdf_test.py
old mode 100644
new mode 100755
index ec970df..7ef65f9
--- a/selftest/cdf_test.py
+++ b/selftest/cdf_test.py
@@ -1,13 +1,13 @@
+#!/usr/bin/env python3
+import _prep
 from osmo_ms_driver import cdf
 from datetime import timedelta

-
 def print_fuzzy_compare(want, expe, len=3):
 want_str = str(want)[0:len]
 expe_str = str(expe)[0:len]
 print(want_str, expe_str, want_str == expe_str)

-
 def check_steps(a, steps, fun):
 print("Done", a.is_done())
 for step in steps:
@@ -39,7 +39,6 @@ def testImmediate():
 print("Done", a.is_done())
 print_fuzzy_compare(a.current_value(), 1.0)

-
 def testLinearWithDuration():
 print("Testing linear with duration")
 a = cdf.linear_with_duration(timedelta(seconds=10), 
step_size=timedelta(seconds=2))

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e3064f4c3c4c7af5d3491f850090516e541f4d3
Gerrit-PatchSet: 5
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-gsm-tester[master]: ms: Add a first test to use all parts of the system

2018-03-07 Thread Holger Freyther

Patch Set 6:

(1 comment)

https://gerrit.osmocom.org/#/c/6918/6/src/osmo_ms_driver/location_update_test.py
File src/osmo_ms_driver/location_update_test.py:

Line 115: ms.start(loop)
> Oh I now see what you were saying about the variables. This should be bette
Good point. That wasn't intentional and the result of the refactoring.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3277ed0f0f9ee734569bedd4752564eb68c9cfd
Gerrit-PatchSet: 6
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: Yes


osmo-gsm-tester[master]: ms: Add a first test to use all parts of the system

2018-03-07 Thread Pau Espin Pedrol

Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3277ed0f0f9ee734569bedd4752564eb68c9cfd
Gerrit-PatchSet: 7
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


osmo-gsm-tester[master]: ms: Create a starter for virtphy and mobile application

2018-03-07 Thread Pau Espin Pedrol

Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5c6d742842d7f3e0a1858436ef3f8634d8c0582d
Gerrit-PatchSet: 7
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


[PATCH] osmo-gsm-tester[master]: ms: Create a starter for virtphy and mobile application

2018-03-07 Thread Holger Freyther
Hello Pau Espin Pedrol, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6917

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

ms: Create a starter for virtphy and mobile application

In the long run we might not want to start the virtphy but
for now virtphy+mobile belong together. Start virtphy first
as mobile will not handle a missing socket gracefully.

Change-Id: I5c6d742842d7f3e0a1858436ef3f8634d8c0582d
---
A src/osmo_ms_driver/starter.py
1 file changed, 119 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/17/6917/7

diff --git a/src/osmo_ms_driver/starter.py b/src/osmo_ms_driver/starter.py
new file mode 100644
index 000..243dedc
--- /dev/null
+++ b/src/osmo_ms_driver/starter.py
@@ -0,0 +1,119 @@
+# osmo_ms_driver: Starter for processes
+# Help to start processes over time.
+#
+# Copyright (C) 2018 by Holger Hans Peter Freyther
+#
+# 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 3 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, see .
+
+from osmo_gsm_tester import log, template
+
+import os
+import os.path
+import subprocess
+import time
+
+_devnull = open(os.devnull, 'w')
+#_devnull = open('/dev/stdout', 'w')
+
+class Launcher(log.Origin):
+def __init__(self, base_name, name_number, tmp_dir):
+super().__init__(log.C_RUN, "{}/{}".format(base_name, name_number))
+self._name_number = name_number
+self._tmp_dir = tmp_dir
+
+def name_number(self):
+return self._name_number
+
+class OsmoVirtPhy(Launcher):
+def __init__(self, name_number, tmp_dir):
+super().__init__("osmo-ms-virt-phy", name_number, tmp_dir)
+self._phy_filename = os.path.join(self._tmp_dir, "osmocom_l2_" + 
self._name_number)
+
+def phy_filename(self):
+return self._phy_filename
+
+def start(self, loop):
+if len(self._phy_filename.encode()) > 107:
+raise log.Error('Path for unix socket is longer than max allowed 
len for unix socket path (107):', self._phy_filename)
+
+self.log("Starting virtphy process")
+args = ["virtphy", "--l1ctl-sock=" + self._phy_filename]
+self.log(' '.join(args))
+self._vphy_proc = subprocess.Popen(args, stderr=_devnull, 
stdout=_devnull)
+
+def verify_ready(self):
+while True:
+if os.path.exists(self._phy_filename):
+return
+time.sleep(0.2)
+
+def kill(self):
+"""Clean up things."""
+if self._vphy_proc:
+self._vphy_proc.kill()
+
+class OsmoMobile(Launcher):
+def __init__(self, name_number, tmp_dir, lua_tmpl, cfg_tmpl, 
imsi_ki_generator, phy_filename, ev_server_path):
+super().__init__("osmo-ms-mob", name_number, tmp_dir)
+self._lua_template = lua_tmpl
+self._cfg_template = cfg_tmpl
+self._imsi_ki_generator = imsi_ki_generator
+self._phy_filename = phy_filename
+self._ev_server_path = ev_server_path
+
+def write_lua_cfg(self):
+lua_support = os.path.join(os.path.dirname(__file__), 'lua')
+cfg = {
+'test': {
+'event_path': self._ev_server_path,
+'lua_support': lua_support,
+}
+}
+lua_cfg_file = os.path.join(self._tmp_dir, "lua_" + self._name_number 
+ ".lua")
+lua_script = template.render(self._lua_template, cfg)
+with open(lua_cfg_file, 'w') as w:
+w.write(lua_script)
+return lua_cfg_file
+
+def write_mob_cfg(self, lua_filename, phy_filename):
+(imsi, ki) = next(self._imsi_ki_generator)
+cfg = {
+'test': {
+'script': lua_filename,
+'virt_phy': phy_filename,
+'imsi': imsi,
+'ki_comp128': ki,
+'ms_number': self._name_number,
+}
+}
+mob_cfg_file = os.path.join(self._tmp_dir, "mob_" + self._name_number 
+ ".cfg")
+mob_vty = template.render(self._cfg_template, cfg)
+with open(mob_cfg_file, 'w') as w:
+w.write(mob_vty)
+return mob_cfg_file
+
+def start(self, loop):
+lua_filename = self.write_lua_cfg()
+mob_filename = self.write_mob_cfg(lua_filename, self._phy_filename)
+
+self.log("Starting process")
+# Let the kernel pick an unused port for the VTY.
+args = ["mobile", "-c", 

[MERGED] osmo-bsc[master]: implement support for 3-digit MNC with leading zeros

2018-03-07 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged.

Change subject: implement support for 3-digit MNC with leading zeros
..


implement support for 3-digit MNC with leading zeros

Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).

The changes to abis_test and gsm0408_test show that this code now handles
3-digit MNC correctly, by not dropping the leading zero as 0xf in the encoded
PLMN.

Re-implement CTRL commands 'mcc', 'mnc' and 'mcc-mnc-apply' to preserve the
presence of the third digit of the MNC. Always reply with all leading zeros.
Adjust the expected results in ctrl_test_runner.py, to show that it works.

In VTY and CTRL, the parsing of MCC and MNC is inherently made stricter by use
of osmo_{mcc,mnc}_from_str() -- they will no longer allow surplus characters
and detect errno returned by strtol() (in contrast to atoi()).

Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
 Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore),
 I020a4f11791c61742a3d795f782805f7b7e8733e (libosmocore)
Change-Id: I8e722103344186fde118b26d8353db95a4581daa
---
M include/osmocom/bsc/bsc_msc_data.h
M include/osmocom/bsc/gsm_data.h
M src/libbsc/bsc_ctrl_commands.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/gsm_data.c
M src/libbsc/net_init.c
M src/libbsc/pcu_sock.c
M src/libbsc/system_information.c
M src/osmo-bsc/osmo_bsc_api.c
M src/osmo-bsc/osmo_bsc_bssap.c
M src/osmo-bsc/osmo_bsc_ctrl.c
M src/osmo-bsc/osmo_bsc_filter.c
M src/osmo-bsc/osmo_bsc_msc.c
M src/osmo-bsc/osmo_bsc_vty.c
M tests/abis/abis_test.c
M tests/abis/abis_test.ok
M tests/bssap/bssap_test.err
M tests/ctrl_test_runner.py
M tests/gsm0408/gsm0408_test.c
M tests/gsm0408/gsm0408_test.ok
M tests/nanobts_omlattr/nanobts_omlattr_test.c
22 files changed, 225 insertions(+), 171 deletions(-)

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



diff --git a/include/osmocom/bsc/bsc_msc_data.h 
b/include/osmocom/bsc/bsc_msc_data.h
index a3e0106..a04e632 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -78,8 +79,7 @@
struct osmo_timer_list pong_timer;
int advanced_ping;
struct bsc_msc_connection *msc_con;
-   int core_mnc;
-   int core_mcc;
+   struct osmo_plmn_id core_plmn;
int core_lac;
int core_ci;
int rtp_base;
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 8692469..27aa261 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1197,9 +1198,8 @@
 * these have in common, like country and network code, put in yet
 * separate structs and placed as members in osmo_bsc and osmo_msc. */
 
-   /* global parameters */
-   uint16_t country_code;
-   uint16_t network_code;
+   struct osmo_plmn_id plmn;
+
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
int neci;
@@ -1275,6 +1275,16 @@
} mgw;
 };
 
+static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts)
+{
+   static struct osmo_location_area_id lai;
+   lai = (struct osmo_location_area_id){
+   .plmn = bts->network->plmn,
+   .lac = bts->location_area_code,
+   };
+   return 
+}
+
 extern void talloc_ctx_init(void *ctx_root);
 
 int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
diff --git a/src/libbsc/bsc_ctrl_commands.c b/src/libbsc/bsc_ctrl_commands.c
index 41d2361..64f4589 100644
--- a/src/libbsc/bsc_ctrl_commands.c
+++ b/src/libbsc/bsc_ctrl_commands.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,8 +31,61 @@
 #include 
 #include 
 
-CTRL_CMD_DEFINE_RANGE(net_mnc, "mnc", struct gsm_network, network_code, 0, 
999);
-CTRL_CMD_DEFINE_RANGE(net_mcc, "mcc", struct gsm_network, country_code, 1, 
999);
+CTRL_CMD_DEFINE(net_mcc, "mcc");
+static int get_net_mcc(struct ctrl_cmd *cmd, void *_data)
+{
+   struct gsm_network *net = cmd->node;
+   cmd->reply = talloc_asprintf(cmd, "%s", osmo_mcc_name(net->plmn.mcc));
+   if (!cmd->reply) {
+   cmd->reply = "OOM";
+   return CTRL_CMD_ERROR;
+   }
+   return CTRL_CMD_REPLY;
+}
+static int set_net_mcc(struct ctrl_cmd *cmd, void *_data)
+{
+   struct gsm_network *net = cmd->node;
+   uint16_t mcc;
+   if (osmo_mcc_from_str(cmd->value, ))
+   return -1;
+   net->plmn.mcc = mcc;
+   return get_net_mcc(cmd, _data);
+}
+static int verify_net_mcc(struct ctrl_cmd *cmd, const char *value, void *_data)
+{

osmo-gsm-tester[master]: ms: Add a first test to use all parts of the system

2018-03-07 Thread Pau Espin Pedrol

Patch Set 6: Code-Review+2

(2 comments)

https://gerrit.osmocom.org/#/c/6918/6/src/osmo_ms_driver/location_update_test.py
File src/osmo_ms_driver/location_update_test.py:

Line 115: ms.start(loop)
Oh I now see what you were saying about the variables. This should be better 
called phy instead of ms. Can be fixed later if it's easier for you.


Line 118: for ms in self._phys:
Same here, it should be named phy instead of ms, and of course then 
ms.verify_phy_ready() can already be called phy.verify_ready(). Again, can be 
fixed later if t's a lot of hassle to change it now.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3277ed0f0f9ee734569bedd4752564eb68c9cfd
Gerrit-PatchSet: 6
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: Yes


osmo-gsm-tester[master]: ms: Create a starter for virtphy and mobile application

2018-03-07 Thread Pau Espin Pedrol

Patch Set 6: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/6917/6/src/osmo_ms_driver/starter.py
File src/osmo_ms_driver/starter.py:

Line 58: import time
You forgot to fix this one.


Line 88: 
You forgot to fix this one.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5c6d742842d7f3e0a1858436ef3f8634d8c0582d
Gerrit-PatchSet: 6
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: Yes


[PATCH] osmo-gsm-tester[master]: ms: Add a first test to use all parts of the system

2018-03-07 Thread Holger Freyther
Hello Pau Espin Pedrol, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6918

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

ms: Add a first test to use all parts of the system

This is an interim solution but is bringing all parts together.
We will need to:

 * Abstract this into a base class
 * Be able to mix different tests without interfering with each
   other (e.g. 10k LU tests, 2k SMS sending)
 * The event loop will need to handle multiple timers/timeouts
 * Stats printing should print more information and test pass/fail
 * The test should quit early if everything has already passed

Change-Id: Id3277ed0f0f9ee734569bedd4752564eb68c9cfd
---
A src/osmo_ms_driver/location_update_test.py
1 file changed, 207 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/18/6918/6

diff --git a/src/osmo_ms_driver/location_update_test.py 
b/src/osmo_ms_driver/location_update_test.py
new file mode 100644
index 000..7a2159d
--- /dev/null
+++ b/src/osmo_ms_driver/location_update_test.py
@@ -0,0 +1,207 @@
+# osmo_ms_driver: Starter for processes
+# Help to start processes over time.
+#
+# Copyright (C) 2018 by Holger Hans Peter Freyther
+#
+# 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 3 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, see .
+
+
+from osmo_gsm_tester import log
+from .starter import OsmoVirtPhy, OsmoMobile
+
+from datetime import timedelta
+
+import time
+
+def imsi_ki_gen():
+"""
+Generate IMSIs and KIs to be used by test.
+"""
+n = 10100
+while True:
+yield ("%.15d" % n, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00")
+n += 1
+
+class Results(log.Origin):
+
+def __init__(self, name):
+super().__init__(log.C_RUN, name)
+self._time_of_registration = None
+self._time_of_launch = None
+self._time_of_lu = None
+
+def set_start_time(self, time):
+assert self._time_of_registration is None
+self._time_of_registration = time
+
+def set_launch_time(self, time):
+assert self._time_of_launch is None
+self._time_of_launch = time
+
+def set_lu_time(self, time):
+assert self._time_of_lu is None
+self._time_of_lu = time
+
+def start_time(self):
+return self._time_of_registration or 0
+
+def launch_time(self):
+return self._time_of_launch or 0
+
+def lu_time(self):
+return self._time_of_lu or 0
+
+def lu_delay(self):
+return self.lu_time() - self.start_time()
+
+class MassUpdateLocationTest(log.Origin):
+"""
+A test to launch a configurable amount of MS and make them
+execute a Location Updating Procedure.
+
+Configure the number of MS to be tested and a function that
+decides how quickly to start them and a timeout.
+"""
+
+TEMPLATE_LUA = "osmo-mobile-lu.lua"
+TEMPLATE_CFG = "osmo-mobile.cfg"
+TEST_TIME = timedelta(seconds=120)
+
+def __init__(self, name, number_of_ms, cdf_function, event_server, 
tmp_dir):
+super().__init__(log.C_RUN, name)
+self._number_of_ms = number_of_ms
+self._cdf = cdf_function
+self._cdf.set_target(number_of_ms)
+self._unstarted = []
+self._phys = []
+self._results = {}
+imsi_gen = imsi_ki_gen()
+
+for i in range(0, number_of_ms):
+ms_name = "%.5d" % i
+
+phy = OsmoVirtPhy(ms_name, tmp_dir)
+self._phys.append(phy)
+
+launcher = OsmoMobile(ms_name, tmp_dir, self.TEMPLATE_LUA,
+self.TEMPLATE_CFG, imsi_gen,
+phy.phy_filename(),
+event_server.server_path())
+self._results[ms_name] = Results(ms_name)
+self._unstarted.append(launcher)
+self._event_server = event_server
+self._event_server.register(self.handle_msg)
+
+def pre_launch(self, loop):
+"""
+We need the virtphy's be ready when the lua script in the
+mobile comes and kicks-off the test. In lua we don't seem to
+be able to just stat/check if a file/socket exists so we need
+to do this from here.
+"""
+self.log("Pre-launching all virtphy's")
+for ms in self._phys:
+ms.start(loop)
+
+self.log("Checking if sockets are in the filesystem")
+   

[PATCH] osmo-gsm-tester[master]: ms: Create a cumulative distribution function class

2018-03-07 Thread Holger Freyther
Hello Pau Espin Pedrol, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6230

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

ms: Create a cumulative distribution function class

We are using the CDF to decide which percentage of the jobs should
be running at a given point. The x-axis is time and the y-axis the
percentage of how many jobs should be running.

There are three functions to do this. The first one is a constant
which would result in everything being started right now, one to
start them linearly and the last (formula from Qt/3rdparty) to first
accelerate and decelerate slowly.

Change-Id: I9e3064f4c3c4c7af5d3491f850090516e541f4d3
---
A selftest/cdf_test.py
A src/osmo_ms_driver/__init__.py
A src/osmo_ms_driver/cdf.py
3 files changed, 206 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/30/6230/5

diff --git a/selftest/cdf_test.py b/selftest/cdf_test.py
new file mode 100644
index 000..ec970df
--- /dev/null
+++ b/selftest/cdf_test.py
@@ -0,0 +1,72 @@
+from osmo_ms_driver import cdf
+from datetime import timedelta
+
+
+def print_fuzzy_compare(want, expe, len=3):
+want_str = str(want)[0:len]
+expe_str = str(expe)[0:len]
+print(want_str, expe_str, want_str == expe_str)
+
+
+def check_steps(a, steps, fun):
+print("Done", a.is_done())
+for step in steps:
+# Verify we can step
+
+# Compare and step once
+fun(a, step)
+if a.is_done():
+break
+a.step_once()
+print("Done", a.is_done())
+
+def compare_value(a, step):
+print_fuzzy_compare(a.current_value(), step)
+
+def compare_scaled_value(a, val):
+(step, scale) = val
+print_fuzzy_compare(a.current_value(), step)
+print_fuzzy_compare(a.current_scaled_value(), scale)
+
+def compare_x_value(a, val):
+(x, step) = val
+print(a._x, x, x == a._x)
+print_fuzzy_compare(a.current_value(), step)
+
+def testImmediate():
+print("Testing the immediate CDF")
+a = cdf.immediate()
+print("Done", a.is_done())
+print_fuzzy_compare(a.current_value(), 1.0)
+
+
+def testLinearWithDuration():
+print("Testing linear with duration")
+a = cdf.linear_with_duration(timedelta(seconds=10), 
step_size=timedelta(seconds=2))
+steps = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
+check_steps(a, steps, compare_value)
+
+print("Testing linear with duration scaled")
+a = cdf.linear_with_duration(timedelta(seconds=10), 
step_size=timedelta(seconds=2))
+a.set_target(1000)
+steps = [(0.0, 0.0), (0.2, 200), (0.4, 400), (0.6, 600), (0.8, 800), (1.0, 
1)]
+check_steps(a, steps, compare_scaled_value)
+
+def testInOut():
+print("Testing in_out")
+print_fuzzy_compare(cdf._in_out(0.5), 0.5, 3)
+print_fuzzy_compare(cdf._in_out(0.75), 0.875, 4)
+print_fuzzy_compare(cdf._in_out(0.8), 0.92, 3)
+print_fuzzy_compare(cdf._in_out(0.85), 0.955, 4)
+print_fuzzy_compare(cdf._in_out(1.0), 1.0, 3)
+
+def testEaseInOutDuration():
+print("Testing ease In and Out")
+a = cdf.ease_in_out_duration(duration=timedelta(seconds=20), 
step_size=timedelta(seconds=5))
+steps = [(0.0, 0.0), (5.0, 0.125), (10.0, 0.5), (15.0, 0.875), (20, 1.0)]
+check_steps(a, steps, compare_x_value)
+
+testImmediate()
+testLinearWithDuration()
+testInOut()
+testEaseInOutDuration()
diff --git a/src/osmo_ms_driver/__init__.py b/src/osmo_ms_driver/__init__.py
new file mode 100644
index 000..d3c1590
--- /dev/null
+++ b/src/osmo_ms_driver/__init__.py
@@ -0,0 +1,29 @@
+# osmo_gsm_tester: automated cellular network hardware tests
+#
+# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH
+#
+# Authors: D. Lazlo Sitzer 
+#  Neels Hofmeyr 
+#
+# 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 3 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, see .
+
+__version__ = 'UNKNOWN'
+
+try:
+from ._version import _version
+__version__ = _version
+except:
+pass
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_ms_driver/cdf.py b/src/osmo_ms_driver/cdf.py
new file mode 100644
index 000..781349b
--- /dev/null
+++ b/src/osmo_ms_driver/cdf.py
@@ -0,0 +1,105 @@
+# osmo_ms_driver: A cumululative distribution function class.
+# Help to start processes over time.
+#
+# Copyright (C) 2018 by Holger Hans Peter Freyther
+#
+# This program is free software: you can 

[PATCH] osmo-trx[master]: Makefile.am: Avoid using subdir if arch is not required

2018-03-07 Thread Pau Espin Pedrol

Makefile.am: Avoid using subdir if arch is not required

There's no need in going a level deeper if we already know nothing's
going to be done. This way we also get cleaner make outputs.

Related: OS#3029

Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
---
M Transceiver52M/Makefile.am
M Transceiver52M/arm/Makefile.am
M Transceiver52M/x86/Makefile.am
M configure.ac
4 files changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/46/7146/2

diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 3c1b86c..187a335 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -24,7 +24,11 @@
 AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/common
 AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
 
-SUBDIRS = arm x86
+if ARCH_ARM
+SUBDIRS = arm
+else
+SUBDIRS = x86
+endif
 
 if USRP1
 AM_CPPFLAGS += $(USRP_CFLAGS)
diff --git a/Transceiver52M/arm/Makefile.am b/Transceiver52M/arm/Makefile.am
index 0b959be..6b0b992 100644
--- a/Transceiver52M/arm/Makefile.am
+++ b/Transceiver52M/arm/Makefile.am
@@ -1,4 +1,3 @@
-if ARCH_ARM
 if ARCH_ARM_A15
 ARCH_FLAGS = -mfpu=neon-vfpv4
 else
@@ -20,4 +19,3 @@
scale_neon.S \
mult.c \
mult_neon.S
-endif
diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am
index 45aa629..5d84f85 100644
--- a/Transceiver52M/x86/Makefile.am
+++ b/Transceiver52M/x86/Makefile.am
@@ -1,4 +1,3 @@
-if !ARCH_ARM
 AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common
 
 noinst_LTLIBRARIES = libarch.la
@@ -29,4 +28,3 @@
../common/convert_base.c \
convert.c \
convolve.c
-endif
diff --git a/configure.ac b/configure.ac
index 916cf18..ada8cfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,11 +182,14 @@
 CommonLibs/Makefile \
 GSM/Makefile \
 Transceiver52M/Makefile \
-Transceiver52M/arm/Makefile \
-Transceiver52M/x86/Makefile \
 tests/Makefile \
 tests/CommonLibs/Makefile \
 tests/Transceiver52M/Makefile \
 ])
 
+AM_COND_IF([ARCH_ARM],
+   [AC_CONFIG_FILES([Transceiver52M/arm/Makefile])],
+  [AC_CONFIG_FILES([Transceiver52M/x86/Makefile])])
+
+
 AC_OUTPUT

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-trx[master]: Makefile.am: Avoid using subdir if arch is not required

2018-03-07 Thread Pau Espin Pedrol

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

Makefile.am: Avoid using subdir if arch is not required

There's no need in going a level deeper if we already know nothing's
going to be done. This way we also get cleaner make outputs.

Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
---
M Transceiver52M/Makefile.am
M Transceiver52M/arm/Makefile.am
M Transceiver52M/x86/Makefile.am
M configure.ac
4 files changed, 10 insertions(+), 7 deletions(-)


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

diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 3c1b86c..187a335 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -24,7 +24,11 @@
 AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/common
 AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
 
-SUBDIRS = arm x86
+if ARCH_ARM
+SUBDIRS = arm
+else
+SUBDIRS = x86
+endif
 
 if USRP1
 AM_CPPFLAGS += $(USRP_CFLAGS)
diff --git a/Transceiver52M/arm/Makefile.am b/Transceiver52M/arm/Makefile.am
index 0b959be..6b0b992 100644
--- a/Transceiver52M/arm/Makefile.am
+++ b/Transceiver52M/arm/Makefile.am
@@ -1,4 +1,3 @@
-if ARCH_ARM
 if ARCH_ARM_A15
 ARCH_FLAGS = -mfpu=neon-vfpv4
 else
@@ -20,4 +19,3 @@
scale_neon.S \
mult.c \
mult_neon.S
-endif
diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am
index 45aa629..5d84f85 100644
--- a/Transceiver52M/x86/Makefile.am
+++ b/Transceiver52M/x86/Makefile.am
@@ -1,4 +1,3 @@
-if !ARCH_ARM
 AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common
 
 noinst_LTLIBRARIES = libarch.la
@@ -29,4 +28,3 @@
../common/convert_base.c \
convert.c \
convolve.c
-endif
diff --git a/configure.ac b/configure.ac
index 916cf18..ada8cfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,11 +182,14 @@
 CommonLibs/Makefile \
 GSM/Makefile \
 Transceiver52M/Makefile \
-Transceiver52M/arm/Makefile \
-Transceiver52M/x86/Makefile \
 tests/Makefile \
 tests/CommonLibs/Makefile \
 tests/Transceiver52M/Makefile \
 ])
 
+AM_COND_IF([ARCH_ARM],
+   [AC_CONFIG_FILES([Transceiver52M/arm/Makefile])],
+  [AC_CONFIG_FILES([Transceiver52M/x86/Makefile])])
+
+
 AC_OUTPUT

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-ci[master]: jenkins: add osmo-gsm-tester_run-{prod,rnd}

2018-03-07 Thread Neels Hofmeyr

Patch Set 4:

(1 comment)

https://gerrit.osmocom.org/#/c/7021/4/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 137:  repo: osmo-gsm-tester_build-osmo-bsc
> it's used here. This is a macro using another macro.
ok I understand. Interesting to see that one can use macros, didn't know about 
those before.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic1c4babc547f48402b0bcfaf38e2734e87e565f0
Gerrit-PatchSet: 4
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: Yes


osmo-ci[master]: jenkins: add osmo-gsm-tester-build jobs

2018-03-07 Thread Neels Hofmeyr

Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/7019/3/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 66:   - gsmtester_build_branch:
> Take a look at the macro gsmtester_build_branch.
ah, I get it now, so that macro is adding a string parameter to the job. Maybe 
the macro could be named "add_string_param"? "add_branch_param"? (to me it 
sounded like actual instructions to start building a branch) well, cosmetics :) 
not really important


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic49c94e9e6639e43f6ae14b868bc826af3ce2085
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: Yes


osmo-ci[master]: add ansible playbooks

2018-03-07 Thread Neels Hofmeyr

Patch Set 1:

(5 comments)

minor cosmetics...

https://gerrit.osmocom.org/#/c/7127/1/ansible/roles/gsm-tester-modems/tasks/main.yml
File ansible/roles/gsm-tester-modems/tasks/main.yml:

Line 2: # modems
USRP and UHD are not related to modems, it is about SDR based BTSes: the entire 
UHD stuff should not be under gsm-tester-modems/


Line 25: - name: install gobi2000 packages 
ws


https://gerrit.osmocom.org/#/c/7127/1/ansible/roles/gsm-tester-network/README.md
File ansible/roles/gsm-tester-network/README.md:

Line 7: - `bts_interface` (eth1): on which network interface the bts is 
configured.
"the bts are"? It's definitely more than one. Also the octasic vs. the osmo-trx 
vs. the actual Abis/IP ones are fundamentally different, maybe the comment 
should be more concise about that.


https://gerrit.osmocom.org/#/c/7127/1/ansible/roles/gsm-tester-network/defaults/main.yml
File ansible/roles/gsm-tester-network/defaults/main.yml:

Line 3: bts_interface: eth1
(same) maybe the name should be abis_ip_bts_interface ?


https://gerrit.osmocom.org/#/c/7127/1/ansible/roles/gsm-tester-network/templates/interface.j2
File ansible/roles/gsm-tester-network/templates/interface.j2:

Line 2: auto {{ bts_interface }}
oh, so these are the IP addresses given to the various components like 
osmo-msc, osmo-bsc, osmo-mgw, and they should be IP addresses that are 
reachable from the BTSes. So then maybe the name should just be 
public_interface? Most of the time they are just IP addresses to give to a 
component so that we can tcpdump its communication separately. Only a few of 
the components actually communicate with a BTS directly.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7007a4e6c38f73843390ec2b3b91133aff21e36a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


osmo-ci[master]: jenkins: add osmo-gsm-tester_run-{prod,rnd}

2018-03-07 Thread lynxis lazus

Patch Set 4:

(2 comments)

https://gerrit.osmocom.org/#/c/7021/4/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 127:   project: '{repo}'
> where is the {repo} coming from? IIUC the '- project:' section responsible 
this is a macro. repo must be given, when calling this macro.
we could move this into an own file


Line 137:  repo: osmo-gsm-tester_build-osmo-bsc
it's used here. This is a macro using another macro.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic1c4babc547f48402b0bcfaf38e2734e87e565f0
Gerrit-PatchSet: 4
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: Yes


osmo-ci[master]: jenkins: add osmo-gsm-tester_run-{prod,rnd}

2018-03-07 Thread Neels Hofmeyr

Patch Set 4: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/7021/4/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 127:   project: '{repo}'
where is the {repo} coming from? IIUC the '- project:' section responsible for 
these jobs doesn't define repos. Is it somehow re-using the repo definition 
from above?

If not, I'd also prefer this in its own file. Actually I prefer it in its own 
file in any case.


Line 132: # all artifact in one place
("artifacts")


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic1c4babc547f48402b0bcfaf38e2734e87e565f0
Gerrit-PatchSet: 4
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: Yes


osmo-ci[master]: jenkins: add job osmo-gsm-tester_build-trigger-all

2018-03-07 Thread Neels Hofmeyr

Patch Set 3: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/7020/3/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 105: - job:
this doesn't seem to use any of the above definitions, so it might be clearer 
to have it in its own file? I find jjb's job template business hard enough to 
follow, no need to add non-templated jobs to the mix.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8dcf2a6fa2991cb73b4807f8a10d251f3dca77dd
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


osmo-ci[master]: jenkins: add osmo-gsm-tester-build jobs

2018-03-07 Thread Pau Espin Pedrol

Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/7019/3/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 11: repo:
> (our other yml files call this "repos" -- I saw it was also called "repos" 
I requested this change, reason is explained in older comments in this same 
patch and others in the patch series.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic49c94e9e6639e43f6ae14b868bc826af3ce2085
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


osmo-ci[master]: jenkins: add osmo-gsm-tester-build jobs

2018-03-07 Thread Neels Hofmeyr

Patch Set 3: Code-Review+1

(3 comments)

some comments, none really important

https://gerrit.osmocom.org/#/c/7019/3/jobs/osmo-gsm-tester.yml
File jobs/osmo-gsm-tester.yml:

Line 11: repo:
(our other yml files call this "repos" -- I saw it was also called "repos" in 
an earlier patch set. Any particular reason to drop the 's' and be different 
from the other files?)


Line 22:   reverse-job: master-openbsc
what, "reverse"? un-build the binaries?? :)

How about "triggered-by" (my favorite) or if you want to match jjb naming 
"triggers-reverse"


Line 66:   - gsmtester_build_branch:
(I don't understand what's going on here, but if you say it's correct...)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic49c94e9e6639e43f6ae14b868bc826af3ce2085
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


[PATCH] osmo-ci[master]: osmocom-latest-packages.sh: Catch latest tags outside master...

2018-03-07 Thread Pau Espin Pedrol

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

osmocom-latest-packages.sh: Catch latest tags outside master branch

Some projects, like osmo-trx, may have tags created in a non-master
branch. Let's catch those too.

Tested with several osmocom repositories. The ones showing different
behaviour are osmo-trx (expected) and other repositories which have
wrong or no tags and are anyway not used since there's no OBS build for
them.

Old cmdline is left of ==, new is right:
artwork: ( == )
asn1c: ( == )
docker-playground: (debian-jessie-buildslave-0.1.0 == )
layer1-api: (superfemto_v3.8.1 == )
libasn1c: (0.9.28 == 0.9.28)
libgtpnl: (1.1.0 == 1.1.0)
libosmo-abis: (0.4.0 == 0.4.0)
libosmocore: (0.10.2 == 0.10.2)
libosmo-netif: (0.1.1 == 0.1.1)
libosmo-sccp: (0.8.1 == 0.8.1)
libsmpp34: (1.12.0 == 1.12.0)
meta-telephony: ( == )
mncc-python: ( == )
octphy-2g-headers: (OCTSDR-OPENBSC-02.09.00-B1121 == )
openbsc: (1.0.0 == 1.0.0)
osmo-bsc: (1.1.2 == 1.1.2)
osmo-bts: (0.7.0 == 0.7.0)
osmo-ci: ( == )
osmocom-bb: (osmocon_v0.0.0 == )
osmo-ggsn: (1.1.0 == 1.1.0)
osmo-gsm-manuals: ( == v1)
osmo-gsm-tester: ( == 0.1)
osmo-gsm-tester-conf: ( == )
osmo-gsm-tester-sysmocom: ( == )
osmo-hlr: (0.1.0 == 0.1.0)
osmo-iuh: (0.2.0 == 0.2.0)
osmo-mgw: (1.2.0 == 1.2.0)
osmo-msc: (1.1.2 == 1.1.2)
osmo-pcu: (0.4.0 == 0.4.0)
osmo-python-tests: ( == )
osmo-sgsn: (1.2.0 == 1.2.0)
osmo-sip-connector: (1.1.0 == 1.1.0)
osmo-trx: (0.2.0 == 0.3.0)
pysim: ( == )
python-smpplib: ( == )

Change-Id: I3b521a194f0ae9fdfa358423e66f30c1316c23e8
---
M scripts/osmocom-latest-packages.sh
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/scripts/osmocom-latest-packages.sh 
b/scripts/osmocom-latest-packages.sh
index 8fe074c..4783185 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -32,7 +32,7 @@
   [ -d "$1" ] || git clone "git://git.osmocom.org/$1"
   cd "$1"
   git fetch
-  VER=$(git describe --abbrev=0 --tags --match "*.*.*" origin/master)
+  VER=$(git tag -l --sort=v:refname | grep "^[0-9]*.[0-9]*.[0-9]*$" | tail -n 
1)
   git checkout -f -B "$VER" "refs/tags/$VER"
   gbp buildpackage -d -S -uc -us "--git-export-dir=$output" 
"--git-debian-branch=$VER"
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b521a194f0ae9fdfa358423e66f30c1316c23e8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-03-07 Thread Vadim Yanitskiy

Patch Set 5: Verified-1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
Gerrit-PatchSet: 5
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Minh-Quang Nguyen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Minh-Quang Nguyen 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[ABANDON] osmo-bsc[master]: Temporarily add V=1 for debugging build problem

2018-03-07 Thread dexter
dexter has abandoned this change.

Change subject: Temporarily add V=1 for debugging build problem
..


Abandoned

debugging done

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I43c2763bd7741c1938138b4cde760fbf6902c20a
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bsc[master]: Temporarily add V=1 for debugging build problem

2018-03-07 Thread dexter

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

Temporarily add V=1 for debugging build problem

Change-Id: I43c2763bd7741c1938138b4cde760fbf6902c20a
---
M contrib/jenkins.sh
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index 5b57532..499324c 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -41,7 +41,7 @@
 cd "$base"
 autoreconf --install --force
 ./configure --enable-sanitize --enable-external-tests
-$MAKE $PARALLEL_MAKE
+$MAKE V=1 $PARALLEL_MAKE
 LD_LIBRARY_PATH="$inst/lib" $MAKE check \
   || cat-testlogs.sh
 LD_LIBRARY_PATH="$inst/lib" \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43c2763bd7741c1938138b4cde760fbf6902c20a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] libosmo-netif[master]: osmux: Use correct log category DLMUX

2018-03-07 Thread Pau Espin Pedrol

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

osmux: Use correct log category DLMUX

Change-Id: I77f4593941207689f714d15304dcce40b21d4bd8
---
M src/osmux.c
1 file changed, 27 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/43/7143/1

diff --git a/src/osmux.c b/src/osmux.c
index 88674a7..a0563d2 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -89,12 +89,12 @@
   osmuxh->ctr + 1));
goto next;
default:
-   LOGP(DLMIB, LOGL_ERROR, "Discarding unsupported Osmux 
FT %d\n",
+   LOGP(DLMUX, LOGL_ERROR, "Discarding unsupported Osmux 
FT %d\n",
 osmuxh->ft);
return NULL;
}
if (!osmo_amr_ft_valid(osmuxh->amr_ft)) {
-   LOGP(DLMIB, LOGL_ERROR, "Discarding bad AMR FT %d\n",
+   LOGP(DLMUX, LOGL_ERROR, "Discarding bad AMR FT %d\n",
 osmuxh->amr_ft);
return NULL;
}
@@ -103,14 +103,14 @@
sizeof(struct osmux_hdr);
 
if (len > msg->len) {
-   LOGP(DLMIB, LOGL_ERROR, "Discarding malformed "
+   LOGP(DLMUX, LOGL_ERROR, "Discarding malformed "
"OSMUX message\n");
return NULL;
}
 
msgb_pull(msg, len);
} else if (msg->len > 0) {
-   LOGP(DLMIB, LOGL_ERROR,
+   LOGP(DLMUX, LOGL_ERROR,
"remaining %d bytes, broken osmuxhdr?\n", msg->len);
}
 
@@ -195,7 +195,7 @@
 
osmo_rtp_snprintf(buf, sizeof(buf), msg);
buf[sizeof(buf)-1] = '\0';
-   LOGP(DLMIB, LOGL_DEBUG, "to BTS: %s\n", buf);
+   LOGP(DLMUX, LOGL_DEBUG, "to BTS: %s\n", buf);
}
 #endif
llist_add_tail(>list, list);
@@ -234,7 +234,7 @@
if (rtph == NULL)
return -1;
 
-   LOGP(DLMIB, LOGL_ERROR, "too many messages for this RTP "
+   LOGP(DLMUX, LOGL_ERROR, "too many messages for this RTP "
"ssrc=%u\n", rtph->ssrc);
return -1;
}
@@ -292,7 +292,7 @@
batch->osmuxh = osmuxh;
} else {
if (batch->osmuxh->ctr == 0x7) {
-   LOGP(DLMIB, LOGL_ERROR, "cannot add msg=%p, "
+   LOGP(DLMUX, LOGL_ERROR, "cannot add msg=%p, "
 "too many messages for this RTP ssrc=%u\n",
 state->msg, state->rtph->ssrc);
return 0;
@@ -354,12 +354,12 @@
struct osmux_circuit *circuit;
 
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "Now building batch\n");
+   LOGP(DLMUX, LOGL_DEBUG, "Now building batch\n");
 #endif
 
batch_msg = msgb_alloc(batch_size, "osmux");
if (batch_msg == NULL) {
-   LOGP(DLMIB, LOGL_ERROR, "Not enough memory\n");
+   LOGP(DLMUX, LOGL_ERROR, "Not enough memory\n");
return NULL;
}
 
@@ -387,7 +387,7 @@
 
osmo_rtp_snprintf(buf, sizeof(buf), cur);
buf[sizeof(buf)-1] = '\0';
-   LOGP(DLMIB, LOGL_DEBUG, "to BSC-NAT: %s\n", buf);
+   LOGP(DLMUX, LOGL_DEBUG, "to BSC-NAT: %s\n", buf);
 #endif
 
state.rtph = osmo_rtp_get_hdr(cur);
@@ -396,7 +396,7 @@
 
if (ctr == 0) {
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "add osmux header\n");
+   LOGP(DLMUX, LOGL_DEBUG, "add osmux header\n");
 #endif
state.add_osmux_hdr = 1;
}
@@ -417,7 +417,7 @@
struct osmux_batch *batch = (struct osmux_batch *)h->internal_data;
 
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "invoking delivery function\n");
+   LOGP(DLMUX, LOGL_DEBUG, "invoking delivery function\n");
 #endif
batch_msg = osmux_build_batch(batch, h->batch_size, h->batch_factor);
if (!batch_msg)
@@ -440,7 +440,7 @@
struct osmux_in_handle *h = data;
 
 #ifdef DEBUG_MSG
-   LOGP(DLMIB, LOGL_DEBUG, "osmux_batch_timer_expired\n");
+   LOGP(DLMUX, LOGL_DEBUG, "osmux_batch_timer_expired\n");
 #endif
osmux_xfrm_input_deliver(h);
 }
@@ -462,7 +462,7 @@
 
/* The AMR payload does not fit with what we expect */
if (osmo_amr_bytes(amrh->ft) != amr_payload_len) {
-   LOGP(DLMIB, LOGL_ERROR,
+   LOGP(DLMUX, LOGL_ERROR,
 "Bad AMR frame, expected %zd bytes, got %d bytes\n",
 osmo_amr_bytes(amrh->ft), 

[PATCH] osmo-bsc[master]: introduce an osmo_fsm for gsm_subscriber_connection

2018-03-07 Thread dexter

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

introduce an osmo_fsm for gsm_subscriber_connection

In the current implementation of osmo-bsc, the subscriber connection is
not handled (very) statefully. However, there is some state keeping in the
code that handles the mgcp connection, but there are still to much loose ends
which allow odd situations to happen, which then lead severe error situations
(see also closes tags at the end) This commit adds a number of improvements
to fix those problems.

- Use an osmo-fsm to control the gsm_subscriber_connection state and
  make sure that certain operations can only take place at certain states
  (e.g let connection oriented SCCP traffic only pass when an SCCP connection
  actually exists.

  Remove the old osmo_bsc_mgcp.c code. Use the recently developed MGCP client
  FSM to handle the MGCP connections.

  Also make sure that stuff that already works does not break. This in
  particular refers to the internal handover capability and the respective
  unit-tests.

  See also OS#2823, OS#2768 and OS#2898

- Fix logic to permit assignment to a signalling channel. (OS#2762)

- Introduce T993210 to release lchan + subscr_conn if MSC fails to respond

  The GSM specs don't have an explicit timer for this, so let's introdcue
  a custom timer (hence starting with 99).

  This timeout catches the following situation:
  * we send a SCCP CR with COMPL_L3_INFO from the MS to the MSC,
  * the MSC doesn't respond (e.g. SCCP routing failure, program down, ...)

  The MS is supposed to timeout with T3210, 3220 or 3230.  But the BSC
  shouldn't trust the MS but have some timer on its own.

  SCCP would have a timer T(conn est), but that one is specified to be
  1-2min and hence rather long.

  See also: OS#2775

- Terminate bsc_subscr_conn_fsm on SCCP N-DISC.ind from MSC

  If the MSC is disconnecting the SCCP channel, we must terminate the FSM
  which in turn will release all lchan's and other state.

  This makes TC_chan_rel_hard_rlsd pass, see also OS#2731

  As a side-effect, this fixes TC_chan_act_ack_est_ind_refused(),
  where the MSC is answering with CREF to our CR/COMPL_L3.

- Release subscriber connection on RLL RELEASE IND of SAPI0 on main DCCH

  The subscriber connection isn't really useful for anything after the
  SAPI0 main signalling link has been released.  We could try to
  re-establish, but our best option is probably simply releasing the
  subscriber_conn and anything related to it.

  This will make TC_chan_rel_rll_rel_ind pass, see also OS#2730

This commit has been tested using the BSC_Tests TTCN3 testsuit and the
following tests were passed:

TC_chan_act_noreply
TC_chan_act_ack_noest
TC_chan_act_ack_est_ind_noreply
TC_chan_act_ack_est_ind_refused
TC_chan_act_nack
TC_chan_exhaustion
TC_ctrl
TC_chan_rel_conn_fail
TC_chan_rel_hard_clear
TC_chan_rel_hard_rlsd
TC_chan_rel_a_reset
TC_rll_est_ind_inact_lchan
TC_rll_est_ind_inval_sapi1
TC_rll_est_ind_inval_sapi3
TC_rll_est_ind_inval_sacch
TC_assignment_cic_only
TC_assignment_csd
TC_assignment_ctm
TC_assignment_fr_a5_0
TC_assignment_fr_a5_1_codec_missing
TC_assignment_fr_a5_1
TC_assignment_fr_a5_3
TC_assignment_fr_a5_4
TC_paging_imsi_nochan
TC_paging_tmsi_nochan
TC_paging_tmsi_any
TC_paging_tmsi_sdcch
TC_paging_tmsi_tch_f
TC_paging_tmsi_tch_hf
TC_paging_imsi_nochan_cgi
TC_paging_imsi_nochan_lac_ci
TC_paging_imsi_nochan_ci
TC_paging_imsi_nochan_lai
TC_paging_imsi_nochan_lac
TC_paging_imsi_nochan_all
TC_paging_imsi_nochan_plmn_lac_rnc
TC_paging_imsi_nochan_rnc
TC_paging_imsi_nochan_lac_rnc
TC_paging_imsi_nochan_lacs
TC_paging_imsi_nochan_lacs_empty
TC_paging_imsi_a_reset
TC_paging_counter
TC_rsl_drop_counter
TC_classmark
TC_unsol_ass_fail
TC_unsol_ass_compl
TC_unsol_ho_fail
TC_err_82_short_msg
TC_ho_int

Authors:
Harald Welte 
Philipp Maier 
Neels Hofmeyr 

Closes: OS#2730
Closes: OS#2731
Closes: OS#2762
Closes: OS#2768
Closes: OS#2775
Closes: OS#2823
Closes: OS#2898
Closes: OS#2936
Change-Id: I68286d26e2014048b054f39ef29c35fef420cc97
---
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/bsc_api.h
A include/osmocom/bsc/bsc_subscr_conn_fsm.h
M include/osmocom/bsc/gsm_data.h
M include/osmocom/bsc/handover.h
M include/osmocom/bsc/osmo_bsc.h
D include/osmocom/bsc/osmo_bsc_mgcp.h
M include/osmocom/bsc/osmo_bsc_sigtran.h
M src/ipaccess/Makefile.am
M src/libbsc/Makefile.am
M src/libbsc/abis_rsl.c
M src/libbsc/bsc_api.c
A src/libbsc/bsc_subscr_conn_fsm.c
M src/libbsc/handover_decision_2.c
M src/libbsc/handover_logic.c
M src/osmo-bsc/Makefile.am
M src/osmo-bsc/osmo_bsc_api.c
M src/osmo-bsc/osmo_bsc_audio.c
M src/osmo-bsc/osmo_bsc_bssap.c
M src/osmo-bsc/osmo_bsc_main.c
D src/osmo-bsc/osmo_bsc_mgcp.c
M src/osmo-bsc/osmo_bsc_sigtran.c
M src/utils/Makefile.am
M tests/abis/abis_test.c
M tests/bsc-nat/bsc_nat_test.c
M tests/bsc/bsc_test.c
M tests/bssap/Makefile.am
M tests/bssap/bssap_test.c
M tests/channel/channel_test.c
M tests/gsm0408/gsm0408_test.c
M 

[PATCH] osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-03-07 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5753

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

LC15: Fix missing fill frame and GSM 05.08 mandatory frame

It was discovered that the LC15 BTS does not send L2 fill frame
in case there is nothing to transmit. This leads to bad RXQUAL
reported by MS during signaling in TCH channel.

BTS needs to send L2 fill frame in case there is nothing to
transmit as indicated in GSM TS 05.08, section 8.3.

Related: OS#1950
Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
---
M src/common/msg_utils.c
M src/osmo-bts-litecell15/l1_if.c
2 files changed, 127 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/5753/5

diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index f936c98..55874cf 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -379,15 +379,18 @@
static const uint8_t f[] = { 52, 53, 54, 55, 56, 57, 58, 59 },
h0[] = { 0, 2, 4, 6, 52, 54, 56, 58 },
h1[] = { 14, 16, 18, 20, 66, 68, 70, 72 };
-   if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
+
+   switch (lchan->tch_mode) {
+   case GSM48_CMODE_SPEECH_V1:
+   case GSM48_CMODE_SPEECH_AMR:
if (lchan->type == GSM_LCHAN_TCH_F)
return fn_chk(f, fn, ARRAY_SIZE(f));
else
return fn_chk(lchan->nr ? h1 : h0, fn,
- lchan->nr ? ARRAY_SIZE(h1) :
- ARRAY_SIZE(h0));
+   lchan->nr ? ARRAY_SIZE(h1) : ARRAY_SIZE(h0));
+   default:
+   return false;
}
-   return false;
 }
 
 /*! \brief Check if DTX DL AMR is enabled for a given lchan (it have proper 
type,
@@ -465,16 +468,72 @@
  */
 uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn)
 {
-   /* FIXME: add EFR support */
-   if (lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)
+   uint8_t payload_len;
+
+   static const uint8_t amr_sid_first_zero[] = {
+   0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00
+   };
+
+   switch (lchan->tch_mode) {
+   case GSM48_CMODE_SPEECH_EFR:
+   /* FIXME: add EFR support */
return 0;
 
-   if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) {
-   if (dtx_sched_optional(lchan, fn))
-   return 0;
-   } else
+   case GSM48_CMODE_SPEECH_AMR:
if (dtx_amr_sid_optional(lchan, fn))
return 0;
+
+   if (lchan->rsl_cmode != RSL_CMOD_SPD_SPEECH)
+   break;
+
+   if (!!lchan->tch.dtx.len)
+   break;
+
+   /* Send zero SID FIRST frame */
+   payload_len = sizeof(amr_sid_first_zero);
+   memcpy(dst, amr_sid_first_zero, payload_len);
+
+   /* Debug print */
+   LOGP(DL1C, LOGL_DEBUG, "%s %s %s: Sending zero speech frame "
+   "for tch_mode=%s\n", gsm_fn_as_gsmtime_str(fn),
+   gsm_ts_name(lchan->ts), 
get_value_string(gsm_chan_t_names, lchan->type),
+   get_value_string(gsm48_chan_mode_names, 
lchan->tch_mode));
+
+   return payload_len + 1;
+
+   default:
+   if (dtx_sched_optional(lchan, fn))
+   return 0;
+
+   if (!lchan->ts->trx->bts->dtxd)
+   break;
+
+   /* Determine the payload length */
+   switch (lchan->type) {
+   case GSM_LCHAN_TCH_F:
+   payload_len = GSM_FR_BYTES;
+   break;
+   case GSM_LCHAN_TCH_H:
+   payload_len = GSM_HR_BYTES;
+   break;
+   default:
+   return 0;
+   }
+
+   /**
+* Need to send zeroed TCH frame on mandatory fn,
+* defined in GSM TS 05.08, section 8.3
+*/
+   memset(dst, 0x00, payload_len);
+
+   /* Debug print */
+   LOGP(DL1C, LOGL_DEBUG, "%s %s %s: Sending zero speech frame "
+   "for tch_mode=%s\n", gsm_fn_as_gsmtime_str(fn),
+   gsm_ts_name(lchan->ts), 
get_value_string(gsm_chan_t_names, lchan->type),
+   get_value_string(gsm48_chan_mode_names, 
lchan->tch_mode));
+
+   return payload_len + 1;
+   }
 
if (lchan->tch.dtx.len) {
if (dtx_dl_amr_enabled(lchan)) {
@@ -502,6 +561,13 @@
}
memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len);
lchan->tch.dtx.fn = fn;
+
+   /* Debug print */
+   LOGP(DL1C, LOGL_DEBUG, "%s %s %s: Sending SID buffer "
+ 

osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-03-07 Thread Vadim Yanitskiy

Patch Set 4: Verified-1

I've refactored the source code to fit the common Osmocom
code style, but have no opportunity to verify and test.

URGENT: please check everything before submitting!

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Minh-Quang Nguyen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Minh-Quang Nguyen 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-03-07 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5753

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

LC15: Fix missing fill frame and GSM 05.08 mandatory frame

It was discovered that the LC15 BTS does not send L2 fill frame
in case there is nothing to transmit. This leads to bad RXQUAL
reported by MS during signaling in TCH channel.

BTS needs to send L2 fill frame in case there is nothing to
transmit as indicated in GSM TS 05.08, section 8.3.

Related: OS#1950
Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
---
M src/common/msg_utils.c
M src/osmo-bts-litecell15/l1_if.c
2 files changed, 127 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/5753/4

diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index f936c98..cf3f463 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -379,14 +379,18 @@
static const uint8_t f[] = { 52, 53, 54, 55, 56, 57, 58, 59 },
h0[] = { 0, 2, 4, 6, 52, 54, 56, 58 },
h1[] = { 14, 16, 18, 20, 66, 68, 70, 72 };
-   if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
+
+   switch (lchan->tch_mode) {
+   case GSM48_CMODE_SPEECH_V1:
+   case GSM48_CMODE_SPEECH_AMR:
if (lchan->type == GSM_LCHAN_TCH_F)
return fn_chk(f, fn, ARRAY_SIZE(f));
else
return fn_chk(lchan->nr ? h1 : h0, fn,
- lchan->nr ? ARRAY_SIZE(h1) :
- ARRAY_SIZE(h0));
+   lchan->nr ? ARRAY_SIZE(h1) : ARRAY_SIZE(h0));
+   break;
}
+
return false;
 }
 
@@ -465,16 +469,72 @@
  */
 uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn)
 {
-   /* FIXME: add EFR support */
-   if (lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)
+   uint8_t payload_len;
+
+   static const uint8_t amr_sid_first_zero[] = {
+   0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00
+   };
+
+   switch (lchan->tch_mode) {
+   case GSM48_CMODE_SPEECH_EFR:
+   /* FIXME: add EFR support */
return 0;
 
-   if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) {
-   if (dtx_sched_optional(lchan, fn))
-   return 0;
-   } else
+   case GSM48_CMODE_SPEECH_AMR:
if (dtx_amr_sid_optional(lchan, fn))
return 0;
+
+   if (lchan->rsl_cmode != RSL_CMOD_SPD_SPEECH)
+   break;
+
+   if (!!lchan->tch.dtx.len)
+   break;
+
+   /* Send zero SID FIRST frame */
+   payload_len = sizeof(amr_sid_first_zero);
+   memcpy(dst, amr_sid_first_zero, payload_len);
+
+   /* Debug print */
+   LOGP(DL1C, LOGL_DEBUG, "%s %s %s: Sending zero speech frame "
+   "for tch_mode=%s\n", gsm_fn_as_gsmtime_str(fn),
+   gsm_ts_name(lchan->ts), 
get_value_string(gsm_chan_t_names, lchan->type),
+   get_value_string(gsm48_chan_mode_names, 
lchan->tch_mode));
+
+   return payload_len + 1;
+
+   default:
+   if (dtx_sched_optional(lchan, fn))
+   return 0;
+
+   if (!lchan->ts->trx->bts->dtxd)
+   break;
+
+   /* Determine the payload length */
+   switch (lchan->type) {
+   case GSM_LCHAN_TCH_F:
+   payload_len = GSM_FR_BYTES;
+   break;
+   case GSM_LCHAN_TCH_H:
+   payload_len = GSM_HR_BYTES;
+   break;
+   default:
+   return 0;
+   }
+
+   /**
+* Need to send zeroed TCH frame on mandatory fn,
+* defined in GSM TS 05.08, section 8.3
+*/
+   memset(dst, 0x00, payload_len);
+
+   /* Debug print */
+   LOGP(DL1C, LOGL_DEBUG, "%s %s %s: Sending zero speech frame "
+   "for tch_mode=%s\n", gsm_fn_as_gsmtime_str(fn),
+   gsm_ts_name(lchan->ts), 
get_value_string(gsm_chan_t_names, lchan->type),
+   get_value_string(gsm48_chan_mode_names, 
lchan->tch_mode));
+
+   return payload_len + 1;
+   }
 
if (lchan->tch.dtx.len) {
if (dtx_dl_amr_enabled(lchan)) {
@@ -502,6 +562,13 @@
}
memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len);
lchan->tch.dtx.fn = fn;
+
+   /* Debug print */
+   LOGP(DL1C, LOGL_DEBUG, "%s %s %s: Sending SID buffer "
+   "for tch_mode=%s\n", gsm_fn_as_gsmtime_str(fn),
+