libosmocore[master]: Add human-readable names for signal_ns

2017-05-22 Thread Harald Welte

Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/2693/1/src/gb/libosmogb.map
File src/gb/libosmogb.map:

Line 41: gprs_signal_ns_names;
all other NS realted symbols are prefixed 'gprs_ns_', yours is not. Please try 
to align with existing conventions.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


libosmocore[master]: core/conv: add x86 SSE support for Viterbi decoder

2017-05-22 Thread Harald Welte

Patch Set 9:

ok, everyone except Tom has voted +1. @tom, any further feedback on this, or 
shall we merge it?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1da6d71ed0564f1d684f3a836e998d09de5f0351
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Tom Tsou 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


[MERGED] openbsc[master]: ipaccess-config: properly create swload

2017-05-22 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: ipaccess-config: properly create swload
..


ipaccess-config: properly create swload

Instead of 20, use the actual buffer sizes of struct sw_load, which are 255.
Previous code would truncate a longer string at 20 without(!) NUL termination.

In the _len members, store the actual length copied. In previous code, if the
source string were longer than 20, we would store only 20 (without NUL term)
but still reflect the longer length of the source string.

Fix both of these issues for sw_load.file_id / file_id_len and
sw_load.file_version / file_version_len.

Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db
---
M openbsc/src/ipaccess/ipaccess-config.c
1 file changed, 6 insertions(+), 4 deletions(-)

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



diff --git a/openbsc/src/ipaccess/ipaccess-config.c 
b/openbsc/src/ipaccess/ipaccess-config.c
index 8685a40..6822c06 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -609,11 +609,13 @@
 
load = talloc_zero(tall_ctx_config, struct abis_nm_sw_desc);
 
-   strncpy((char *)load->file_id, header->firmware_info.sw_part, 20);
-   load->file_id_len = strlen(header->firmware_info.sw_part) + 1;
+   osmo_strlcpy((char *)load->file_id, header->firmware_info.sw_part,
+sizeof(load->file_id));
+   load->file_id_len = strlen((char*)load->file_id) + 1;
 
-   strncpy((char *)load->file_version, header->firmware_info.version, 20);
-   load->file_version_len = strlen(header->firmware_info.version) + 1;
+   osmo_strlcpy((char *)load->file_version, header->firmware_info.version,
+sizeof(load->file_version));
+   load->file_version_len = strlen((char*)load->file_version) + 1;
 
return load;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db
Gerrit-PatchSet: 4
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 


openbsc[master]: ipaccess-config: properly create swload

2017-05-22 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: tests/Makefile.am: do not test disabled features

2017-05-22 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: tests/Makefile.am: do not test disabled features
..


tests/Makefile.am: do not test disabled features

Compiling tests for disabled features breaks build.

Change-Id: Iebcc24b493092a5a8e3561d7642a0b4608a8beae
---
M tests/Makefile.am
1 file changed, 19 insertions(+), 4 deletions(-)

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



diff --git a/tests/Makefile.am b/tests/Makefile.am
index 97af698..158c37e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,17 +6,16 @@
  smscb/smscb_test bits/bitrev_test a5/a5_test  \
  conv/conv_test auth/milenage_test lapd/lapd_test  \
  gsm0808/gsm0808_test gsm0408/gsm0408_test \
-gb/bssgp_fc_test gb/gprs_bssgp_test gb/gprs_ns_test\
 gprs/gprs_test kasumi/kasumi_test gea/gea_test \
 logging/logging_test fr/fr_test codec/codec_test   \
 loggingrb/loggingrb_test strrb/strrb_test  \
-vty/vty_test comp128/comp128_test utils/utils_test \
-smscb/gsm0341_test stats/stats_test ctrl/ctrl_test \
+comp128/comp128_test smscb/gsm0341_test\
 bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test\
 tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test  \
 write_queue/wqueue_test socket/socket_test \
 coding/coding_test conv/conv_gsm0503_test  \
-abis/abis_test endian/endian_test sercomm/sercomm_test
+abis/abis_test endian/endian_test sercomm/sercomm_test \
+stats/stats_test
 
 if ENABLE_MSGFILE
 check_PROGRAMS += msgfile/msgfile_test
@@ -26,6 +25,22 @@
 check_PROGRAMS += sim/sim_test
 endif
 
+if ENABLE_UTILITIES
+check_PROGRAMS += utils/utils_test
+endif
+
+if ENABLE_VTY
+check_PROGRAMS += vty/vty_test
+endif
+
+if ENABLE_CTRL
+check_PROGRAMS += ctrl/ctrl_test
+endif
+
+if ENABLE_GB
+check_PROGRAMS += gb/bssgp_fc_test gb/gprs_bssgp_test gb/gprs_ns_test
+endif
+
 utils_utils_test_SOURCES = utils/utils_test.c
 utils_utils_test_LDADD = $(top_builddir)/src/libosmocore.la 
$(top_builddir)/src/gsm/libosmogsm.la
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebcc24b493092a5a8e3561d7642a0b4608a8beae
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


libosmocore[master]: tests/Makefile.am: do not test disabled features

2017-05-22 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmocom-bb[master]: Introduce contrib/jenkins.sh to enable gerrit verification[1]

2017-05-24 Thread Harald Welte

Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ife88be9022fc1fc1baee7f11872e5b8db4215682
Gerrit-PatchSet: 7
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: blobb 
Gerrit-HasComments: No


[MERGED] osmocom-bb[master]: Introduce contrib/jenkins.sh to enable gerrit verification[1]

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Introduce contrib/jenkins.sh to enable gerrit verification[1]
..


Introduce contrib/jenkins.sh to enable gerrit verification[1]

First, jenkins.sh builds libosmocore dependency.
Then it compiles the "host" (PC) part of OsmocomBB.

After "libosmocore embedded"-build has been introduced this
script will use it instead of the x86 dep.

[1] http://jenkins.osmocom.org/jenkins/job/osmocomBB-gerrit/

Change-Id: Ife88be9022fc1fc1baee7f11872e5b8db4215682
---
A contrib/jenkins.sh
1 file changed, 32 insertions(+), 0 deletions(-)

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



diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
new file mode 100755
index 000..ca72ac5
--- /dev/null
+++ b/contrib/jenkins.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -ex
+
+base="$PWD"
+deps="$base/deps"
+inst="$deps/install"
+export deps inst
+
+mkdir "$deps" || true
+rm -rf "$inst"
+
+osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
+
+# TODO: ask whether fail is expected, because osmocom-bb build succeeds?
+#"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py 
$(find . -name "*.[hc]")
+
+export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
+export LD_LIBRARY_PATH="$inst/lib"
+
+set +x
+echo
+echo
+echo
+echo " === OsmocomBB 
==="
+echo
+set -x
+
+cd src/host/layer23
+autoreconf -fi
+./configure
+make

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ife88be9022fc1fc1baee7f11872e5b8db4215682
Gerrit-PatchSet: 7
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: blobb 


osmo-bts[master]: phy_link: Fix typo in state being printed

2017-05-24 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-bts[master]: phy_link: Fix typo in state being printed

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: phy_link: Fix typo in state being printed
..


phy_link: Fix typo in state being printed

Change-Id: I312eefa6738f8abdeedd2efb574f3e45cd2e8aa3
---
M src/common/phy_link.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/common/phy_link.c b/src/common/phy_link.c
index 25b7e5d..588fcc9 100644
--- a/src/common/phy_link.c
+++ b/src/common/phy_link.c
@@ -44,7 +44,7 @@
 
 const struct value_string phy_link_state_vals[] = {
{ PHY_LINK_SHUTDOWN,"shutdown" },
-   { PHY_LINK_CONNECTING,  "connectiong" },
+   { PHY_LINK_CONNECTING,  "connecting" },
{ PHY_LINK_CONNECTED,   "connected" },
{ 0, NULL }
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I312eefa6738f8abdeedd2efb574f3e45cd2e8aa3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: core/conv: add x86 SSE support for Viterbi decoder

2017-05-24 Thread Harald Welte

Patch Set 9: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1da6d71ed0564f1d684f3a836e998d09de5f0351
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Tom Tsou 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: core/conv: add x86 SSE support for Viterbi decoder

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: core/conv: add x86 SSE support for Viterbi decoder
..


core/conv: add x86 SSE support for Viterbi decoder

Fast convolutional decoding is provided through x86 intrinsic based
SSE operations. SSE3, found on virtually all modern x86 processors,
is the minimal requirement. SSE4.1 and AVX2 are used if available.

Also, the original code was extended with runtime SIMD detection,
so only supported extensions will be used by target CPU. It makes
the library more partable, what is very important for binary
packages distribution. Runtime SIMD detection is currently
implemented through the __builtin_cpu_supports call.

Change-Id: I1da6d71ed0564f1d684f3a836e998d09de5f0351
---
M src/Makefile.am
M src/viterbi.c
M src/viterbi_gen.c
A src/viterbi_sse.c
4 files changed, 748 insertions(+), 10 deletions(-)

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



diff --git a/src/Makefile.am b/src/Makefile.am
index 5724055..a0aa5a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,12 @@
 macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
 viterbi.c viterbi_gen.c sercomm.c
 
+if HAVE_SSE3
+libosmocore_la_SOURCES += viterbi_sse.c
+# Per-object flags hack
+viterbi_sse.lo : CFLAGS += $(SIMD_FLAGS)
+endif
+
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
 
 if ENABLE_PLUGIN
diff --git a/src/viterbi.c b/src/viterbi.c
index 21c6a57..2097a02 100644
--- a/src/viterbi.c
+++ b/src/viterbi.c
@@ -24,11 +24,34 @@
 #include 
 #include 
 
-#include 
 #include "config.h"
+
+#include 
 
 #define BIT2NRZ(REG,N) (((REG >> N) & 0x01) * 2 - 1) * -1
 #define NUM_STATES(K)  (K == 7 ? 64 : 16)
+
+static int init_complete = 0;
+
+__attribute__ ((visibility("hidden"))) int avx2_supported = 0;
+__attribute__ ((visibility("hidden"))) int sse3_supported = 0;
+__attribute__ ((visibility("hidden"))) int sse41_supported = 0;
+
+/**
+ * This pointers will be initialized by the osmo_conv_init()
+ * depending on supported SIMD extensions.
+ */
+static int16_t *(*vdec_malloc)(size_t n);
+static void (*vdec_free)(int16_t *ptr);
+
+/* Forward malloc wrappers */
+int16_t *osmo_conv_vdec_malloc(size_t n);
+void osmo_conv_vdec_free(int16_t *ptr);
+
+#ifdef HAVE_SSE3
+int16_t *osmo_conv_vdec_malloc_sse3(size_t n);
+void osmo_conv_vdec_free_sse3(int16_t *ptr);
+#endif
 
 /* Forward Metric Units */
 void osmo_conv_gen_metrics_k5_n2(const int8_t *seq, const int16_t *out,
@@ -43,6 +66,21 @@
int16_t *sums, int16_t *paths, int norm);
 void osmo_conv_gen_metrics_k7_n4(const int8_t *seq, const int16_t *out,
int16_t *sums, int16_t *paths, int norm);
+
+#ifdef HAVE_SSE3
+void osmo_conv_gen_metrics_k5_n2_sse(const int8_t *seq, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k5_n3_sse(const int8_t *seq, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k5_n4_sse(const int8_t *seq, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k7_n2_sse(const int8_t *seq, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k7_n3_sse(const int8_t *seq, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k7_n4_sse(const int8_t *seq, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm);
+#endif
 
 /* Trellis State
  * state - Internal lshift register value
@@ -89,12 +127,6 @@
void (*metric_func)(const int8_t *, const int16_t *,
int16_t *, int16_t *, int);
 };
-
-/* Non-aligned Memory Allocator */
-static int16_t *vdec_malloc(size_t n)
-{
-   return (int16_t *) malloc(sizeof(int16_t) * n);
-}
 
 /* Accessor calls */
 static inline int conv_code_recursive(const struct osmo_conv_code *code)
@@ -294,9 +326,9 @@
if (!trellis)
return;
 
+   vdec_free(trellis->outputs);
+   vdec_free(trellis->sums);
free(trellis->vals);
-   free(trellis->outputs);
-   free(trellis->sums);
free(trellis);
 }
 
@@ -430,7 +462,7 @@
if (!dec)
return;
 
-   free(dec->paths[0]);
+   vdec_free(dec->paths[0]);
free(dec->paths);
free_trellis(dec->trellis);
free(dec);
@@ -456,13 +488,31 @@
if (dec->k == 5) {
switch (dec->n) {
case 2:
+   #ifdef HAVE_SSE3
+   dec->metric_func = !sse3_supported ?
+   osmo_conv_gen_metrics_k5_n2 :
+   osmo_conv

osmo-pcu[master]: Print human-readable BSSGP PDU type

2017-05-24 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ief4b5ce4e4020edaf771eaa24f4382ec368dd18c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-gsm-manuals[master]: apply rename of resource nitb_iface to ip_address

2017-05-24 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icbbb7d921e7340739883650f778d5a7341840875
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-manuals
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


[MERGED] osmo-pcu[master]: Print human-readable BSSGP PDU type

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Print human-readable BSSGP PDU type
..


Print human-readable BSSGP PDU type

Change-Id: Ief4b5ce4e4020edaf771eaa24f4382ec368dd18c
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 9 insertions(+), 8 deletions(-)

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



diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 7c325ae..e73a8c0 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -209,7 +209,7 @@
 static int gprs_bssgp_pcu_rx_ptp(struct msgb *msg, struct tlv_parsed *tp, 
struct bssgp_bvc_ctx *bctx)
 {
struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) 
msgb_bssgph(msg);
-   uint8_t pdu_type = bgph->pdu_type;
+   enum bssgp_pdu_type pdu_type = (enum bssgp_pdu_type) bgph->pdu_type;
unsigned rc = 0;
 
if (!bctx)
@@ -248,7 +248,7 @@
LOGP(DBSSGP, LOGL_DEBUG, "rx BSSGP_PDUT_FLOW_CONTROL_MS_ACK\n");
break;
default:
-   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u PDU type 0x%02x 
unknown\n", bctx->bvci, pdu_type);
+   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u PDU type 0x%02x 
unknown\n", bctx->bvci, bssgp_pdu_str(pdu_type));
rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg);
break;
}
@@ -259,9 +259,10 @@
 static int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, 
struct bssgp_bvc_ctx *bctx)
 {
struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) 
msgb_bssgph(msg);
+   enum bssgp_pdu_type pdu_type = (enum bssgp_pdu_type) bgph->pdu_type;
int rc = 0;
int bvci = bctx ? bctx->bvci : -1;
-   switch (bgph->pdu_type) {
+   switch (pdu_type) {
case BSSGP_PDUT_STATUS:
/* Some exception has occurred */
DEBUGP(DBSSGP, "BSSGP BVCI=%d Rx BVC STATUS\n", bvci);
@@ -311,8 +312,8 @@
LOGP(DBSSGP, LOGL_DEBUG, "rx BSSGP_PDUT_SGSN_INVOKE_TRACE\n");
break;
default:
-   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%d Rx PDU type 0x%02x 
unknown\n",
-   bvci, bgph->pdu_type);
+   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%d Rx PDU type %s 
unknown\n",
+bvci, bssgp_pdu_str(pdu_type));
rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg);
break;
}
@@ -324,7 +325,7 @@
struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) 
msgb_bssgph(msg);
struct bssgp_ud_hdr *budh = (struct bssgp_ud_hdr *) msgb_bssgph(msg);
struct tlv_parsed tp;
-   uint8_t pdu_type = bgph->pdu_type;
+   enum bssgp_pdu_type pdu_type = (enum bssgp_pdu_type) bgph->pdu_type;
uint16_t ns_bvci = msgb_bvci(msg);
int data_len;
int rc = 0;
@@ -358,8 +359,8 @@
 && pdu_type != BSSGP_PDUT_PAGING_PS)
{
LOGP(DBSSGP, LOGL_NOTICE, "NSEI=%u/BVCI=%u Rejecting PDU "
-   "type %u for unknown BVCI\n", msgb_nsei(msg), ns_bvci,
-   pdu_type);
+   "type %s for unknown BVCI\n", msgb_nsei(msg), ns_bvci,
+   bssgp_pdu_str(pdu_type));
return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg);
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ief4b5ce4e4020edaf771eaa24f4382ec368dd18c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: Implement basic Get Attribute responder

