libosmocore[master]: tests/conv: move conv.h to the global include dir

2017-03-23 Thread Vadim Yanitskiy

Patch Set 2:

> actualyl, no. Files in "include/osmocom/" should only be files that
 > are installed into the system.  "tests.h" sounds like something
 > only needed during unit tests, and it does not belong into a
 > directory containing system-wide installed header files? Am I
 > missing something?

Ok, you are right. Let me some time to find another way.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: tnt <t...@246tnt.com>
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H

2017-03-22 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2160

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

osmo-bts-trx/l1_if.c: use channel combination III for TCH/H

Currently the channel combination II is used for TCH/H, which
allows only one lchan to be allocated. The reason is that it
saves a bit of CPU by disabling UL burst detection on lchan 1.

There is also the channel combination III, which allows to
increase channel capacity, providing two lchans on a single
TCH/H timeslot.

Ideally we should implement some dynamic II <-> III switching
depending on the network load level. But for now this change
replaces the channel combination of TCH/H by III, until dynamic
switching is implemented.

Fixes issue: https://osmocom.org/issues/1795

Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810
---
M src/osmo-bts-trx/l1_if.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/60/2160/2

diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index abb16eb..d0c8afd 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -49,7 +49,7 @@
[GSM_PCHAN_CCCH]= 4,
[GSM_PCHAN_CCCH_SDCCH4] = 5,
[GSM_PCHAN_TCH_F]   = 1,
-   [GSM_PCHAN_TCH_H]   = 2,
+   [GSM_PCHAN_TCH_H]   = 3,
[GSM_PCHAN_SDCCH8_SACCH8C]  = 7,
[GSM_PCHAN_PDCH]= 13,
/* [GSM_PCHAN_TCH_F_PDCH] not needed here, see trx_set_ts_as_pchan() */

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Jenkins Builder


[PATCH] libosmocore[master]: tests/conv: add GSM 05.03 specific test

2017-03-17 Thread Vadim Yanitskiy
3_mcs1_ul_hdr
+[.] Input length  : ret =  39  exp =  39 -> OK
+[.] Output length : ret = 117  exp = 117 -> OK
+[.] Random vector checks:
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
+[..] Encoding / Decoding cycle : OK
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 64df724..afc7cff 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -45,6 +45,12 @@
 AT_CHECK([$abs_top_builddir/tests/conv/conv_test], [0], [expout])
 AT_CLEANUP
 
+AT_SETUP([conv_gsm0503])
+AT_KEYWORDS([conv_gsm0503])
+cat $abs_srcdir/conv/conv_gsm0503_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/conv/conv_gsm0503_test], [0], [expout])
+AT_CLEANUP
+
 AT_SETUP([coding])
 AT_KEYWORDS([coding])
 cat $abs_srcdir/coding/coding_test.ok > expout

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a
Gerrit-PatchSet: 5
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: tnt <t...@246tnt.com>


[MERGED] openbsc[master]: VTY: add the dyn_ts_allow_tch_f option

2017-04-03 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: VTY: add the dyn_ts_allow_tch_f option
..


VTY: add the dyn_ts_allow_tch_f option

This option allows to enable or disable TCH/F allocation on the
TCH/F_TCH/H_PDCH timeslots. Until now, source code modification
was required to enable this feature.

Related: OS#1778

Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712
---
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libbsc/bsc_vty.c
M openbsc/src/libcommon-cs/common_cs_vty.c
M openbsc/src/osmo-nitb/bsc_hack.c
4 files changed, 29 insertions(+), 14 deletions(-)

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



diff --git a/openbsc/include/openbsc/gsm_data.h 
b/openbsc/include/openbsc/gsm_data.h
index 17cc804..08e07d8 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -384,7 +384,6 @@
 
/* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */
bool dyn_ts_allow_tch_f;
-   /* TODO: vty for this; related: OS#1781 */
 
/* all active subscriber connections. */
struct llist_head subscr_conns;
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index b1747aa..66b30cd 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -821,6 +821,8 @@
vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
+   vty_out(vty, " dyn_ts_allow_tch_f %d%s",
+   gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE);
vty_out(vty, " subscriber-keep-in-ram %d%s",
gsmnet->subscr_group->keep_subscr, VTY_NEWLINE);
if (gsmnet->tz.override != 0) {
diff --git a/openbsc/src/libcommon-cs/common_cs_vty.c 
b/openbsc/src/libcommon-cs/common_cs_vty.c
index 08a7581..76336a1 100644
--- a/openbsc/src/libcommon-cs/common_cs_vty.c
+++ b/openbsc/src/libcommon-cs/common_cs_vty.c
@@ -197,6 +197,18 @@
return CMD_SUCCESS;
 }
 
+DEFUN(cfg_net_dyn_ts_allow_tch_f,
+  cfg_net_dyn_ts_allow_tch_f_cmd,
+  "dyn_ts_allow_tch_f (0|1)",
+  "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n"
+  "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n"
+  "Allow TCH/F on TCH_F_TCH_H_PDCH\n")
+{
+   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+   gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false;
+   return CMD_SUCCESS;
+}
+
 DEFUN(cfg_net_subscr_keep,
   cfg_net_subscr_keep_cmd,
   "subscriber-keep-in-ram (0|1)",
@@ -295,6 +307,7 @@
install_element(GSMNET_NODE, _net_timezone_cmd);
install_element(GSMNET_NODE, _net_timezone_dst_cmd);
install_element(GSMNET_NODE, _net_no_timezone_cmd);
+   install_element(GSMNET_NODE, _net_dyn_ts_allow_tch_f_cmd);
 
return CMD_SUCCESS;
 }
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index dd90b8b..d8029cd 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -301,6 +301,20 @@
} else
DEBUGP(DMNCC, "Using internal MNCC handler.\n");
 
+   /*
+* For osmo-nitb, skip TCH/F for now, because otherwise dyn TS
+* always imply the possibility to have a mix of TCH/F and
+* TCH/H channels; if two phones request a TCH/F and a TCH/H,
+* respectively, they cannot call each other. If we deny TCH/F,
+* they will both fall back to TCH/H, and dynamic channels are
+* usable. See OS#1778.
+*
+* A third-party MSC may well be able to handle a TCH/H TCH/F
+* mismatch. Moreover, this option may be overwritten in the
+* config file or in VTY.
+*/
+   bsc_gsmnet->dyn_ts_allow_tch_f = false;
+
/* Read the config */
rc = bsc_network_configure(config_file);
if (rc < 0) {
@@ -312,19 +326,6 @@
smpp_openbsc_start(bsc_gsmnet);
 #endif
bsc_api_init(bsc_gsmnet, msc_bsc_api());
-
-   /*
-* For osmo-nitb, skip TCH/F for now, because otherwise dyn TS
-* always imply the possibility to have a mix of TCH/F and
-* TCH/H channels; if two phones request a TCH/F and a TCH/H,
-* respectively, they cannot call each other. If we deny TCH/F,
-* they will both fall back to TCH/H, and dynamic channels are
-* usable. See http://osmocom.org/issues/1778.
-*
-* A third-party MSC may well be able to handle a TCH/H TCH/F
-* mismatch.
-*/
-   bsc_gsmnet->dyn_ts_allow_tch_f = false;
 
/* start control interface after reading config for
 * ctrl_vty_get_bind_addr

osmo-trx[master]: ssedetect: Add runtime CPU detection

2017-04-23 Thread Vadim Yanitskiy

Patch Set 3: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/2100/3/Transceiver52M/x86/convert.c
File Transceiver52M/x86/convert.c:

Line 197:   if (__builtin_cpu_supports("sse4.1")) {
It is only supported by GCC, so building with another
compiler, for example with clang, fails:

convert.c:197:6: error: use of unknown builtin
'__builtin_cpu_supports' [-Wimplicit-function-declaration]
if (__builtin_cpu_supports("sse4.1")) {
^
1 error generated.

I don't know, is there any way to determine supported
instructions sets in clang, but for now we can go this
way:

#if (defined(__GNUC__) && !defined(__clang__))
if (__builtin_cpu_supports("sse4.1"))
// ...
#endif


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iba74f8a6e4e921ff31e4bd9f0c7c881fe547423a
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


libosmocore[master]: core/conv: implement optimized Viterbi decoder

2017-04-08 Thread Vadim Yanitskiy

Patch Set 6:

Thanks everyone for review! I'll be happy to see this one merged.
There are also some patches, written by Tom and related to Viterbi,
so I'll take care of them.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: tnt <t...@246tnt.com>
Gerrit-HasComments: No


osmo-tetra[laforge/sq5bpf-rebase-20161218]: adding dmo support

2017-07-07 Thread Vadim Yanitskiy

Patch Set 1:

(1 comment)

> Do you see my updated code or do I have to push a button somewhere?

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

https://gerrit.osmocom.org/#/c/2817/1/src/conv_enc_test.c
File src/conv_enc_test.c:

PS1, Line 53: void dp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t 
*bits, unsigned int len, void *priv)
: {
: }
> I have not figured out why yet, but without this function I get some error 
Just a hint: you can use grep to find, where this
function is being called, and drop corresponding line(s).


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa5521d7313595384e74dd790a56550755b93fe9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-tetra
Gerrit-Branch: laforge/sq5bpf-rebase-20161218
Gerrit-Owner: allesklar2 <jjuerg...@seemoo.tu-darmstadt.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: allesklar2 <jjuerg...@seemoo.tu-darmstadt.de>
Gerrit-HasComments: Yes


[PATCH] osmocom-bb[master]: vty_interface.c: use RPLMN from settings if preset

2017-07-27 Thread Vadim Yanitskiy

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

vty_interface.c: use RPLMN from settings if preset

Previously, when testcard was attached via VTY interface, the
initial values were used for MCC / MNC, LAC and TMSI, even if
correct RPLMN settings were set.

Change-Id: Ic70889cdb6be95f06d0c2df710524b4128b5f72b
---
M src/host/layer23/src/mobile/vty_interface.c
1 file changed, 15 insertions(+), 0 deletions(-)


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

diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index d909153..b26d471 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -472,6 +472,9 @@
int attached)
 {
struct osmocom_ms *ms;
+   struct gsm_settings *set;
+
+   /* Initial testcard settings */
uint16_t mcc = 0x001, mnc = 0x01f, lac = 0x;
uint32_t tmsi = 0x;
 
@@ -485,6 +488,18 @@
return CMD_WARNING;
}
 
+   set = >settings;
+   if (set->test_rplmn_valid) {
+   mcc = set->test_rplmn_mcc;
+   mnc = set->test_rplmn_mnc;
+
+   if (set->test_lac > 0x && set->test_lac < 0xfffe)
+   lac = set->test_lac;
+
+   if (set->test_tmsi != 0x)
+   tmsi = set->test_tmsi;
+   }
+
if (argc == 2) {
vty_out(vty, "Give MNC together with MCC%s", VTY_NEWLINE);
return CMD_WARNING;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic70889cdb6be95f06d0c2df710524b4128b5f72b
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: add DLMGCP logging category for libosmo-mgcp

2017-07-11 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I09c587e2d59472cbde852d467d457254746d9e67
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


openbsc[master]: check for missing result of rate_ctr_group_alloc()

2017-07-11 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7dad4a4d52fe05f6b990359841b4408df5990e21
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-pcu[master]: check for missing result of rate_ctr_group_alloc()

2017-07-11 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6d780c67b4af15aaa5c6f2b8b00f2a0b70a7385
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


libosmo-abis[master]: check for missing result of rate_ctr_group_alloc()

2017-07-11 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iff8506832d3472ab193b19b43cfbe7a9511075d1
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-bts[master]: cosmetic: Move error goto path to the end of the function

2017-07-04 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3ad15a9edbfe74de3deb7298441d54fd9d0178ad
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No



osmo-bts[master]: cosmetic: scheduler_trx.c: Add function to get rid of ugly g...

2017-07-04 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

I did the same in my simplified version of scheduler for OsmocomBB.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9c2e166e6f182f703ccf49aa883c223e377c8421
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


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

2017-04-24 Thread Vadim Yanitskiy

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

Makefile: add forgotten gsmmap to (dist)clean section

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


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/98/2398/1

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: newchange
Gerrit-Change-Id: I14abe8a061d218ca81dd2d101b218d3030324aa2
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


osmo-trx[master]: buildenv: Make build CPU invariant

2017-04-30 Thread Vadim Yanitskiy

Patch Set 4: Code-Review+1

(2 comments)

https://gerrit.osmocom.org/#/c/2102/4/config/ax_ext.m4
File config/ax_ext.m4:

Line 22: # HAVE_MMX / HAVE_SSE / HAVE_SSE2 / HAVE_SSE3 / HAVE_SSSE3 / 
HAVE_SSE4.1 / HAVE_SSE4.2 / HAVE_AVX
Now we have only HAVE_SSE3 and HAVE_SSE4.1, right?
So, it would be good to update this line with actual info.


PS4, Line 47: AC_REQUIRE([AX_GCC_X86_CPUID])
:   AC_REQUIRE([AX_GCC_X86_AVX_XGETBV])
: 
:   AX_GCC_X86_CPUID(0x0001)
Do we still need this?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c
Gerrit-PatchSet: 4
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


osmo-trx[master]: cosmetic: Add info about SSE support

2017-04-30 Thread Vadim Yanitskiy

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iacc83fd668c31644e0efb3e18962cf2870ed1daf
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-trx[master]: buildenv: Turn off native architecture builds

2017-04-30 Thread Vadim Yanitskiy

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3df4b8db9692016115edbe2247beeec090715687
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: configure.ac: add SIMD detection capabilities

2017-04-30 Thread Vadim Yanitskiy
dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+[AS_VAR_SET(CACHEVAR,[yes])],
+[AS_VAR_SET(CACHEVAR,[no])])
+  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+  [m4_default([$2], :)],
+  [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
diff --git a/m4/ax_check_simd.m4 b/m4/ax_check_simd.m4
new file mode 100644
index 000..d07d706
--- /dev/null
+++ b/m4/ax_check_simd.m4
@@ -0,0 +1,82 @@
+# ===
+#  http://www.gnu.org/software/autoconf-archive/ax_ext.html
+# ===
+#
+# SYNOPSIS
+#
+#   AX_EXT
+#
+# DESCRIPTION
+#
+#   Find supported SIMD extensions by requesting cpuid. When an SIMD
+#   extension is found, the -m"simdextensionname" is added to SIMD_FLAGS if
+#   compiler supports it. For example, if "sse2" is available, then "-msse2"
+#   is added to SIMD_FLAGS.
+#
+#   This macro calls:
+#
+# AC_SUBST(SIMD_FLAGS)
+#
+#   And defines:
+#
+#  HAVE_AVX3 / HAVE_SSE3 / HAVE_SSE4.1
+#
+# LICENSE
+#
+#   Copyright (c) 2007 Christophe Tournayre <tur...@users.sourceforge.net>
+#   Copyright (c) 2013 Michael Petch <mpe...@capp-sysware.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+#
+# NOTE: The functionality that requests the cpuid has been stripped because
+#   this project detects the CPU capabilities during runtime. However, we
+#   still need to check if the compiler supports the requested SIMD flag.
+
+#serial 12
+
+AC_DEFUN([AX_CHECK_SIMD],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  case $host_cpu in
+i[[3456]]86*|x86_64*|amd64*)
+  AX_CHECK_COMPILE_FLAG(-mavx2, ax_cv_support_avx2_ext=yes, [])
+  if test x"$ax_cv_support_avx2_ext" = x"yes"; then
+SIMD_FLAGS="$SIMD_FLAGS -mavx2"
+AC_DEFINE(HAVE_AVX2,,
+  [Support AVX2 (Advanced Vector Extensions 2) instructions])
+AM_CONDITIONAL(HAVE_AVX2, true)
+  else
+AC_MSG_WARN([Your compiler does not support AVX2 instructions])
+AM_CONDITIONAL(HAVE_AVX2, false)
+  fi
+
+  AX_CHECK_COMPILE_FLAG(-msse3, ax_cv_support_sse3_ext=yes, [])
+  if test x"$ax_cv_support_sse3_ext" = x"yes"; then
+SIMD_FLAGS="$SIMD_FLAGS -msse3"
+AC_DEFINE(HAVE_SSE3,,
+  [Support SSE3 (Streaming SIMD Extensions 3) instructions])
+AM_CONDITIONAL(HAVE_SSE3, true)
+  else
+AC_MSG_WARN([Your compiler does not support SSE3 instructions])
+AM_CONDITIONAL(HAVE_SSE3, false)
+  fi
+
+  AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, [])
+  if test x"$ax_cv_support_sse41_ext" = x"yes"; then
+SIMD_FLAGS="$SIMD_FLAGS -msse4.1"
+AC_DEFINE(HAVE_SSE4_1,,
+  [Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions])
+AM_CONDITIONAL(HAVE_SSE4_1, true)
+  else
+AC_MSG_WARN([Your compiler does not support SSE4.1 instructions])
+AM_CONDITIONAL(HAVE_SSE4_1, false)
+  fi
+  ;;
+  esac
+
+  AC_SUBST(SIMD_FLAGS)
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index 6948e1a..999436d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,7 @@
 LIBVERSION=8:0:0
 
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-AM_CFLAGS = -Wall $(TALLOC_CFLAGS)
+AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(SIMD_FLAGS)
 
 lib_LTLIBRARIES = libosmocore.la
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf8fff984bd936a75c7c307338df88ba4b005817
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


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