2017-05-24 Thread Harald Welte

Patch Set 6:

(3 comments)

https://gerrit.osmocom.org/#/c/2545/6/src/common/oml.c
File src/common/oml.c:

Line 174:   uint16_t i, r = 1; /* byte 0 is reserved for unsupported 
attributes counter */
i think the variables are named un-intuitive.  Using 'i' as a loop counter in a 
for loop, ok.  But what is "r" here?  Something like the number of output bytes 
or output attributes? If so, please name it more descriptively.


Line 213:   return i;
why do we return "i" and just set "i" to something computed from "r" above, 
rather than returning r directly? or the other way: Why are we re-using the 'i' 
loop counter for something that's not the loop count and then returning it?  I 
think this makes the code hard to understand.


Line 220:   uint8_t resp[MAX_VERSION_LENGTH * attr_len * 2]; /* heuristic 
for ARI space requirements */
ARI?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I09f95ed995fab5def9dc6e8cc201012fba4db28d
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: Yes


osmo-hlr[master]: install hlr.sql in prefix/doc/osmo-hlr/

2017-05-24 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-hlr[master]: install hlr.sql in prefix/doc/osmo-hlr/

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: install hlr.sql in prefix/doc/osmo-hlr/
..


install hlr.sql in prefix/doc/osmo-hlr/

In particular I need this to start a fresh osmo-hlr instance on the
osmo-gsm-tester. Might also come in handy during packaging?

Change-Id: I08e48375814ab93691892299d34909c6d0bf12a2
---
M debian/osmo-hlr.install
M sql/Makefile.am
2 files changed, 4 insertions(+), 0 deletions(-)

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



diff --git a/debian/osmo-hlr.install b/debian/osmo-hlr.install
index 028b9b3..114df0b 100644
--- a/debian/osmo-hlr.install
+++ b/debian/osmo-hlr.install
@@ -1 +1,2 @@
 /usr/bin/osmo-hlr
+/usr/share/doc/osmo-hlr/hlr.sql
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 059a571..ab44e2a 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -2,3 +2,6 @@
hlr_data.sql \
hlr.sql \
$(NULL)
+
+docsdir = $(datadir)/doc/osmo-hlr
+docs_DATA = $(srcdir)/hlr.sql

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

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


[MERGED] libosmocore[master]: Distinguish between unsupported and invalid MCS

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Distinguish between unsupported and invalid MCS
..


Distinguish between unsupported and invalid MCS

Previously MCS0 was incorrectly set for some of type1 header values
while according to 3GPP TS 44.060 it can only be set for type3. Fix
this:

* use EGPRS_MCS* constants instead of magic values
* do not set MCS0 for reserved bits values in EGPRS header type1
* return different error codes for invalid and unsupported MCS as well
  as for other decoding errors

Note: there's no need to adjust tests because MCS0 decoding is not
supported but it's better to explicitly distinguish between unsupported
and invalid values nevertheless.

Change-Id: Id665d5c0cf50efa18b1bcbf4f17359418a380f9e
Related: OS#1524
---
M src/coding/gsm0503_coding.c
M src/gsm/gprs_rlc.c
2 files changed, 63 insertions(+), 59 deletions(-)

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



diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c
index 30ec387..baf1ce1 100644
--- a/src/coding/gsm0503_coding.c
+++ b/src/coding/gsm0503_coding.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -820,15 +821,17 @@
if ((nbits != GSM0503_GPRS_BURSTS_NBITS) &&
(nbits != GSM0503_EGPRS_BURSTS_NBITS)) {
/* Invalid EGPRS bit length */
-   return -1;
+   return -EOVERFLOW;
}
 
hdr = (union gprs_rlc_ul_hdr_egprs *) l2_data;
type = egprs_decode_hdr(hdr, bursts, nbits);
if (egprs_parse_ul_cps(&cps, hdr, type) < 0)
-   return -1;
+   return -EIO;
 
switch (cps.mcs) {
+   case EGPRS_MCS0:
+   return -ENOTSUP;
case EGPRS_MCS1:
case EGPRS_MCS2:
case EGPRS_MCS3:
@@ -846,7 +849,7 @@
break;
default:
/* Invalid MCS-X */
-   return -1;
+   return -EINVAL;
}
 
/* Decode MCS-X block, where X = cps.mcs */
@@ -854,19 +857,19 @@
rc = egprs_decode_data(l2_data, dc, cps.mcs, cps.p[0],
0, n_errors, n_bits_total);
if (rc < 0)
-   return -1;
+   return -EFAULT;
} else {
/* MCS-7,8,9 block 1 */
rc = egprs_decode_data(l2_data, c1, cps.mcs, cps.p[0],
0, n_errors, n_bits_total);
if (rc < 0)
-   return -1;
+   return -EFAULT;
 
/* MCS-7,8,9 block 2 */
rc = egprs_decode_data(l2_data, c2, cps.mcs, cps.p[1],
1, n_errors, n_bits_total);
if (rc < 0)
-   return -1;
+   return -EFAULT;
}
 
return rc;
diff --git a/src/gsm/gprs_rlc.c b/src/gsm/gprs_rlc.c
index d6ccbbe..a4053ef 100644
--- a/src/gsm/gprs_rlc.c
+++ b/src/gsm/gprs_rlc.c
@@ -2,6 +2,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #define EGPRS_CPS_TYPE1_TBL_SZ 29
@@ -10,35 +11,35 @@
 
 /* 3GPP TS 44.060 10.4.8a.1.1 "Header type 1" */
 static const struct egprs_cps egprs_cps_table_type1[EGPRS_CPS_TYPE1_TBL_SZ] = {
-   { .bits =  0, .mcs = 9, .p = { EGPRS_CPS_P1, EGPRS_CPS_P1 } },
-   { .bits =  1, .mcs = 9, .p = { EGPRS_CPS_P1, EGPRS_CPS_P2 } },
-   { .bits =  2, .mcs = 9, .p = { EGPRS_CPS_P1, EGPRS_CPS_P3 } },
-   { .bits =  3, .mcs = 0, .p = { EGPRS_CPS_NONE, EGPRS_CPS_NONE } },
-   { .bits =  4, .mcs = 9, .p = { EGPRS_CPS_P2, EGPRS_CPS_P1 } },
-   { .bits =  5, .mcs = 9, .p = { EGPRS_CPS_P2, EGPRS_CPS_P2 } },
-   { .bits =  6, .mcs = 9, .p = { EGPRS_CPS_P2, EGPRS_CPS_P3 } },
-   { .bits =  7, .mcs = 0, .p = { EGPRS_CPS_NONE, EGPRS_CPS_NONE } },
-   { .bits =  8, .mcs = 9, .p = { EGPRS_CPS_P3, EGPRS_CPS_P1 } },
-   { .bits =  9, .mcs = 9, .p = { EGPRS_CPS_P3, EGPRS_CPS_P2 } },
-   { .bits = 10, .mcs = 9, .p = { EGPRS_CPS_P3, EGPRS_CPS_P3 } },
-   { .bits = 11, .mcs = 8, .p = { EGPRS_CPS_P1, EGPRS_CPS_P1 } },
-   { .bits = 12, .mcs = 8, .p = { EGPRS_CPS_P1, EGPRS_CPS_P2 } },
-   { .bits = 13, .mcs = 8, .p = { EGPRS_CPS_P1, EGPRS_CPS_P3 } },
-   { .bits = 14, .mcs = 8, .p = { EGPRS_CPS_P2, EGPRS_CPS_P1 } },
-   { .bits = 15, .mcs = 8, .p = { EGPRS_CPS_P2, EGPRS_CPS_P2 } },
-   { .bits = 16, .mcs = 8, .p = { EGPRS_CPS_P2, EGPRS_CPS_P3 } },
-   { .bits = 17, .mcs = 8, .p = { EGPRS_CPS_P3, EGPRS_CPS_P1 } },
-   { .bits = 18, .mcs = 8, .p = { EGPRS_CPS_P3, EGPRS_CPS_P2 } },
-   { .bits = 19, .mcs = 8, .p = { EGPRS_CPS_P3, EGPRS_CPS_P3 } },
-   { .bits = 20, .mcs = 7, .p = { EGPRS_CPS_P1, EGPRS_CPS_P1 } },
-   { .bits = 21, .mcs = 7, .p = { EGPRS_CPS_P1, EGPRS_CPS_P2 } },
-  

libosmocore[master]: Distinguish between unsupported and invalid MCS

2017-05-24 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id665d5c0cf50efa18b1bcbf4f17359418a380f9e
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou 
Gerrit-Reviewer: fixeria 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: Add human-readable names for signal_ns

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add human-readable names for signal_ns
..


Add human-readable names for signal_ns

Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd
Related: SYS#3610
---
M include/osmocom/gprs/gprs_ns.h
M src/gb/gprs_ns.c
M src/gb/libosmogb.map
3 files changed, 13 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h
index 130d8c0..9cebbd6 100644
--- a/include/osmocom/gprs/gprs_ns.h
+++ b/include/osmocom/gprs/gprs_ns.h
@@ -203,6 +203,8 @@
S_NS_MISMATCH, /* got an unexpected IE (sets msg, pdu_type, ie_type) */
 };
 
+extern const struct value_string gprs_ns_signal_ns_names[];
+
 struct ns_signal_data {
struct gprs_nsvc *nsvc;
struct gprs_nsvc *old_nsvc;
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index d0c5a17..23c0be8 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -150,6 +150,16 @@
.class_id = OSMO_STATS_CLASS_PEER,
 };
 
+const struct value_string gprs_ns_signal_ns_names[] = {
+   { S_NS_RESET,   "NS-RESET" },
+   { S_NS_BLOCK,   "NS-BLOCK" },
+   { S_NS_UNBLOCK, "NS-UNBLOCK" },
+   { S_NS_ALIVE_EXP,   "NS-ALIVE expired" },
+   { S_NS_REPLACED,"NSVC replaced" },
+   { S_NS_MISMATCH,"Unexpected IE" },
+   { 0, NULL }
+};
+
 #define CHECK_TX_RC(rc, nsvc) \