2017-04-30 Thread Vadim Yanitskiy
SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m4)
+
+   m0 = _mm_load_si128((__m128i *) [32]);
+   m1 = _mm_load_si128((__m128i *) [40]);
+   m2 = _mm_load_si128((__m128i *) [48]);
+   m3 = _mm_load_si128((__m128i *) [56]);
+
+   SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m5)
+
+   m0 = _mm_load_si128((__m128i *) [64]);
+   m1 = _mm_load_si128((__m128i *) [72]);
+   m2 = _mm_load_si128((__m128i *) [80]);
+   m3 = _mm_load_si128((__m128i *) [88]);
+
+   SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m6)
+
+   m0 = _mm_load_si128((__m128i *) [96]);
+   m1 = _mm_load_si128((__m128i *) [104]);
+   m2 = _mm_load_si128((__m128i *) [112]);
+   m3 = _mm_load_si128((__m128i *) [120]);
+
+   SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m7)
+
+   /* (PMU) Butterflies: 0-15 */
+   SSE_BUTTERFLY(m8, m9, m4, m0, m1)
+   SSE_BUTTERFLY(m10, m11, m5, m2, m3)
+
+   _mm_store_si128((__m128i *) [0], m0);
+   _mm_store_si128((__m128i *) [8], m2);
+   _mm_store_si128((__m128i *) [32], m9);
+   _mm_store_si128((__m128i *) [40], m11);
+
+   /* (PMU) Butterflies: 17-31 */
+   SSE_BUTTERFLY(m12, m13, m6, m0, m2)
+   SSE_BUTTERFLY(m14, m15, m7, m9, m11)
+
+   _mm_store_si128((__m128i *) [16], m0);
+   _mm_store_si128((__m128i *) [24], m9);
+   _mm_store_si128((__m128i *) [48], m13);
+   _mm_store_si128((__m128i *) [56], m15);
+
+   if (norm)
+   SSE_NORMALIZE_K7(m4, m1, m5, m3, m6, m2,
+m7, m11, m0, m8, m9, m10)
+
+   _mm_store_si128((__m128i *) [0], m4);
+   _mm_store_si128((__m128i *) [8], m5);
+   _mm_store_si128((__m128i *) [16], m6);
+   _mm_store_si128((__m128i *) [24], m7);
+   _mm_store_si128((__m128i *) [32], m1);
+   _mm_store_si128((__m128i *) [40], m3);
+   _mm_store_si128((__m128i *) [48], m2);
+   _mm_store_si128((__m128i *) [56], m11);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k5_n2_sse(const int8_t *val, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[0], val[1] };
+
+   _sse_metrics_k5_n2(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k5_n3_sse(const int8_t *val, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], 0 };
+
+   _sse_metrics_k5_n4(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k5_n4_sse(const int8_t *val, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], val[3] };
+
+   _sse_metrics_k5_n4(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k7_n2_sse(const int8_t *val, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[0], val[1] };
+
+   _sse_metrics_k7_n2(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k7_n3_sse(const int8_t *val, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], 0 };
+
+   _sse_metrics_k7_n4(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k7_n4_sse(const int8_t *val, const int16_t *out,
+   int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], val[3] };
+
+   _sse_metrics_k7_n4(_val, out, sums, paths, norm);
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1da6d71ed0564f1d684f3a836e998d09de5f0351
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


osmo-bts[master]: TRX: Remove bogus extern global variable declarations

2017-08-09 Thread Vadim Yanitskiy

Patch Set 4: Code-Review+1

Maxim has added the 'Related: OS#1848' label in the previous
patch set. I think it makes sense to keep it.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I94b5f934fc3bd00b0467d90029d3053b16594186
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-bts[master]: TRX: Remove bogus extern global variable declarations

2017-08-09 Thread Vadim Yanitskiy

Patch Set 5: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I94b5f934fc3bd00b0467d90029d3053b16594186
Gerrit-PatchSet: 5
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: gsm0480: modify USSD structures to support external handling

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: modify USSD structures to support external handling

This change adds the following new fields to ss_request struct:

  - message_type - GSM 04.80 Chapter 2.2
  - component_type - GSM 04.80 Chapter 3.6.2
  - error_code - GSM 04.80 Chapter 3.6.6
  - problem_code - GSM 04.80 Chapter 3.6.7
  - ussd_text_language
  - ussd_text_len

Also, the MAX_LEN_USSD_STRING was increased to 182.

Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
2 files changed, 33 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/3374/1

diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 672ffe5..e3b15d2 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -7,7 +7,7 @@
 #include 
 #include 
 
-#define MAX_LEN_USSD_STRING31
+#define MAX_LEN_USSD_STRING182
 
 /* deprecated */
 struct ussd_request {
@@ -21,11 +21,31 @@
struct ussd_request *request) 
OSMO_DEPRECATED("Use gsm0480_decode_ss_request() instead");
 
 struct ss_request {
-   uint8_t opcode;
-   uint8_t ss_code;
-   uint8_t ussd_text[MAX_LEN_USSD_STRING + 1];
+   /*! L3 transaction ID */
uint8_t transaction_id;
+   /*! Message type2.2   */
+   uint8_t message_type;
+
+   /*! Component type  3.6.2 */
+   uint8_t component_type;
+   /*! Invoke id   3.6.3 */
uint8_t invoke_id;
+
+   union {
+   /*! Operational code3.6.4 */
+   uint8_t opcode;
+   /*! Error code  3.6.6 */
+   uint8_t error_code;
+   /*! Problem code3.6.7 */
+   uint8_t problem_code;
+   };
+
+   uint8_t ussd_text_len;
+   uint8_t ussd_text_language;
+   uint8_t ussd_text[MAX_LEN_USSD_STRING + 1];
+
+   /*! Parameters of a Interrogate/Activate/DeactivateSS Request */
+   uint8_t ss_code;
 };
 
 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 38693d4..1c01e64 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -264,6 +264,7 @@
int rc = 1;
uint8_t msg_type = hdr->msg_type & 0x3F;  /* message-type - section 3.4 
*/
 
+   req->message_type = msg_type;
switch (msg_type) {
case GSM0480_MTYPE_RELEASE_COMPLETE:
LOGP(0, LOGL_DEBUG, "SS Release Complete\n");
@@ -333,6 +334,8 @@
LOGP(0, LOGL_ERROR, "Component does not fit.\n");
return 0;
}
+
+   req->component_type = component_type;
 
switch (component_type) {
case GSM0480_CTYPE_INVOKE:
@@ -443,9 +446,12 @@
/* Prevent a mobile-originated buffer-overrun! 
*/
if (num_chars > MAX_LEN_USSD_STRING)
num_chars = MAX_LEN_USSD_STRING;
-   gsm_7bit_decode_n_ussd((char *)req->ussd_text,
-   sizeof(req->ussd_text),
-   &(uss_req_data[7]), 
num_chars);
+
+   num_chars = gsm_7bit_decode_n_ussd((char 
*)req->ussd_text,
+   sizeof(req->ussd_text), 
&(uss_req_data[7]), num_chars);
+
+   req->ussd_text_language = 0x80;
+   req->ussd_text_len = num_chars;
rc = 1;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: drop length check in gsm0480_decode_ss_request()

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: drop length check in gsm0480_decode_ss_request()

According to GSM 04.80 Section 2.5 'Release complete' Table 2.5,
the 'RELEASE COMPLETE' message payload is optional, so let's drop
length check in gsm0480_decode_ss_request().

Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6
---
M src/gsm/gsm0480.c
1 file changed, 0 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/3373/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 557aa14..38693d4 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -248,12 +248,6 @@
struct ss_request *req)
 {
int rc = 0;
-
-   if (len < sizeof(*hdr) + 2) {
-   LOGP(0, LOGL_DEBUG, "SS Request is too short.\n");
-   return 0;
-   }
-
if (gsm48_hdr_pdisc(hdr) == GSM48_PDISC_NC_SS) {
req->transaction_id = hdr->proto_discr & 0x70;
rc = parse_ss(hdr, len, req);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA

Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
---
M src/gsm/gsm0480.c
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/3380/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index c74077a..6731cec 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -425,6 +425,11 @@
   length - offset - 3,
   req);
break;
+   case GSM0480_OP_CODE_PROCESS_USS_DATA:
+   rc = parse_process_uss_data(invoke_data + offset + 3,
+   length - offset - 3,
+   req);
+   break;
case GSM0480_OP_CODE_ACTIVATE_SS:
case GSM0480_OP_CODE_DEACTIVATE_SS:
case GSM0480_OP_CODE_INTERROGATE_SS:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
---
M src/gsm/gsm0480.c
1 file changed, 84 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/3378/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index e8a3bc3..7e036ba 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -202,6 +202,10 @@
 struct ss_request *req);
 static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length,
struct ss_request *req);
+static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
+ struct ss_request *req);
+static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
+ struct ss_request *req);
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
struct ss_request *req);
 static int parse_ss_for_bs_req(const uint8_t *ss_req_data,
@@ -360,6 +364,9 @@
  req);
break;
case GSM0480_CTYPE_RETURN_RESULT:
+   rc &= parse_ss_return_result(facility_ie+2,
+component_length,
+req);
break;
case GSM0480_CTYPE_RETURN_ERROR:
break;
@@ -439,6 +446,83 @@
return rc;
 }
 
+/* Parse an Return Result component - see table 3.4 */
+static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
+ struct ss_request *req)
+{
+   uint8_t operation_code;
+   uint8_t offset;
+
+   if (length < 3)
+   return 0;
+
+   /* Mandatory part */
+   if (rr_data[0] != GSM0480_COMPIDTAG_INVOKE_ID) {
+   LOGP(0, LOGL_DEBUG, "Unexpected GSM 04.80 Component-ID tag "
+"0x%02x (expecting Invoke ID tag)\n", rr_data[0]);
+   return 0;
+   }
+
+   offset = rr_data[1] + 2;
+   req->invoke_id = rr_data[2];
+
+   if (offset >= length)
+   return 1;
+
+   if (rr_data[offset] != GSM_0480_SEQUENCE_TAG)
+   return 0;
+
+   if (offset + 2 > length)
+   return 0;
+
+   offset += 2;
+   operation_code = rr_data[offset + 2];
+   req->opcode = operation_code;
+
+   switch (operation_code) {
+   case GSM0480_OP_CODE_USS_NOTIFY:
+   case GSM0480_OP_CODE_USS_REQUEST:
+   case GSM0480_OP_CODE_PROCESS_USS_REQ:
+   return parse_process_uss_req(rr_data + offset + 3,
+   length - offset - 3, req);
+   case GSM0480_OP_CODE_PROCESS_USS_DATA:
+   return parse_process_uss_data(rr_data + offset + 3,
+   length - offset - 3, req);
+   default:
+   LOGP(0, LOGL_DEBUG, "GSM 04.80 operation code 0x%02x "
+   "is not yet handled\n", operation_code);
+   return 0;
+   }
+
+   return 1;
+}
+
+static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
+ struct ss_request *req)
+{
+   uint8_t num_chars;
+
+   /* we need at least that much */
+   if (length < 3)
+   return 0;
+
+   if (uss_req_data[0] != ASN1_IA5_STRING_TAG)
+   return 0;
+
+   num_chars = uss_req_data[1];
+   if (num_chars > length - 2)
+   return 0;
+
+   if (num_chars > MAX_LEN_USSD_STRING)
+   num_chars = MAX_LEN_USSD_STRING;
+
+   req->ussd_text_language = 1;
+   req->ussd_text_len = num_chars;
+   memcpy(req->ussd_text, uss_req_data + 2, num_chars);
+
+   return 1;
+}
+
 /* Parse the parameters of a Process UnstructuredSS Request */
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
 struct ss_request *req)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: parse GSM0480_MTYPE_FACILITY separately

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: parse GSM0480_MTYPE_FACILITY separately

Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
---
M src/gsm/gsm0480.c
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/3377/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 87095d2..e8a3bc3 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -194,6 +194,8 @@
 /* Forward declarations */
 static int parse_ss(const struct gsm48_hdr *hdr,
uint16_t len, struct ss_request *req);
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+struct ss_request *req);
 static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
  struct ss_request *req);
 static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
@@ -272,8 +274,10 @@
req->ussd_text[0] = 0xFF;
break;
case GSM0480_MTYPE_REGISTER:
-   case GSM0480_MTYPE_FACILITY:
rc &= parse_ss_info_elements(>data[0], len - sizeof(*hdr), 
req);
+   break;
+   case GSM0480_MTYPE_FACILITY:
+   rc &= parse_ss_facility(>data[0], len - sizeof(*hdr), req);
break;
default:
LOGP(0, LOGL_DEBUG, "Unknown GSM 04.80 message-type field 
0x%02x\n",
@@ -285,6 +289,18 @@
return rc;
 }
 
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+struct ss_request *req)
+{
+   uint8_t facility_length;
+
+   facility_length = ss_facility[0];
+   if (len - 1 < facility_length)
+   return 0;
+
+   return parse_facility_ie(ss_facility + 1, facility_length, req);
+}
+
 static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
  struct ss_request *req)
 {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: expose the gsm0480_parse_ss_facility_ie()

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: expose the gsm0480_parse_ss_facility_ie()

Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
M src/gsm/libosmogsm.map
3 files changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/3381/1

diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index e3b15d2..e3d40a9 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -50,6 +50,8 @@
 
 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
struct ss_request *request);
+int gsm0480_parse_ss_facility_ie(const uint8_t *facility_ie, uint16_t length,
+struct ss_request *req);
 
 struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, 
const char *text);
 struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char 
*text);
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 6731cec..9705359 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -198,8 +198,6 @@
 struct ss_request *req);
 static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
  struct ss_request *req);
-static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
-struct ss_request *req);
 static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length,
struct ss_request *req);
 static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
@@ -302,7 +300,8 @@
if (len - 1 < facility_length)
return 0;
 
-   return parse_facility_ie(ss_facility + 1, facility_length, req);
+   return gsm0480_parse_ss_facility_ie(ss_facility + 1,
+   facility_length, req);
 }
 
 static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
@@ -324,7 +323,7 @@
case GSM48_IE_CAUSE:
break;
case GSM0480_IE_FACILITY:
-   rc = parse_facility_ie(ss_ie + 2, iei_length, req);
+   rc = gsm0480_parse_ss_facility_ie(ss_ie + 2, iei_length, req);
break;
case GSM0480_IE_SS_VERSION:
break;
@@ -338,8 +337,8 @@
return rc;
 }
 
-static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
-struct ss_request *req)
+int gsm0480_parse_ss_facility_ie(const uint8_t *facility_ie, uint16_t length,
+struct ss_request *req)
 {
int rc = 1;
uint8_t offset = 0;
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 714cb25..b9d30bb 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -83,6 +83,7 @@
 gsm0480_create_ussd_release_complete;
 gsm0480_decode_ussd_request;
 gsm0480_decode_ss_request;
+gsm0480_parse_ss_facility_ie;
 gsm0480_wrap_facility;
 gsm0480_wrap_invoke;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ

Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
---
M src/gsm/gsm0480.c
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/3379/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 7e036ba..c74077a 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -418,6 +418,8 @@
uint8_t operation_code = invoke_data[offset+2];
req->opcode = operation_code;
switch (operation_code) {
+   case GSM0480_OP_CODE_USS_NOTIFY:
+   case GSM0480_OP_CODE_USS_REQUEST:
case GSM0480_OP_CODE_PROCESS_USS_REQ:
rc = parse_process_uss_req(invoke_data + offset + 3,
   length - offset - 3,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: handle UnstructuredSS request with DSC != 0x0F

Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
---
M src/gsm/gsm0480.c
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index de99223..87095d2 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -455,6 +455,17 @@
req->ussd_text_len = num_chars;
 
return 1;
+   } else {
+   num_chars = uss_req_data[6];
+   /* Prevent a mobile-originated buffer-overrun! */
+   if (num_chars > MAX_LEN_USSD_STRING)
+   num_chars = MAX_LEN_USSD_STRING;
+
+   req->ussd_text_language = dcs;
+   req->ussd_text_len = num_chars;
+   memcpy(req->ussd_text, &(uss_req_data[7]), num_chars);
+
+   return 1;
}
 
return 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: refactor the parse_process_uss_req()

2017-07-29 Thread Vadim Yanitskiy

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

gsm0480: refactor the parse_process_uss_req()

This change reduces the degree of code nesting using
the 'follow by contradiction' pattern.

Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
---
M src/gsm/gsm0480.c
1 file changed, 20 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/3375/1

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 1c01e64..de99223 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -427,36 +427,37 @@
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
 struct ss_request *req)
 {
-   int rc = 0;
int num_chars;
uint8_t dcs;
-
 
/* we need at least that much */
if (length < 8)
return 0;
 
+   if (uss_req_data[0] != GSM_0480_SEQUENCE_TAG)
+   return 0;
 
-   if (uss_req_data[0] == GSM_0480_SEQUENCE_TAG) {
-   if (uss_req_data[2] == ASN1_OCTET_STRING_TAG) {
-   dcs = uss_req_data[4];
-   if ((dcs == 0x0F) &&
-   (uss_req_data[5] == ASN1_OCTET_STRING_TAG)) {
-   num_chars = (uss_req_data[6] * 8) / 7;
-   /* Prevent a mobile-originated buffer-overrun! 
*/
-   if (num_chars > MAX_LEN_USSD_STRING)
-   num_chars = MAX_LEN_USSD_STRING;
+   /* Both 2th and 5th should be equal to ASN1_OCTET_STRING_TAG */
+   if ((uss_req_data[2] & uss_req_data[5]) != ASN1_OCTET_STRING_TAG)
+   return 0;
 
-   num_chars = gsm_7bit_decode_n_ussd((char 
*)req->ussd_text,
-   sizeof(req->ussd_text), 
&(uss_req_data[7]), num_chars);
+   dcs = uss_req_data[4];
+   if (dcs == 0x0F) {
+   num_chars = (uss_req_data[6] * 8) / 7;
+   /* Prevent a mobile-originated buffer-overrun! */
+   if (num_chars > MAX_LEN_USSD_STRING)
+   num_chars = MAX_LEN_USSD_STRING;
 
-   req->ussd_text_language = 0x80;
-   req->ussd_text_len = num_chars;
-   rc = 1;
-   }
-   }
+   num_chars = gsm_7bit_decode_n_ussd((char *)req->ussd_text,
+   sizeof(req->ussd_text), &(uss_req_data[7]), num_chars);
+
+   req->ussd_text_language = 0x80;
+   req->ussd_text_len = num_chars;
+
+   return 1;
}
-   return rc;
+
+   return 0;
 }
 
 /* Parse the parameters of a Interrogate/Activate/DeactivateSS Request */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: parse GSM0480_MTYPE_FACILITY separately

2017-07-29 Thread Vadim Yanitskiy

gsm0480: parse GSM0480_MTYPE_FACILITY separately

Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
---
M src/gsm/gsm0480.c
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/3377/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 87095d2..e8a3bc3 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -194,6 +194,8 @@
 /* Forward declarations */
 static int parse_ss(const struct gsm48_hdr *hdr,
uint16_t len, struct ss_request *req);
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+struct ss_request *req);
 static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
  struct ss_request *req);
 static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
@@ -272,8 +274,10 @@
req->ussd_text[0] = 0xFF;
break;
case GSM0480_MTYPE_REGISTER:
-   case GSM0480_MTYPE_FACILITY:
rc &= parse_ss_info_elements(>data[0], len - sizeof(*hdr), 
req);
+   break;
+   case GSM0480_MTYPE_FACILITY:
+   rc &= parse_ss_facility(>data[0], len - sizeof(*hdr), req);
break;
default:
LOGP(0, LOGL_DEBUG, "Unknown GSM 04.80 message-type field 
0x%02x\n",
@@ -285,6 +289,18 @@
return rc;
 }
 
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+struct ss_request *req)
+{
+   uint8_t facility_length;
+
+   facility_length = ss_facility[0];
+   if (len - 1 < facility_length)
+   return 0;
+
+   return parse_facility_ie(ss_facility + 1, facility_length, req);
+}
+
 static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
  struct ss_request *req)
 {

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F

2017-07-29 Thread Vadim Yanitskiy

gsm0480: handle UnstructuredSS request with DSC != 0x0F

Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
---
M src/gsm/gsm0480.c
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index de99223..87095d2 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -455,6 +455,17 @@
req->ussd_text_len = num_chars;
 
return 1;
+   } else {
+   num_chars = uss_req_data[6];
+   /* Prevent a mobile-originated buffer-overrun! */
+   if (num_chars > MAX_LEN_USSD_STRING)
+   num_chars = MAX_LEN_USSD_STRING;
+
+   req->ussd_text_language = dcs;
+   req->ussd_text_len = num_chars;
+   memcpy(req->ussd_text, &(uss_req_data[7]), num_chars);
+
+   return 1;
}
 
return 0;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Jenkins Builder


[PATCH] libosmocore[master]: gsm0480: refactor the parse_process_uss_req()

2017-07-29 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/3375

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

gsm0480: refactor the parse_process_uss_req()

This change reduces the degree of code nesting using
the 'follow by contradiction' pattern.

Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
---
M src/gsm/gsm0480.c
1 file changed, 20 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/3375/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 1c01e64..de99223 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -427,36 +427,37 @@
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
 struct ss_request *req)
 {
-   int rc = 0;
int num_chars;
uint8_t dcs;
-
 
/* we need at least that much */
if (length < 8)
return 0;
 
+   if (uss_req_data[0] != GSM_0480_SEQUENCE_TAG)
+   return 0;
 
-   if (uss_req_data[0] == GSM_0480_SEQUENCE_TAG) {
-   if (uss_req_data[2] == ASN1_OCTET_STRING_TAG) {
-   dcs = uss_req_data[4];
-   if ((dcs == 0x0F) &&
-   (uss_req_data[5] == ASN1_OCTET_STRING_TAG)) {
-   num_chars = (uss_req_data[6] * 8) / 7;
-   /* Prevent a mobile-originated buffer-overrun! 
*/
-   if (num_chars > MAX_LEN_USSD_STRING)
-   num_chars = MAX_LEN_USSD_STRING;
+   /* Both 2th and 5th should be equal to ASN1_OCTET_STRING_TAG */
+   if ((uss_req_data[2] & uss_req_data[5]) != ASN1_OCTET_STRING_TAG)
+   return 0;
 
-   num_chars = gsm_7bit_decode_n_ussd((char 
*)req->ussd_text,
-   sizeof(req->ussd_text), 
&(uss_req_data[7]), num_chars);
+   dcs = uss_req_data[4];
+   if (dcs == 0x0F) {
+   num_chars = (uss_req_data[6] * 8) / 7;
+   /* Prevent a mobile-originated buffer-overrun! */
+   if (num_chars > MAX_LEN_USSD_STRING)
+   num_chars = MAX_LEN_USSD_STRING;
 
-   req->ussd_text_language = 0x80;
-   req->ussd_text_len = num_chars;
-   rc = 1;
-   }
-   }
+   num_chars = gsm_7bit_decode_n_ussd((char *)req->ussd_text,
+   sizeof(req->ussd_text), &(uss_req_data[7]), num_chars);
+
+   req->ussd_text_language = 0x80;
+   req->ussd_text_len = num_chars;
+
+   return 1;
}
-   return rc;
+
+   return 0;
 }
 
 /* Parse the parameters of a Interrogate/Activate/DeactivateSS Request */

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Jenkins Builder


[PATCH] libosmocore[master]: gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA

2017-07-29 Thread Vadim Yanitskiy

gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA

Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
---
M src/gsm/gsm0480.c
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/3380/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index c74077a..6731cec 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -425,6 +425,11 @@
   length - offset - 3,
   req);
break;
+   case GSM0480_OP_CODE_PROCESS_USS_DATA:
+   rc = parse_process_uss_data(invoke_data + offset + 3,
+   length - offset - 3,
+   req);
+   break;
case GSM0480_OP_CODE_ACTIVATE_SS:
case GSM0480_OP_CODE_DEACTIVATE_SS:
case GSM0480_OP_CODE_INTERROGATE_SS:

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ

2017-07-29 Thread Vadim Yanitskiy

gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ

Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
---
M src/gsm/gsm0480.c
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/3379/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 7e036ba..c74077a 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -418,6 +418,8 @@
uint8_t operation_code = invoke_data[offset+2];
req->opcode = operation_code;
switch (operation_code) {
+   case GSM0480_OP_CODE_USS_NOTIFY:
+   case GSM0480_OP_CODE_USS_REQUEST:
case GSM0480_OP_CODE_PROCESS_USS_REQ:
rc = parse_process_uss_req(invoke_data + offset + 3,
   length - offset - 3,

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: expose the gsm0480_parse_ss_facility_ie()

2017-07-29 Thread Vadim Yanitskiy

gsm0480: expose the gsm0480_parse_ss_facility_ie()

Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
M src/gsm/libosmogsm.map
3 files changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/3381/2

diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index e3b15d2..e3d40a9 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -50,6 +50,8 @@
 
 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
struct ss_request *request);
+int gsm0480_parse_ss_facility_ie(const uint8_t *facility_ie, uint16_t length,
+struct ss_request *req);
 
 struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, 
const char *text);
 struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char 
*text);
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 6731cec..9705359 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -198,8 +198,6 @@
 struct ss_request *req);
 static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
  struct ss_request *req);
-static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
-struct ss_request *req);
 static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length,
struct ss_request *req);
 static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
@@ -302,7 +300,8 @@
if (len - 1 < facility_length)
return 0;
 
-   return parse_facility_ie(ss_facility + 1, facility_length, req);
+   return gsm0480_parse_ss_facility_ie(ss_facility + 1,
+   facility_length, req);
 }
 
 static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
@@ -324,7 +323,7 @@
case GSM48_IE_CAUSE:
break;
case GSM0480_IE_FACILITY:
-   rc = parse_facility_ie(ss_ie + 2, iei_length, req);
+   rc = gsm0480_parse_ss_facility_ie(ss_ie + 2, iei_length, req);
break;
case GSM0480_IE_SS_VERSION:
break;
@@ -338,8 +337,8 @@
return rc;
 }
 
-static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
-struct ss_request *req)
+int gsm0480_parse_ss_facility_ie(const uint8_t *facility_ie, uint16_t length,
+struct ss_request *req)
 {
int rc = 1;
uint8_t offset = 0;
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 714cb25..b9d30bb 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -83,6 +83,7 @@
 gsm0480_create_ussd_release_complete;
 gsm0480_decode_ussd_request;
 gsm0480_decode_ss_request;
+gsm0480_parse_ss_facility_ie;
 gsm0480_wrap_facility;
 gsm0480_wrap_invoke;
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

2017-07-29 Thread Vadim Yanitskiy

gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
---
M src/gsm/gsm0480.c
1 file changed, 84 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/3378/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index e8a3bc3..7e036ba 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -202,6 +202,10 @@
 struct ss_request *req);
 static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length,
struct ss_request *req);
+static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
+ struct ss_request *req);
+static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
+ struct ss_request *req);
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
struct ss_request *req);
 static int parse_ss_for_bs_req(const uint8_t *ss_req_data,
@@ -360,6 +364,9 @@
  req);
break;
case GSM0480_CTYPE_RETURN_RESULT:
+   rc &= parse_ss_return_result(facility_ie+2,
+component_length,
+req);
break;
case GSM0480_CTYPE_RETURN_ERROR:
break;
@@ -439,6 +446,83 @@
return rc;
 }
 