if (rc < 0) 
\
LOGP(DNS, LOGL_ERROR, "TX failed (%d) to peer %s\n",
\
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 3ec3ee5..6aad8fd 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -38,6 +38,7 @@
 bssgp_vty_init;
 bssgp_nsi;
 
+gprs_ns_signal_ns_names;
 gprs_ns_pdu_strings;
 gprs_ns_cause_str;
 gprs_ns_destroy;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: Add human-readable names for signal_ns

2017-05-24 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: measurement: Improve log output

2017-05-24 Thread Harald Welte

Patch Set 6: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/2389/6/src/common/measurement.c
File src/common/measurement.c:

Line 140:   DEBUGP(DMEAS,
I think we can simply pass the lchan into "is_meas_complete" and replace the 
pchan, ts and subch arguments wih it.  At that point, we can use the 
gsm_lchan_name() function to get a descriptive log prefix.


Line 216:   if (!is_meas_complete(ts_pchan(lchan->ts), lchan->ts->nr,
this seems like the only caller of is_meas_complete() and it derives all three 
firsrt arguments from lchan. So as suggested above, pass the lchan into the 
function and avoid re-implemnenting gsm_lchan_name()


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic871eed6dcbc7d10aca6cd11dbc803b3e6da449f
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-bts[master]: measurement: exclude idle channels from uplink measurement

2017-05-24 Thread Harald Welte

Patch Set 6: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I471a767c7974bdacadc3233d0c3e7b7965f6eafa
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


[MERGED] osmo-bts[master]: measurement: exclude idle channels from uplink measurement

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: measurement: exclude idle channels from uplink measurement
..


measurement: exclude idle channels from uplink measurement

The DATA-IND, received from the physical layer does not only include the actual
uplink data. It also includes the frames which are received when the channel
is idle (which is just noise). This would falsify the measurement results.

Depending on the BTS model, the phy may also filter the idle frames and not
send a DATA-IND at all, when the channel is idle. If this is the case, the
measurement period end can not be detected properly.

The idle frames are located at the very end of each measurement period. In
order to fix the issue, the measurement perioud has to end early. For TCH/F and
TCH/H 1, one frame has to be skipped. For TCH/H 0 two frames are skipped.

Example: For a TCH/F in TS0, the Measurement perioud would end at frame number
103. However, 103 is reserverd as idle frame. So we need to detect the end of
the measurement period at frame number 103 (-1).

Change-Id: I471a767c7974bdacadc3233d0c3e7b7965f6eafa
---
M src/common/measurement.c
1 file changed, 29 insertions(+), 24 deletions(-)

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



diff --git a/src/common/measurement.c b/src/common/measurement.c
index 260304a..22ab27c 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -24,35 +24,40 @@
  * 7 6 and 791 to 90 103, 25,  51,  77 */
 
 /* measurement period ends at fn % 104 == ? */
+/* Added (-1) offset in DATA-IND frame number to align with Meas period ends */
 static const uint8_t tchf_meas_rep_fn104[] = {
-   [0] =   103,
-   [1] =   12,
-   [2] =   25,
-   [3] =   38,
-   [4] =   51,
-   [5] =   64,
-   [6] =   77,
-   [7] =   90,
+   [0] =   103 - 1,
+   [1] =   12 - 1,
+   [2] =   25 - 1,
+   [3] =   38 - 1,
+   [4] =   51 - 1,
+   [5] =   64 - 1,
+   [6] =   77 - 1,
+   [7] =   90 - 1,
 };
+
+/* Added (-2) offset in DATA-IND frame number to align with Meas period ends */
 static const uint8_t tchh0_meas_rep_fn104[] = {
-   [0] =   103,
-   [1] =   103,
-   [2] =   25,
-   [3] =   25,
-   [4] =   51,
-   [5] =   51,
-   [6] =   77,
-   [7] =   77,
+   [0] =   103 - 2,
+   [1] =   103 - 2,
+   [2] =   25 - 2,
+   [3] =   25 - 2,
+   [4] =   51 - 2,
+   [5] =   51 - 2,
+   [6] =   77 - 2,
+   [7] =   77 - 2,
 };
+
+/* Added (-1) offset in DATA-IND frame number to align with Meas period ends */
 static const uint8_t tchh1_meas_rep_fn104[] = {
-   [0] =   12,
-   [1] =   12,
-   [2] =   38,
-   [3] =   38,
-   [4] =   64,
-   [5] =   64,
-   [6] =   90,
-   [7] =   90,
+   [0] =   12 - 1,
+   [1] =   12 - 1,
+   [2] =   38 - 1,
+   [3] =   38 - 1,
+   [4] =   64 - 1,
+   [5] =   64 - 1,
+   [6] =   90 - 1,
+   [7] =   90 - 1,
 };
 
 /* Measurment reporting period for SDCCH8 and SDCCH4 chan

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I471a767c7974bdacadc3233d0c3e7b7965f6eafa
Gerrit-PatchSet: 7
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


osmo-bts[master]: octphy: integrate channel measurement handling

2017-05-24 Thread Harald Welte

Patch Set 6: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0f053bb10b1cb112a8814ee591969d607888e686
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-pcu[master]: Fix typo in logging

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Fix typo in logging
..


Fix typo in logging

DL-TBD was errorneously printed as UL-TBF.

Change-Id: I94a224c0339a062e4c8d5aa6c4c858f3f0298a0d
---
M src/bts.cpp
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/bts.cpp b/src/bts.cpp
index e25c47b..61c9321 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -986,7 +986,7 @@
if (ms)
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET CONTROL ACK with "
 "unknown TBF corresponds to MS with IMSI %s, TA 
%d, "
-"uTBF (TFI=%d, state=%s), uTBF (TFI=%d, 
state=%s)\n",
+"uTBF (TFI=%d, state=%s), dTBF (TFI=%d, 
state=%s)\n",
 ms->imsi(), ms->ta(),
 ms->ul_tbf() ? ms->ul_tbf()->tfi() : 0,
 ms->ul_tbf() ? ms->ul_tbf()->state_name() : "None",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I94a224c0339a062e4c8d5aa6c4c858f3f0298a0d
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-pcu[master]: Fix typo in logging

2017-05-24 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I94a224c0339a062e4c8d5aa6c4c858f3f0298a0d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-pcu[master]: Cleanup FN scheduling

2017-05-24 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmocom-bb[master]: host/mobile: use talloc for ms->name allocation

2017-05-24 Thread Harald Welte

Patch Set 3: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/2667/3/src/host/layer23/src/mobile/vty_interface.c
File src/host/layer23/src/mobile/vty_interface.c:

Line 1268:  talloc_free(ms->name);
please use osmo_talloc_replace_string() in situations like this.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: Yes


[PATCH] osmo-bts[master]: measurement: fix measurement computation of reported timing ...

2017-05-24 Thread Harald Welte
dex a0060df..8ff8522 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2279,7 +2279,8 @@
msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->meas.bts_tx_pwr);
if (lchan->meas.flags & LC_UL_M_F_L1_VALID) {
msgb_tv_fixed_put(msg, RSL_IE_L1_INFO, 2, lchan->meas.l1_info);
-   lchan->meas.flags &= ~LC_UL_M_F_L1_VALID;
+   /* Note: L1 info valid flag is cleared by function
+* lchan_meas_update_ordered_TA() in measurement.c */
}
msgb_tl16v_put(msg, RSL_IE_L3_INFO, l3_len, l3);
if (ms_to_valid(lchan)) {

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2e0dfd13b53e8aa2822985f12bf2985e683ab553
Gerrit-PatchSet: 7
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: measurement: fix measurement computation of reported timing ...

2017-05-24 Thread Harald Welte

Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2e0dfd13b53e8aa2822985f12bf2985e683ab553
Gerrit-PatchSet: 7
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-netif[master]: somo_stream_srv_fd_cb(): close socket if NODELAY fails

2017-05-24 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] libosmo-netif[master]: somo_stream_srv_fd_cb(): close socket if NODELAY fails

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: somo_stream_srv_fd_cb(): close socket if NODELAY fails
..


somo_stream_srv_fd_cb(): close socket if NODELAY fails

We didn't check for cases where setsockopt_nodelay() fails.  Let's check
for that and bail out + close the socket.

Change-Id: I0adbc4cec35be7c36bdf01d4d8fefd6097e9be5d
Fixes: coverity CID#166970
---
M src/stream.c
1 file changed, 14 insertions(+), 8 deletions(-)

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



diff --git a/src/stream.c b/src/stream.c
index add08b8..b96293e 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -431,17 +431,23 @@
osmo_stream_cli_reconnect(cli);
return ret;
}
-
-   if (cli->flags & OSMO_STREAM_CLI_F_NODELAY)
-   setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
-
cli->ofd.fd = ret;
-   if (osmo_fd_register(&cli->ofd) < 0) {
-   close(ret);
-   cli->ofd.fd = -1;
-   return -EIO;
+
+   if (cli->flags & OSMO_STREAM_CLI_F_NODELAY) {
+   ret = setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
+   if (ret < 0)
+   goto error_close_socket;
}
+
+   if (osmo_fd_register(&cli->ofd) < 0)
+   goto error_close_socket;
+
return 0;
+
+error_close_socket:
+   close(ret);
+   cli->ofd.fd = -1;
+   return -EIO;
 }
 
 /*! \brief Set the NODELAY socket option to avoid Nagle-like behavior

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0adbc4cec35be7c36bdf01d4d8fefd6097e9be5d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmocom-bb[master]: mobile/gsm480_ss.c: fix copy-paste error

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mobile/gsm480_ss.c: fix copy-paste error
..


mobile/gsm480_ss.c: fix copy-paste error

Change-Id: I23287c0f31bee9c1b710f17f932633d2c621dab0
---
M src/host/layer23/src/mobile/gsm480_ss.c
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/src/host/layer23/src/mobile/gsm480_ss.c 
b/src/host/layer23/src/mobile/gsm480_ss.c
index d626a0e..4d46d64 100644
--- a/src/host/layer23/src/mobile/gsm480_ss.c
+++ b/src/host/layer23/src/mobile/gsm480_ss.c
@@ -897,8 +897,8 @@
case 0x85:
if (((tag_data[0] & 0x70) >> 4) == 1)
strcpy(number, "+");
-   else if (((tag_data[0] & 0x70) >> 4) == 1)
-   strcpy(number, "+");
+   else if (((tag_data[0] & 0x70) >> 4) == 2)
+   strcpy(number, "0");
else
number[0] = '\0';
gsm48_decode_bcd_number(number + strlen(number),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I23287c0f31bee9c1b710f17f932633d2c621dab0
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] osmocom-bb[master]: mobile/gsm48_rr.c: fix BA range exceed check

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mobile/gsm48_rr.c: fix BA range exceed check
..


mobile/gsm48_rr.c: fix BA range exceed check

Change-Id: Ic2ebe9faeeda7ce812527962d209e6049f2dfc75
---
M src/host/layer23/src/mobile/gsm48_rr.c
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/src/host/layer23/src/mobile/gsm48_rr.c 
b/src/host/layer23/src/mobile/gsm48_rr.c
index 9b3f0f9..b821457 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -146,11 +146,13 @@
*ranges = 0;
return -EINVAL;
}
-   if (max_ranges > n)
+
+   if (n > max_ranges) {
LOGP(DRR, LOGL_NOTICE, "BA range %d exceed the maximum number "
"of ranges supported by this mobile (%d).\n",
n, max_ranges);
n = max_ranges;
+   }
 
/* decode ranges */
for (i = 0; i < n; i++) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2ebe9faeeda7ce812527962d209e6049f2dfc75
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmocom-bb[master]: mobile/gsm322.c: check fwrite() return value

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mobile/gsm322.c: check fwrite() return value
..


mobile/gsm322.c: check fwrite() return value

Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
---
M src/host/layer23/src/mobile/gsm322.c
1 file changed, 12 insertions(+), 9 deletions(-)

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



diff --git a/src/host/layer23/src/mobile/gsm322.c 
b/src/host/layer23/src/mobile/gsm322.c
index 9166089..089813c 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -5111,6 +5111,7 @@
char filename[PATH_MAX];
struct gsm322_ba_list *ba;
uint8_t buf[4];
+   int rc = 0;
int i;
 
LOGP(DPLMN, LOGL_INFO, "exit PLMN process\n");
@@ -5139,23 +5140,25 @@
sprintf(filename, "%s/%s.ba", config_dir, ms->name);
fp = fopen(filename, "w");
if (fp) {
-   int rc;
-
fputs(ba_version, fp);
llist_for_each_entry(ba, &cs->ba_list, entry) {
buf[0] = ba->mcc >> 8;
buf[1] = ba->mcc & 0xff;
buf[2] = ba->mnc >> 8;
buf[3] = ba->mnc & 0xff;
-   rc = fwrite(buf, 4, 1, fp);
-   rc = fwrite(ba->freq, sizeof(ba->freq), 1, fp);
-   LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
-   "mnc=%s  %s, %s)\n", gsm_print_mcc(ba->mcc),
-   gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
-   gsm_get_mnc(ba->mcc, ba->mnc));
+
+   rc += fwrite(buf, 4, 1, fp);
+   rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
}
fclose(fp);
-   } else
+   }
+
+   if (rc == 2)
+   LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
+   "mnc=%s  %s, %s)\n", gsm_print_mcc(ba->mcc),
+   gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
+   gsm_get_mnc(ba->mcc, ba->mnc));
+   else
LOGP(DCS, LOGL_ERROR, "Failed to write BA list\n");
 
/* free lists */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] osmocom-bb[master]: mobile/gsm480_ss.c: gsm480_mmss_ind: return rc

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mobile/gsm480_ss.c: gsm480_mmss_ind: return rc
..


mobile/gsm480_ss.c: gsm480_mmss_ind: return rc

Change-Id: Iabaccdbdfc5a5eb6424bd1603f405241650f13d8
---
M src/host/layer23/src/mobile/gsm480_ss.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/host/layer23/src/mobile/gsm480_ss.c 
b/src/host/layer23/src/mobile/gsm480_ss.c
index 4d46d64..8d025e9 100644
--- a/src/host/layer23/src/mobile/gsm480_ss.c
+++ b/src/host/layer23/src/mobile/gsm480_ss.c
@@ -1243,7 +1243,8 @@
gsm480_trans_free(trans);
rc = -ENOTSUP;
}
-   return 0;
+
+   return rc;
 }
 
 /* receive message from MM layer */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iabaccdbdfc5a5eb6424bd1603f405241650f13d8
Gerrit-PatchSet: 4
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmocom-bb[master]: mobile/gsm48_mm.c: strip unused variable

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mobile/gsm48_mm.c: strip unused variable
..


mobile/gsm48_mm.c: strip unused variable

Change-Id: I2708628263bec4bc6bf53a357928e23609b40c64
---
M src/host/layer23/src/mobile/gsm48_mm.c
1 file changed, 0 insertions(+), 2 deletions(-)

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



diff --git a/src/host/layer23/src/mobile/gsm48_mm.c 
b/src/host/layer23/src/mobile/gsm48_mm.c
index 46b641c..100129b 100644
--- a/src/host/layer23/src/mobile/gsm48_mm.c
+++ b/src/host/layer23/src/mobile/gsm48_mm.c
@@ -777,11 +777,9 @@
 {
struct gsm48_mmlayer *mm = &ms->mmlayer;
struct msgb *msg;
-   struct gsm48_mmr *mmr;
int work = 0;
 
while ((msg = msgb_dequeue(&mm->mmr_downqueue))) {
-   mmr = (struct gsm48_mmr *) msg->data;
gsm48_rcv_mmr(ms, msg);
msgb_free(msg);
work = 1; /* work done */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2708628263bec4bc6bf53a357928e23609b40c64
Gerrit-PatchSet: 4
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmocom-bb[master]: mobile/gsm322.c: fix mcc/mnc typo

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mobile/gsm322.c: fix mcc/mnc typo
..


mobile/gsm322.c: fix mcc/mnc typo

Change-Id: I4a3aaa0465598b17ccd30ec4cbeb90429216540e
---
M src/host/layer23/src/mobile/gsm322.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/host/layer23/src/mobile/gsm322.c 
b/src/host/layer23/src/mobile/gsm322.c
index 089813c..993e5ca 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -2144,7 +2144,7 @@
return -ENOMEM;
ngm = (struct gsm322_msg *) nmsg->data;
ngm->mcc = mcc;
-   ngm->mnc = mcc;
+   ngm->mnc = mnc;
gsm322_plmn_sendmsg(ms, nmsg);
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a3aaa0465598b17ccd30ec4cbeb90429216540e
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmocom-bb[master]: sap_interface.c: drop meaningless condition

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: sap_interface.c: drop meaningless condition
..


sap_interface.c: drop meaningless condition

If sap_state is equal to SAP_NOT_CONNECTED, it cannot
be equal to another value at the same time. So the
second part of condition doesn't make sense.

Change-Id: I3038fc15745dc4be796d894002524e6b2dd5c90e
---
M src/host/layer23/src/common/sap_interface.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/host/layer23/src/common/sap_interface.c 
b/src/host/layer23/src/common/sap_interface.c
index 22f9550..fd19659 100644
--- a/src/host/layer23/src/common/sap_interface.c
+++ b/src/host/layer23/src/common/sap_interface.c
@@ -151,7 +151,7 @@
 
 static int osmosap_send(struct osmocom_ms *ms, struct msgb *msg)
 {
-   if(ms->sap_entity.sap_state == SAP_NOT_CONNECTED && 
!ms->sap_entity.sap_state == SAP_CONNECTION_UNDER_NEGOTIATION)
+   if(ms->sap_entity.sap_state == SAP_NOT_CONNECTED)
sap_connect(ms);
 
if (ms->sap_wq.bfd.fd <= 0)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3038fc15745dc4be796d894002524e6b2dd5c90e
Gerrit-PatchSet: 4
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] osmocom-bb[master]: host/app_mobile.c: do not exit in mobile_new()

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: host/app_mobile.c: do not exit in mobile_new()
..


host/app_mobile.c: do not exit in mobile_new()

Previously, if there was any error during a new osmocom_ms
structure allocation, the mobile_new() used to call exit()
directly. Since we always check return value of this function
it would be more correct to return NULL in any bad case.

Change-Id: I9a594dd1d133f0c0740dc3bff41633f94099b593
---
M src/host/layer23/src/mobile/app_mobile.c
1 file changed, 7 insertions(+), 6 deletions(-)

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



diff --git a/src/host/layer23/src/mobile/app_mobile.c 
b/src/host/layer23/src/mobile/app_mobile.c
index e076741..c74a93f 100644
--- a/src/host/layer23/src/mobile/app_mobile.c
+++ b/src/host/layer23/src/mobile/app_mobile.c
@@ -252,7 +252,7 @@
ms = talloc_zero(l23_ctx, struct osmocom_ms);
if (!ms) {
fprintf(stderr, "Failed to allocate MS\n");
-   exit(1);
+   return NULL;
}
llist_add_tail(&ms->entity, &ms_list);
 
@@ -423,11 +423,12 @@
 
printf("No Mobile Station defined, creating: MS '1'\n");
ms = mobile_new("1");
-   if (ms) {
-   rc = mobile_init(ms);
-   if (rc < 0)
-   return rc;
-   }
+   if (!ms)
+   return -1;
+
+   rc = mobile_init(ms);
+   if (rc < 0)
+   return rc;
}
 
quit = 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a594dd1d133f0c0740dc3bff41633f94099b593
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: Introduce build script for arm-none-eabi cross-compilations

2017-05-24 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e07fb9e60830dbd585f22d9c658c46252ce399f
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: Introduce build script for arm-none-eabi cross-compilations

2017-05-24 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Introduce build script for arm-none-eabi cross-compilations
..


Introduce build script for arm-none-eabi cross-compilations

This is a necessary step to use libosmocore-arm dep in OsmocomBB.

After this patch is submitted the "./contrib/jenkins.sh" line in
libosmocore jenkins jobs [1][2] needs to be replaced with:

  if [[ "$JOB_NAME" == *"arch=arm-none-eabi,label=linux_amd64_debian8"* ]]
  then
./contrib/jenkins-arm.sh
  else
# (FreeBSD && debian8)_amd64 builds
./contrib/jenkins.sh
  fi

Furthermore, the "arch" matrix-build axis has to be created,
holding "arm-none-eabi". Following combination filter is
necessary to skip cross-compilations on FreeBSD buildslave:

  !(arch=="arm-none-eabi" && label=="FreeBSD_amd64")

[1] https://jenkins.osmocom.org/jenkins/job/libosmocore/
[2] https://jenkins.osmocom.org/jenkins/job/libosmocore-gerrit/

Change-Id: I9e07fb9e60830dbd585f22d9c658c46252ce399f
---
A contrib/jenkins-arm.sh
1 file changed, 33 insertions(+), 0 deletions(-)

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



diff --git a/contrib/jenkins-arm.sh b/contrib/jenkins-arm.sh
new file mode 100755
index 000..e279821
--- /dev/null
+++ b/contrib/jenkins-arm.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -ex
+
+./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
+
+autoreconf --install --force
+./configure --enable-static --enable-sanitize \
+   --prefix=/usr/local/arm-none-eabi \
+   --host=arm-none-eabi \
+   --enable-embedded \
+   --disable-shared \
+   CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles 
-nodefaultlibs"
+
+$MAKE $PARALLEL_MAKE \
+   || cat-testlogs.sh
+
+# verify build in dir other than source tree
+rm -rf *
+git checkout .
+autoreconf --install --force
+mkdir builddir
+cd builddir
+
+../configure --enable-static \
+   --prefix=/usr/local/arm-none-eabi \
+   --host=arm-none-eabi \
+   --enable-embedded \
+   --disable-shared \
+   CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles 
-nodefaultlibs"
+
+$MAKE $PARALLEL_MAKE \
+   || cat-testlogs.sh

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9e07fb9e60830dbd585f22d9c658c46252ce399f
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


libosmocore[master]: Introduce build script for arm-none-eabi cross-compilations

2017-05-24 Thread Harald Welte

Patch Set 3:

will you take care of respective jenkins changes as outlined in the commit 
message? thanks!

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e07fb9e60830dbd585f22d9c658c46252ce399f
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmocom-bb[master]: Makefile: add forgotten gsmmap to (dist)clean section

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I14abe8a061d218ca81dd2d101b218d3030324aa2
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[MERGED] osmocom-bb[master]: Makefile: add forgotten gsmmap to (dist)clean section

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Makefile: add forgotten gsmmap to (dist)clean section
..


Makefile: add forgotten gsmmap to (dist)clean section

Change-Id: I14abe8a061d218ca81dd2d101b218d3030324aa2
---
M src/Makefile
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/src/Makefile b/src/Makefile
index a145880..00231a6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -85,6 +85,7 @@
make -C shared/libosmocore/build-target $@
make -C host/layer23 $@
make -C host/osmocon $@
+   make -C host/gsmmap $@
make -C target/firmware $@
make -C target/firmware -f Makefile.mtk $@
 
@@ -92,5 +93,6 @@
rm -rf shared/libosmocore/build-target
make -C host/layer23 $@
make -C host/osmocon $@
+   make -C host/gsmmap $@
 # 'firmware' also handles 'mtk-firmware'
make -C target/firmware $@

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I14abe8a061d218ca81dd2d101b218d3030324aa2
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


osmocom-bb[master]: host/mobile: use talloc for ms->name allocation

2017-05-25 Thread Harald Welte

Patch Set 4: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/2667/4/src/host/layer23/src/mobile/app_mobile.c
File src/host/layer23/src/mobile/app_mobile.c:

Line 273:   mncc_name = talloc_asprintf(ms, "/tmp/ms_mncc_%s", 
ms->name);
mncc_name variable declaration could go inside the 'if' block as it's not used 
anywhere outside. but nevermind.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
Gerrit-PatchSet: 4
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


[MERGED] osmocom-bb[master]: host/mobile: use talloc for ms->name allocation

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: host/mobile: use talloc for ms->name allocation
..


host/mobile: use talloc for ms->name allocation

The approach of talloc memory management reduces memory usage,
and prevents some buffer overflows, which were possible before.

Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
---
M src/host/layer23/include/osmocom/bb/common/osmocom_data.h
M src/host/layer23/src/common/main.c
M src/host/layer23/src/mobile/app_mobile.c
M src/host/layer23/src/mobile/gsm322.c
M src/host/layer23/src/mobile/vty_interface.c
5 files changed, 32 insertions(+), 27 deletions(-)

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



diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h 
b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
index 17dad10..9b544ab 100644
--- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
+++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
@@ -57,7 +57,7 @@
 /* One Mobilestation for osmocom */
 struct osmocom_ms {
struct llist_head entity;
-   char name[32];
+   char *name;
struct osmo_wqueue l2_wq, sap_wq;
uint16_t test_arfcn;
struct osmol1_entity l1_entity;
diff --git a/src/host/layer23/src/common/main.c 
b/src/host/layer23/src/common/main.c
index 59cee03..693b10e 100644
--- a/src/host/layer23/src/common/main.c
+++ b/src/host/layer23/src/common/main.c
@@ -246,8 +246,7 @@
 
llist_add_tail(&ms->entity, &ms_list);
 
-   sprintf(ms->name, "1");
-
+   ms->name = talloc_strdup(ms, "1");
ms->test_arfcn = 871;
 
handle_options(argc, argv);
diff --git a/src/host/layer23/src/mobile/app_mobile.c 
b/src/host/layer23/src/mobile/app_mobile.c
index c74a93f..7dc7208 100644
--- a/src/host/layer23/src/mobile/app_mobile.c
+++ b/src/host/layer23/src/mobile/app_mobile.c
@@ -248,18 +248,21 @@
 struct osmocom_ms *mobile_new(char *name)
 {
static struct osmocom_ms *ms;
+   char *mncc_name;
 
ms = talloc_zero(l23_ctx, struct osmocom_ms);
if (!ms) {
fprintf(stderr, "Failed to allocate MS\n");
return NULL;
}
-   llist_add_tail(&ms->entity, &ms_list);
 
-   strcpy(ms->name, name);
-
+   talloc_set_name(ms, "ms_%s", name);
+   ms->name = talloc_strdup(ms, name);
ms->l2_wq.bfd.fd = -1;
ms->sap_wq.bfd.fd = -1;
+
+   /* Register a new MS */
+   llist_add_tail(&ms->entity, &ms_list);
 
gsm_support_init(ms);
gsm_settings_init(ms);
@@ -267,13 +270,12 @@
ms->shutdown = 3; /* being down */
 
if (mncc_recv_app) {
-   char name[32];
-
-   sprintf(name, "/tmp/ms_mncc_%s", ms->name);
+   mncc_name = talloc_asprintf(ms, "/tmp/ms_mncc_%s", ms->name);
 
ms->mncc_entity.mncc_recv = mncc_recv_app;
-   ms->mncc_entity.sock_state = mncc_sock_init(ms, name, l23_ctx);
+   ms->mncc_entity.sock_state = mncc_sock_init(ms, mncc_name, 
l23_ctx);
 
+   talloc_free(mncc_name);
} else if (ms->settings.ch_cap == GSM_CAP_SDCCH)
ms->mncc_entity.mncc_recv = mncc_recv_dummy;
else
diff --git a/src/host/layer23/src/mobile/gsm322.c 
b/src/host/layer23/src/mobile/gsm322.c
index 993e5ca..ad6a83b 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -5028,7 +5028,7 @@
struct gsm322_plmn *plmn = &ms->plmn;
struct gsm322_cellsel *cs = &ms->cellsel;
FILE *fp;
-   char filename[PATH_MAX];
+   char *ba_filename;
int i;
struct gsm322_ba_list *ba;
uint8_t buf[4];
@@ -5060,8 +5060,9 @@
cs->list[i].flags |= GSM322_CS_FLAG_SUPPORT;
 
/* read BA list */
-   sprintf(filename, "%s/%s.ba", config_dir, ms->name);
-   fp = fopen(filename, "r");
+   ba_filename = talloc_asprintf(ms, "%s/%s.ba", config_dir, ms->name);
+   fp = fopen(ba_filename, "r");
+   talloc_free(ba_filename);
if (fp) {
int rc;
char *s_rc;
@@ -5108,7 +5109,7 @@
struct llist_head *lh, *lh2;
struct msgb *msg;
FILE *fp;
-   char filename[PATH_MAX];
+   char *ba_filename;
struct gsm322_ba_list *ba;
uint8_t buf[4];
int rc = 0;
@@ -5137,20 +5138,23 @@
}
 
/* store BA list */
-   sprintf(filename, "%s/%s.ba", config_dir, ms->name);
-   fp = fopen(filename, "w");
-   if (fp) {
-   fputs(ba_version, fp);
-   llist_for_each_entry(ba, &cs->ba_list, entr

[PATCH] openbsc[master]: gsm_data_shared: add value strings for gsm_chreq

2017-05-25 Thread Harald Welte
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/2031

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

gsm_data_shared: add value strings for gsm_chreq

Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae
---
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libcommon/gsm_data_shared.c
2 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/31/2031/5

diff --git a/openbsc/include/openbsc/gsm_data_shared.h 
b/openbsc/include/openbsc/gsm_data_shared.h
index 9495f93..e7c8467 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -889,6 +889,7 @@
 enum gsm_bts_type_variant str2btsvariant(const char *arg);
 const char *btsvariant2str(enum gsm_bts_type_variant v);
 
+extern const struct value_string gsm_chreq_descs[];
 const struct value_string gsm_pchant_names[13];
 const struct value_string gsm_pchant_descs[13];
 const char *gsm_pchan_name(enum gsm_phys_chan_config c);
diff --git a/openbsc/src/libcommon/gsm_data_shared.c 
b/openbsc/src/libcommon/gsm_data_shared.c
index 156167d..f404363 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -106,6 +106,16 @@
return get_value_string(bts_type_names, type);
 }
 
+const struct value_string gsm_chreq_descs[] = {
+   { GSM_CHREQ_REASON_EMERG,   "emergency call" },
+   { GSM_CHREQ_REASON_PAG, "answer to paging" },
+   { GSM_CHREQ_REASON_CALL,"call re-establishment" },
+   { GSM_CHREQ_REASON_LOCATION_UPD,"Location updating" },
+   { GSM_CHREQ_REASON_PDCH,"one phase packet access" },
+   { GSM_CHREQ_REASON_OTHER,   "other" },
+   { 0,NULL }
+};
+
 const struct value_string gsm_pchant_names[13] = {
{ GSM_PCHAN_NONE,   "NONE" },
{ GSM_PCHAN_CCCH,   "CCCH" },

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae
Gerrit-PatchSet: 5
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 


[PATCH] openbsc[master]: libbsc: add debug log message to S_L_INP_* callbacks

2017-05-25 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2041

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

libbsc: add debug log message to S_L_INP_* callbacks

Improve debug log output of input callbacks by adding a line containing
the signal event name.

Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2
---
M openbsc/src/libbsc/bsc_init.c
M openbsc/src/libbsc/bts_ericsson_rbs2000.c
2 files changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/41/2041/2

diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index cda4350..2af846e 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -320,6 +320,7 @@
 
switch (signal) {
case S_L_INP_TEI_UP:
+   LOGP(DLMI, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_UP\n", 
__func__);
if (isd->link_type == E1INP_SIGN_OML) {
/* TODO: this is required for the Nokia BTS, hopping is 
configured
   during OML, other MA is not set.  */
@@ -344,6 +345,7 @@
bootstrap_rsl(trx);
break;
case S_L_INP_TEI_DN:
+   LOGP(DLMI, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_DN\n", 
__func__);
LOGP(DLMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", 
isd->link_type, trx);
 
if (isd->link_type == E1INP_SIGN_OML)
diff --git a/openbsc/src/libbsc/bts_ericsson_rbs2000.c 
b/openbsc/src/libbsc/bts_ericsson_rbs2000.c
index 0cae6d8..1c0fa1a 100644
--- a/openbsc/src/libbsc/bts_ericsson_rbs2000.c
+++ b/openbsc/src/libbsc/bts_ericsson_rbs2000.c
@@ -116,6 +116,7 @@
 
switch (signal) {
case S_L_INP_TEI_UP:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_UP\n", 
__func__);
switch (isd->link_type) {
case E1INP_SIGN_OML:
if (isd->trx->bts->type != GSM_BTS_TYPE_RBS2000)
@@ -128,6 +129,7 @@
}
break;
case S_L_INP_TEI_DN:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_DN\n", 
__func__);
if (isd->trx->bts->type != GSM_BTS_TYPE_RBS2000)
break;
LOGP(DNM, LOGL_NOTICE, "Line-%u TS-%u TEI-%u SAPI-%u: Link "
@@ -139,7 +141,9 @@
lapd_sap_start(e1i_ts->lapd, isd->tei, isd->sapi);
break;
case S_L_INP_LINE_INIT:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_LINE_INIT\n", 
__func__);
case S_L_INP_LINE_NOALARM:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_LINE_NOALARM\n", 
__func__);
if (strcasecmp(isd->line->driver->name, "DAHDI")
 && strcasecmp(isd->line->driver->name, "MISDN_LAPD")
 && strcasecmp(isd->line->driver->name, "UNIXSOCKET"))
@@ -147,6 +151,7 @@
start_sabm_in_line(isd->line, 1);
break;
case S_L_INP_LINE_ALARM:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_LINE_ALARM\n", 
__func__);
if (strcasecmp(isd->line->driver->name, "DAHDI")
 && strcasecmp(isd->line->driver->name, "MISDN_LAPD")
 && strcasecmp(isd->line->driver->name, "UNIXSOCKET"))

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


openbsc[master]: pcu_sock: add basic pcu interface support

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


openbsc[master]: libbsc: add debug log message to S_L_INP_* callbacks

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


openbsc[master]: gsm_data_shared: add value strings for gsm_chreq

2017-05-25 Thread Harald Welte

Patch Set 5: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae
Gerrit-PatchSet: 5
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


openbsc[master]: pcu_sock: implement direct tlli on AGCH

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


openbsc[master]: pcu_sock: Send non-NULL hLayer1 to PCU

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8170bd4134904702b6b272e496100361ba473cbc
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


openbsc[master]: pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1f5407264fc4f209456ffcb73d7853ff315aab86
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


openbsc[master]: pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I68dc5e837bd2a3602f7875063c85da4082196274
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


openbsc[master]: pcu_sock: Forward imm.ass PCU originated messages

2017-05-25 Thread Harald Welte

Patch Set 2: Code-Review+2

actually, we're only adding a new message without breaking existing 
functionality, so we don't need to bump the version number

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice099c4ed7008200ed179e581aba1899c6c29455
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


[MERGED] openbsc[master]: pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for ...

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for 
array iteration
..


pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for array iteration

Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 0f3dc1b..e713b08 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -211,7 +211,7 @@
info_ind->initial_mcs = rlcc->initial_mcs;
 
/* NSVC */
-   for (i = 0; i < 2; i++) {
+   for (i = 0; i < ARRAY_SIZE(info_ind->nsvci); i++) {
nsvc = &bts->gprs.nsvc[i];
info_ind->nsvci[i] = nsvc->nsvci;
info_ind->local_port[i] = nsvc->local_port;
@@ -219,13 +219,13 @@
info_ind->remote_ip[i] = nsvc->remote_ip;
}
 
-   for (i = 0; i < 8; i++) {
+   for (i = 0; i < ARRAY_SIZE(info_ind->trx); i++) {
trx = gsm_bts_trx_num(bts, i);
if (!trx)
break;
info_ind->trx[i].pdch_mask = 0;
info_ind->trx[i].arfcn = trx->arfcn;
-   for (j = 0; j < 8; j++) {
+   for (j = 0; j < ARRAY_SIZE(trx->ts); j++) {
ts = &trx->ts[j];
if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED
&& ts_should_be_pdch(ts)) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0
..


pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0

It would prevent using only e.g. TRX 1 when TRX 0 is disabled.

Change-Id: I68dc5e837bd2a3602f7875063c85da4082196274
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 0e904db..7712878 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -222,7 +222,7 @@
for (i = 0; i < ARRAY_SIZE(info_ind->trx); i++) {
trx = gsm_bts_trx_num(bts, i);
if (!trx)
-   break;
+   continue;
info_ind->trx[i].hlayer1 = 0x2342;
info_ind->trx[i].pdch_mask = 0;
info_ind->trx[i].arfcn = trx->arfcn;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I68dc5e837bd2a3602f7875063c85da4082196274
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: abis_rsl: fix off-by-one length check when parsing ericson t...

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: abis_rsl: fix off-by-one length check when parsing ericson tlli 
field
..


abis_rsl: fix off-by-one length check when parsing ericson tlli field

Change-Id: I658f6d82a67944345ddda5534fa996dca9e990ab
---
M openbsc/src/libbsc/abis_rsl.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index d750df4..85c92cd 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -2018,7 +2018,7 @@
/* FIXME: Replace the messy message parsing below
 * with proper TV parser */
LOGP(DRSL, LOGL_INFO, "IMM.ass sent\n");
-   if(msg->len < 8)
+   if(msg->len < 9)
LOGP(DRSL, LOGL_ERROR, "short IMM.ass sent message!\n");
else if(msg->data[4] != 0xf1)
LOGP(DRSL, LOGL_ERROR, "unsupported IMM.ass message 
format! (please fix)\n");

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I658f6d82a67944345ddda5534fa996dca9e990ab
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: libbsc: add debug log message to S_L_INP_* callbacks

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: libbsc: add debug log message to S_L_INP_* callbacks
..


libbsc: add debug log message to S_L_INP_* callbacks

Improve debug log output of input callbacks by adding a line containing
the signal event name.

Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2
---
M openbsc/src/libbsc/bsc_init.c
M openbsc/src/libbsc/bts_ericsson_rbs2000.c
2 files changed, 7 insertions(+), 0 deletions(-)

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



diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index cda4350..2af846e 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -320,6 +320,7 @@
 
switch (signal) {
case S_L_INP_TEI_UP:
+   LOGP(DLMI, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_UP\n", 
__func__);
if (isd->link_type == E1INP_SIGN_OML) {
/* TODO: this is required for the Nokia BTS, hopping is 
configured
   during OML, other MA is not set.  */
@@ -344,6 +345,7 @@
bootstrap_rsl(trx);
break;
case S_L_INP_TEI_DN:
+   LOGP(DLMI, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_DN\n", 
__func__);
LOGP(DLMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", 
isd->link_type, trx);
 
if (isd->link_type == E1INP_SIGN_OML)
diff --git a/openbsc/src/libbsc/bts_ericsson_rbs2000.c 
b/openbsc/src/libbsc/bts_ericsson_rbs2000.c
index 0cae6d8..1c0fa1a 100644
--- a/openbsc/src/libbsc/bts_ericsson_rbs2000.c
+++ b/openbsc/src/libbsc/bts_ericsson_rbs2000.c
@@ -116,6 +116,7 @@
 
switch (signal) {
case S_L_INP_TEI_UP:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_UP\n", 
__func__);
switch (isd->link_type) {
case E1INP_SIGN_OML:
if (isd->trx->bts->type != GSM_BTS_TYPE_RBS2000)
@@ -128,6 +129,7 @@
}
break;
case S_L_INP_TEI_DN:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_TEI_DN\n", 
__func__);
if (isd->trx->bts->type != GSM_BTS_TYPE_RBS2000)
break;
LOGP(DNM, LOGL_NOTICE, "Line-%u TS-%u TEI-%u SAPI-%u: Link "
@@ -139,7 +141,9 @@
lapd_sap_start(e1i_ts->lapd, isd->tei, isd->sapi);
break;
case S_L_INP_LINE_INIT:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_LINE_INIT\n", 
__func__);
case S_L_INP_LINE_NOALARM:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_LINE_NOALARM\n", 
__func__);
if (strcasecmp(isd->line->driver->name, "DAHDI")
 && strcasecmp(isd->line->driver->name, "MISDN_LAPD")
 && strcasecmp(isd->line->driver->name, "UNIXSOCKET"))
@@ -147,6 +151,7 @@
start_sabm_in_line(isd->line, 1);
break;
case S_L_INP_LINE_ALARM:
+   LOGP(DNM, LOGL_DEBUG, "%s() signal: S_L_INP_LINE_ALARM\n", 
__func__);
if (strcasecmp(isd->line->driver->name, "DAHDI")
 && strcasecmp(isd->line->driver->name, "MISDN_LAPD")
 && strcasecmp(isd->line->driver->name, "UNIXSOCKET"))

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


[MERGED] openbsc[master]: pcu_sock: add basic pcu interface support

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: add basic pcu interface support
..


pcu_sock: add basic pcu interface support

Adds a basic version of a pcu socket interface, similar
to the one that can be found in osmo-bts.

Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2
---
M openbsc/include/openbsc/Makefile.am
M openbsc/include/openbsc/debug.h
M openbsc/include/openbsc/gsm_data_shared.h
A openbsc/include/openbsc/pcu_if.h
A openbsc/include/openbsc/pcuif_proto.h
M openbsc/src/libbsc/Makefile.am
M openbsc/src/libbsc/abis_rsl.c
M openbsc/src/libbsc/bsc_init.c
A openbsc/src/libbsc/pcu_sock.c
M openbsc/src/libcommon/debug.c
10 files changed, 929 insertions(+), 1 deletion(-)

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



diff --git a/openbsc/include/openbsc/Makefile.am 
b/openbsc/include/openbsc/Makefile.am
index eb09e18..2740a5d 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -65,6 +65,8 @@
bsc_msc_data.h \
osmux.h \
paging.h \
+   pcu_if.h \
+   pcuif_proto.h \
rest_octets.h \
rrlp.h \
rs232.h \
diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h
index 74db723..8a4247b 100644
--- a/openbsc/include/openbsc/debug.h
+++ b/openbsc/include/openbsc/debug.h
@@ -37,6 +37,7 @@
DRANAP,
DSUA,
DV42BIS,
+   DPCU,
Debug_LastEntry,
 };
 
diff --git a/openbsc/include/openbsc/gsm_data_shared.h 
b/openbsc/include/openbsc/gsm_data_shared.h
index e7c8467..3371fb9 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -869,6 +869,9 @@
struct amr_multirate_conf mr_full;
struct amr_multirate_conf mr_half;
 
+   /* PCU socket state */
+   struct pcu_sock_state *pcu_state;
+
 #endif /* ROLE_BSC */
void *role;
 };
diff --git a/openbsc/include/openbsc/pcu_if.h b/openbsc/include/openbsc/pcu_if.h
new file mode 100644
index 000..68d4174
--- /dev/null
+++ b/openbsc/include/openbsc/pcu_if.h
@@ -0,0 +1,33 @@
+#ifndef _PCU_IF_H
+#define _PCU_IF_H
+
+#define PCU_SOCK_DEFAULT   "/tmp/pcu_bts"
+
+#include 
+
+extern int pcu_direct;
+
+struct pcu_sock_state {
+   struct gsm_network *net;
+   struct osmo_fd listen_bfd;  /* fd for listen socket */
+   struct osmo_fd conn_bfd;/* fd for connection to lcr */
+   struct llist_head upqueue;  /* queue for sending messages */
+};
+
+/* PCU relevant information has changed; Inform PCU (if connected) */
+void pcu_info_update(struct gsm_bts *bts);
+
+/* Forward rach indication to PCU */
+int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn,
+   uint8_t is_11bit, enum ph_burst_type burst_type);
+
+/* Confirm the sending of an immediate assignment to the pcu */
+int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli);
+
+/* Open connection to PCU */
+int pcu_sock_init(const char *path, struct gsm_bts *bts);
+
+/* Close connection to PCU */
+void pcu_sock_exit(struct gsm_bts *bts);
+
+#endif /* _PCU_IF_H */
diff --git a/openbsc/include/openbsc/pcuif_proto.h 
b/openbsc/include/openbsc/pcuif_proto.h
new file mode 100644
index 000..a52d896
--- /dev/null
+++ b/openbsc/include/openbsc/pcuif_proto.h
@@ -0,0 +1,158 @@
+#ifndef _PCUIF_PROTO_H
+#define _PCUIF_PROTO_H
+
+#define PCU_IF_VERSION 0x07
+
+/* msg_type */
+#define PCU_IF_MSG_DATA_REQ0x00/* send data to given channel */
+#define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
+#define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
+#define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
+#define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
+#define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
+#define PCU_IF_MSG_ACT_REQ 0x40/* activate/deactivate PDCH */
+#define PCU_IF_MSG_TIME_IND0x52/* GSM time indication */
+#define PCU_IF_MSG_PAG_REQ 0x60/* paging request */
+
+/* sapi */
+#define PCU_IF_SAPI_RACH   0x01/* channel request on CCCH */
+#define PCU_IF_SAPI_AGCH   0x02/* assignment on AGCH */
+#define PCU_IF_SAPI_PCH0x03/* paging/assignment on PCH */
+#define PCU_IF_SAPI_BCCH   0x04/* SI on BCCH */
+#define PCU_IF_SAPI_PDTCH  0x05/* packet data/control/ccch block */
+#define PCU_IF_SAPI_PRACH  0x06/* packet random access channel */
+#define PCU_IF_SAPI_PTCCH  0x07/* packet TA control channel */
+
+/* flags */
+#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
+#define PCU_IF_FLAG_SYSMO  (1 << 1)/* access PDCH of sysmoBTS directly */
+#define PCU_IF_FLAG_CS1(1 << 16)
+#define PCU_IF_FLAG_CS2(1 << 17)
+#define PCU_IF_FLAG_CS3

[MERGED] openbsc[master]: pcu_sock: Send non-NULL hLayer1 to PCU

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: Send non-NULL hLayer1 to PCU
..


pcu_sock: Send non-NULL hLayer1 to PCU

The BSC-located PCU case looks to the PCU like a BTS-located PCU with
"direct PHY" access, i.e. the data related primitives are communicated
from the PCU directly towards the TRAU Frames or whatever transport
method is used between CCU and PCU.

In order to make the PCU believe that, we need to pass in a 'layer 1
handle'.  As we don't use it, we can just pass any non-zero value and be
happy.

Change-Id: I8170bd4134904702b6b272e496100361ba473cbc
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 4555b31..2186409 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -223,6 +223,7 @@
trx = gsm_bts_trx_num(bts, i);
if (!trx)
break;
+   info_ind->trx[i].hlayer1 = 0x2342;
info_ind->trx[i].pdch_mask = 0;
info_ind->trx[i].arfcn = trx->arfcn;
for (j = 0; j < ARRAY_SIZE(trx->ts); j++) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8170bd4134904702b6b272e496100361ba473cbc
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[MERGED] openbsc[master]: pcu_sock: Forward imm.ass PCU originated messages

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: Forward imm.ass PCU originated messages
..


pcu_sock: Forward imm.ass PCU originated messages

The PCU sends imm.ass messages in response to a rach request. Those
messages need to be forwarded to RSL in order to get them send. This
commit introduces the required functionality for that

Change-Id: Ice099c4ed7008200ed179e581aba1899c6c29455
---
M openbsc/include/openbsc/pcu_if.h
M openbsc/include/openbsc/pcuif_proto.h
M openbsc/src/libbsc/abis_rsl.c
M openbsc/src/libbsc/pcu_sock.c
4 files changed, 59 insertions(+), 0 deletions(-)

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



diff --git a/openbsc/include/openbsc/pcu_if.h b/openbsc/include/openbsc/pcu_if.h
index 68d4174..0c355b7 100644
--- a/openbsc/include/openbsc/pcu_if.h
+++ b/openbsc/include/openbsc/pcu_if.h
@@ -24,6 +24,10 @@
 /* Confirm the sending of an immediate assignment to the pcu */
 int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli);
 
+
+/* Confirm the sending of an immediate assignment to the pcu */
+int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli);
+
 /* Open connection to PCU */
 int pcu_sock_init(const char *path, struct gsm_bts *bts);
 
diff --git a/openbsc/include/openbsc/pcuif_proto.h 
b/openbsc/include/openbsc/pcuif_proto.h
index 3fc500b..eb28d66 100644
--- a/openbsc/include/openbsc/pcuif_proto.h
+++ b/openbsc/include/openbsc/pcuif_proto.h
@@ -7,6 +7,7 @@
 #define PCU_IF_MSG_DATA_REQ0x00/* send data to given channel */
 #define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
 #define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
+#define PCU_IF_MSG_DATA_CNF_DT 0x11/* confirm (with direct tlli) */
 #define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
 #define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
 #define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
@@ -54,6 +55,21 @@
uint16_tber10k; /*!< \brief BER in units of 0.01% */
int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
+} __attribute__ ((packed));
+
+/* data confirmation with direct tlli (instead of raw mac block with tlli) */
+struct gsm_pcu_if_data_cnf_dt {
+   uint8_t sapi;
+   uint32_ttlli;
+   uint32_tfn;
+   uint16_tarfcn;
+   uint8_t trx_nr;
+   uint8_t ts_nr;
+   uint8_t block_nr;
+   int8_t  rssi;
+   uint16_t ber10k;/*!< \brief BER in units of 0.01% */
+   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter bits */
+   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
 } __attribute__ ((packed));
 
 struct gsm_pcu_if_rts_req {
@@ -146,6 +162,7 @@
union {
struct gsm_pcu_if_data  data_req;
struct gsm_pcu_if_data  data_cnf;
+   struct gsm_pcu_if_data_cnf_dt   data_cnf_dt;
struct gsm_pcu_if_data  data_ind;
struct gsm_pcu_if_rts_req   rts_req;
struct gsm_pcu_if_rach_ind  rach_ind;
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 62c12a8..d750df4 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -1993,6 +1993,7 @@
struct e1inp_sign_link *sign_link = msg->dst;
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
int rc = 0;
+   uint32_t tlli;
 
msg->lchan = lchan_lookup(sign_link->trx, rslh->chan_nr,
  "Abis RSL rx CCHAN: ");
@@ -2013,6 +2014,22 @@
LOGP(DRSL, LOGL_NOTICE, "Unimplemented Abis RSL TRX message "
"type 0x%02x\n", rslh->c.msg_type);
break;
+   case 0x10: /* Ericsson specific: Immediate Assign Sent */
+   /* FIXME: Replace the messy message parsing below
+* with proper TV parser */
+   LOGP(DRSL, LOGL_INFO, "IMM.ass sent\n");
+   if(msg->len < 8)
+   LOGP(DRSL, LOGL_ERROR, "short IMM.ass sent message!\n");
+   else if(msg->data[4] != 0xf1)
+   LOGP(DRSL, LOGL_ERROR, "unsupported IMM.ass message 
format! (please fix)\n");
+   else {
+   tlli =  msg->data[8];
+   tlli |= msg->data[7] << 8;
+   tlli |= msg->data[6] << 16;
+   tlli |= msg->data[5] << 24;
+   pcu_tx_imm_ass_sent(sign_link->trx->bts, tlli);
+   }
+   

[MERGED] openbsc[master]: pcu_sock: implement direct tlli on AGCH

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: implement direct tlli on AGCH
..


pcu_sock: implement direct tlli on AGCH

Ericsson allows to attach a reference to immediate assignments. A
confirmation of the transmission is then sent back, but only containing
the reference, not the whole RLC packet.

Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9
---
M openbsc/include/openbsc/pcuif_proto.h
M openbsc/src/libbsc/pcu_sock.c
2 files changed, 33 insertions(+), 1 deletion(-)

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



diff --git a/openbsc/include/openbsc/pcuif_proto.h 
b/openbsc/include/openbsc/pcuif_proto.h
index a52d896..3fc500b 100644
--- a/openbsc/include/openbsc/pcuif_proto.h
+++ b/openbsc/include/openbsc/pcuif_proto.h
@@ -1,7 +1,7 @@
 #ifndef _PCUIF_PROTO_H
 #define _PCUIF_PROTO_H
 
-#define PCU_IF_VERSION 0x07
+#define PCU_IF_VERSION 0x08
 
 /* msg_type */
 #define PCU_IF_MSG_DATA_REQ0x00/* send data to given channel */
@@ -22,6 +22,7 @@
 #define PCU_IF_SAPI_PDTCH  0x05/* packet data/control/ccch block */
 #define PCU_IF_SAPI_PRACH  0x06/* packet random access channel */
 #define PCU_IF_SAPI_PTCCH  0x07/* packet TA control channel */
+#define PCU_IF_SAPI_AGCH_DT0x08/* assignment on AGCH but with 
additional TLLI */
 
 /* flags */
 #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 7712878..0ae3a03 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -56,6 +56,7 @@
[PCU_IF_SAPI_PDTCH] =   "PDTCH",
[PCU_IF_SAPI_PRACH] =   "PRACH",
[PCU_IF_SAPI_PTCCH] =   "PTCCH",
+   [PCU_IF_SAPI_AGCH_DT] = "AGCH_DT",
 };
 
 /* Check if BTS has a PCU connection */
@@ -326,6 +327,7 @@
struct gsm_bts_trx_ts *ts;
struct msgb *msg;
char imsi_digit_buf[4];
+   uint32_t tlli = -1;
uint8_t pag_grp;
int rc = 0;
 
@@ -342,6 +344,7 @@
imsi_digit_buf[1] = data_req->data[1];
imsi_digit_buf[2] = data_req->data[2];
imsi_digit_buf[3] = '\0';
+   LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s", imsi_digit_buf);
pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
str_to_imsi(imsi_digit_buf));
pcu_rx_rr_paging(bts, pag_grp, data_req->data+3);
@@ -360,6 +363,34 @@
rc = -EIO;
}
break;
+   case PCU_IF_SAPI_AGCH_DT:
+   /* DT = direct tlli. A tlli is prefixed */
+
+   if (data_req->len < 5) {
+   LOGP(DPCU, LOGL_ERROR, "Received PCU data request with "
+   "invalid/small length %d\n", 
data_req->len);
+   break;
+   }
+   tlli = *((uint32_t *)data_req->data);
+
+   msg = msgb_alloc(data_req->len - 4, "pcu_agch");
+   if (!msg) {
+   rc = -ENOMEM;
+   break;
+   }
+   msg->l3h = msgb_put(msg, data_req->len - 4);
+   memcpy(msg->l3h, data_req->data + 4, data_req->len - 4);
+
+   if (bts->type == GSM_BTS_TYPE_RBS2000)
+   rc = rsl_ericsson_imm_assign_cmd(bts, tlli, msg->len, 
msg->data);
+   else
+   rc = rsl_imm_assign_cmd(bts, msg->len, msg->data);
+
+   if (rc) {
+   msgb_free(msg);
+   rc = -EIO;
+   }
+   break;
default:
LOGP(DPCU, LOGL_ERROR, "Received PCU data request with "
"unsupported sapi %d\n", data_req->sapi);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1
..


pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1

The use of PCU_IF_FLAG_SYSMO enable the PCU to use DIRECT_PHY code path.

Change-Id: I1f5407264fc4f209456ffcb73d7853ff315aab86
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 2186409..0e904db 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -46,7 +46,7 @@
 
 static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg);
 uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx);
-int pcu_direct = 0;
+int pcu_direct = 1;
 
 static const char *sapi_string[] = {
[PCU_IF_SAPI_RACH] ="RACH",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1f5407264fc4f209456ffcb73d7853ff315aab86
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: pcu_sock: Don't re-implement core functionality like gsm_bts...

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: Don't re-implement core functionality like 
gsm_bts_trx_num()
..


pcu_sock: Don't re-implement core functionality like gsm_bts_trx_num()

Change-Id: I5ea506c8240dac124ccf5522d02ba18e4f0cb90d
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 2 insertions(+), 14 deletions(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index b2bc425..0f3dc1b 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -58,18 +58,6 @@
[PCU_IF_SAPI_PTCCH] =   "PTCCH",
 };
 
-static struct gsm_bts_trx *trx_by_nr(struct gsm_bts *bts, uint8_t trx_nr)
-{
-   struct gsm_bts_trx *trx;
-
-   llist_for_each_entry(trx, &bts->trx_list, list) {
-   if (trx->nr == trx_nr)
-   return trx;
-   }
-
-   return NULL;
-}
-
 /* Check if BTS has a PCU connection */
 static bool pcu_connected(struct gsm_bts *bts)
 {
@@ -232,7 +220,7 @@
}
 
for (i = 0; i < 8; i++) {
-   trx = trx_by_nr(bts, i);
+   trx = gsm_bts_trx_num(bts, i);
if (!trx)
break;
info_ind->trx[i].pdch_mask = 0;
@@ -427,7 +415,7 @@
 
/* release PDCH */
for (i = 0; i < 8; i++) {
-   trx = trx_by_nr(bts, i);
+   trx = gsm_bts_trx_num(bts, i);
if (!trx)
break;
for (j = 0; j < 8; j++) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5ea506c8240dac124ccf5522d02ba18e4f0cb90d
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[MERGED] openbsc[master]: pcu_sock: Fix broken paging command

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: Fix broken paging command
..


pcu_sock: Fix broken paging command

The pcu sends us an already made up MAC-Block that contains the
paging request. pcu_sock.c is parsing this paging request
wrongly and fails silently, which results into a dropping of the
request.

This commit fixes the parsing problems.

Change-Id: Iefef08123bdc351afd8287d3f27ebf0ae58a6e7d
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 20 insertions(+), 7 deletions(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 7e77797..98e12fa 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -313,26 +313,39 @@
 static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group,
const uint8_t *raw_rr_msg)
 {
-   struct gsm48_hdr *gsmh = (struct gsm48_hdr *) raw_rr_msg;
-   struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) gsmh;
+   struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) raw_rr_msg;
uint8_t chan_needed;
unsigned int mi_len;
uint8_t *mi;
int rc;
 
-   switch (gsmh->msg_type) {
+   switch (p1->msg_type) {
case GSM48_MT_RR_PAG_REQ_1:
chan_needed = (p1->cneed2 << 2) | p1->cneed1;
mi_len = p1->data[0];
mi = p1->data+1;
-   /* FIXME: why does rsl_paging_cmd add 2 to mi? */
-   rc = rsl_paging_cmd(bts, paging_group, mi_len, mi,
+   LOGP(DPCU, LOGL_ERROR, "PCU Sends paging "
+"request type %02x (chan_needed=%02x, mi_len=%u, mi=%s)\n",
+p1->msg_type, chan_needed, mi_len,
+osmo_hexdump_nospc(mi,mi_len));
+   /* NOTE: We will have to add 2 to mi_len and subtract 2 from
+* the mi pointer because rsl_paging_cmd() will perform the
+* reverse operations. This is because rsl_paging_cmd() is
+* normally expected to chop off the element identifier (0xC0)
+* and the length field. In our parameter, we do not have
+* those fields included. */
+   rc = rsl_paging_cmd(bts, paging_group, mi_len+2, mi-2,
chan_needed, true);
break;
case GSM48_MT_RR_PAG_REQ_2:
case GSM48_MT_RR_PAG_REQ_3:
LOGP(DPCU, LOGL_ERROR, "PCU Sends unsupported paging "
-   "request type\n");
+   "request type %02x\n", p1->msg_type);
+   rc = -EINVAL;
+   break;
+   default:
+   LOGP(DPCU, LOGL_ERROR, "PCU Sends unknown paging "
+   "request type %02x\n", p1->msg_type);
rc = -EINVAL;
break;
}
@@ -365,7 +378,7 @@
imsi_digit_buf[1] = data_req->data[1];
imsi_digit_buf[2] = data_req->data[2];
imsi_digit_buf[3] = '\0';
-   LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s", imsi_digit_buf);
+   LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s\n", imsi_digit_buf);
pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
str_to_imsi(imsi_digit_buf));
pcu_rx_rr_paging(bts, pag_grp, data_req->data+3);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefef08123bdc351afd8287d3f27ebf0ae58a6e7d
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


[MERGED] openbsc[master]: pcu_sock: Forward paging request from PCU via RSL to BTS

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: Forward paging request from PCU via RSL to BTS
..


pcu_sock: Forward paging request from PCU via RSL to BTS

Change-Id: I28bf0995699618f3f5fa15fc8e1733beddfc482f
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 44 insertions(+), 9 deletions(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index e713b08..4555b31 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -284,6 +284,39 @@
return pcu_sock_send(bts, msg);
 }
 
+/* we need to decode the raw RR paging messsage (see PCU code
+ * Encoding::write_paging_request) and extract the mobile identity
+ * (P-TMSI) from it */
+static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group,
+   const uint8_t *raw_rr_msg)
+{
+   struct gsm48_hdr *gsmh = (struct gsm48_hdr *) raw_rr_msg;
+   struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) gsmh;
+   uint8_t chan_needed;
+   unsigned int mi_len;
+   uint8_t *mi;
+   int rc;
+
+   switch (gsmh->msg_type) {
+   case GSM48_MT_RR_PAG_REQ_1:
+   chan_needed = (p1->cneed2 << 2) | p1->cneed1;
+   mi_len = p1->data[0];
+   mi = p1->data+1;
+   /* FIXME: why does rsl_paging_cmd add 2 to mi? */
+   rc = rsl_paging_cmd(bts, paging_group, mi_len, mi,
+   chan_needed, true);
+   break;
+   case GSM48_MT_RR_PAG_REQ_2:
+   case GSM48_MT_RR_PAG_REQ_3:
+   LOGP(DPCU, LOGL_ERROR, "PCU Sends unsupported paging "
+   "request type\n");
+   rc = -EINVAL;
+   break;
+   }
+
+   return rc;
+}
+
 static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
struct gsm_pcu_if_data *data_req)
 {
@@ -291,6 +324,8 @@
struct gsm_bts_trx *trx;
struct gsm_bts_trx_ts *ts;
struct msgb *msg;
+   char imsi_digit_buf[4];
+   uint8_t pag_grp;
int rc = 0;
 
LOGP(DPCU, LOGL_DEBUG, "Data request received: sapi=%s arfcn=%d "
@@ -300,15 +335,15 @@
 
switch (data_req->sapi) {
case PCU_IF_SAPI_PCH:
-   if (msg_type == PCU_IF_MSG_PAG_REQ) {
-   /* FIXME: Add function to schedule paging request.
-* This might not be required, if PCU_IF_MSG_DATA_REQ
-* is used instead. */
-   } else {
-   struct gsm_bts_role_bts *btsb = bts->role;
-
-   printf("paging_add_imm_ass(btsb->paging_state, 
data_req->data,data_req->len);\n");
-   }
+   /* the first three bytes are the last three digits of
+* the IMSI, which we need to compute the paging group */
+   imsi_digit_buf[0] = data_req->data[0];
+   imsi_digit_buf[1] = data_req->data[1];
+   imsi_digit_buf[2] = data_req->data[2];
+   imsi_digit_buf[3] = '\0';
+   pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+   str_to_imsi(imsi_digit_buf));
+   pcu_rx_rr_paging(bts, pag_grp, data_req->data+3);
break;
case PCU_IF_SAPI_AGCH:
msg = msgb_alloc(data_req->len, "pcu_agch");

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I28bf0995699618f3f5fa15fc8e1733beddfc482f
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: abis_rsl: use msgb_pull to parse tlli from msg

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: abis_rsl: use msgb_pull to parse tlli from msg
..


abis_rsl: use msgb_pull to parse tlli from msg

Change-Id: I971bf6c8821689f9d8a1294a9b3bf1af9c4091f7
---
M openbsc/src/libbsc/abis_rsl.c
1 file changed, 2 insertions(+), 4 deletions(-)

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



diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 85c92cd..7ee19a7 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -2023,10 +2023,8 @@
else if(msg->data[4] != 0xf1)
LOGP(DRSL, LOGL_ERROR, "unsupported IMM.ass message 
format! (please fix)\n");
else {
-   tlli =  msg->data[8];
-   tlli |= msg->data[7] << 8;
-   tlli |= msg->data[6] << 16;
-   tlli |= msg->data[5] << 24;
+   msgb_pull(msg, 5); /* drop previous data to use 
msg_pull_u32 */
+   tlli = msgb_pull_u32(msg);
pcu_tx_imm_ass_sent(sign_link->trx->bts, tlli);
}
break;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I971bf6c8821689f9d8a1294a9b3bf1af9c4091f7
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] openbsc[master]: gsm_data_shared: add value strings for gsm_chreq

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: gsm_data_shared: add value strings for gsm_chreq
..


gsm_data_shared: add value strings for gsm_chreq

Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae
---
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libcommon/gsm_data_shared.c
2 files changed, 11 insertions(+), 0 deletions(-)

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



diff --git a/openbsc/include/openbsc/gsm_data_shared.h 
b/openbsc/include/openbsc/gsm_data_shared.h
index 9495f93..e7c8467 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -889,6 +889,7 @@
 enum gsm_bts_type_variant str2btsvariant(const char *arg);
 const char *btsvariant2str(enum gsm_bts_type_variant v);
 
+extern const struct value_string gsm_chreq_descs[];
 const struct value_string gsm_pchant_names[13];
 const struct value_string gsm_pchant_descs[13];
 const char *gsm_pchan_name(enum gsm_phys_chan_config c);
diff --git a/openbsc/src/libcommon/gsm_data_shared.c 
b/openbsc/src/libcommon/gsm_data_shared.c
index 156167d..f404363 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -106,6 +106,16 @@
return get_value_string(bts_type_names, type);
 }
 
+const struct value_string gsm_chreq_descs[] = {
+   { GSM_CHREQ_REASON_EMERG,   "emergency call" },
+   { GSM_CHREQ_REASON_PAG, "answer to paging" },
+   { GSM_CHREQ_REASON_CALL,"call re-establishment" },
+   { GSM_CHREQ_REASON_LOCATION_UPD,"Location updating" },
+   { GSM_CHREQ_REASON_PDCH,"one phase packet access" },
+   { GSM_CHREQ_REASON_OTHER,   "other" },
+   { 0,NULL }
+};
+
 const struct value_string gsm_pchant_names[13] = {
{ GSM_PCHAN_NONE,   "NONE" },
{ GSM_PCHAN_CCCH,   "CCCH" },

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae
Gerrit-PatchSet: 5
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 


[PATCH] osmo-pcu[master]: Fix format string error (string needs %s)

2017-05-25 Thread Harald Welte

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

Fix format string error (string needs %s)

In a49475b5a822773ce10e28bf5a02e91de78bd063 we introduce the use of
bssgp_pdu_str() and change from printing the numeric code to the
stringified version of the message code.  However, the format string
was not updated accordingly :/

Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc
Fixes: Coverity CID 169684
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index e73a8c0..aeb0942 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -248,7 +248,8 @@
LOGP(DBSSGP, LOGL_DEBUG, "rx BSSGP_PDUT_FLOW_CONTROL_MS_ACK\n");
break;
default:
-   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u PDU type 0x%02x 
unknown\n", bctx->bvci, bssgp_pdu_str(pdu_type));
+   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u PDU type %s unknown\n",
+   bctx->bvci, bssgp_pdu_str(pdu_type));
rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg);
break;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] libosmo-abis[master]: ipacces.c: Remove ipa_bts_id_resp() and use libosmocore