+/* Parse an Return Result component - see table 3.4 */
+static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
+ struct ss_request *req)
+{
+   uint8_t operation_code;
+   uint8_t offset;
+
+   if (length < 3)
+   return 0;
+
+   /* Mandatory part */
+   if (rr_data[0] != GSM0480_COMPIDTAG_INVOKE_ID) {
+   LOGP(0, LOGL_DEBUG, "Unexpected GSM 04.80 Component-ID tag "
+"0x%02x (expecting Invoke ID tag)\n", rr_data[0]);
+   return 0;
+   }
+
+   offset = rr_data[1] + 2;
+   req->invoke_id = rr_data[2];
+
+   if (offset >= length)
+   return 1;
+
+   if (rr_data[offset] != GSM_0480_SEQUENCE_TAG)
+   return 0;
+
+   if (offset + 2 > length)
+   return 0;
+
+   offset += 2;
+   operation_code = rr_data[offset + 2];
+   req->opcode = operation_code;
+
+   switch (operation_code) {
+   case GSM0480_OP_CODE_USS_NOTIFY:
+   case GSM0480_OP_CODE_USS_REQUEST:
+   case GSM0480_OP_CODE_PROCESS_USS_REQ:
+   return parse_process_uss_req(rr_data + offset + 3,
+   length - offset - 3, req);
+   case GSM0480_OP_CODE_PROCESS_USS_DATA:
+   return parse_process_uss_data(rr_data + offset + 3,
+   length - offset - 3, req);
+   default:
+   LOGP(0, LOGL_DEBUG, "GSM 04.80 operation code 0x%02x "
+   "is not yet handled\n", operation_code);
+   return 0;
+   }
+
+   return 1;
+}
+
+static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
+ struct ss_request *req)
+{
+   uint8_t num_chars;
+
+   /* we need at least that much */
+   if (length < 3)
+   return 0;
+
+   if (uss_req_data[0] != ASN1_IA5_STRING_TAG)
+   return 0;
+
+   num_chars = uss_req_data[1];
+   if (num_chars > length - 2)
+   return 0;
+
+   if (num_chars > MAX_LEN_USSD_STRING)
+   num_chars = MAX_LEN_USSD_STRING;
+
+   req->ussd_text_language = 1;
+   req->ussd_text_len = num_chars;
+   memcpy(req->ussd_text, uss_req_data + 2, num_chars);
+
+   return 1;
+}
+
 /* Parse the parameters of a Process UnstructuredSS Request */
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
 struct ss_request *req)

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: gsm/tlv.h: fix copy-paste error

2017-05-15 Thread Vadim Yanitskiy

Patch Set 1:

> I still wonder how can we test this for sure.
> Do we have GAN implementation using those somewhere?

IDK. Harald (as git blame shows) should know better.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id52ddd8358fd4af1ecc71142deb09f1e237021f3
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


libosmocore[master]: gsm/tlv.h: fix copy-paste error

2017-05-15 Thread Vadim Yanitskiy

Patch Set 1:

> How was this found? Is there specific test case we might add which
 > fails with old code but works with new one?

This was found by cppcheck: "unreachable part of code".
My assumption is that the TVLV_GROSS_LEN was merely
copy-pasted to VTVLV_GAN_GROSS_LEN, and return statements
were out of code writer's attention.

Otherwise, why do we need another function, which works
the same way like old one?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id52ddd8358fd4af1ecc71142deb09f1e237021f3
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: configure.ac: fix build on systems without SIMD support

2017-05-09 Thread Vadim Yanitskiy

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

configure.ac: fix build on systems without SIMD support

HAVE_AVX2, HAVE_SSE3 and HAVE_SSE4_1 were never defined if CPU
architecture doesn't match the (86*|x86_64*|amd64*) condition.

Change-Id: If0c3128f9768f95c1f5f955db242e71c81384c6c
---
M m4/ax_check_simd.m4
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/2548/1

diff --git a/m4/ax_check_simd.m4 b/m4/ax_check_simd.m4
index d07d706..8a0ceb7 100644
--- a/m4/ax_check_simd.m4
+++ b/m4/ax_check_simd.m4
@@ -41,6 +41,10 @@
 [
   AC_REQUIRE([AC_CANONICAL_HOST])
 
+  AM_CONDITIONAL(HAVE_AVX2, false)
+  AM_CONDITIONAL(HAVE_SSE3, false)
+  AM_CONDITIONAL(HAVE_SSE4_1, false)
+
   case $host_cpu in
 i[[3456]]86*|x86_64*|amd64*)
   AX_CHECK_COMPILE_FLAG(-mavx2, ax_cv_support_avx2_ext=yes, [])
@@ -51,7 +55,6 @@
 AM_CONDITIONAL(HAVE_AVX2, true)
   else
 AC_MSG_WARN([Your compiler does not support AVX2 instructions])
-AM_CONDITIONAL(HAVE_AVX2, false)
   fi
 
   AX_CHECK_COMPILE_FLAG(-msse3, ax_cv_support_sse3_ext=yes, [])
@@ -62,7 +65,6 @@
 AM_CONDITIONAL(HAVE_SSE3, true)
   else
 AC_MSG_WARN([Your compiler does not support SSE3 instructions])
-AM_CONDITIONAL(HAVE_SSE3, false)
   fi
 
   AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, [])
@@ -73,7 +75,6 @@
 AM_CONDITIONAL(HAVE_SSE4_1, true)
   else
 AC_MSG_WARN([Your compiler does not support SSE4.1 instructions])
-AM_CONDITIONAL(HAVE_SSE4_1, false)
   fi
   ;;
   esac

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0c3128f9768f95c1f5f955db242e71c81384c6c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: configure.ac: fix build on systems without SIMD support

2017-05-09 Thread Vadim Yanitskiy

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/2548/1/m4/ax_check_simd.m4
File m4/ax_check_simd.m4:

Line 44:   AM_CONDITIONAL(HAVE_AVX2, false)
> Unlikely that the generic macro needs a fix? How did you test without avx s
All AM_CONDITIONAL expressions weren't in generic macro -
it was extended to be able to include some source code
depending on supported SIMD features.

Regarding to AVX, what do you mean?
How did I test runtime CPU detection?

If I understood your question correct, the answer is:
I used QEMU, which allows to 'hide' some SIMD features
of host CPU from guest OS (e.g. -cpu host,-avx2 - provide
host CPU without AVX2).


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If0c3128f9768f95c1f5f955db242e71c81384c6c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code

2017-05-09 Thread Vadim Yanitskiy

Patch Set 4: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/2134/4/config/ax_sse.m4
File config/ax_sse.m4:

PS4, Line 44:   case $host_cpu in
: i[[3456]]86*|x86_64*|amd64*)
On some CPU architectures (e.g. ARM), which don't match this
condition, both HAVE_SSE3 and HAVE_SSE4_1 will never be defined.

I made the same mistake in libosmocore, see fix:
https://gerrit.osmocom.org/#/c/2548/1/m4/ax_check_simd.m4


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3
Gerrit-PatchSet: 4
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


libosmocore[master]: configure.ac: fix build on systems without SIMD support

2017-05-09 Thread Vadim Yanitskiy

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/2548/1/m4/ax_check_simd.m4
File m4/ax_check_simd.m4:

Line 44:   AM_CONDITIONAL(HAVE_AVX2, false)
> QEMU: Great!
Odd: Why do you think so?

Original macro used to check whether *both* CPU and compiler
do support some set of SIMD features. But, since we decided
to use runtime SIMD detection, we don't need to check, whether
CPU of build machine supports required SIMD anymore. So, this
is why cpuid related functionality was cut out. And right now
this is a small part of original macro, which only checks if
compiler supports defined SIMD flags.

Honestly, it isn't my own idea - I used dexter's recent changes
of OsmoTRX as an example and just replicated his a bit mistaken
way of AM_CONDITIONAL variable definition. I already notified him
about that.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If0c3128f9768f95c1f5f955db242e71c81384c6c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


[MERGED] osmo-bts[master]: osmo-bts-trx/l1_if.c: cosmetic: drop double check

2017-05-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: osmo-bts-trx/l1_if.c: cosmetic: drop double check
..


osmo-bts-trx/l1_if.c: cosmetic: drop double check