2017-05-25 Thread Harald Welte
 = ipa_ccm_make_id_resp_from_req(dev, data + 1, len 
- 1);
+   dev->trx_id = old_trx_nr;
ret = ipa_send(link->ofd->fd, rmsg->data, rmsg->len);
if (ret != rmsg->len) {
LOGP(DLINP, LOGL_ERROR, "cannot send ID_RESP "

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

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


[PATCH] libosmo-abis[master]: Add value_string for input signal names (e1inp_signal_names)

2017-05-25 Thread Harald Welte

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

Add value_string for input signal names (e1inp_signal_names)

Change-Id: I1662d4a969d2d12677646f3120b25be9a20c6d22
---
M include/osmocom/abis/e1_input.h
M src/e1_input.c
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/38/2738/1

diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 8501d5c..1a701f9 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -212,6 +212,8 @@
S_L_INP_LINE_NOALARM,
 };
 
+extern const struct value_string e1inp_signal_names[];
+
 /* register a driver with the E1 core */
 int e1inp_driver_register(struct e1inp_driver *drv);
 
diff --git a/src/e1_input.c b/src/e1_input.c
index 1e1252e..40e36b4 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -803,6 +803,17 @@
return 0;
 }
 
+const struct value_string e1inp_signal_names[] = {
+   { S_L_INP_NONE, "NONE" },
+   { S_L_INP_TEI_UP,   "TEI-UP" },
+   { S_L_INP_TEI_DN,   "TEI-DOWN" },
+   { S_L_INP_TEI_UNKNOWN,  "TEI-UNKNOWN" },
+   { S_L_INP_LINE_INIT,"LINE-INIT" },
+   { S_L_INP_LINE_ALARM,   "LINE-ALARM" },
+   { S_L_INP_LINE_NOALARM, "LINE-NOALARM" },
+   { 0, NULL }
+};
+
 void e1inp_misdn_init(void);
 void e1inp_dahdi_init(void);
 void e1inp_ipaccess_init(void);

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

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


[PATCH] osmo-bts[master]: Remove unusued left-over gsm0503_conv.c

2017-05-25 Thread Harald Welte
 },
-   { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 },
-   { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 },
-   { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 },
-   { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 },
-   { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 },
-   { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 },
-};
-
-static const uint8_t conv_tch_ahs_4_75_next_state[][2] = {
-   {  0,  1 }, {  2,  3 }, {  5,  4 }, {  7,  6 },
-   {  9,  8 }, { 11, 10 }, { 12, 13 }, { 14, 15 },
-   { 16, 17 }, { 18, 19 }, { 21, 20 }, { 23, 22 },
-   { 25, 24 }, { 27, 26 }, { 28, 29 }, { 30, 31 },
-   { 33, 32 }, { 35, 34 }, { 36, 37 }, { 38, 39 },
-   { 40, 41 }, { 42, 43 }, { 45, 44 }, { 47, 46 },
-   { 49, 48 }, { 51, 50 }, { 52, 53 }, { 54, 55 },
-   { 56, 57 }, { 58, 59 }, { 61, 60 }, { 63, 62 },
-   {  1,  0 }, {  3,  2 }, {  4,  5 }, {  6,  7 },
-   {  8,  9 }, { 10, 11 }, { 13, 12 }, { 15, 14 },
-   { 17, 16 }, { 19, 18 }, { 20, 21 }, { 22, 23 },
-   { 24, 25 }, { 26, 27 }, { 29, 28 }, { 31, 30 },
-   { 32, 33 }, { 34, 35 }, { 37, 36 }, { 39, 38 },
-   { 41, 40 }, { 43, 42 }, { 44, 45 }, { 46, 47 },
-   { 48, 49 }, { 50, 51 }, { 53, 52 }, { 55, 54 },
-   { 57, 56 }, { 59, 58 }, { 60, 61 }, { 62, 63 },
-};
-
-static const uint8_t conv_tch_ahs_4_75_next_term_output[] = {
-0,  3,  5,  6,  5,  6,  0,  3,  3,  0,  6,  5,  6,  5,  3,  0,
-4,  7,  1,  2,  1,  2,  4,  7,  7,  4,  2,  1,  2,  1,  7,  4,
-7,  4,  2,  1,  2,  1,  7,  4,  4,  7,  1,  2,  1,  2,  4,  7,
-3,  0,  6,  5,  6,  5,  3,  0,  0,  3,  5,  6,  5,  6,  0,  3,
-};
-
-static const uint8_t conv_tch_ahs_4_75_next_term_state[] = {
-0,  2,  4,  6,  8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
-   32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
-0,  2,  4,  6,  8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
-   32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
-};
-
-static int conv_tch_ahs_4_75_puncture[] = {
- 1,   2,   4,   5,   7,   8,  10,  13,  16,  22,  28,  34,
-40,  46,  52,  58, 64,  70,  76,  82,  88,  94, 100, 106,
-   112, 118, 124, 130, 136, 142, 148, 151, 154, 160, 163, 166,
-   172, 175, 178, 184, 187, 190, 196, 199, 202, 208, 211, 214,
-   220, 223, 226, 232, 235, 238, 241, 244, 247, 250, 253, 256,
-   259, 262, 265, 268, 271, 274, 275, 277, 278, 280, 281, 283,
-   284,
-   -1, /* end */
-};
-
-const struct osmo_conv_code gsm0503_conv_tch_ahs_4_75 = {
-   .N = 3,
-   .K = 7,
-   .len = 89,
-   .next_output  = conv_tch_ahs_4_75_next_output,
-   .next_state   = conv_tch_ahs_4_75_next_state,
-   .next_term_output = conv_tch_ahs_4_75_next_term_output,
-   .next_term_state  = conv_tch_ahs_4_75_next_term_state,
-   .puncture = conv_tch_ahs_4_75_puncture,
-};
-

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdcca1bc55a83c76ec47918dc4dd301155210091
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