Change-Id: I25a8f85ee65e1c0dd54049ffacc039702ca36c8f
---
M src/osmo-bts-trx/l1_if.c
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index d0c8afd..f9ba5fa 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -182,16 +182,16 @@
 && l1h->config.bsic_valid
 && l1h->config.arfcn_valid) {
/* before power on */
-   if (l1h->config.arfcn_valid && !l1h->config.arfcn_sent) {
+   if (!l1h->config.arfcn_sent) {
trx_if_cmd_rxtune(l1h, l1h->config.arfcn);
trx_if_cmd_txtune(l1h, l1h->config.arfcn);
l1h->config.arfcn_sent = 1;
}
-   if (l1h->config.tsc_valid && !l1h->config.tsc_sent) {
+   if (!l1h->config.tsc_sent) {
trx_if_cmd_settsc(l1h, l1h->config.tsc);
l1h->config.tsc_sent = 1;
}
-   if (l1h->config.bsic_valid && !l1h->config.bsic_sent) {
+   if (!l1h->config.bsic_sent) {
trx_if_cmd_setbsic(l1h, l1h->config.bsic);
l1h->config.bsic_sent = 1;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I25a8f85ee65e1c0dd54049ffacc039702ca36c8f
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: configure.ac: fix build on systems without SIMD support

2017-05-09 Thread Vadim Yanitskiy

Patch Set 1:

BTW: I have checked project configuration with CC=arm-elf-gcc:

> ~/osmocom/libosmocore/configure --host arm-elf
> [...]
> checking for arm-elf-gcc... arm-elf-gcc
> checking whether the C compiler works... yes
> [...]
> checking for TALLOC... yes
> checking for PCSC... yes
> checking whether arm-elf-gcc has __builtin_cpu_supports built-in... no
> configure: WARNING: Runtime SIMD detection will be disabled
> checking that generated files are newer than configure... done
> configure: creating ./config.status
> config.status: creating libosmocore.pc
> config.status: creating libosmocodec.pc
> [...]

As you can see, no errors anymore with this change.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If0c3128f9768f95c1f5f955db242e71c81384c6c
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


libosmocore[master]: configure.ac: add SIMD detection capabilities

2017-05-09 Thread Vadim Yanitskiy

Patch Set 6:

> Fails on systems without SIMD support:
 > 
 > checking whether arm-poky-linux-gnueabi-gcc  -march=armv5te -marm
 > -mthumb-interwork 
 > --sysroot=/home/oebuilds/jenkins/workspace/201310-nightly/label/OE/build/tmp/sysroots/sysmobts-v2
 > has __builtin_cpu_supports built-in... no
 > | configure: WARNING: Runtime SIMD detection will be disabled
 > | checking that generated files are newer than configure... done
 > | configure: error: conditional "HAVE_AVX2" was never defined.
 > | Usually this means the macro was only invoked conditionally.
 > | Configure failed. The contents of all config.log files follows to
 > aid debugging
 > 
 > 
 > | configure:12931: result: no
 > | configure:12944: WARNING: Runtime SIMD detection will be disabled
 > | configure:13061: checking that generated files are newer than
 > configure
 > | configure:13067: result: done
 > | configure:13154: error: conditional "HAVE_AVX2" was never
 > defined.
 > | Usually this means the macro was only invoked conditionally.
 > 
 > 
 > Please fix it quickly

Fixed. See 2548.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idf8fff984bd936a75c7c307338df88ba4b005817
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: dexter <pma...@sysmocom.de>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: utils/osmo-sim-test.c: strip unused variables

2017-05-15 Thread Vadim Yanitskiy

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

utils/osmo-sim-test.c: strip unused variables

Change-Id: Id577d9df5a814ad5aa00e1d04c4790d75d17ad7e
---
M utils/osmo-sim-test.c
1 file changed, 1 insertion(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/2648/1

diff --git a/utils/osmo-sim-test.c b/utils/osmo-sim-test.c
index d822bec..d5e932e 100644
--- a/utils/osmo-sim-test.c
+++ b/utils/osmo-sim-test.c
@@ -36,7 +36,7 @@
 static struct msgb *_select_file(struct osim_chan_hdl *st, uint8_t p1, uint8_t 
p2,
const uint8_t *data, uint8_t data_len)
 {
-   struct msgb *msg, *resp;
+   struct msgb *msg;
uint8_t *dst;
 
msg = osim_new_apdumsg(0x00, 0xA4, p1, p2, data_len, 256);
@@ -51,8 +51,6 @@
 /* 11.1.1 */
 static struct msgb *select_adf(struct osim_chan_hdl *st, const uint8_t *adf, 
uint8_t adf_len)
 {
-   int sw;
-
return _select_file(st, 0x04, 0x04, adf,adf_len);
 }
 
@@ -69,7 +67,6 @@
 {
struct msgb *msg;
char *pindst;
-   int sw;
 
if (strlen(pin) > 8)
return -EINVAL;
@@ -373,7 +370,6 @@
struct osim_card_hdl *card;
struct osim_chan_hdl *chan;
struct msgb *msg;
-   int rc;
 
reader = osim_reader_open(OSIM_READER_DRV_PCSC, 0, "", NULL);
if (!reader)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id577d9df5a814ad5aa00e1d04c4790d75d17ad7e
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gsm/gsm0411_smr.c: strip unused variable

2017-05-15 Thread Vadim Yanitskiy

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

gsm/gsm0411_smr.c: strip unused variable

Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
---
M src/gsm/gsm0411_smr.c
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/2647/1

diff --git a/src/gsm/gsm0411_smr.c b/src/gsm/gsm0411_smr.c
index 6d7fb8b..eb8aec0 100644
--- a/src/gsm/gsm0411_smr.c
+++ b/src/gsm/gsm0411_smr.c
@@ -287,7 +287,6 @@
struct gsm48_hdr *gh = (struct gsm48_hdr*)msg->l3h;
struct gsm411_rp_hdr *rp_data = (struct gsm411_rp_hdr*)>data;
uint8_t msg_type =  rp_data->msg_type & 0x07;
-   int rc;
 
/* check direction */
if (inst->network == (msg_type & 1)) {
@@ -329,7 +328,7 @@
return -EINVAL;
}
 
-   return rc;
+   return 0;
 }
 
 static int gsm411_mnsms_error_ind_tx(struct gsm411_smr_inst *inst,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


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

2017-05-17 Thread Vadim Yanitskiy

Patch Set 1:

> > (1 comment)
 > 
 > Because 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.

Ah, sorry. I understand what did you mean.
I'll update the commit message.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3038fc15745dc4be796d894002524e6b2dd5c90e
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmocom-bb[master]: mobile/gsm480_ss.c: drop meaningless condition

2017-05-17 Thread Vadim Yanitskiy

Patch Set 1: Code-Review-1

> it is indeed duplicate.  However, why did the original author
 > introduce that second else clause?  I think it is likely that thre
 > is a typo in the condition, i.e. the spec has two cases in which we
 > should generate a '+'.  Please check the spec and see if the proper
 > fix is to have that else clause, but with a different condition.

You're right. In gsm411_sms.c I found the following:

if (((smsp[1] & 0x70) >> 4) == 1)
strcpy(gsms->address, "+");
else if (((smsp[1] & 0x70) >> 4) == 2)
strcpy(gsms->address, "0");
else
gsms->address[0] = '\0';

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I23287c0f31bee9c1b710f17f932633d2c621dab0
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


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

2017-05-17 Thread Vadim Yanitskiy

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/62/2662/2

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: newpatchset
Gerrit-Change-Id: I23287c0f31bee9c1b710f17f932633d2c621dab0
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] osmocom-bb[master]: host/mobile: use osmocom_ms as talloc context

2017-05-17 Thread Vadim Yanitskiy
zero(ms, struct gsm_sub_plmn_na);
if (!na)
return -ENOMEM;
lai[0] = data[0];
@@ -1110,7 +1108,7 @@
 
 /* add forbidden PLMN */
 int gsm_subscr_add_forbidden_plmn(struct gsm_subscriber *subscr, uint16_t mcc,
-   uint16_t mnc, uint8_t cause)
+   uint16_t mnc, uint8_t cause, struct osmocom_ms *ms)
 {
struct gsm_sub_plmn_na *na;
 
@@ -1119,7 +1117,7 @@
 
LOGP(DPLMN, LOGL_INFO, "Add to list of forbidden PLMNs "
"(mcc=%s, mnc=%s)\n", gsm_print_mcc(mcc), gsm_print_mnc(mnc));
-   na = talloc_zero(l23_ctx, struct gsm_sub_plmn_na);
+   na = talloc_zero(ms, struct gsm_sub_plmn_na);
if (!na)
return -ENOMEM;
na->mcc = mcc;
diff --git a/src/host/layer23/src/mobile/transaction.c 
b/src/host/layer23/src/mobile/transaction.c
index 45bf2b4..9824bd1 100644
--- a/src/host/layer23/src/mobile/transaction.c
+++ b/src/host/layer23/src/mobile/transaction.c
@@ -30,8 +30,6 @@
 #include 
 #include 
 
-extern void *l23_ctx;
-
 void _gsm48_cc_trans_free(struct gsm_trans *trans);
 void _gsm480_ss_trans_free(struct gsm_trans *trans);
 void _gsm411_sms_trans_free(struct gsm_trans *trans);
@@ -67,7 +65,7 @@
 {
struct gsm_trans *trans;
 
-   trans = talloc_zero(l23_ctx, struct gsm_trans);
+   trans = talloc_zero(ms, struct gsm_trans);
if (!trans)
return NULL;
 
diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index d6591d3..271837d 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -42,8 +42,6 @@
 #include 
 #include 
 
-void *l23_ctx;
-
 int mncc_call(struct osmocom_ms *ms, char *number);
 int mncc_hangup(struct osmocom_ms *ms);
 int mncc_answer(struct osmocom_ms *ms);
@@ -2099,7 +2097,7 @@
if (vty_check_number(vty, argv[1]))
return CMD_WARNING;
 
-   abbrev = talloc_zero(l23_ctx, struct gsm_settings_abbrev);
+   abbrev = talloc_zero(ms, struct gsm_settings_abbrev);
    if (!abbrev) {
vty_out(vty, "No Memory!%s", VTY_NEWLINE);
return CMD_WARNING;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0d5fcbdd77fe41d78cfe54731dd2ebfc4171f62c
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


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

2017-05-17 Thread Vadim Yanitskiy
 fputs(ba_version, fp);
-   llist_for_each_entry(ba, >ba_list, entry) {
-   buf[0] = ba->mcc >> 8;
-   buf[1] = ba->mcc & 0xff;
-   buf[2] = ba->mnc >> 8;
-   buf[3] = ba->mnc & 0xff;
+   ba_filename = talloc_asprintf(ms, "%s/%s.ba", config_dir, ms->name);
+   if (ba_filename) {
+   fp = fopen(ba_filename, "w");
+   talloc_free(ba_filename);
+   if (fp) {
+   fputs(ba_version, fp);
+   llist_for_each_entry(ba, >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);
+   rc += fwrite(buf, 4, 1, fp);
+   rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
+   }
+   fclose(fp);
}
-   fclose(fp);
}
 
if (rc == 2)
diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index 78d136d..d6591d3 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1251,6 +1251,7 @@
 {
struct osmocom_ms *ms;
int found = 0;
+   char *name;
 
llist_for_each_entry(ms, _list, entity) {
if (!strcmp(ms->name, argv[0])) {
@@ -1265,7 +1266,14 @@
return CMD_WARNING;
}
 
-   strncpy(ms->name, argv[1], sizeof(ms->name) - 1);
+   name = talloc_strdup(ms, argv[1]);
+   if (name) {
+   talloc_free(ms->name);
+   ms->name = name;
+   } else {
+   vty_out(vty, "Couldn't rename MS: no memory%s", VTY_NEWLINE);
+   return CMD_WARNING;
+   }
 
return CMD_SUCCESS;
 }

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>


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

2017-05-17 Thread Vadim Yanitskiy
Hello Harald Welte,

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

https://gerrit.osmocom.org/2658

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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/58/2658/3

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: newpatchset
Gerrit-Change-Id: I3038fc15745dc4be796d894002524e6b2dd5c90e
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


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

2017-05-17 Thread Vadim Yanitskiy
Hello Harald Welte,

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

https://gerrit.osmocom.org/2659

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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/59/2659/2

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(>entity, _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: newpatchset
Gerrit-Change-Id: I9a594dd1d133f0c0740dc3bff41633f94099b593
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>


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

2017-05-17 Thread Vadim Yanitskiy
Hello Harald Welte,

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

https://gerrit.osmocom.org/2660

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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/60/2660/2

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, >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: newpatchset
Gerrit-Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


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

2017-05-17 Thread Vadim Yanitskiy

Patch Set 1:

> this is not the correct fix.  The return value of fwrite should be
 > checked with the expected result, rather than ignored.

Ok, thanks! I'll update this one.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmocom-bb[master]: host/mobile: use osmocom_ms as talloc context

2017-05-17 Thread Vadim Yanitskiy

Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/#/c/2668/1/src/host/layer23/include/osmocom/bb/mobile/mncc_sock.h
File src/host/layer23/include/osmocom/bb/mobile/mncc_sock.h:

Line 13
> why not simply use 'inst' as the talloc context? We already have that as an
Sure, this is exactly what I did ;)


https://gerrit.osmocom.org/#/c/2668/1/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
File src/host/layer23/include/osmocom/bb/mobile/subscriber.h:

Line 102: int gsm_subscr_add_forbidden_plmn(struct gsm_subscriber *subscr, 
uint16_t mcc,
> Is there not a 1:1 relationship between subscr and ms, so we can do this wi
Yes, there is. But gsm_subscriber is being allocated
statically within osmocom_ms structure, so it could
not be used as a talloc context :(


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0d5fcbdd77fe41d78cfe54731dd2ebfc4171f62c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


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

2017-05-17 Thread Vadim Yanitskiy
Hello Harald Welte,

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

https://gerrit.osmocom.org/2658

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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/58/2658/2

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: newpatchset
Gerrit-Change-Id: I3038fc15745dc4be796d894002524e6b2dd5c90e
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


osmocom-bb[master]: mobile/gsm322.c: avoid using memset with zero length

2017-05-17 Thread Vadim Yanitskiy

Patch Set 1:

> do you have any reference as to why it is unsafe to call memset
 > with zero-length?

Just a compiler warning:

In function ‘memset’,
inlined from ‘bargraph.constprop.17’ at gsm322.c:325:8:
/usr/include/x86_64-linux-gnu/bits/string3.h:81:30: warning: call to 
‘__warn_memset_zero_len’ declared with attribute warning: memset used with 
constant zero length parameter; this could be due to transposed parameters 
[enabled by default]
   __warn_memset_zero_len ();

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifc8a06dd100ce494e3bcfbc7636738435fa5e34d
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmocom-bb[master]: host/mobile: use osmocom_ms as talloc context

2017-05-17 Thread Vadim Yanitskiy

Patch Set 2:

> (1 comment)

Well, currently we have so much mobile app specific structures
allocated statically within osmocom_ms. I think it would be
even better to allocate them conditionally by talloc.

Let me some time...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0d5fcbdd77fe41d78cfe54731dd2ebfc4171f62c
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


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

2017-05-17 Thread Vadim Yanitskiy
buf[2] = ba->mnc >> 8;
-   buf[3] = ba->mnc & 0xff;
+   ba_filename = talloc_asprintf(ms, "%s/%s.ba", config_dir, ms->name);
+   if (ba_filename) {
+   fp = fopen(ba_filename, "w");
+   talloc_free(ba_filename);
+   if (fp) {
+   fputs(ba_version, fp);
+   llist_for_each_entry(ba, >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);
+   rc += fwrite(buf, 4, 1, fp);
+   rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
+   }
+   fclose(fp);
}
-   fclose(fp);
}
 
if (rc == 2)
diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index 78d136d..a248ea1 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1265,7 +1265,8 @@
return CMD_WARNING;
}
 
-   strncpy(ms->name, argv[1], sizeof(ms->name) - 1);
+   talloc_free(ms->name);
+   ms->name = talloc_strdup(ms, argv[1]);
 
return CMD_SUCCESS;
 }

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>


[ABANDON] osmocom-bb[master]: mobile/gsm322.c: avoid using memset with zero length

2017-05-17 Thread Vadim Yanitskiy
Vadim Yanitskiy has abandoned this change.

Change subject: mobile/gsm322.c: avoid using memset with zero length
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: Ifc8a06dd100ce494e3bcfbc7636738435fa5e34d
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


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

2017-05-17 Thread Vadim Yanitskiy

Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/2660/2/src/host/layer23/src/mobile/gsm322.c
File src/host/layer23/src/mobile/gsm322.c:

Line 5150:  rc += fwrite(buf, 4, 1, fp);
> I'm not sure if addition is a good idea.  Example: First fwrite() returns 3
I relied on the man page:

> On  success,  fread()  and  fwrite() return the number of items read or
> written.  This number equals the number of bytes transferred only  when
> size  is 1.  If an error occurs, or the end of the file is reached, the
> return value is a short item count (or zero).

As we have nmemb = 1 in both cases, fwrite can only return 0 or 1.
Am I wrong?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


[MERGED] libosmocore[master]: utils/osmo-sim-test.c: strip unused variables

2017-05-17 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: utils/osmo-sim-test.c: strip unused variables
..


utils/osmo-sim-test.c: strip unused variables

Change-Id: Id577d9df5a814ad5aa00e1d04c4790d75d17ad7e
---
M utils/osmo-sim-test.c
1 file changed, 1 insertion(+), 5 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/utils/osmo-sim-test.c b/utils/osmo-sim-test.c
index d822bec..d5e932e 100644
--- a/utils/osmo-sim-test.c
+++ b/utils/osmo-sim-test.c
@@ -36,7 +36,7 @@
 static struct msgb *_select_file(struct osim_chan_hdl *st, uint8_t p1, uint8_t 
p2,
const uint8_t *data, uint8_t data_len)
 {
-   struct msgb *msg, *resp;
+   struct msgb *msg;
uint8_t *dst;
 
msg = osim_new_apdumsg(0x00, 0xA4, p1, p2, data_len, 256);
@@ -51,8 +51,6 @@
 /* 11.1.1 */
 static struct msgb *select_adf(struct osim_chan_hdl *st, const uint8_t *adf, 
uint8_t adf_len)
 {
-   int sw;
-
return _select_file(st, 0x04, 0x04, adf,adf_len);
 }
 
@@ -69,7 +67,6 @@
 {
struct msgb *msg;
char *pindst;
-   int sw;
 
if (strlen(pin) > 8)
return -EINVAL;
@@ -373,7 +370,6 @@
struct osim_card_hdl *card;
struct osim_chan_hdl *chan;
struct msgb *msg;
-   int rc;
 
reader = osim_reader_open(OSIM_READER_DRV_PCSC, 0, "", NULL);
if (!reader)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id577d9df5a814ad5aa00e1d04c4790d75d17ad7e
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


[MERGED] libosmocore[master]: gsm/gsm0411_smr.c: strip unused variable

2017-05-17 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: gsm/gsm0411_smr.c: strip unused variable
..


gsm/gsm0411_smr.c: strip unused variable

Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
---
M src/gsm/gsm0411_smr.c
1 file changed, 1 insertion(+), 2 deletions(-)

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



diff --git a/src/gsm/gsm0411_smr.c b/src/gsm/gsm0411_smr.c
index 6d7fb8b..eb8aec0 100644
--- a/src/gsm/gsm0411_smr.c
+++ b/src/gsm/gsm0411_smr.c
@@ -287,7 +287,6 @@
struct gsm48_hdr *gh = (struct gsm48_hdr*)msg->l3h;
struct gsm411_rp_hdr *rp_data = (struct gsm411_rp_hdr*)>data;
uint8_t msg_type =  rp_data->msg_type & 0x07;
-   int rc;
 
/* check direction */
if (inst->network == (msg_type & 1)) {
@@ -329,7 +328,7 @@
return -EINVAL;
}
 
-   return rc;
+   return 0;
 }
 
 static int gsm411_mnsms_error_ind_tx(struct gsm411_smr_inst *inst,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: add libpseudotalloc as super-simplistic talloc replacement

2017-05-17 Thread Vadim Yanitskiy

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/2651/1/src/pseudotalloc/pseudotalloc.c
File src/pseudotalloc/pseudotalloc.c:

Line 45:memcpy(ptr, p, strlen(p)+1);
We could use already calculated: len+1


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie341034076f242a813f081919dd09d845775ad35
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


[PATCH] libosmocore[master]: ctrl_test.c: fix build with GCC 7.1.1

2017-06-12 Thread Vadim Yanitskiy

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

ctrl_test.c: fix build with GCC 7.1.1

According to GCC's online docs:

When an inline function is not static, then the compiler must
assume that there may be calls from other source files; since
a global symbol can be defined only once in any program, the
function must not be defined in the other source files, so the
calls therein cannot be integrated. Therefore, a non-static
inline function is always compiled on its own in the usual fashion.

There is no any (performance or size) benefit from 'inline' keyword
in this particular file, so let's replace one by 'static'.

Change-Id: I11e1f1cfea09c6f0cf8225239e782b551d3eb52f
---
M tests/ctrl/ctrl_test.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/2895/1

diff --git a/tests/ctrl/ctrl_test.c b/tests/ctrl/ctrl_test.c
index 3bbab76..08be15f 100644
--- a/tests/ctrl/ctrl_test.c
+++ b/tests/ctrl/ctrl_test.c
@@ -7,7 +7,7 @@
 #include 
 #include 
 
-inline void check_type(enum ctrl_type c)
+static void check_type(enum ctrl_type c)
 {
const char *t = get_value_string(ctrl_type_vals, c);
int v = get_string_value(ctrl_type_vals, t);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11e1f1cfea09c6f0cf8225239e782b551d3eb52f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


osmo-trx[master]: sigProcLib: Remove unused functions from public interface

2017-06-12 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifc122aaff23414c363b4b00f99061eed8a6902d0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


libosmocore[master]: timer_gettimeofday.c: Fix implicit use of timeradd

2017-06-20 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iced451be255cfde8a6cf38380bef71ef29673994
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: core/conv/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS

2017-06-19 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2975

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

core/conv/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS

This allows passing 'make CFLAGS+="..."'
without breaking the build.

Suggested-by: zecke

Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
---
M src/Makefile.am
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/2975/2

diff --git a/src/Makefile.am b/src/Makefile.am
index 692b699..d8fceca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,17 +26,17 @@
 if HAVE_SSE3
 libosmocore_la_SOURCES += conv_acc_sse.c
 if HAVE_SSE4_1
-conv_acc_sse.lo : CFLAGS += -msse3 -msse4.1
+conv_acc_sse.lo : AM_CFLAGS += -msse3 -msse4.1
 else
-conv_acc_sse.lo : CFLAGS += -msse3
+conv_acc_sse.lo : AM_CFLAGS += -msse3
 endif
 
 if HAVE_AVX2
 libosmocore_la_SOURCES += conv_acc_sse_avx.c
 if HAVE_SSE4_1
-conv_acc_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+conv_acc_sse_avx.lo : AM_CFLAGS += -msse3 -mavx2 -msse4.1
 else
-conv_acc_sse_avx.lo : CFLAGS += -msse3 -mavx2
+conv_acc_sse_avx.lo : AM_CFLAGS += -msse3 -mavx2
 endif
 endif
 endif

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: fix build: viterbi_sse: use AM_CFLAGS, not CFLAGS

2017-06-19 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: src/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS

2017-06-19 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2975

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

src/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS

This allows passing 'make CFLAGS+="..."'
without breaking the build.

Suggested-by: zecke

Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
---
M src/Makefile.am
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/2975/3

diff --git a/src/Makefile.am b/src/Makefile.am
index 692b699..d8fceca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,17 +26,17 @@
 if HAVE_SSE3
 libosmocore_la_SOURCES += conv_acc_sse.c
 if HAVE_SSE4_1
-conv_acc_sse.lo : CFLAGS += -msse3 -msse4.1
+conv_acc_sse.lo : AM_CFLAGS += -msse3 -msse4.1
 else
-conv_acc_sse.lo : CFLAGS += -msse3
+conv_acc_sse.lo : AM_CFLAGS += -msse3
 endif
 
 if HAVE_AVX2
 libosmocore_la_SOURCES += conv_acc_sse_avx.c
 if HAVE_SSE4_1
-conv_acc_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+conv_acc_sse_avx.lo : AM_CFLAGS += -msse3 -mavx2 -msse4.1
 else
-conv_acc_sse_avx.lo : CFLAGS += -msse3 -mavx2
+conv_acc_sse_avx.lo : AM_CFLAGS += -msse3 -mavx2
 endif
 endif
 endif

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


[MERGED] libosmocore[master]: core/conv/conv_acc.c: delete reset_decoder()

2017-06-19 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: core/conv/conv_acc.c: delete reset_decoder()
..


core/conv/conv_acc.c: delete reset_decoder()

Currently this implementation exposes nothing than
osmo_conv_decode_acc(), so it wasn't possible to call
reset_decoder() from outside.

The method itself was used to initialize accumulated
path metrics and the starting state of encoder. Now
this code is moved to generate_trellis().

Moreover, setting accumulated path metrics inside
existing loop is a bit faster that calling memset().

Change-Id: I8f17cebf468cf0106927ccee091cfb2896649cb2
---
M src/conv_acc.c
1 file changed, 13 insertions(+), 20 deletions(-)

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



diff --git a/src/conv_acc.c b/src/conv_acc.c
index c4545d7..7f03628 100644
--- a/src/conv_acc.c
+++ b/src/conv_acc.c
@@ -413,32 +413,27 @@
rc = gen_state_info(>vals[i],
i, outputs, code);
}
+
+   if (rc < 0)
+   goto fail;
+
+   /* Set accumulated path metrics to zero */
+   trellis->sums[i] = 0;
}
 
-   if (rc < 0)
-   goto fail;
+   /**
+* For termination other than tail-biting, initialize the zero state
+* as the encoder starting state. Initialize with the maximum
+* accumulated sum at length equal to the constraint length.
+*/
+   if (code->term != CONV_TERM_TAIL_BITING)
+   trellis->sums[0] = INT8_MAX * code->N * code->K;
 
return trellis;
 
 fail:
free_trellis(trellis);
return NULL;
-}
-
-/* Reset decoder
- * Set accumulated path metrics to zero. For termination other than
- * tail-biting, initialize the zero state as the encoder starting state.
- * Initialize with the maximum accumulated sum at length equal to the
- * constraint length.
- */
-static void reset_decoder(struct vdecoder *dec, int term)
-{
-   int ns = dec->trellis->num_states;
-
-   memset(dec->trellis->sums, 0, sizeof(int16_t) * ns);
-
-   if (term != CONV_TERM_TAIL_BITING)
-   dec->trellis->sums[0] = INT8_MAX * dec->n * dec->k;
 }
 
 static void _traceback(struct vdecoder *dec,
@@ -640,8 +635,6 @@
const int *punc, uint8_t *out, int len, int term)
 {
int8_t depunc[dec->len * dec->n];
-
-   reset_decoder(dec, term);
 
if (punc) {
depuncture(seq, punc, depunc, dec->len * dec->n);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f17cebf468cf0106927ccee091cfb2896649cb2
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


[MERGED] libosmocore[master]: core/conv/conv_acc.c: use static allocation for trellis

2017-06-19 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: core/conv/conv_acc.c: use static allocation for trellis
..


core/conv/conv_acc.c: use static allocation for trellis

Allocation of a new memory is an expensive operation, which
takes place when it's initially unknown, how much memory will
we need, or in order to decrease total memory usage.

The trellis struct wasn't require dynamic allocation itself,
so let's allocate one statically inside the vdecoder structure.

Change-Id: Ib8e448823ca5548a05a45824b0b1c06743dfe5a4
---
M src/conv_acc.c
1 file changed, 23 insertions(+), 27 deletions(-)

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



diff --git a/src/conv_acc.c b/src/conv_acc.c
index f45d50f..13b220b 100644
--- a/src/conv_acc.c
+++ b/src/conv_acc.c
@@ -164,7 +164,7 @@
int len;
int recursive;
int intrvl;
-   struct vtrellis *trellis;
+   struct vtrellis trellis;
int16_t **paths;
 
void (*metric_func)(const int8_t *, const int16_t *,
@@ -372,41 +372,38 @@
vdec_free(trellis->outputs);
vdec_free(trellis->sums);
free(trellis->vals);
-   free(trellis);
 }
 
-/* Allocate and initialize the trellis object
+/* Initialize the trellis object
  * Initialization consists of generating the outputs and output value of a
  * given state. Due to trellis symmetry and anti-symmetry, only one of the
  * transition paths is utilized by the butterfly operation in the forward
  * recursion, so only one set of N outputs is required per state variable.
  */
-static struct vtrellis *generate_trellis(const struct osmo_conv_code *code)
+static int generate_trellis(struct vdecoder *dec,
+   const struct osmo_conv_code *code)
 {
-   int i, rc = -1;
-   struct vtrellis *trellis;
+   struct vtrellis *trellis = >trellis;
int16_t *outputs;
+   int i, rc;
 
int ns = NUM_STATES(code->K);
-   int recursive = conv_code_recursive(code);
int olen = (code->N == 2) ? 2 : 4;
-
-   trellis = (struct vtrellis *) calloc(1, sizeof(struct vtrellis));
-   if (!trellis)
-   goto fail;
 
trellis->num_states = ns;
trellis->sums = vdec_malloc(ns);
trellis->outputs = vdec_malloc(ns * olen);
trellis->vals = (uint8_t *) malloc(ns * sizeof(uint8_t));
 
-   if (!trellis->sums || !trellis->outputs || !trellis->vals)
+   if (!trellis->sums || !trellis->outputs || !trellis->vals) {
+   rc = -ENOMEM;
goto fail;
+   }
 
/* Populate the trellis state objects */
for (i = 0; i < ns; i++) {
outputs = >outputs[olen * i];
-   if (recursive) {
+   if (dec->recursive) {
rc = gen_recursive_state_info(>vals[i],
i, outputs, code);
} else {
@@ -429,11 +426,11 @@
if (code->term != CONV_TERM_TAIL_BITING)
trellis->sums[0] = INT8_MAX * code->N * code->K;
 
-   return trellis;
+   return 0;
 
 fail:
free_trellis(trellis);
-   return NULL;
+   return rc;
 }
 
 static void _traceback(struct vdecoder *dec,
@@ -444,7 +441,7 @@
 
for (i = len - 1; i >= 0; i--) {
path = dec->paths[i][state] + 1;
-   out[i] = dec->trellis->vals[state];
+   out[i] = dec->trellis.vals[state];
state = vstate_lshift(state, dec->k, path);
}
 }
@@ -457,7 +454,7 @@
 
for (i = len - 1; i >= 0; i--) {
path = dec->paths[i][state] + 1;
-   out[i] = path ^ dec->trellis->vals[state];
+   out[i] = path ^ dec->trellis.vals[state];
state = vstate_lshift(state, dec->k, path);
}
 }
@@ -472,8 +469,8 @@
unsigned path, state = 0;
 
if (term != CONV_TERM_FLUSH) {
-   for (i = 0; i < dec->trellis->num_states; i++) {
-   sum = dec->trellis->sums[i];
+   for (i = 0; i < dec->trellis.num_states; i++) {
+   sum = dec->trellis.sums[i];
if (sum > max) {
max = sum;
state = i;
@@ -503,7 +500,7 @@
if (!dec)
return;
 
-   free_trellis(dec->trellis);
+   free_trellis(>trellis);
 
if (dec->paths != NULL) {
vdec_free(dec->paths[0]);
@@ -517,7 +514,7 @@
  */
 static int vdec_init(struct vdecoder *dec, const struct osmo_conv_code *code)
 {
-   int i, ns;
+   int i, ns, rc;
 
ns = NUM_STATES(code->K);
 
@@ -563,9 +560,9 @@
else
dec->len = code->len;
 
-  

[MERGED] libosmocore[master]: core/conv/conv_acc.c: use static allocation for vdecoder

2017-06-19 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: core/conv/conv_acc.c: use static allocation for vdecoder
..


core/conv/conv_acc.c: use static allocation for vdecoder

Allocation of a new memory is an expensive operation, which
takes place when it's initially unknown, how much memory will
we need, or in order to decrease total memory usage.

The vdecoder struct wasn't require dynamic allocation itself,
so let's use static allocation in order to increase performance.

Change-Id: Id1b140d3cb61db7352dcfc217a8fc36091e945ab
---
M src/conv_acc.c
1 file changed, 19 insertions(+), 23 deletions(-)

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



diff --git a/src/conv_acc.c b/src/conv_acc.c
index 7f03628..f45d50f 100644
--- a/src/conv_acc.c
+++ b/src/conv_acc.c
@@ -498,7 +498,7 @@
 }
 
 /* Release decoder object */
-static void free_vdec(struct vdecoder *dec)
+static void vdec_deinit(struct vdecoder *dec)
 {
if (!dec)
return;
@@ -509,22 +509,18 @@
vdec_free(dec->paths[0]);
free(dec->paths);
}
-
-   free(dec);
 }
 
-/* Allocate decoder object
+/* Initialize decoder object with code specific params
  * Subtract the constraint length K on the normalization interval to
  * accommodate the initialization path metric at state zero.
  */
-static struct vdecoder *alloc_vdec(const struct osmo_conv_code *code)
+static int vdec_init(struct vdecoder *dec, const struct osmo_conv_code *code)
 {
int i, ns;
-   struct vdecoder *dec;
 
ns = NUM_STATES(code->K);
 
-   dec = (struct vdecoder *) calloc(1, sizeof(struct vdecoder));
dec->n = code->N;
dec->k = code->K;
dec->recursive = conv_code_recursive(code);
@@ -542,7 +538,7 @@
dec->metric_func = osmo_conv_metrics_k5_n4;
break;
default:
-   goto fail;
+   return -EINVAL;
}
} else if (dec->k == 7) {
switch (dec->n) {
@@ -556,10 +552,10 @@
dec->metric_func = osmo_conv_metrics_k7_n4;
break;
default:
-   goto fail;
+   return -EINVAL;
}
} else {
-   goto fail;
+   return -EINVAL;
}
 
if (code->term == CONV_TERM_FLUSH)
@@ -569,24 +565,24 @@
 
dec->trellis = generate_trellis(code);
if (!dec->trellis)
-   goto fail;
+   goto enomem;
 
dec->paths = (int16_t **) malloc(sizeof(int16_t *) * dec->len);
if (!dec->paths)
-   goto fail;
+   goto enomem;
 
dec->paths[0] = vdec_malloc(ns * dec->len);
if (!dec->paths[0])
-   goto fail;
+   goto enomem;
 
for (i = 1; i < dec->len; i++)
dec->paths[i] = >paths[0][i * ns];
 
-   return dec;
+   return 0;
 
-fail:
-   free_vdec(dec);
-   return NULL;
+enomem:
+   vdec_deinit(dec);
+   return -ENOMEM;
 }
 
 /* Depuncture sequence with nagative value terminated puncturing matrix */
@@ -697,7 +693,7 @@
const sbit_t *input, ubit_t *output)
 {
int rc;
-   struct vdecoder *vdec;
+   struct vdecoder dec;
 
if (!init_complete)
osmo_conv_init();
@@ -706,14 +702,14 @@
((code->K != 5) && (code->K != 7)))
return -EINVAL;
 
-   vdec = alloc_vdec(code);
-   if (!vdec)
-   return -EFAULT;
+   rc = vdec_init(, code);
+   if (rc)
+   return rc;
 
-   rc = conv_decode(vdec, input, code->puncture,
+   rc = conv_decode(, input, code->puncture,
output, code->len, code->term);
 
-   free_vdec(vdec);
+   vdec_deinit();
 
return rc;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id1b140d3cb61db7352dcfc217a8fc36091e945ab
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: gitignore some tests

2017-06-19 Thread Vadim Yanitskiy

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

gitignore some tests

For some reasons, the following test executables
were not listed in .gitignore:

  - tests/conv/conv_gsm0503_test
  - tests/endian/endian_test
  - tests/sercomm/sercomm_test

Change-Id: If85e665d1c2a0b55d23937db5725768cdbf14f58
---
M .gitignore
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/2976/1

diff --git a/.gitignore b/.gitignore
index 89459f0..0702c4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -78,6 +78,7 @@
 tests/auth/milenage_test
 tests/coding/coding_test
 tests/conv/conv_test
+tests/conv/conv_gsm0503_test
 tests/lapd/lapd_test
 tests/gsm0808/gsm0808_test
 tests/gb/bssgp_fc_test
@@ -103,6 +104,8 @@
 tests/write_queue/wqueue_test
 tests/oap/oap_test
 tests/socket/socket_test
+tests/endian/endian_test
+tests/sercomm/sercomm_test
 
 utils/osmo-arfcn
 utils/osmo-auc-gen

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If85e665d1c2a0b55d23937db5725768cdbf14f58
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[MERGED] libosmocore[master]: src/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS

2017-06-19 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: src/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS
..


src/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS

This allows passing 'make CFLAGS+="..."'
without breaking the build.

Suggested-by: zecke

Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
---
M src/Makefile.am
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Holger Freyther: Looks good to me, approved



diff --git a/src/Makefile.am b/src/Makefile.am
index 692b699..d8fceca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,17 +26,17 @@
 if HAVE_SSE3
 libosmocore_la_SOURCES += conv_acc_sse.c
 if HAVE_SSE4_1
-conv_acc_sse.lo : CFLAGS += -msse3 -msse4.1
+conv_acc_sse.lo : AM_CFLAGS += -msse3 -msse4.1
 else
-conv_acc_sse.lo : CFLAGS += -msse3
+conv_acc_sse.lo : AM_CFLAGS += -msse3
 endif
 
 if HAVE_AVX2
 libosmocore_la_SOURCES += conv_acc_sse_avx.c
 if HAVE_SSE4_1
-conv_acc_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+conv_acc_sse_avx.lo : AM_CFLAGS += -msse3 -mavx2 -msse4.1
 else
-conv_acc_sse_avx.lo : CFLAGS += -msse3 -mavx2
+conv_acc_sse_avx.lo : AM_CFLAGS += -msse3 -mavx2
 endif
 endif
 endif

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: abis_test.c: Fix warning appearing on some buggy gcc versions

2017-06-21 Thread Vadim Yanitskiy

Patch Set 1:

I can confirm that the same warning appears
when compiling with clang-4.0:

warning: suggest braces around initialization
of subobject [-Wmissing-braces]

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I31d5ffc0cf461d207d6c3d43aa0a25a5448d7000
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[ABANDON] libosmocore[master]: core/conv: combine Viterbi implementation into a single dir

2017-06-22 Thread Vadim Yanitskiy
Vadim Yanitskiy has abandoned this change.

Change subject: core/conv: combine Viterbi implementation into a single dir
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: Ifbcb020c1302e49de2a9afe8567f851a16a023e6
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>


osmo-tetra[laforge/sq5bpf-rebase-20161218]: adding dmo support

2017-06-25 Thread Vadim Yanitskiy

Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/#/c/2817/1//COMMIT_MSG
Commit Message:

Line 7: adding dmo support
Not so critical, but it would be great to have a bit
more information about the change and DMO in general here.


https://gerrit.osmocom.org/#/c/2817/1/src/conv_enc_test.c
File src/conv_enc_test.c:

PS1, Line 53: void dp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t 
*bits, unsigned int len, void *priv)
: {
: }
Why this is empty?

Could you please explain, writing a few words comment
inside the body, if this function makes sense.

Otherwise, it shouldn't be here.


https://gerrit.osmocom.org/#/c/2817/1/src/lower_mac/tetra_scramb.c
File src/lower_mac/tetra_scramb.c:

PS1, Line 34: #define SCRAMB_INIT   3
: #define SCRAMB_ZERO   0
Both already defined in lower_mac/tetra_scramb.h,
so we can clean them out.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa5521d7313595384e74dd790a56550755b93fe9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-tetra
Gerrit-Branch: laforge/sq5bpf-rebase-20161218
Gerrit-Owner: allesklar2 <jjuerg...@seemoo.tu-darmstadt.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


osmo-bts[master]: TRX: Remove bogus extern global variable declarations

2017-06-25 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I94b5f934fc3bd00b0467d90029d3053b16594186
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-bts[master]: TRX: Use timerfd and CLOCK_MONOTONIC for GSM frame timer

2017-06-25 Thread Vadim Yanitskiy

Patch Set 2:

> let's say if osmo-gsm-tester at least doesn't get worse with this.

Did you measured avarage clock jitter before and after this change?
Does this change solve the problem with osmo-gsm-tester?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I51b19adde14ebb7ef3bb863d45e06243c323e22e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-bts[master]: TRX: Rename trx_if_data() -> trx_if_send_burst()

2017-06-25 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5031541d4ae4244a62a18acf71139db2874927fa
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


libosmocore[master]: Add and use macros to set/get/clear/toggle bit flags

2017-06-26 Thread Vadim Yanitskiy

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie9d38b837ce84649c2975dbe8b889fe3a769885f
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: fixeria <axilira...@gmail.com>
Gerrit-HasComments: No


libosmocore[master]: Add and use macros to set/get/clear/toggle bit flags

2017-06-26 Thread Vadim Yanitskiy

Patch Set 3:

> Shall I abandon this or +1 x 3 outweight Harald's -1?

Let's wait for the final response from Harald.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie9d38b837ce84649c2975dbe8b889fe3a769885f
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: fixeria <axilira...@gmail.com>
Gerrit-HasComments: No


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

2017-05-24 Thread Vadim Yanitskiy

Patch Set 4:

(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:  osmo_talloc_replace_string(ms, >name, argv[1]);
> please use osmo_talloc_replace_string() in situations like this.
Done


-- 
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 <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: Yes


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

2017-05-24 Thread Vadim Yanitskiy
buf[2] = ba->mnc >> 8;
-   buf[3] = ba->mnc & 0xff;
+   ba_filename = talloc_asprintf(ms, "%s/%s.ba", config_dir, ms->name);
+   if (ba_filename) {
+   fp = fopen(ba_filename, "w");
+   talloc_free(ba_filename);
+   if (fp) {
+   fputs(ba_version, fp);
+   llist_for_each_entry(ba, >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);
+   rc += fwrite(buf, 4, 1, fp);
+   rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
+   }
+   fclose(fp);
}
-   fclose(fp);
}
 
if (rc == 2)
diff --git a/src/host/layer23/src/mobile/vty_interface.c 
b/src/host/layer23/src/mobile/vty_interface.c
index 78d136d..d909153 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1265,7 +1265,7 @@
return CMD_WARNING;
}
 
-   strncpy(ms->name, argv[1], sizeof(ms->name) - 1);
+   osmo_talloc_replace_string(ms, >name, argv[1]);
 
    return CMD_SUCCESS;
 }

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
Gerrit-PatchSet: 4
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>


[MERGED] osmocom-bb[master]: osmocon.c: strip unused variable

2017-05-24 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: osmocon.c: strip unused variable
..


osmocon.c: strip unused variable

Change-Id: I295785295c108798e0c235e78bd8fd8f3c585d16
---
M src/host/osmocon/osmocon.c
1 file changed, 2 insertions(+), 3 deletions(-)

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



diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index 648d416..76f6037 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -497,8 +497,7 @@
 
 static int mtk_prepare_block(void)
 {
-   int rc, i;
-
+   int i;
int remaining_bytes;
int fill_bytes;
uint8_t *block_data;
@@ -565,7 +564,7 @@
dnload.block_ptr = dnload.block;
 
dnload.block_number++;
-   return rc;
+   return 0;
 }
 
 static int handle_write_block(void)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I295785295c108798e0c235e78bd8fd8f3c585d16
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>


libosmocore[master]: libosmocoding: decode MCS-0 properly

2017-05-19 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I424f7b5494846d2d5cf890f99251dae4ad5bd7d1
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


osmo-bts[master]: osmo-bts-trx: use libosmocoding

2017-05-19 Thread Vadim Yanitskiy

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1b41bb1a8de655639107ec1f3b75afc240fd316f
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: core/conv: do not mix up AVX and SSE code

2017-05-28 Thread Vadim Yanitskiy
 /* (PMU) Butterflies: 17-31 */
+   SSE_BUTTERFLY(m12, m13, m6, m0, m2)
+   SSE_BUTTERFLY(m14, m15, m7, m9, m11)
+
+   _mm_store_si128((__m128i *) [16], m0);
+   _mm_store_si128((__m128i *) [24], m9);
+   _mm_store_si128((__m128i *) [48], m13);
+   _mm_store_si128((__m128i *) [56], m15);
+
+   if (norm)
+   SSE_NORMALIZE_K7(m4, m1, m5, m3, m6, m2,
+m7, m11, m0, m8, m9, m10)
+
+   _mm_store_si128((__m128i *) [0], m4);
+   _mm_store_si128((__m128i *) [8], m5);
+   _mm_store_si128((__m128i *) [16], m6);
+   _mm_store_si128((__m128i *) [24], m7);
+   _mm_store_si128((__m128i *) [32], m1);
+   _mm_store_si128((__m128i *) [40], m3);
+   _mm_store_si128((__m128i *) [48], m2);
+   _mm_store_si128((__m128i *) [56], m11);
+}
+
+/* Aligned Memory Allocator
+ * SSE requires 16-byte memory alignment. We store relevant trellis values
+ * (accumulated sums, outputs, and path decisions) as 16 bit signed integers
+ * so the allocated memory is casted as such.
+ */
+__attribute__ ((visibility("hidden")))
+int16_t *osmo_conv_vdec_malloc_sse_avx(size_t n)
+{
+   return (int16_t *) _mm_malloc(sizeof(int16_t) * n, SSE_ALIGN);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_vdec_free_sse_avx(int16_t *ptr)
+{
+   _mm_free(ptr);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k5_n2_sse_avx(const int8_t *val,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[0], val[1] };
+
+   _sse_metrics_k5_n2(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k5_n3_sse_avx(const int8_t *val,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], 0 };
+
+   _sse_metrics_k5_n4(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k5_n4_sse_avx(const int8_t *val,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], val[3] };
+
+   _sse_metrics_k5_n4(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k7_n2_sse_avx(const int8_t *val,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[0], val[1] };
+
+   _sse_metrics_k7_n2(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k7_n3_sse_avx(const int8_t *val,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], 0 };
+
+   _sse_metrics_k7_n4(_val, out, sums, paths, norm);
+}
+
+__attribute__ ((visibility("hidden")))
+void osmo_conv_gen_metrics_k7_n4_sse_avx(const int8_t *val,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm)
+{
+   const int16_t _val[4] = { val[0], val[1], val[2], val[3] };
+
+   _sse_metrics_k7_n4(_val, out, sums, paths, norm);
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: core/conv: do not mix up AVX and SSE code

2017-05-28 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2760

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

core/conv: do not mix up AVX and SSE code

According to GCC's wiki:

If you specify command-line switches such as -msse, the compiler
could use the extended instruction sets even if the built-ins are
not used explicitly in the program. For this reason, applications
that perform run-time CPU detection must compile separate files
for each supported architecture, using the appropriate flags. In
particular, the file containing the CPU detection code should be
compiled without these options.

So, this change introduces a separate Viterbi implementation,
which is almost the same as previous one, but is being compiled
with -mavx2. This implementation will be only used by CPUs with
both SSE and AVX support:

SSE3 and AVX2: viterbi_sse_avx.c
SSE3 only: viterbi_sse.c
Generic: viterbi_gen.c

Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
---
M src/Makefile.am
M src/viterbi.c
M src/viterbi_gen.c
M src/viterbi_sse.c
A src/viterbi_sse_avx.c
A src/viterbi_sse_common.c
6 files changed, 773 insertions(+), 571 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/60/2760/3

diff --git a/src/Makefile.am b/src/Makefile.am
index a0aa5a0..a5c8491 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,11 +25,24 @@
 
 if HAVE_SSE3
 libosmocore_la_SOURCES += viterbi_sse.c
-# Per-object flags hack
-viterbi_sse.lo : CFLAGS += $(SIMD_FLAGS)
+if HAVE_SSE4_1
+viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
+else
+viterbi_sse.lo : CFLAGS += -msse3
+endif
+
+if HAVE_AVX2
+libosmocore_la_SOURCES += viterbi_sse_avx.c
+if HAVE_SSE4_1
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+else
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
+endif
+endif
 endif
 
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
+EXTRA_DIST = viterbi_sse_common.c
 
 if ENABLE_PLUGIN
 libosmocore_la_SOURCES += plugin.c
diff --git a/src/viterbi.c b/src/viterbi.c
index 2097a02..b2a39a8 100644
--- a/src/viterbi.c
+++ b/src/viterbi.c
@@ -38,36 +38,54 @@
 __attribute__ ((visibility("hidden"))) int sse41_supported = 0;
 
 /**
- * This pointers will be initialized by the osmo_conv_init()
- * depending on supported SIMD extensions.
+ * These pointers are being initialized at runtime 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);
+void (*osmo_conv_gen_metrics_k5_n2)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k5_n3)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k5_n4)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k7_n2)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k7_n3)(const int8_t *seq,
+   const int16_t *out, 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
-int16_t *osmo_conv_vdec_malloc_sse3(size_t n);
-void osmo_conv_vdec_free_sse3(int16_t *ptr);
+/* Forward malloc wrappers */
+int16_t *osmo_conv_vdec_malloc_gen(size_t n);
+void osmo_conv_vdec_free_gen(int16_t *ptr);
+
+#if defined(HAVE_SSE3)
+int16_t *osmo_conv_vdec_malloc_sse(size_t n);
+void osmo_conv_vdec_free_sse(int16_t *ptr);
+#endif
+
+#if defined(HAVE_SSE3) && defined(HAVE_AVX2)
+int16_t *osmo_conv_vdec_malloc_sse_avx(size_t n);
+void osmo_conv_vdec_free_sse_avx(int16_t *ptr);
 #endif
 
 /* Forward Metric Units */
-void osmo_conv_gen_metrics_k5_n2(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k5_n3(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k5_n4(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k7_n2(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k7_n3(const int8_t *seq, const int16_t *out,
-   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);
+void osmo_conv_gen_metrics_k5_n2_gen(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k5_n3_gen(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k5_n4_gen(const int8_t *seq,
+   const int16_t 

libosmocore[master]: core/conv: do not mix up AVX and SSE code

2017-05-28 Thread Vadim Yanitskiy

Patch Set 1:

> Vadim,
 > 
 > Is sse+avx code just a copy of the sse code? In this case we should
 > move it to an include file and then include into .c files to avoid
 > code duplication.

Both files are almost the same, excluding the SSE_BROADCAST
definition. Great idea with creating an include file, thanks!

WIP...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Tom Tsou <t...@tsou.cc>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: tnt <t...@246tnt.com>
Gerrit-HasComments: No


[PATCH] libosmocore[master]: core/conv: do not mix up AVX and SSE code

2017-05-28 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2760

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

core/conv: do not mix up AVX and SSE code

According to GCC's wiki:

If you specify command-line switches such as -msse, the compiler
could use the extended instruction sets even if the built-ins are
not used explicitly in the program. For this reason, applications
that perform run-time CPU detection must compile separate files
for each supported architecture, using the appropriate flags. In
particular, the file containing the CPU detection code should be
compiled without these options.

So, this change introduces a separate Viterbi implementation,
which is almost the same as previous one, but is being compiled
with -mavx2. This implementation will be only used by CPUs with
both SSE and AVX support:

SSE3 and AVX2: viterbi_sse_avx.c
SSE3 only: viterbi_sse.c
Generic: viterbi_gen.c

Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
---
M src/Makefile.am
M src/viterbi.c
M src/viterbi_gen.c
M src/viterbi_sse.c
A src/viterbi_sse_avx.c
A src/viterbi_sse_common.c
6 files changed, 772 insertions(+), 571 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/60/2760/2

diff --git a/src/Makefile.am b/src/Makefile.am
index a0aa5a0..2658afc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,8 +25,20 @@
 
 if HAVE_SSE3
 libosmocore_la_SOURCES += viterbi_sse.c
-# Per-object flags hack
-viterbi_sse.lo : CFLAGS += $(SIMD_FLAGS)
+if HAVE_SSE4_1
+viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
+else
+viterbi_sse.lo : CFLAGS += -msse3
+endif
+
+if HAVE_AVX2
+libosmocore_la_SOURCES += viterbi_sse_avx.c
+if HAVE_SSE4_1
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+else
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
+endif
+endif
 endif
 
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
diff --git a/src/viterbi.c b/src/viterbi.c
index 2097a02..b2a39a8 100644
--- a/src/viterbi.c
+++ b/src/viterbi.c
@@ -38,36 +38,54 @@
 __attribute__ ((visibility("hidden"))) int sse41_supported = 0;
 
 /**
- * This pointers will be initialized by the osmo_conv_init()
- * depending on supported SIMD extensions.
+ * These pointers are being initialized at runtime 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);
+void (*osmo_conv_gen_metrics_k5_n2)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k5_n3)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k5_n4)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k7_n2)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_gen_metrics_k7_n3)(const int8_t *seq,
+   const int16_t *out, 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
-int16_t *osmo_conv_vdec_malloc_sse3(size_t n);
-void osmo_conv_vdec_free_sse3(int16_t *ptr);
+/* Forward malloc wrappers */
+int16_t *osmo_conv_vdec_malloc_gen(size_t n);
+void osmo_conv_vdec_free_gen(int16_t *ptr);
+
+#if defined(HAVE_SSE3)
+int16_t *osmo_conv_vdec_malloc_sse(size_t n);
+void osmo_conv_vdec_free_sse(int16_t *ptr);
+#endif
+
+#if defined(HAVE_SSE3) && defined(HAVE_AVX2)
+int16_t *osmo_conv_vdec_malloc_sse_avx(size_t n);
+void osmo_conv_vdec_free_sse_avx(int16_t *ptr);
 #endif
 
 /* Forward Metric Units */
-void osmo_conv_gen_metrics_k5_n2(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k5_n3(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k5_n4(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k7_n2(const int8_t *seq, const int16_t *out,
-   int16_t *sums, int16_t *paths, int norm);
-void osmo_conv_gen_metrics_k7_n3(const int8_t *seq, const int16_t *out,
-   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);
+void osmo_conv_gen_metrics_k5_n2_gen(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k5_n3_gen(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k5_n4_gen(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void osmo_conv_gen_metrics_k7_n2_gen(const 

[PATCH] libosmocore[master]: core/conv: rename viterbi_gen.c to viterbi_generic.c

2017-05-29 Thread Vadim Yanitskiy

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

core/conv: rename viterbi_gen.c to viterbi_generic.c

Let's avoid confusion with generated files which have
ending with _gen.* as well.

Change-Id: I3ecd8f9e73c05236f2cdc186f58b3d0ba552283f
---
M src/Makefile.am
R src/viterbi_generic.c
2 files changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/2781/1

diff --git a/src/Makefile.am b/src/Makefile.am
index a0aa5a0..e3a0f00 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,7 @@
 conv.c application.c rbtree.c strrb.c \
 loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c 
\
 macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
-viterbi.c viterbi_gen.c sercomm.c
+viterbi.c viterbi_generic.c sercomm.c
 
 if HAVE_SSE3
 libosmocore_la_SOURCES += viterbi_sse.c
diff --git a/src/viterbi_gen.c b/src/viterbi_generic.c
similarity index 100%
rename from src/viterbi_gen.c
rename to src/viterbi_generic.c

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ecd8f9e73c05236f2cdc186f58b3d0ba552283f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: core/conv: combine Viterbi implementation into a single dir

2017-05-29 Thread Vadim Yanitskiy

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

core/conv: combine Viterbi implementation into a single dir

Change-Id: Ifbcb020c1302e49de2a9afe8567f851a16a023e6
---
M src/Makefile.am
R src/viterbi/viterbi.c
R src/viterbi/viterbi_generic.c
R src/viterbi/viterbi_sse.c
R src/viterbi/viterbi_sse_avx.c
R src/viterbi/viterbi_sse_common.c
6 files changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/2782/1

diff --git a/src/Makefile.am b/src/Makefile.am
index e98c623..0b0635d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,28 +21,28 @@
 conv.c application.c rbtree.c strrb.c \
 loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c 
\
 macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
-viterbi.c viterbi_generic.c sercomm.c
+viterbi/viterbi.c viterbi/viterbi_generic.c sercomm.c
 
 if HAVE_SSE3
-libosmocore_la_SOURCES += viterbi_sse.c
+libosmocore_la_SOURCES += viterbi/viterbi_sse.c
 if HAVE_SSE4_1
-viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
+viterbi/viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
 else
-viterbi_sse.lo : CFLAGS += -msse3
+viterbi/viterbi_sse.lo : CFLAGS += -msse3
 endif
 
 if HAVE_AVX2
-libosmocore_la_SOURCES += viterbi_sse_avx.c
+libosmocore_la_SOURCES += viterbi/viterbi_sse_avx.c
 if HAVE_SSE4_1
-viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+viterbi/viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
 else
-viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
+viterbi/viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
 endif
 endif
 endif
 
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
-EXTRA_DIST = viterbi_sse_common.h
+EXTRA_DIST = viterbi/viterbi_sse_common.h
 
 if ENABLE_PLUGIN
 libosmocore_la_SOURCES += plugin.c
diff --git a/src/viterbi.c b/src/viterbi/viterbi.c
similarity index 100%
rename from src/viterbi.c
rename to src/viterbi/viterbi.c
diff --git a/src/viterbi_generic.c b/src/viterbi/viterbi_generic.c
similarity index 100%
rename from src/viterbi_generic.c
rename to src/viterbi/viterbi_generic.c
diff --git a/src/viterbi_sse.c b/src/viterbi/viterbi_sse.c
similarity index 98%
rename from src/viterbi_sse.c
rename to src/viterbi/viterbi_sse.c
index f389085..412a18c 100644
--- a/src/viterbi_sse.c
+++ b/src/viterbi/viterbi_sse.c
@@ -55,7 +55,7 @@
 /**
  * Include common SSE implementation
  */
-#include 
+#include 
 
 /* Aligned Memory Allocator
  * SSE requires 16-byte memory alignment. We store relevant trellis values
diff --git a/src/viterbi_sse_avx.c b/src/viterbi/viterbi_sse_avx.c
similarity index 98%
rename from src/viterbi_sse_avx.c
rename to src/viterbi/viterbi_sse_avx.c
index b4c45a6..6181ba5 100644
--- a/src/viterbi_sse_avx.c
+++ b/src/viterbi/viterbi_sse_avx.c
@@ -55,7 +55,7 @@
 /**
  * Include common SSE implementation
  */
-#include 
+#include 
 
 /* Aligned Memory Allocator
  * SSE requires 16-byte memory alignment. We store relevant trellis values
diff --git a/src/viterbi_sse_common.h b/src/viterbi/viterbi_sse_common.c
similarity index 100%
rename from src/viterbi_sse_common.h
rename to src/viterbi/viterbi_sse_common.c

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbcb020c1302e49de2a9afe8567f851a16a023e6
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>


[PATCH] libosmocore[master]: core/conv: do not mix up AVX and SSE code

2017-05-29 Thread Vadim Yanitskiy
Hello Max, Jenkins Builder,

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

https://gerrit.osmocom.org/2760

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

core/conv: do not mix up AVX and SSE code

According to GCC's wiki:

If you specify command-line switches such as -msse, the compiler
could use the extended instruction sets even if the built-ins are
not used explicitly in the program. For this reason, applications
that perform run-time CPU detection must compile separate files
for each supported architecture, using the appropriate flags. In
particular, the file containing the CPU detection code should be
compiled without these options.

So, this change introduces a separate Viterbi implementation,
which is almost the same as previous one, but is being compiled
with -mavx2. This implementation will be only used by CPUs with
both SSE and AVX support:

SSE3 and AVX2: viterbi_sse_avx.c
SSE3 only: viterbi_sse.c
Generic: viterbi_gen.c

Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
---
M src/Makefile.am
M src/viterbi.c
M src/viterbi_generic.c
M src/viterbi_sse.c
A src/viterbi_sse_avx.c
A src/viterbi_sse_common.h
6 files changed, 741 insertions(+), 571 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/60/2760/4

diff --git a/src/Makefile.am b/src/Makefile.am
index e3a0f00..e98c623 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,11 +25,24 @@
 
 if HAVE_SSE3
 libosmocore_la_SOURCES += viterbi_sse.c
-# Per-object flags hack
-viterbi_sse.lo : CFLAGS += $(SIMD_FLAGS)
+if HAVE_SSE4_1
+viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
+else
+viterbi_sse.lo : CFLAGS += -msse3
+endif
+
+if HAVE_AVX2
+libosmocore_la_SOURCES += viterbi_sse_avx.c
+if HAVE_SSE4_1
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+else
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
+endif
+endif
 endif
 
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
+EXTRA_DIST = viterbi_sse_common.h
 
 if ENABLE_PLUGIN
 libosmocore_la_SOURCES += plugin.c
diff --git a/src/viterbi.c b/src/viterbi.c
index 2097a02..854754c 100644
--- a/src/viterbi.c
+++ b/src/viterbi.c
@@ -31,6 +31,18 @@
 #define BIT2NRZ(REG,N) (((REG >> N) & 0x01) * 2 - 1) * -1
 #define NUM_STATES(K)  (K == 7 ? 64 : 16)
 
+#define INIT_POINTERS(simd) \
+{ \
+   osmo_conv_metrics_k5_n2 = osmo_conv_##simd##_metrics_k5_n2; \
+   osmo_conv_metrics_k5_n3 = osmo_conv_##simd##_metrics_k5_n3; \
+   osmo_conv_metrics_k5_n4 = osmo_conv_##simd##_metrics_k5_n4; \
+   osmo_conv_metrics_k7_n2 = osmo_conv_##simd##_metrics_k7_n2; \
+   osmo_conv_metrics_k7_n3 = osmo_conv_##simd##_metrics_k7_n3; \
+   osmo_conv_metrics_k7_n4 = osmo_conv_##simd##_metrics_k7_n4; \
+   vdec_malloc = _conv_##simd##_vdec_malloc; \
+   vdec_free = _conv_##simd##_vdec_free; \
+}
+
 static int init_complete = 0;
 
 __attribute__ ((visibility("hidden"))) int avx2_supported = 0;
@@ -38,19 +50,37 @@
 __attribute__ ((visibility("hidden"))) int sse41_supported = 0;
 
 /**
- * This pointers will be initialized by the osmo_conv_init()
- * depending on supported SIMD extensions.
+ * These pointers are being initialized at runtime 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);
+void (*osmo_conv_metrics_k5_n2)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_metrics_k5_n3)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_metrics_k5_n4)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_metrics_k7_n2)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_metrics_k7_n3)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
+void (*osmo_conv_metrics_k7_n4)(const int8_t *seq,
+   const int16_t *out, int16_t *sums, int16_t *paths, int norm);
 
-#ifdef HAVE_SSE3
-int16_t *osmo_conv_vdec_malloc_sse3(size_t n);
-void osmo_conv_vdec_free_sse3(int16_t *ptr);
+/* Forward malloc wrappers */
+int16_t *osmo_conv_gen_vdec_malloc(size_t n);
+void osmo_conv_gen_vdec_free(int16_t *ptr);
+
+#if defined(HAVE_SSE3)
+int16_t *osmo_conv_sse_vdec_malloc(size_t n);
+void osmo_conv_sse_vdec_free(int16_t *ptr);
+#endif
+
+#if defined(HAVE_SSE3) && defined(HAVE_AVX2)
+int16_t *osmo_conv_sse_avx_vdec_malloc(size_t n);
+void osmo_conv_sse_avx_vdec_free(int16_t *ptr);
 #endif
 
 /* Forward Metric Units */
@@ -67,18 +97,33 @@
 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,
+#if defined(HAVE_SSE3)
+void osmo_conv_sse_metrics_k5_n2(const 

[PATCH] libosmocore[master]: core/conv: combine Viterbi implementation into a single dir

2017-05-29 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/2782

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

core/conv: combine Viterbi implementation into a single dir

Change-Id: Ifbcb020c1302e49de2a9afe8567f851a16a023e6
---
M src/Makefile.am
R src/viterbi/viterbi.c
R src/viterbi/viterbi_generic.c
R src/viterbi/viterbi_sse.c
R src/viterbi/viterbi_sse_avx.c
R src/viterbi/viterbi_sse_common.h
6 files changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/2782/2

diff --git a/src/Makefile.am b/src/Makefile.am
index e98c623..0b0635d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,28 +21,28 @@
 conv.c application.c rbtree.c strrb.c \
 loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c 
\
 macaddr.c stat_item.c stats.c stats_statsd.c prim.c \
-viterbi.c viterbi_generic.c sercomm.c
+viterbi/viterbi.c viterbi/viterbi_generic.c sercomm.c
 
 if HAVE_SSE3
-libosmocore_la_SOURCES += viterbi_sse.c
+libosmocore_la_SOURCES += viterbi/viterbi_sse.c
 if HAVE_SSE4_1
-viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
+viterbi/viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
 else
-viterbi_sse.lo : CFLAGS += -msse3
+viterbi/viterbi_sse.lo : CFLAGS += -msse3
 endif
 
 if HAVE_AVX2
-libosmocore_la_SOURCES += viterbi_sse_avx.c
+libosmocore_la_SOURCES += viterbi/viterbi_sse_avx.c
 if HAVE_SSE4_1
-viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+viterbi/viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
 else
-viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
+viterbi/viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
 endif
 endif
 endif
 
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
-EXTRA_DIST = viterbi_sse_common.h
+EXTRA_DIST = viterbi/viterbi_sse_common.h
 
 if ENABLE_PLUGIN
 libosmocore_la_SOURCES += plugin.c
diff --git a/src/viterbi.c b/src/viterbi/viterbi.c
similarity index 100%
rename from src/viterbi.c
rename to src/viterbi/viterbi.c
diff --git a/src/viterbi_generic.c b/src/viterbi/viterbi_generic.c
similarity index 100%
rename from src/viterbi_generic.c
rename to src/viterbi/viterbi_generic.c
diff --git a/src/viterbi_sse.c b/src/viterbi/viterbi_sse.c
similarity index 98%
rename from src/viterbi_sse.c
rename to src/viterbi/viterbi_sse.c
index f389085..412a18c 100644
--- a/src/viterbi_sse.c
+++ b/src/viterbi/viterbi_sse.c
@@ -55,7 +55,7 @@
 /**
  * Include common SSE implementation
  */
-#include 
+#include 
 
 /* Aligned Memory Allocator
  * SSE requires 16-byte memory alignment. We store relevant trellis values
diff --git a/src/viterbi_sse_avx.c b/src/viterbi/viterbi_sse_avx.c
similarity index 98%
rename from src/viterbi_sse_avx.c
rename to src/viterbi/viterbi_sse_avx.c
index b4c45a6..6181ba5 100644
--- a/src/viterbi_sse_avx.c
+++ b/src/viterbi/viterbi_sse_avx.c
@@ -55,7 +55,7 @@
 /**
  * Include common SSE implementation
  */
-#include 
+#include 
 
 /* Aligned Memory Allocator
  * SSE requires 16-byte memory alignment. We store relevant trellis values
diff --git a/src/viterbi_sse_common.h b/src/viterbi/viterbi_sse_common.h
similarity index 100%
rename from src/viterbi_sse_common.h
rename to src/viterbi/viterbi_sse_common.h

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifbcb020c1302e49de2a9afe8567f851a16a023e6
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Jenkins Builder


  1   2   3   4   5   6   7   8   9   10   >