libosmo-abis[master]: Add value_string for input signal names (e1inp_signal_names)

2017-05-25 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1662d4a969d2d12677646f3120b25be9a20c6d22
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: Remove unusued left-over gsm0503_conv.c

2017-05-25 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icdcca1bc55a83c76ec47918dc4dd301155210091
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-pcu[master]: Fix format string error (string needs %s)

2017-05-25 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-pcu[master]: Fix format string error (string needs %s)

2017-05-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Fix format string error (string needs %s)
..


Fix format string error (string needs %s)

In a49475b5a822773ce10e28bf5a02e91de78bd063 we introduce the use of
bssgp_pdu_str() and change from printing the numeric code to the
stringified version of the message code.  However, the format string
was not updated accordingly :/

Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc
Fixes: Coverity CID 169684
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index e73a8c0..aeb0942 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -248,7 +248,8 @@
LOGP(DBSSGP, LOGL_DEBUG, "rx BSSGP_PDUT_FLOW_CONTROL_MS_ACK\n");
break;
default:
-   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u PDU type 0x%02x 
unknown\n", bctx->bvci, bssgp_pdu_str(pdu_type));
+   LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u PDU type %s unknown\n",
+   bctx->bvci, bssgp_pdu_str(pdu_type));
rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg);
break;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bts[master]: scheduler_trx.c: Avoid code duplication for BER10k computation

2017-05-25 Thread Harald Welte

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

scheduler_trx.c: Avoid code duplication for BER10k computation

Use an (inline) function rather than code copy+pasting

Change-Id: I42e76a4707968e428cbd2e43d5df71ef445efece
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 16 insertions(+), 8 deletions(-)


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

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 843ab39..1ca371d 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -61,6 +61,16 @@
 /* Maximum size of a EGPRS message in bytes */
 #define EGPRS_0503_MAX_BYTES   155
 
+
+/* Compute the bit error rate in 1/1 units */
+static inline uint16_t compute_ber10k(int n_bits_total, int n_errors)
+{
+   if (n_bits_total == 0)
+   return 1;
+   else
+   return 1 * n_errors / n_bits_total;
+}
+
 /*
  * TX on downlink
  */
@@ -819,6 +829,7 @@
uint8_t *toa_num = &chan_state->toa_num;
uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
int n_errors, n_bits_total;
+   uint16_t ber10k;
int rc;
 
/* handle RACH, if handover RACH detection is turned on */
@@ -897,8 +908,7 @@
/* Send uplink measurement information to L2 */
l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | 
tn,
n_errors, n_bits_total, *rssi_sum / *rssi_num, *toa_sum / 
*toa_num);
-   uint16_t ber10k =
-   (n_bits_total == 0) ? 1 : 1 * n_errors / n_bits_total;
+   ber10k = compute_ber10k(n_bits_total, n_errors);
return _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, l2, l2_len,
  *rssi_sum / *rssi_num,
  4 * (*toa_sum) / *toa_num, 0, ber10k,
@@ -920,6 +930,7 @@
uint8_t *toa_num = &chan_state->toa_num;
uint8_t l2[EGPRS_0503_MAX_BYTES];
int n_errors, n_bursts_bits, n_bits_total;
+   uint16_t ber10k;
int rc;
 
LOGP(DL1C, LOGL_DEBUG, "PDTCH received %s fn=%u ts=%u trx=%u bid=%u\n", 
@@ -1001,8 +1012,7 @@
l1ts->mf_period, trx_chan_desc[chan].name);
return 0;
}
-   uint16_t ber10k =
-   (n_bits_total == 0) ? 1 : 1 * n_errors / n_bits_total;
+   ber10k = compute_ber10k(n_bits_total, n_errors);
return _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 3) % 
GSM_HYPERFRAME, chan,
l2, rc, *rssi_sum / *rssi_num, 4 * (*toa_sum) / *toa_num, 0,
  ber10k, PRES_INFO_BOTH);
@@ -1124,8 +1134,7 @@
 
/* FACCH */
if (rc == GSM_MACBLOCK_LEN) {
-   uint16_t ber10k = (n_bits_total == 0) ? 1 :
-   1 * n_errors / n_bits_total;
+   uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);
_sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 7) % 
GSM_HYPERFRAME, chan,
tch_data + amr, GSM_MACBLOCK_LEN, rssi, 4 * toa, 0,
   ber10k, PRES_INFO_UNKNOWN);
@@ -1299,8 +1308,7 @@
/* FACCH */
if (rc == GSM_MACBLOCK_LEN) {
chan_state->ul_ongoing_facch = 1;
-   uint16_t ber10k =
-   (n_bits_total == 0) ? 1 : 1 * n_errors / n_bits_total;
+   uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);
_sched_compose_ph_data_ind(l1t, tn,
(fn + GSM_HYPERFRAME - 10 - ((fn % 26) >= 19)) % 
GSM_HYPERFRAME, chan,
tch_data + amr, GSM_MACBLOCK_LEN, rssi, 4 * toa, 0,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42e76a4707968e428cbd2e43d5df71ef445efece
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-bts[master]: scheduler_trx.c: Fix typos, improve comments, cosmetics

2017-05-25 Thread Harald Welte
 464, 464);
 
-   /* Send uplnk measurement information to L2 */
+   /* Send uplink measurement information to L2 */
l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr|tn,
n_errors, n_bits_total, rssi, toa);
 
@@ -1159,6 +1168,7 @@
tch_data, rc);
 }
 
+/*! \brief a single TCH/H burst was received by the PHY, process it */
 int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
int8_t rssi, float toa)
@@ -1175,14 +1185,14 @@
struct gsm_lchan *lchan =
get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | 
tn);
 
-   /* handle rach, if handover rach detection is turned on */
+   /* handle RACH, if handover RACH detection is turned on */
if (chan_state->ho_rach_detect == 1)
return rx_rach_fn(l1t, tn, fn, chan, bid, bits, GSM_BURST_LEN, 
rssi, toa);
 
LOGP(DL1C, LOGL_DEBUG, "TCH/H received %s fn=%u ts=%u trx=%u bid=%u\n",
trx_chan_desc[chan].name, fn, tn, l1t->trx->nr, bid);
 
-   /* alloc burst memory, if not already */
+   /* allocate burst memory, if not already */
if (!*bursts_p) {
*bursts_p = talloc_zero_size(tall_bts_ctx, 696);
if (!*bursts_p)
@@ -1269,7 +1279,7 @@
memcpy(*bursts_p, *bursts_p + 232, 232);
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
 
-   /* Send uplnk measurement information to L2 */
+   /* Send uplink measurement information to L2 */
l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr|tn,
n_errors, n_bits_total, rssi, toa);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e2ce70aea8d62657ce3a7d6c16e5a7f8b76c22f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


libosmocore[master]: Revert "Introduce build script for arm-none-eabi cross-compi...

2017-05-26 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I644114679db1394e75ff12b0203ae8e568aff82c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: blobb 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: Introduce build script for arm-none-eabi cross-compilations

2017-05-26 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Introduce build script for arm-none-eabi cross-compilations
..


Introduce build script for arm-none-eabi cross-compilations

This is a necessary step to use libosmocore-arm dep in OsmocomBB.

After this patch is submitted the "./contrib/jenkins.sh" line in
libosmocore jenkins jobs [1][2] needs to be replaced with:

  if [[ "$JOB_NAME" == *"arch=arm-none-eabi,label=linux_amd64_debian8"* ]]
  then
./contrib/jenkins-arm.sh
  else
# (FreeBSD && debian8)_amd64 builds
./contrib/jenkins.sh
  fi

Furthermore, the "arch" matrix-build axis has to be created,
holding "arm-none-eabi" and "amd64". Following combination filter 
is necessary to skip cross-compilations on FreeBSD buildslave:

  !(arch=="arm-none-eabi" && label=="FreeBSD_amd64")

[1] https://jenkins.osmocom.org/jenkins/job/libosmocore/
[2] https://jenkins.osmocom.org/jenkins/job/libosmocore-gerrit/

Change-Id: I0db83ad2c94ada65c00fd1bcf867830dec80085d
---
A contrib/jenkins-arm.sh
1 file changed, 33 insertions(+), 0 deletions(-)

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



diff --git a/contrib/jenkins-arm.sh b/contrib/jenkins-arm.sh
new file mode 100755
index 000..d5fc31f
--- /dev/null
+++ b/contrib/jenkins-arm.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -ex
+
+./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
+
+autoreconf --install --force
+./configure --enable-static \
+   --prefix=/usr/local/arm-none-eabi \
+   --host=arm-none-eabi \
+   --enable-embedded \
+   --disable-shared \
+   CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles 
-nodefaultlibs"
+
+$MAKE $PARALLEL_MAKE \
+   || cat-testlogs.sh
+
+# verify build in dir other than source tree
+rm -rf *
+git checkout .
+autoreconf --install --force
+mkdir builddir
+cd builddir
+
+../configure --enable-static \
+   --prefix=/usr/local/arm-none-eabi \
+   --host=arm-none-eabi \
+   --enable-embedded \
+   --disable-shared \
+   CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles 
-nodefaultlibs"
+
+$MAKE $PARALLEL_MAKE \
+   || cat-testlogs.sh

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0db83ad2c94ada65c00fd1bcf867830dec80085d
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


libosmocore[master]: Introduce build script for arm-none-eabi cross-compilations

2017-05-26 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0db83ad2c94ada65c00fd1bcf867830dec80085d
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-bts[master]: scheduler_trx.c: Fix typos, improve comments, cosmetics

2017-05-26 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5e2ce70aea8d62657ce3a7d6c16e5a7f8b76c22f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmocore[master]: Revert "Introduce build script for arm-none-eabi cross-compi...

2017-05-26 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Revert "Introduce build script for arm-none-eabi 
cross-compilations"
..


Revert "Introduce build script for arm-none-eabi cross-compilations"

"--enable-sanitize" does not work on jenkins build slave (debian8), although it 
worked out locally for me.

Following patch will introduce corrected arm build script without 
"--enable-sanitize" option:

https://gerrit.osmocom.org/#/c/2742/  

This reverts commit ba58167e1bf6ff8815c4e9e0d7b0b63ba1c529f8.

Change-Id: I644114679db1394e75ff12b0203ae8e568aff82c
---
D contrib/jenkins-arm.sh
1 file changed, 0 insertions(+), 33 deletions(-)

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



diff --git a/contrib/jenkins-arm.sh b/contrib/jenkins-arm.sh
deleted file mode 100755
index e279821..000
--- a/contrib/jenkins-arm.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
-
-autoreconf --install --force
-./configure --enable-static --enable-sanitize \
-   --prefix=/usr/local/arm-none-eabi \
-   --host=arm-none-eabi \
-   --enable-embedded \
-   --disable-shared \
-   CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles 
-nodefaultlibs"
-
-$MAKE $PARALLEL_MAKE \
-   || cat-testlogs.sh
-
-# verify build in dir other than source tree
-rm -rf *
-git checkout .
-autoreconf --install --force
-mkdir builddir
-cd builddir
-
-../configure --enable-static \
-   --prefix=/usr/local/arm-none-eabi \
-   --host=arm-none-eabi \
-   --enable-embedded \
-   --disable-shared \
-   CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles 
-nodefaultlibs"
-
-$MAKE $PARALLEL_MAKE \
-   || cat-testlogs.sh

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I644114679db1394e75ff12b0203ae8e568aff82c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: blobb 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: blobb 


osmo-bts[master]: scheduler_trx.c: Avoid code duplication for BER10k computation

2017-05-26 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I42e76a4707968e428cbd2e43d5df71ef445efece
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmo-abis[master]: ipacces.c: Remove ipa_bts_id_resp() and use libosmocore

2017-05-26 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I858920db1fb5f5d66e71b676d28c84d330d7904a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: Remove unusued left-over gsm0503_conv.c

2017-05-26 Thread Harald Welte

Patch Set 1: Code-Review-1

there's also a header file...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icdcca1bc55a83c76ec47918dc4dd301155210091
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmo-abis[master]: Add value_string for input signal names (e1inp_signal_names)

2017-05-26 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add value_string for input signal names (e1inp_signal_names)
..


Add value_string for input signal names (e1inp_signal_names)

Change-Id: I1662d4a969d2d12677646f3120b25be9a20c6d22
---
M include/osmocom/abis/e1_input.h
M src/e1_input.c
2 files changed, 13 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 8501d5c..1a701f9 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -212,6 +212,8 @@
S_L_INP_LINE_NOALARM,
 };
 
+extern const struct value_string e1inp_signal_names[];
+
 /* register a driver with the E1 core */
 int e1inp_driver_register(struct e1inp_driver *drv);
 
diff --git a/src/e1_input.c b/src/e1_input.c
index 1e1252e..40e36b4 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -803,6 +803,17 @@
return 0;
 }
 
+const struct value_string e1inp_signal_names[] = {
+   { S_L_INP_NONE, "NONE" },
+   { S_L_INP_TEI_UP,   "TEI-UP" },
+   { S_L_INP_TEI_DN,   "TEI-DOWN" },
+   { S_L_INP_TEI_UNKNOWN,  "TEI-UNKNOWN" },
+   { S_L_INP_LINE_INIT,"LINE-INIT" },
+   { S_L_INP_LINE_ALARM,   "LINE-ALARM" },
+   { S_L_INP_LINE_NOALARM, "LINE-NOALARM" },
+   { 0, NULL }
+};
+
 void e1inp_misdn_init(void);
 void e1inp_dahdi_init(void);
 void e1inp_ipaccess_init(void);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1662d4a969d2d12677646f3120b25be9a20c6d22
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmo-abis[master]: ipacces.c: Remove ipa_bts_id_resp() and use libosmocore

2017-05-26 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: ipacces.c: Remove ipa_bts_id_resp() and use libosmocore
..


ipacces.c: Remove ipa_bts_id_resp() and use libosmocore

In Chanage-Id Icbcd8827a75fd5f3393351c1ca372de85275ad35 we introduced a
very similar function to libosocore.  Let's use that rather than our own
version here.

Change-Id: I858920db1fb5f5d66e71b676d28c84d330d7904a
---
M src/input/ipaccess.c
1 file changed, 4 insertions(+), 85 deletions(-)

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



diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index ac84ffc..fb2e30d 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -567,90 +567,6 @@
return ret;
 }
 
-#define IPA_STRING_MAX 64
-
-static struct msgb *
-ipa_bts_id_resp(struct ipaccess_unit *dev, uint8_t *data, int len, int trx_nr)
-{
-   struct msgb *nmsg;
-   char str[IPA_STRING_MAX];
-   uint8_t *tag;
-
-   memset(str, 0, sizeof(str));
-
-   nmsg = ipa_msg_alloc(0);
-   if (!nmsg)
-   return NULL;
-
-   *msgb_put(nmsg, 1) = IPAC_MSGT_ID_RESP;
-   while (len) {
-   if (len < 2) {
-   LOGP(DLINP, LOGL_NOTICE,
-   "Short read of ipaccess tag\n");
-   msgb_free(nmsg);
-   return NULL;
-   }
-   switch (data[1]) {
-   case IPAC_IDTAG_UNIT:
-   snprintf(str, sizeof(str), "%u/%u/%u",
-   dev->site_id, dev->bts_id, trx_nr);
-   break;
-   case IPAC_IDTAG_MACADDR:
-   snprintf(str, sizeof(str),
-"%02x:%02x:%02x:%02x:%02x:%02x",
-dev->mac_addr[0], dev->mac_addr[1],
-dev->mac_addr[2], dev->mac_addr[3],
-dev->mac_addr[4], dev->mac_addr[5]);
-   break;
-   case IPAC_IDTAG_LOCATION1:
-   if (dev->location1)
-   strncpy(str, dev->location1, IPA_STRING_MAX);
-   break;
-   case IPAC_IDTAG_LOCATION2:
-   if (dev->location2)
-   strncpy(str, dev->location2, IPA_STRING_MAX);
-   break;
-   case IPAC_IDTAG_EQUIPVERS:
-   if (dev->equipvers)
-   strncpy(str, dev->equipvers, IPA_STRING_MAX);
-   break;
-   case IPAC_IDTAG_SWVERSION:
-   if (dev->swversion)
-   strncpy(str, dev->swversion, IPA_STRING_MAX);
-   break;
-   case IPAC_IDTAG_UNITNAME:
-   snprintf(str, sizeof(str),
-"%s-%02x-%02x-%02x-%02x-%02x-%02x",
-dev->unit_name,
-dev->mac_addr[0], dev->mac_addr[1],
-dev->mac_addr[2], dev->mac_addr[3],
-dev->mac_addr[4], dev->mac_addr[5]);
-   break;
-   case IPAC_IDTAG_SERNR:
-   if (dev->serno)
-   strncpy(str, dev->serno, IPA_STRING_MAX);
-   break;
-   default:
-   LOGP(DLINP, LOGL_NOTICE,
-   "Unknown ipaccess tag 0x%02x\n", *data);
-   msgb_free(nmsg);
-   return NULL;
-   }
-   str[IPA_STRING_MAX-1] = '\0';
-
-   LOGP(DLINP, LOGL_INFO, " tag %d: %s\n", data[1], str);
-   tag = msgb_put(nmsg, 3 + strlen(str) + 1);
-   tag[0] = 0x00;
-   tag[1] = 1 + strlen(str) + 1;
-   tag[2] = data[1];
-   memcpy(tag + 3, str, strlen(str) + 1);
-   data += 2;
-   len -= 2;
-   }
-   ipa_msg_push_header(nmsg, IPAC_PROTO_IPACCESS);
-   return nmsg;
-}
-
 static struct msgb *ipa_bts_id_ack(void)
 {
struct msgb *nmsg2;
@@ -698,13 +614,16 @@
if (msg_type == IPAC_MSGT_ID_GET) {
uint8_t *data = msgb_l2(msg);
int len = msgb_l2len(msg);
+   int old_trx_nr = dev->trx_id;
int trx_nr = 0;
 
if (link->ofd->priv_nr >= E1INP_SIGN_RSL)
trx_nr = link->ofd->priv_nr - E1INP_SIGN_RSL;
 
LOGP(DLINP, LOGL_NOTICE, "

[PATCH] libosmo-abis[master]: Revert "ipacces.c: Remove ipa_bts_id_resp() and use libosmoc...

2017-05-26 Thread Harald Welte
msg = ipa_ccm_make_id_resp_from_req(dev, data + 1, len 
- 1);
-   dev->trx_id = old_trx_nr;
+   rmsg = ipa_bts_id_resp(dev, data + 1, len - 1, trx_nr);
ret = ipa_send(link->ofd->fd, rmsg->data, rmsg->len);
if (ret != rmsg->len) {
LOGP(DLINP, LOGL_ERROR, "cannot send ID_RESP "

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

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


[MERGED] libosmo-abis[master]: Revert "ipacces.c: Remove ipa_bts_id_resp() and use libosmoc...

2017-05-26 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Revert "ipacces.c: Remove ipa_bts_id_resp() and use libosmocore"
..


Revert "ipacces.c: Remove ipa_bts_id_resp() and use libosmocore"

This reverts commit d517db06ced45bbe0a70799487964e52edd8a375, which for
some reason broke the IPA client functionality.  This needs to be
investigated and properly fixed.  But until that happens: revert.

Change-Id: Ic168f437c5bf1fcdb7441b0541c80a4805463004
---
M src/input/ipaccess.c
1 file changed, 85 insertions(+), 4 deletions(-)

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



diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index fb2e30d..ac84ffc 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -567,6 +567,90 @@
return ret;
 }
 
+#define IPA_STRING_MAX 64
+
+static struct msgb *
+ipa_bts_id_resp(struct ipaccess_unit *dev, uint8_t *data, int len, int trx_nr)
+{
+   struct msgb *nmsg;
+   char str[IPA_STRING_MAX];
+   uint8_t *tag;
+
+   memset(str, 0, sizeof(str));
+
+   nmsg = ipa_msg_alloc(0);
+   if (!nmsg)
+   return NULL;
+
+   *msgb_put(nmsg, 1) = IPAC_MSGT_ID_RESP;
+   while (len) {
+   if (len < 2) {
+   LOGP(DLINP, LOGL_NOTICE,
+   "Short read of ipaccess tag\n");
+   msgb_free(nmsg);
+   return NULL;
+   }
+   switch (data[1]) {
+   case IPAC_IDTAG_UNIT:
+   snprintf(str, sizeof(str), "%u/%u/%u",
+   dev->site_id, dev->bts_id, trx_nr);
+   break;
+   case IPAC_IDTAG_MACADDR:
+   snprintf(str, sizeof(str),
+"%02x:%02x:%02x:%02x:%02x:%02x",
+dev->mac_addr[0], dev->mac_addr[1],
+dev->mac_addr[2], dev->mac_addr[3],
+dev->mac_addr[4], dev->mac_addr[5]);
+   break;
+   case IPAC_IDTAG_LOCATION1:
+   if (dev->location1)
+   strncpy(str, dev->location1, IPA_STRING_MAX);
+   break;
+   case IPAC_IDTAG_LOCATION2:
+   if (dev->location2)
+   strncpy(str, dev->location2, IPA_STRING_MAX);
+   break;
+   case IPAC_IDTAG_EQUIPVERS:
+   if (dev->equipvers)
+   strncpy(str, dev->equipvers, IPA_STRING_MAX);
+   break;
+   case IPAC_IDTAG_SWVERSION:
+   if (dev->swversion)
+   strncpy(str, dev->swversion, IPA_STRING_MAX);
+   break;
+   case IPAC_IDTAG_UNITNAME:
+   snprintf(str, sizeof(str),
+"%s-%02x-%02x-%02x-%02x-%02x-%02x",
+dev->unit_name,
+dev->mac_addr[0], dev->mac_addr[1],
+dev->mac_addr[2], dev->mac_addr[3],
+dev->mac_addr[4], dev->mac_addr[5]);
+   break;
+   case IPAC_IDTAG_SERNR:
+   if (dev->serno)
+   strncpy(str, dev->serno, IPA_STRING_MAX);
+   break;
+   default:
+   LOGP(DLINP, LOGL_NOTICE,
+   "Unknown ipaccess tag 0x%02x\n", *data);
+   msgb_free(nmsg);
+   return NULL;
+   }
+   str[IPA_STRING_MAX-1] = '\0';
+
+   LOGP(DLINP, LOGL_INFO, " tag %d: %s\n", data[1], str);
+   tag = msgb_put(nmsg, 3 + strlen(str) + 1);
+   tag[0] = 0x00;
+   tag[1] = 1 + strlen(str) + 1;
+   tag[2] = data[1];
+   memcpy(tag + 3, str, strlen(str) + 1);
+   data += 2;
+   len -= 2;
+   }
+   ipa_msg_push_header(nmsg, IPAC_PROTO_IPACCESS);
+   return nmsg;
+}
+
 static struct msgb *ipa_bts_id_ack(void)
 {
struct msgb *nmsg2;
@@ -614,16 +698,13 @@
if (msg_type == IPAC_MSGT_ID_GET) {
uint8_t *data = msgb_l2(msg);
int len = msgb_l2len(msg);
-   int old_trx_nr = dev->trx_id;
int trx_nr = 0;
 
if (link->ofd->priv_nr >= E1INP_SIGN_RSL)
trx_nr = link->ofd->priv_nr - E1INP_SIGN_RS

libosmo-abis[master]: Revert "ipacces.c: Remove ipa_bts_id_resp() and use libosmoc...

2017-05-26 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic168f437c5bf1fcdb7441b0541c80a4805463004
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: Implement basic Get Attribute responder

2017-05-27 Thread Harald Welte

Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I09f95ed995fab5def9dc6e8cc201012fba4db28d
Gerrit-PatchSet: 7
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[MERGED] osmo-bts[master]: Implement basic Get Attribute responder

2017-05-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Implement basic Get Attribute responder
..


Implement basic Get Attribute responder

Add 3GPP TS 52.021 §8.11.2 Get Attribute Response handling:
* report OsmoBTS version
* report sysmoBTS sub-model
* report OsmoBTS variant

Requires I7ecb0c4339530d3a8354a2f94b34063dda87e030 in OpenBSC.

Change-Id: I09f95ed995fab5def9dc6e8cc201012fba4db28d
Related: OS#1614
---
M src/common/oml.c
M src/osmo-bts-sysmo/l1_if.c
2 files changed, 136 insertions(+), 0 deletions(-)

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



diff --git a/src/common/oml.c b/src/common/oml.c
index 9d65d83..3f0f238 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -24,6 +24,8 @@
  * Operation and Maintainance Messages
  */
 
+#include "btsconfig.h"
+
 #include 
 #include 
 #include 
@@ -31,6 +33,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -148,6 +151,93 @@
 get_value_string(abis_nm_obj_class_names, mo->obj_class),
 mo->obj_inst.bts_nr, mo->obj_inst.trx_nr, mo->obj_inst.ts_nr);
return mo_buf;
+}
+
+static inline struct msgb *add_bts_attr(const struct gsm_bts *bts)
+{
+   struct msgb *a = oml_msgb_alloc();
+
+   if (!a)
+   return NULL;
+
+   abis_nm_put_sw_file(a, btstype2str(GSM_BTS_TYPE_OSMOBTS), 
PACKAGE_VERSION, true);
+   abis_nm_put_sw_file(a, btsatttr2str(BTS_TYPE_VARIANT), 
btsvariant2str(bts->variant), true);
+
+   if (bts->sub_model)
+   abis_nm_put_sw_file(a, btsatttr2str(BTS_SUB_MODEL), 
bts->sub_model, true);
+
+   return a;
+}
+
+static inline int handle_attr(const struct gsm_abis_mo *mo, const uint8_t 
*attr, uint16_t attr_len, uint8_t *out)
+{
+   uint16_t i, attr_out_index = 1; /* byte 0 is reserved for unsupported 
attributes counter */
+   struct msgb *ba = NULL;
+   int length;
+
+   for (i = 0; i < attr_len; i++) {
+   switch (attr[i]) {
+   case NM_ATT_SW_CONFIG:
+   switch (mo->obj_class) {
+   case NM_OC_BTS:
+   ba = add_bts_attr(mo->bts);
+   break;
+   default:
+   LOGP(DOML, LOGL_ERROR, "Unsupported MO class %s 
in Get Attribute Response\n",
+get_value_string(abis_nm_obj_class_names, 
mo->obj_class));
+   return -EINVAL;
+   }
+   break;
+   default:
+   LOGP(DOML, LOGL_ERROR, "O&M Get Attributes [%u], %s is 
unsupported.\n", i,
+get_value_string(abis_nm_att_names, attr[i]));
+   out[attr_out_index] = attr[i];
+   attr_out_index++;
+   }
+   }
+
+   if (attr_out_index - 1 > 255) { /* The number of attributes in §9.4.26 
List of Required Attributes is 2 bytes,
+  but the Count of not-reported 
attributes from §9.4.64 is 1 byte */
+   LOGP(DOML, LOGL_ERROR, "O&M Get Attributes, Count of 
not-reported attributes is too big: %u\n",
+attr_out_index - 1);
+   out[0] = 255;
+   } else
+   out[0] = attr_out_index - 1; /* Count number of unhandled 
attributes */
+
+   length = attr_out_index + 1;
+
+   if (ba) {
+   memcpy(out + attr_out_index, msgb_data(ba), ba->len);
+   length += ba->len;
+   msgb_free(ba);
+   }
+
+   return length;
+}
+
+/* send 3GPP TS 52.021 §8.11.2 Get Attribute Response */
+static int oml_tx_attr_resp(struct gsm_abis_mo *mo, const uint8_t *attr, 
uint16_t attr_len)
+{
+   struct msgb *nmsg = oml_msgb_alloc();
+   uint8_t resp[MAX_VERSION_LENGTH * attr_len * 2]; /* heuristic for 
Attribute Response Info space requirements */
+   int len;
+
+   LOGP(DOML, LOGL_INFO, "%s Tx Get Attribute Response\n", 
gsm_abis_mo_name(mo));
+
+   if (!nmsg)
+   return -ENOMEM;
+
+   len = handle_attr(mo, attr, attr_len, resp);
+   if (len < 0) {
+   LOGP(DOML, LOGL_ERROR, "Tx Get Attribute Response FAILED with 
%d\n", len);
+   msgb_free(nmsg);
+   return len;
+   }
+
+   /* §9.4.64 Get Attribute Response Info */
+   msgb_tl16v_put(nmsg, NM_ATT_GET_ARI, len, resp);
+
+   return oml_mo_send_msg(mo, nmsg, NM_MT_GET_ATTR_RESP);
 }
 
 /* 8.8.1 sending State Changed Event Report */
@@ -368,6 +458,45 @@
dl_set_t200(&lc->lapdm_dcch.datalink[DL_SAPI3], t200_dcch_sapi3);
dl_set_t200(&lc->lapdm_acch.datalink[DL_SAPI0], t200_acch);
dl_set_t2

osmo-bts[master]: measurement: Improve log output

2017-05-27 Thread Harald Welte

Patch Set 8: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/2389/8/src/common/rsl.c
File src/common/rsl.c:

Line 2249:   "%s chan_num:%d Tx MEAS RES valid(%d), flags(%d)\n",
the flags are unsigned (not signed), so %u applies.  Also, a bit-mask of flags 
is typically best printed as a hex value for human interpretation (it's easier 
to figure out than decimal).


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic871eed6dcbc7d10aca6cd11dbc803b3e6da449f
Gerrit-PatchSet: 8
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference

2017-05-27 Thread Harald Welte

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca
Gerrit-PatchSet: 3
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


  1   2   3   4   5   6   7   8   9   10   >